diff --git a/.github/workflows/close-inactive-issues.yml b/.github/workflows/close-inactive-issues.yml index dbb89cc8f2..58ec78c0b8 100644 --- a/.github/workflows/close-inactive-issues.yml +++ b/.github/workflows/close-inactive-issues.yml @@ -24,3 +24,4 @@ jobs: days-before-pr-stale: -1 days-before-pr-close: -1 repo-token: ${{ secrets.GITHUB_TOKEN }} + operations-per-run: 500 diff --git a/.github/workflows/test-invoke-pip-skip.yml b/.github/workflows/test-invoke-pip-skip.yml index 7f9758814e..c2347e5ce3 100644 --- a/.github/workflows/test-invoke-pip-skip.yml +++ b/.github/workflows/test-invoke-pip-skip.yml @@ -1,12 +1,12 @@ name: Test invoke.py pip on: pull_request: - paths-ignore: - - 'pyproject.toml' - - 'invokeai/**' - - 'invokeai/backend/**' - - 'invokeai/configs/**' - - 'invokeai/frontend/web/dist/**' + paths: + - '**' + - '!pyproject.toml' + - '!invokeai/**' + - 'invokeai/frontend/web/**' + - '!invokeai/frontend/web/dist/**' merge_group: workflow_dispatch: diff --git a/.github/workflows/test-invoke-pip.yml b/.github/workflows/test-invoke-pip.yml index 20d7ac94c1..30ed05379c 100644 --- a/.github/workflows/test-invoke-pip.yml +++ b/.github/workflows/test-invoke-pip.yml @@ -6,15 +6,13 @@ on: paths: - 'pyproject.toml' - 'invokeai/**' - - 'invokeai/backend/**' - - 'invokeai/configs/**' + - '!invokeai/frontend/web/**' - 'invokeai/frontend/web/dist/**' pull_request: paths: - 'pyproject.toml' - 'invokeai/**' - - 'invokeai/backend/**' - - 'invokeai/configs/**' + - '!invokeai/frontend/web/**' - 'invokeai/frontend/web/dist/**' types: - 'ready_for_review' diff --git a/invokeai/app/api/dependencies.py b/invokeai/app/api/dependencies.py index 271a2e3be3..347fba7e97 100644 --- a/invokeai/app/api/dependencies.py +++ b/invokeai/app/api/dependencies.py @@ -4,7 +4,8 @@ import os from argparse import Namespace from ...backend import Globals -from ..services.generate_initializer import get_generate +from ..services.model_manager_initializer import get_model_manager +from ..services.restoration_services import RestorationServices from ..services.graph import GraphExecutionState from ..services.image_storage import DiskImageStorage from ..services.invocation_queue import MemoryInvocationQueue @@ -37,18 +38,16 @@ class ApiDependencies: invoker: Invoker = None @staticmethod - def initialize(args, config, event_handler_id: int): - Globals.try_patchmatch = args.patchmatch - Globals.always_use_cpu = args.always_use_cpu - Globals.internet_available = args.internet_available and check_internet() - Globals.disable_xformers = not args.xformers - Globals.ckpt_convert = args.ckpt_convert + def initialize(config, event_handler_id: int): + Globals.try_patchmatch = config.patchmatch + Globals.always_use_cpu = config.always_use_cpu + Globals.internet_available = config.internet_available and check_internet() + Globals.disable_xformers = not config.xformers + Globals.ckpt_convert = config.ckpt_convert # TODO: Use a logger print(f">> Internet connectivity is {Globals.internet_available}") - generate = get_generate(args, config) - events = FastAPIEventService(event_handler_id) output_folder = os.path.abspath( @@ -61,7 +60,7 @@ class ApiDependencies: db_location = os.path.join(output_folder, "invokeai.db") services = InvocationServices( - generate=generate, + model_manager=get_model_manager(config), events=events, images=images, queue=MemoryInvocationQueue(), @@ -69,6 +68,7 @@ class ApiDependencies: filename=db_location, table_name="graph_executions" ), processor=DefaultInvocationProcessor(), + restoration=RestorationServices(config), ) ApiDependencies.invoker = Invoker(services) diff --git a/invokeai/app/api_app.py b/invokeai/app/api_app.py index fb64ca3b7a..0ce2386557 100644 --- a/invokeai/app/api_app.py +++ b/invokeai/app/api_app.py @@ -1,5 +1,4 @@ # Copyright (c) 2022 Kyle Schouviller (https://github.com/kyle0654) - import asyncio from inspect import signature @@ -53,11 +52,11 @@ config = {} # Add startup event to load dependencies @app.on_event("startup") async def startup_event(): - args = Args() - config = args.parse_args() + config = Args() + config.parse_args() ApiDependencies.initialize( - args=args, config=config, event_handler_id=event_handler_id + config=config, event_handler_id=event_handler_id ) @@ -113,10 +112,8 @@ def custom_openapi(): output_type_title = output_type_titles[output_type.__name__] invoker_schema = openapi_schema["components"]["schemas"][invoker_name] outputs_ref = {"$ref": f"#/components/schemas/{output_type_title}"} - if "additionalProperties" not in invoker_schema: - invoker_schema["additionalProperties"] = {} - invoker_schema["additionalProperties"]["outputs"] = outputs_ref + invoker_schema["output"] = outputs_ref app.openapi_schema = openapi_schema return app.openapi_schema diff --git a/invokeai/app/cli_app.py b/invokeai/app/cli_app.py index 9dc1429d92..732a233cb4 100644 --- a/invokeai/app/cli_app.py +++ b/invokeai/app/cli_app.py @@ -17,7 +17,8 @@ from .cli.commands import BaseCommand, CliContext, ExitCli, add_parsers, get_gra from .invocations import * from .invocations.baseinvocation import BaseInvocation from .services.events import EventServiceBase -from .services.generate_initializer import get_generate +from .services.model_manager_initializer import get_model_manager +from .services.restoration_services import RestorationServices from .services.graph import EdgeConnection, GraphExecutionState from .services.image_storage import DiskImageStorage from .services.invocation_queue import MemoryInvocationQueue @@ -126,14 +127,9 @@ def invoke_all(context: CliContext): def invoke_cli(): - args = Args() - config = args.parse_args() - - generate = get_generate(args, config) - - # NOTE: load model on first use, uncomment to load at startup - # TODO: Make this a config option? - # generate.load_model() + config = Args() + config.parse_args() + model_manager = get_model_manager(config) events = EventServiceBase() @@ -145,7 +141,7 @@ def invoke_cli(): db_location = os.path.join(output_folder, "invokeai.db") services = InvocationServices( - generate=generate, + model_manager=model_manager, events=events, images=DiskImageStorage(output_folder), queue=MemoryInvocationQueue(), @@ -153,6 +149,7 @@ def invoke_cli(): filename=db_location, table_name="graph_executions" ), processor=DefaultInvocationProcessor(), + restoration=RestorationServices(config), ) invoker = Invoker(services) diff --git a/invokeai/app/invocations/generate.py b/invokeai/app/invocations/generate.py index 15c5f17438..70892ecde9 100644 --- a/invokeai/app/invocations/generate.py +++ b/invokeai/app/invocations/generate.py @@ -12,12 +12,12 @@ from ..services.image_storage import ImageType from ..services.invocation_services import InvocationServices from .baseinvocation import BaseInvocation, InvocationContext from .image import ImageField, ImageOutput +from ...backend.generator import Txt2Img, Img2Img, Inpaint, InvokeAIGenerator SAMPLER_NAME_VALUES = Literal[ - "ddim", "plms", "k_lms", "k_dpm_2", "k_dpm_2_a", "k_euler", "k_euler_a", "k_heun" + tuple(InvokeAIGenerator.schedulers()) ] - # Text to image class TextToImageInvocation(BaseInvocation): """Generates an image using text2img.""" @@ -57,19 +57,18 @@ class TextToImageInvocation(BaseInvocation): # Handle invalid model parameter # TODO: figure out if this can be done via a validator that uses the model_cache # TODO: How to get the default model name now? - if self.model is None or self.model == "": - self.model = context.services.generate.model_name - - # Set the model (if already cached, this does nothing) - context.services.generate.set_model(self.model) - - results = context.services.generate.prompt2image( + # (right now uses whatever current model is set in model manager) + model= context.services.model_manager.get_model() + outputs = Txt2Img(model).generate( prompt=self.prompt, step_callback=step_callback, **self.dict( exclude={"prompt"} ), # Shorthand for passing all of the parameters above manually ) + # Outputs is an infinite iterator that will return a new InvokeAIGeneratorOutput object + # each time it is called. We only need the first one. + generate_output = next(outputs) # Results are image and seed, unwrap for now and ignore the seed # TODO: pre-seed? @@ -78,7 +77,7 @@ class TextToImageInvocation(BaseInvocation): image_name = context.services.images.create_name( context.graph_execution_state_id, self.id ) - context.services.images.save(image_type, image_name, results[0][0]) + context.services.images.save(image_type, image_name, generate_output.image) return ImageOutput( image=ImageField(image_type=image_type, image_name=image_name) ) @@ -115,23 +114,20 @@ class ImageToImageInvocation(TextToImageInvocation): # Handle invalid model parameter # TODO: figure out if this can be done via a validator that uses the model_cache # TODO: How to get the default model name now? - if self.model is None or self.model == "": - self.model = context.services.generate.model_name - - # Set the model (if already cached, this does nothing) - context.services.generate.set_model(self.model) - - results = context.services.generate.prompt2image( - prompt=self.prompt, - init_img=image, - init_mask=mask, - step_callback=step_callback, - **self.dict( - exclude={"prompt", "image", "mask"} - ), # Shorthand for passing all of the parameters above manually + model = context.services.model_manager.get_model() + generator_output = next( + Img2Img(model).generate( + prompt=self.prompt, + init_image=image, + init_mask=mask, + step_callback=step_callback, + **self.dict( + exclude={"prompt", "image", "mask"} + ), # Shorthand for passing all of the parameters above manually + ) ) - result_image = results[0][0] + result_image = generator_output.image # Results are image and seed, unwrap for now and ignore the seed # TODO: pre-seed? @@ -145,7 +141,6 @@ class ImageToImageInvocation(TextToImageInvocation): image=ImageField(image_type=image_type, image_name=image_name) ) - class InpaintInvocation(ImageToImageInvocation): """Generates an image using inpaint.""" @@ -180,23 +175,20 @@ class InpaintInvocation(ImageToImageInvocation): # Handle invalid model parameter # TODO: figure out if this can be done via a validator that uses the model_cache # TODO: How to get the default model name now? - if self.model is None or self.model == "": - self.model = context.services.generate.model_name - - # Set the model (if already cached, this does nothing) - context.services.generate.set_model(self.model) - - results = context.services.generate.prompt2image( - prompt=self.prompt, - init_img=image, - init_mask=mask, - step_callback=step_callback, - **self.dict( - exclude={"prompt", "image", "mask"} - ), # Shorthand for passing all of the parameters above manually + manager = context.services.model_manager.get_model() + generator_output = next( + Inpaint(model).generate( + prompt=self.prompt, + init_image=image, + mask_image=mask, + step_callback=step_callback, + **self.dict( + exclude={"prompt", "image", "mask"} + ), # Shorthand for passing all of the parameters above manually + ) ) - result_image = results[0][0] + result_image = generator_output.image # Results are image and seed, unwrap for now and ignore the seed # TODO: pre-seed? diff --git a/invokeai/app/invocations/reconstruct.py b/invokeai/app/invocations/reconstruct.py index a90c33605e..c4d8f3ac7c 100644 --- a/invokeai/app/invocations/reconstruct.py +++ b/invokeai/app/invocations/reconstruct.py @@ -8,7 +8,6 @@ from ..services.invocation_services import InvocationServices from .baseinvocation import BaseInvocation, InvocationContext from .image import ImageField, ImageOutput - class RestoreFaceInvocation(BaseInvocation): """Restores faces in an image.""" #fmt: off @@ -23,7 +22,7 @@ class RestoreFaceInvocation(BaseInvocation): image = context.services.images.get( self.image.image_type, self.image.image_name ) - results = context.services.generate.upscale_and_reconstruct( + results = context.services.restoration.upscale_and_reconstruct( image_list=[[image, 0]], upscale=None, strength=self.strength, # GFPGAN strength diff --git a/invokeai/app/invocations/upscale.py b/invokeai/app/invocations/upscale.py index dcc39fc9ad..4079877fdb 100644 --- a/invokeai/app/invocations/upscale.py +++ b/invokeai/app/invocations/upscale.py @@ -26,7 +26,7 @@ class UpscaleInvocation(BaseInvocation): image = context.services.images.get( self.image.image_type, self.image.image_name ) - results = context.services.generate.upscale_and_reconstruct( + results = context.services.restoration.upscale_and_reconstruct( image_list=[[image, 0]], upscale=(self.level, self.strength), strength=0.0, # GFPGAN strength diff --git a/invokeai/app/services/generate_initializer.py b/invokeai/app/services/generate_initializer.py deleted file mode 100644 index 9801909742..0000000000 --- a/invokeai/app/services/generate_initializer.py +++ /dev/null @@ -1,255 +0,0 @@ -import os -import sys -import traceback -from argparse import Namespace - -import invokeai.version -from invokeai.backend import Generate, ModelManager - -from ...backend import Globals - - -# TODO: most of this code should be split into individual services as the Generate.py code is deprecated -def get_generate(args, config) -> Generate: - if not args.conf: - config_file = os.path.join(Globals.root, "configs", "models.yaml") - if not os.path.exists(config_file): - report_model_error( - args, FileNotFoundError(f"The file {config_file} could not be found.") - ) - - print(f">> {invokeai.version.__app_name__}, version {invokeai.version.__version__}") - print(f'>> InvokeAI runtime directory is "{Globals.root}"') - - # these two lines prevent a horrible warning message from appearing - # when the frozen CLIP tokenizer is imported - import transformers # type: ignore - - transformers.logging.set_verbosity_error() - import diffusers - - diffusers.logging.set_verbosity_error() - - # Loading Face Restoration and ESRGAN Modules - gfpgan, codeformer, esrgan = load_face_restoration(args) - - # normalize the config directory relative to root - if not os.path.isabs(args.conf): - args.conf = os.path.normpath(os.path.join(Globals.root, args.conf)) - - if args.embeddings: - if not os.path.isabs(args.embedding_path): - embedding_path = os.path.normpath( - os.path.join(Globals.root, args.embedding_path) - ) - else: - embedding_path = args.embedding_path - else: - embedding_path = None - - # migrate legacy models - ModelManager.migrate_models() - - # load the infile as a list of lines - if args.infile: - try: - if os.path.isfile(args.infile): - infile = open(args.infile, "r", encoding="utf-8") - elif args.infile == "-": # stdin - infile = sys.stdin - else: - raise FileNotFoundError(f"{args.infile} not found.") - except (FileNotFoundError, IOError) as e: - print(f"{e}. Aborting.") - sys.exit(-1) - - # creating a Generate object: - try: - gen = Generate( - conf=args.conf, - model=args.model, - sampler_name=args.sampler_name, - embedding_path=embedding_path, - full_precision=args.full_precision, - precision=args.precision, - gfpgan=gfpgan, - codeformer=codeformer, - esrgan=esrgan, - free_gpu_mem=args.free_gpu_mem, - safety_checker=args.safety_checker, - max_loaded_models=args.max_loaded_models, - ) - except (FileNotFoundError, TypeError, AssertionError) as e: - report_model_error(opt, e) - except (IOError, KeyError) as e: - print(f"{e}. Aborting.") - sys.exit(-1) - - if args.seamless: - print(">> changed to seamless tiling mode") - - # preload the model - try: - gen.load_model() - except KeyError: - pass - except Exception as e: - report_model_error(args, e) - - # try to autoconvert new models - # autoimport new .ckpt files - if path := args.autoconvert: - gen.model_manager.autoconvert_weights( - conf_path=args.conf, - weights_directory=path, - ) - - return gen - - -def load_face_restoration(opt): - try: - gfpgan, codeformer, esrgan = None, None, None - if opt.restore or opt.esrgan: - from invokeai.backend.restoration import Restoration - - restoration = Restoration() - if opt.restore: - gfpgan, codeformer = restoration.load_face_restore_models( - opt.gfpgan_model_path - ) - else: - print(">> Face restoration disabled") - if opt.esrgan: - esrgan = restoration.load_esrgan(opt.esrgan_bg_tile) - else: - print(">> Upscaling disabled") - else: - print(">> Face restoration and upscaling disabled") - except (ModuleNotFoundError, ImportError): - print(traceback.format_exc(), file=sys.stderr) - print(">> You may need to install the ESRGAN and/or GFPGAN modules") - return gfpgan, codeformer, esrgan - - -def report_model_error(opt: Namespace, e: Exception): - print(f'** An error occurred while attempting to initialize the model: "{str(e)}"') - print( - "** This can be caused by a missing or corrupted models file, and can sometimes be fixed by (re)installing the models." - ) - yes_to_all = os.environ.get("INVOKE_MODEL_RECONFIGURE") - if yes_to_all: - print( - "** Reconfiguration is being forced by environment variable INVOKE_MODEL_RECONFIGURE" - ) - else: - response = input( - "Do you want to run invokeai-configure script to select and/or reinstall models? [y] " - ) - if response.startswith(("n", "N")): - return - - print("invokeai-configure is launching....\n") - - # Match arguments that were set on the CLI - # only the arguments accepted by the configuration script are parsed - root_dir = ["--root", opt.root_dir] if opt.root_dir is not None else [] - config = ["--config", opt.conf] if opt.conf is not None else [] - previous_args = sys.argv - sys.argv = ["invokeai-configure"] - sys.argv.extend(root_dir) - sys.argv.extend(config) - if yes_to_all is not None: - for arg in yes_to_all.split(): - sys.argv.append(arg) - - from invokeai.frontend.install import invokeai_configure - - invokeai_configure() - # TODO: Figure out how to restart - # print('** InvokeAI will now restart') - # sys.argv = previous_args - # main() # would rather do a os.exec(), but doesn't exist? - # sys.exit(0) - - -# Temporary initializer for Generate until we migrate off of it -def old_get_generate(args, config) -> Generate: - # TODO: Remove the need for globals - from invokeai.backend.globals import Globals - - # alert - setting globals here - Globals.root = os.path.expanduser( - args.root_dir or os.environ.get("INVOKEAI_ROOT") or os.path.abspath(".") - ) - Globals.try_patchmatch = args.patchmatch - - print(f'>> InvokeAI runtime directory is "{Globals.root}"') - - # these two lines prevent a horrible warning message from appearing - # when the frozen CLIP tokenizer is imported - import transformers - - transformers.logging.set_verbosity_error() - - # Loading Face Restoration and ESRGAN Modules - gfpgan, codeformer, esrgan = None, None, None - try: - if config.restore or config.esrgan: - from ldm.invoke.restoration import Restoration - - restoration = Restoration() - if config.restore: - gfpgan, codeformer = restoration.load_face_restore_models( - config.gfpgan_model_path - ) - else: - print(">> Face restoration disabled") - if config.esrgan: - esrgan = restoration.load_esrgan(config.esrgan_bg_tile) - else: - print(">> Upscaling disabled") - else: - print(">> Face restoration and upscaling disabled") - except (ModuleNotFoundError, ImportError): - print(traceback.format_exc(), file=sys.stderr) - print(">> You may need to install the ESRGAN and/or GFPGAN modules") - - # normalize the config directory relative to root - if not os.path.isabs(config.conf): - config.conf = os.path.normpath(os.path.join(Globals.root, config.conf)) - - if config.embeddings: - if not os.path.isabs(config.embedding_path): - embedding_path = os.path.normpath( - os.path.join(Globals.root, config.embedding_path) - ) - else: - embedding_path = None - - # TODO: lazy-initialize this by wrapping it - try: - generate = Generate( - conf=config.conf, - model=config.model, - sampler_name=config.sampler_name, - embedding_path=embedding_path, - full_precision=config.full_precision, - precision=config.precision, - gfpgan=gfpgan, - codeformer=codeformer, - esrgan=esrgan, - free_gpu_mem=config.free_gpu_mem, - safety_checker=config.safety_checker, - max_loaded_models=config.max_loaded_models, - ) - except (FileNotFoundError, TypeError, AssertionError): - # emergency_model_reconfigure() # TODO? - sys.exit(-1) - except (IOError, KeyError) as e: - print(f"{e}. Aborting.") - sys.exit(-1) - - generate.free_gpu_mem = config.free_gpu_mem - - return generate diff --git a/invokeai/app/services/invocation_services.py b/invokeai/app/services/invocation_services.py index 42cbd6c271..7f24c34378 100644 --- a/invokeai/app/services/invocation_services.py +++ b/invokeai/app/services/invocation_services.py @@ -1,36 +1,39 @@ # Copyright (c) 2022 Kyle Schouviller (https://github.com/kyle0654) -from invokeai.backend import Generate +from invokeai.backend import ModelManager from .events import EventServiceBase from .image_storage import ImageStorageBase +from .restoration_services import RestorationServices from .invocation_queue import InvocationQueueABC from .item_storage import ItemStorageABC - class InvocationServices: """Services that can be used by invocations""" - generate: Generate # TODO: wrap Generate, or split it up from model? events: EventServiceBase images: ImageStorageBase queue: InvocationQueueABC + model_manager: ModelManager + restoration: RestorationServices # NOTE: we must forward-declare any types that include invocations, since invocations can use services graph_execution_manager: ItemStorageABC["GraphExecutionState"] processor: "InvocationProcessorABC" def __init__( - self, - generate: Generate, - events: EventServiceBase, - images: ImageStorageBase, - queue: InvocationQueueABC, - graph_execution_manager: ItemStorageABC["GraphExecutionState"], - processor: "InvocationProcessorABC", + self, + model_manager: ModelManager, + events: EventServiceBase, + images: ImageStorageBase, + queue: InvocationQueueABC, + graph_execution_manager: ItemStorageABC["GraphExecutionState"], + processor: "InvocationProcessorABC", + restoration: RestorationServices, ): - self.generate = generate + self.model_manager = model_manager self.events = events self.images = images self.queue = queue self.graph_execution_manager = graph_execution_manager self.processor = processor + self.restoration = restoration diff --git a/invokeai/app/services/model_manager_initializer.py b/invokeai/app/services/model_manager_initializer.py new file mode 100644 index 0000000000..3ef79f0b7e --- /dev/null +++ b/invokeai/app/services/model_manager_initializer.py @@ -0,0 +1,120 @@ +import os +import sys +import torch +from argparse import Namespace +from invokeai.backend import Args +from omegaconf import OmegaConf +from pathlib import Path + +import invokeai.version +from ...backend import ModelManager +from ...backend.util import choose_precision, choose_torch_device +from ...backend import Globals + +# TODO: Replace with an abstract class base ModelManagerBase +def get_model_manager(config: Args) -> ModelManager: + if not config.conf: + config_file = os.path.join(Globals.root, "configs", "models.yaml") + if not os.path.exists(config_file): + report_model_error( + config, FileNotFoundError(f"The file {config_file} could not be found.") + ) + + print(f">> {invokeai.version.__app_name__}, version {invokeai.version.__version__}") + print(f'>> InvokeAI runtime directory is "{Globals.root}"') + + # these two lines prevent a horrible warning message from appearing + # when the frozen CLIP tokenizer is imported + import transformers # type: ignore + + transformers.logging.set_verbosity_error() + import diffusers + + diffusers.logging.set_verbosity_error() + + # normalize the config directory relative to root + if not os.path.isabs(config.conf): + config.conf = os.path.normpath(os.path.join(Globals.root, config.conf)) + + if config.embeddings: + if not os.path.isabs(config.embedding_path): + embedding_path = os.path.normpath( + os.path.join(Globals.root, config.embedding_path) + ) + else: + embedding_path = config.embedding_path + else: + embedding_path = None + + # migrate legacy models + ModelManager.migrate_models() + + # creating the model manager + try: + device = torch.device(choose_torch_device()) + precision = 'float16' if config.precision=='float16' \ + else 'float32' if config.precision=='float32' \ + else choose_precision(device) + + model_manager = ModelManager( + OmegaConf.load(config.conf), + precision=precision, + device_type=device, + max_loaded_models=config.max_loaded_models, + embedding_path = Path(embedding_path), + ) + except (FileNotFoundError, TypeError, AssertionError) as e: + report_model_error(config, e) + except (IOError, KeyError) as e: + print(f"{e}. Aborting.") + sys.exit(-1) + + # try to autoconvert new models + # autoimport new .ckpt files + if path := config.autoconvert: + model_manager.autoconvert_weights( + conf_path=config.conf, + weights_directory=path, + ) + + return model_manager + +def report_model_error(opt: Namespace, e: Exception): + print(f'** An error occurred while attempting to initialize the model: "{str(e)}"') + print( + "** This can be caused by a missing or corrupted models file, and can sometimes be fixed by (re)installing the models." + ) + yes_to_all = os.environ.get("INVOKE_MODEL_RECONFIGURE") + if yes_to_all: + print( + "** Reconfiguration is being forced by environment variable INVOKE_MODEL_RECONFIGURE" + ) + else: + response = input( + "Do you want to run invokeai-configure script to select and/or reinstall models? [y] " + ) + if response.startswith(("n", "N")): + return + + print("invokeai-configure is launching....\n") + + # Match arguments that were set on the CLI + # only the arguments accepted by the configuration script are parsed + root_dir = ["--root", opt.root_dir] if opt.root_dir is not None else [] + config = ["--config", opt.conf] if opt.conf is not None else [] + previous_config = sys.argv + sys.argv = ["invokeai-configure"] + sys.argv.extend(root_dir) + sys.argv.extend(config.to_dict()) + if yes_to_all is not None: + for arg in yes_to_all.split(): + sys.argv.append(arg) + + from invokeai.frontend.install import invokeai_configure + + invokeai_configure() + # TODO: Figure out how to restart + # print('** InvokeAI will now restart') + # sys.argv = previous_args + # main() # would rather do a os.exec(), but doesn't exist? + # sys.exit(0) diff --git a/invokeai/app/services/restoration_services.py b/invokeai/app/services/restoration_services.py new file mode 100644 index 0000000000..f5fc687c11 --- /dev/null +++ b/invokeai/app/services/restoration_services.py @@ -0,0 +1,109 @@ +import sys +import traceback +import torch +from ...backend.restoration import Restoration +from ...backend.util import choose_torch_device, CPU_DEVICE, MPS_DEVICE + +# This should be a real base class for postprocessing functions, +# but right now we just instantiate the existing gfpgan, esrgan +# and codeformer functions. +class RestorationServices: + '''Face restoration and upscaling''' + + def __init__(self,args): + try: + gfpgan, codeformer, esrgan = None, None, None + if args.restore or args.esrgan: + restoration = Restoration() + if args.restore: + gfpgan, codeformer = restoration.load_face_restore_models( + args.gfpgan_model_path + ) + else: + print(">> Face restoration disabled") + if args.esrgan: + esrgan = restoration.load_esrgan(args.esrgan_bg_tile) + else: + print(">> Upscaling disabled") + else: + print(">> Face restoration and upscaling disabled") + except (ModuleNotFoundError, ImportError): + print(traceback.format_exc(), file=sys.stderr) + print(">> You may need to install the ESRGAN and/or GFPGAN modules") + self.device = torch.device(choose_torch_device()) + self.gfpgan = gfpgan + self.codeformer = codeformer + self.esrgan = esrgan + + # note that this one method does gfpgan and codepath reconstruction, as well as + # esrgan upscaling + # TO DO: refactor into separate methods + def upscale_and_reconstruct( + self, + image_list, + facetool="gfpgan", + upscale=None, + upscale_denoise_str=0.75, + strength=0.0, + codeformer_fidelity=0.75, + save_original=False, + image_callback=None, + prefix=None, + ): + results = [] + for r in image_list: + image, seed = r + try: + if strength > 0: + if self.gfpgan is not None or self.codeformer is not None: + if facetool == "gfpgan": + if self.gfpgan is None: + print( + ">> GFPGAN not found. Face restoration is disabled." + ) + else: + image = self.gfpgan.process(image, strength, seed) + if facetool == "codeformer": + if self.codeformer is None: + print( + ">> CodeFormer not found. Face restoration is disabled." + ) + else: + cf_device = ( + CPU_DEVICE if self.device == MPS_DEVICE else self.device + ) + image = self.codeformer.process( + image=image, + strength=strength, + device=cf_device, + seed=seed, + fidelity=codeformer_fidelity, + ) + else: + print(">> Face Restoration is disabled.") + if upscale is not None: + if self.esrgan is not None: + if len(upscale) < 2: + upscale.append(0.75) + image = self.esrgan.process( + image, + upscale[1], + seed, + int(upscale[0]), + denoise_str=upscale_denoise_str, + ) + else: + print(">> ESRGAN is disabled. Image not upscaled.") + except Exception as e: + print( + f">> Error running RealESRGAN or GFPGAN. Your image was not upscaled.\n{e}" + ) + + if image_callback is not None: + image_callback(image, seed, upscaled=True, use_prefix=prefix) + else: + r[0] = image + + results.append([image, seed]) + + return results diff --git a/invokeai/backend/__init__.py b/invokeai/backend/__init__.py index 06089369c2..06066dd6b1 100644 --- a/invokeai/backend/__init__.py +++ b/invokeai/backend/__init__.py @@ -2,6 +2,15 @@ Initialization file for invokeai.backend """ from .generate import Generate +from .generator import ( + InvokeAIGeneratorBasicParams, + InvokeAIGenerator, + InvokeAIGeneratorOutput, + Txt2Img, + Img2Img, + Inpaint +) from .model_management import ModelManager +from .safety_checker import SafetyChecker from .args import Args from .globals import Globals diff --git a/invokeai/backend/generate.py b/invokeai/backend/generate.py index 35dba41ffb..1b19a1aa7e 100644 --- a/invokeai/backend/generate.py +++ b/invokeai/backend/generate.py @@ -25,18 +25,19 @@ from accelerate.utils import set_seed from diffusers.pipeline_utils import DiffusionPipeline from diffusers.utils.import_utils import is_xformers_available from omegaconf import OmegaConf +from pathlib import Path from .args import metadata_from_png from .generator import infill_methods from .globals import Globals, global_cache_dir from .image_util import InitImageResizer, PngWriter, Txt2Mask, configure_model_padding from .model_management import ModelManager +from .safety_checker import SafetyChecker from .prompting import get_uc_and_c_and_ec from .prompting.conditioning import log_tokenization from .stable_diffusion import HuggingFaceConceptsLibrary from .util import choose_precision, choose_torch_device - def fix_func(orig): if hasattr(torch.backends, "mps") and torch.backends.mps.is_available(): @@ -222,6 +223,7 @@ class Generate: self.precision, max_loaded_models=max_loaded_models, sequential_offload=self.free_gpu_mem, + embedding_path=Path(self.embedding_path), ) # don't accept invalid models fallback = self.model_manager.default_model() or FALLBACK_MODEL_NAME @@ -244,31 +246,8 @@ class Generate: # load safety checker if requested if safety_checker: - try: - print(">> Initializing NSFW checker") - from diffusers.pipelines.stable_diffusion.safety_checker import ( - StableDiffusionSafetyChecker, - ) - from transformers import AutoFeatureExtractor - - safety_model_id = "CompVis/stable-diffusion-safety-checker" - safety_model_path = global_cache_dir("hub") - self.safety_checker = StableDiffusionSafetyChecker.from_pretrained( - safety_model_id, - local_files_only=True, - cache_dir=safety_model_path, - ) - self.safety_feature_extractor = AutoFeatureExtractor.from_pretrained( - safety_model_id, - local_files_only=True, - cache_dir=safety_model_path, - ) - self.safety_checker.to(self.device) - except Exception: - print( - "** An error was encountered while installing the safety checker:" - ) - print(traceback.format_exc()) + print(">> Initializing NSFW checker") + self.safety_checker = SafetyChecker(self.device) else: print(">> NSFW checker is disabled") @@ -523,15 +502,6 @@ class Generate: generator.set_variation(self.seed, variation_amount, with_variations) generator.use_mps_noise = use_mps_noise - checker = ( - { - "checker": self.safety_checker, - "extractor": self.safety_feature_extractor, - } - if self.safety_checker - else None - ) - results = generator.generate( prompt, iterations=iterations, @@ -558,7 +528,7 @@ class Generate: embiggen_strength=embiggen_strength, inpaint_replace=inpaint_replace, mask_blur_radius=mask_blur_radius, - safety_checker=checker, + safety_checker=self.safety_checker, seam_size=seam_size, seam_blur=seam_blur, seam_strength=seam_strength, @@ -940,18 +910,6 @@ class Generate: self.generators = {} set_seed(random.randrange(0, np.iinfo(np.uint32).max)) - if self.embedding_path is not None: - print(f">> Loading embeddings from {self.embedding_path}") - for root, _, files in os.walk(self.embedding_path): - for name in files: - ti_path = os.path.join(root, name) - self.model.textual_inversion_manager.load_textual_inversion( - ti_path, defer_injecting_tokens=True - ) - print( - f'>> Textual inversion triggers: {", ".join(sorted(self.model.textual_inversion_manager.get_all_trigger_strings()))}' - ) - self.model_name = model_name self._set_scheduler() # requires self.model_name to be set first return self.model @@ -998,7 +956,7 @@ class Generate: ): results = [] for r in image_list: - image, seed = r + image, seed, _ = r try: if strength > 0: if self.gfpgan is not None or self.codeformer is not None: diff --git a/invokeai/backend/generator/__init__.py b/invokeai/backend/generator/__init__.py index b01e93ad81..9d6263453a 100644 --- a/invokeai/backend/generator/__init__.py +++ b/invokeai/backend/generator/__init__.py @@ -1,5 +1,13 @@ """ Initialization file for the invokeai.generator package """ -from .base import Generator +from .base import ( + InvokeAIGenerator, + InvokeAIGeneratorBasicParams, + InvokeAIGeneratorOutput, + Txt2Img, + Img2Img, + Inpaint, + Generator, +) from .inpaint import infill_methods diff --git a/invokeai/backend/generator/base.py b/invokeai/backend/generator/base.py index 881d3deaff..db1a387002 100644 --- a/invokeai/backend/generator/base.py +++ b/invokeai/backend/generator/base.py @@ -4,11 +4,15 @@ including img2img, txt2img, and inpaint """ from __future__ import annotations +import itertools +import dataclasses +import diffusers import os import random import traceback +from abc import ABCMeta +from argparse import Namespace from contextlib import nullcontext -from pathlib import Path import cv2 import numpy as np @@ -17,12 +21,257 @@ from PIL import Image, ImageChops, ImageFilter from accelerate.utils import set_seed from diffusers import DiffusionPipeline from tqdm import trange +from typing import List, Iterator, Type +from dataclasses import dataclass, field +from diffusers.schedulers import SchedulerMixin as Scheduler -import invokeai.assets.web as web_assets +from ..image_util import configure_model_padding from ..util.util import rand_perlin_2d +from ..safety_checker import SafetyChecker +from ..prompting.conditioning import get_uc_and_c_and_ec +from ..stable_diffusion.diffusers_pipeline import StableDiffusionGeneratorPipeline downsampling = 8 -CAUTION_IMG = "caution.png" + +@dataclass +class InvokeAIGeneratorBasicParams: + seed: int=None + width: int=512 + height: int=512 + cfg_scale: int=7.5 + steps: int=20 + ddim_eta: float=0.0 + scheduler: int='ddim' + precision: str='float16' + perlin: float=0.0 + threshold: int=0.0 + seamless: bool=False + seamless_axes: List[str]=field(default_factory=lambda: ['x', 'y']) + h_symmetry_time_pct: float=None + v_symmetry_time_pct: float=None + variation_amount: float = 0.0 + with_variations: list=field(default_factory=list) + safety_checker: SafetyChecker=None + +@dataclass +class InvokeAIGeneratorOutput: + ''' + InvokeAIGeneratorOutput is a dataclass that contains the outputs of a generation + operation, including the image, its seed, the model name used to generate the image + and the model hash, as well as all the generate() parameters that went into + generating the image (in .params, also available as attributes) + ''' + image: Image + seed: int + model_hash: str + attention_maps_images: List[Image] + params: Namespace + +# we are interposing a wrapper around the original Generator classes so that +# old code that calls Generate will continue to work. +class InvokeAIGenerator(metaclass=ABCMeta): + scheduler_map = dict( + ddim=diffusers.DDIMScheduler, + dpmpp_2=diffusers.DPMSolverMultistepScheduler, + k_dpm_2=diffusers.KDPM2DiscreteScheduler, + k_dpm_2_a=diffusers.KDPM2AncestralDiscreteScheduler, + k_dpmpp_2=diffusers.DPMSolverMultistepScheduler, + k_euler=diffusers.EulerDiscreteScheduler, + k_euler_a=diffusers.EulerAncestralDiscreteScheduler, + k_heun=diffusers.HeunDiscreteScheduler, + k_lms=diffusers.LMSDiscreteScheduler, + plms=diffusers.PNDMScheduler, + ) + + def __init__(self, + model_info: dict, + params: InvokeAIGeneratorBasicParams=InvokeAIGeneratorBasicParams(), + ): + self.model_info=model_info + self.params=params + + def generate(self, + prompt: str='', + callback: callable=None, + step_callback: callable=None, + iterations: int=1, + **keyword_args, + )->Iterator[InvokeAIGeneratorOutput]: + ''' + Return an iterator across the indicated number of generations. + Each time the iterator is called it will return an InvokeAIGeneratorOutput + object. Use like this: + + outputs = txt2img.generate(prompt='banana sushi', iterations=5) + for result in outputs: + print(result.image, result.seed) + + In the typical case of wanting to get just a single image, iterations + defaults to 1 and do: + + output = next(txt2img.generate(prompt='banana sushi') + + Pass None to get an infinite iterator. + + outputs = txt2img.generate(prompt='banana sushi', iterations=None) + for o in outputs: + print(o.image, o.seed) + + ''' + generator_args = dataclasses.asdict(self.params) + generator_args.update(keyword_args) + + model_info = self.model_info + model_name = model_info['model_name'] + model:StableDiffusionGeneratorPipeline = model_info['model'] + model_hash = model_info['hash'] + scheduler: Scheduler = self.get_scheduler( + model=model, + scheduler_name=generator_args.get('scheduler') + ) + uc, c, extra_conditioning_info = get_uc_and_c_and_ec(prompt,model=model) + gen_class = self._generator_class() + generator = gen_class(model, self.params.precision) + if self.params.variation_amount > 0: + generator.set_variation(generator_args.get('seed'), + generator_args.get('variation_amount'), + generator_args.get('with_variations') + ) + + if isinstance(model, DiffusionPipeline): + for component in [model.unet, model.vae]: + configure_model_padding(component, + generator_args.get('seamless',False), + generator_args.get('seamless_axes') + ) + else: + configure_model_padding(model, + generator_args.get('seamless',False), + generator_args.get('seamless_axes') + ) + + iteration_count = range(iterations) if iterations else itertools.count(start=0, step=1) + for i in iteration_count: + results = generator.generate(prompt, + conditioning=(uc, c, extra_conditioning_info), + sampler=scheduler, + **generator_args, + ) + output = InvokeAIGeneratorOutput( + image=results[0][0], + seed=results[0][1], + attention_maps_images=results[0][2], + model_hash = model_hash, + params=Namespace(model_name=model_name,**generator_args), + ) + if callback: + callback(output) + yield output + + @classmethod + def schedulers(self)->List[str]: + ''' + Return list of all the schedulers that we currently handle. + ''' + return list(self.scheduler_map.keys()) + + def load_generator(self, model: StableDiffusionGeneratorPipeline, generator_class: Type[Generator]): + return generator_class(model, self.params.precision) + + def get_scheduler(self, scheduler_name:str, model: StableDiffusionGeneratorPipeline)->Scheduler: + scheduler_class = self.scheduler_map.get(scheduler_name,'ddim') + scheduler = scheduler_class.from_config(model.scheduler.config) + # hack copied over from generate.py + if not hasattr(scheduler, 'uses_inpainting_model'): + scheduler.uses_inpainting_model = lambda: False + return scheduler + + @classmethod + def _generator_class(cls)->Type[Generator]: + ''' + In derived classes return the name of the generator to apply. + If you don't override will return the name of the derived + class, which nicely parallels the generator class names. + ''' + return Generator + +# ------------------------------------ +class Txt2Img(InvokeAIGenerator): + @classmethod + def _generator_class(cls): + from .txt2img import Txt2Img + return Txt2Img + +# ------------------------------------ +class Img2Img(InvokeAIGenerator): + def generate(self, + init_image: Image | torch.FloatTensor, + strength: float=0.75, + **keyword_args + )->List[InvokeAIGeneratorOutput]: + return super().generate(init_image=init_image, + strength=strength, + **keyword_args + ) + @classmethod + def _generator_class(cls): + from .img2img import Img2Img + return Img2Img + +# ------------------------------------ +# Takes all the arguments of Img2Img and adds the mask image and the seam/infill stuff +class Inpaint(Img2Img): + def generate(self, + mask_image: Image | torch.FloatTensor, + # Seam settings - when 0, doesn't fill seam + seam_size: int = 0, + seam_blur: int = 0, + seam_strength: float = 0.7, + seam_steps: int = 10, + tile_size: int = 32, + inpaint_replace=False, + infill_method=None, + inpaint_width=None, + inpaint_height=None, + inpaint_fill: tuple(int) = (0x7F, 0x7F, 0x7F, 0xFF), + **keyword_args + )->List[InvokeAIGeneratorOutput]: + return super().generate( + mask_image=mask_image, + seam_size=seam_size, + seam_blur=seam_blur, + seam_strength=seam_strength, + seam_steps=seam_steps, + tile_size=tile_size, + inpaint_replace=inpaint_replace, + infill_method=infill_method, + inpaint_width=inpaint_width, + inpaint_height=inpaint_height, + inpaint_fill=inpaint_fill, + **keyword_args + ) + @classmethod + def _generator_class(cls): + from .inpaint import Inpaint + return Inpaint + +# ------------------------------------ +class Embiggen(Txt2Img): + def generate( + self, + embiggen: list=None, + embiggen_tiles: list = None, + strength: float=0.75, + **kwargs)->List[InvokeAIGeneratorOutput]: + return super().generate(embiggen=embiggen, + embiggen_tiles=embiggen_tiles, + strength=strength, + **kwargs) + + @classmethod + def _generator_class(cls): + from .embiggen import Embiggen + return Embiggen class Generator: @@ -44,7 +293,6 @@ class Generator: self.with_variations = [] self.use_mps_noise = False self.free_gpu_mem = None - self.caution_img = None # this is going to be overridden in img2img.py, txt2img.py and inpaint.py def get_make_image(self, prompt, **kwargs): @@ -64,10 +312,10 @@ class Generator: def generate( self, prompt, - init_image, width, height, sampler, + init_image=None, iterations=1, seed=None, image_callback=None, @@ -76,7 +324,7 @@ class Generator: perlin=0.0, h_symmetry_time_pct=None, v_symmetry_time_pct=None, - safety_checker: dict = None, + safety_checker: SafetyChecker=None, free_gpu_mem: bool = False, **kwargs, ): @@ -99,7 +347,6 @@ class Generator: h_symmetry_time_pct=h_symmetry_time_pct, v_symmetry_time_pct=v_symmetry_time_pct, attention_maps_callback=attention_maps_callback, - seed=seed, **kwargs, ) results = [] @@ -127,12 +374,13 @@ class Generator: print("** An error occurred while getting initial noise **") print(traceback.format_exc()) - image = make_image(x_T) + # Pass on the seed in case a layer beneath us needs to generate noise on its own. + image = make_image(x_T, seed) if self.safety_checker is not None: - image = self.safety_check(image) + image = self.safety_checker.check(image) - results.append([image, seed]) + results.append([image, seed, attention_maps_images]) if image_callback is not None: attention_maps_image = ( @@ -292,16 +540,6 @@ class Generator: seed = random.randrange(0, np.iinfo(np.uint32).max) return (seed, initial_noise) - # returns a tensor filled with random numbers from a normal distribution - def get_noise(self, width, height): - """ - Returns a tensor filled with random numbers, either form a normal distribution - (txt2img) or from the latent image (img2img, inpaint) - """ - raise NotImplementedError( - "get_noise() must be implemented in a descendent class" - ) - def get_perlin_noise(self, width, height): fixdevice = "cpu" if (self.model.device.type == "mps") else self.model.device # limit noise to only the diffusion image channels, not the mask channels @@ -361,53 +599,6 @@ class Generator: return v2 - def safety_check(self, image: Image.Image): - """ - If the CompViz safety checker flags an NSFW image, we - blur it out. - """ - import diffusers - - checker = self.safety_checker["checker"] - extractor = self.safety_checker["extractor"] - features = extractor([image], return_tensors="pt") - features.to(self.model.device) - - # unfortunately checker requires the numpy version, so we have to convert back - x_image = np.array(image).astype(np.float32) / 255.0 - x_image = x_image[None].transpose(0, 3, 1, 2) - - diffusers.logging.set_verbosity_error() - checked_image, has_nsfw_concept = checker( - images=x_image, clip_input=features.pixel_values - ) - if has_nsfw_concept[0]: - print( - "** An image with potential non-safe content has been detected. A blurred image will be returned. **" - ) - return self.blur(image) - else: - return image - - def blur(self, input): - blurry = input.filter(filter=ImageFilter.GaussianBlur(radius=32)) - try: - caution = self.get_caution_img() - if caution: - blurry.paste(caution, (0, 0), caution) - except FileNotFoundError: - pass - return blurry - - def get_caution_img(self): - path = None - if self.caution_img: - return self.caution_img - path = Path(web_assets.__path__[0]) / CAUTION_IMG - caution = Image.open(path) - self.caution_img = caution.resize((caution.width // 2, caution.height // 2)) - return self.caution_img - # this is a handy routine for debugging use. Given a generated sample, # convert it into a PNG image and store it at the indicated path def save_sample(self, sample, filepath): diff --git a/invokeai/backend/generator/img2img.py b/invokeai/backend/generator/img2img.py index b7f90361a0..2c62bec4d6 100644 --- a/invokeai/backend/generator/img2img.py +++ b/invokeai/backend/generator/img2img.py @@ -37,7 +37,6 @@ class Img2Img(Generator): h_symmetry_time_pct=None, v_symmetry_time_pct=None, attention_maps_callback=None, - seed=None, **kwargs, ): """ @@ -64,7 +63,7 @@ class Img2Img(Generator): ), ).add_scheduler_args_if_applicable(pipeline.scheduler, eta=ddim_eta) - def make_image(x_T): + def make_image(x_T: torch.Tensor, seed: int): # FIXME: use x_T for initial seeded noise # We're not at the moment because the pipeline automatically resizes init_image if # necessary, which the x_T input might not match. @@ -77,7 +76,7 @@ class Img2Img(Generator): conditioning_data, noise_func=self.get_noise_like, callback=step_callback, - seed=seed + seed=seed, ) if ( pipeline_output.attention_map_saver is not None @@ -88,9 +87,7 @@ class Img2Img(Generator): return make_image - def get_noise_like(self, like: torch.Tensor, seed: Optional[int]): - if seed is not None: - set_seed(seed) + def get_noise_like(self, like: torch.Tensor): device = like.device if device.type == "mps": x = torch.randn_like(like, device="cpu").to(device) diff --git a/invokeai/backend/generator/inpaint.py b/invokeai/backend/generator/inpaint.py index fa7560d43e..f95951a955 100644 --- a/invokeai/backend/generator/inpaint.py +++ b/invokeai/backend/generator/inpaint.py @@ -223,7 +223,6 @@ class Inpaint(Img2Img): inpaint_height=None, inpaint_fill: tuple(int) = (0x7F, 0x7F, 0x7F, 0xFF), attention_maps_callback=None, - seed=None, **kwargs, ): """ @@ -311,7 +310,7 @@ class Inpaint(Img2Img): uc, c, cfg_scale ).add_scheduler_args_if_applicable(pipeline.scheduler, eta=ddim_eta) - def make_image(x_T): + def make_image(x_T: torch.Tensor, seed: int): pipeline_output = pipeline.inpaint_from_embeddings( init_image=init_image, mask=1 - mask, # expects white means "paint here." @@ -320,7 +319,7 @@ class Inpaint(Img2Img): conditioning_data=conditioning_data, noise_func=self.get_noise_like, callback=step_callback, - seed=seed + seed=seed, ) if ( diff --git a/invokeai/backend/generator/txt2img.py b/invokeai/backend/generator/txt2img.py index a9918f81ce..e5a96212f0 100644 --- a/invokeai/backend/generator/txt2img.py +++ b/invokeai/backend/generator/txt2img.py @@ -61,7 +61,7 @@ class Txt2Img(Generator): ), ).add_scheduler_args_if_applicable(pipeline.scheduler, eta=ddim_eta) - def make_image(x_T) -> PIL.Image.Image: + def make_image(x_T: torch.Tensor, _: int) -> PIL.Image.Image: pipeline_output = pipeline.image_from_embeddings( latents=torch.zeros_like(x_T, dtype=self.torch_dtype()), noise=x_T, diff --git a/invokeai/backend/generator/txt2img2img.py b/invokeai/backend/generator/txt2img2img.py index e0ec937b39..1e24a8b729 100644 --- a/invokeai/backend/generator/txt2img2img.py +++ b/invokeai/backend/generator/txt2img2img.py @@ -64,7 +64,7 @@ class Txt2Img2Img(Generator): ), ).add_scheduler_args_if_applicable(pipeline.scheduler, eta=ddim_eta) - def make_image(x_T): + def make_image(x_T: torch.Tensor, _: int): first_pass_latent_output, _ = pipeline.latents_from_embeddings( latents=torch.zeros_like(x_T), num_inference_steps=steps, diff --git a/invokeai/backend/model_management/model_manager.py b/invokeai/backend/model_management/model_manager.py index 4627f283f5..84e2ab378b 100644 --- a/invokeai/backend/model_management/model_manager.py +++ b/invokeai/backend/model_management/model_manager.py @@ -34,8 +34,7 @@ from picklescan.scanner import scan_file_path from invokeai.backend.globals import Globals, global_cache_dir from ..stable_diffusion import StableDiffusionGeneratorPipeline -from ..util import CPU_DEVICE, ask_user, download_with_resume - +from ..util import CUDA_DEVICE, CPU_DEVICE, ask_user, download_with_resume class SDLegacyType(Enum): V1 = 1 @@ -51,23 +50,29 @@ VAE_TO_REPO_ID = { # hack, see note in convert_and_import() } class ModelManager(object): + ''' + Model manager handles loading, caching, importing, deleting, converting, and editing models. + ''' def __init__( - self, - config: OmegaConf, - device_type: torch.device = CPU_DEVICE, - precision: str = "float16", - max_loaded_models=DEFAULT_MAX_MODELS, - sequential_offload=False, + self, + config: OmegaConf|Path, + device_type: torch.device = CUDA_DEVICE, + precision: str = "float16", + max_loaded_models=DEFAULT_MAX_MODELS, + sequential_offload=False, + embedding_path: Path=None, ): """ - Initialize with the path to the models.yaml config file, - the torch device type, and precision. The optional - min_avail_mem argument specifies how much unused system - (CPU) memory to preserve. The cache of models in RAM will - grow until this value is approached. Default is 2G. + Initialize with the path to the models.yaml config file or + an initialized OmegaConf dictionary. Optional parameters + are the torch device type, precision, max_loaded_models, + and sequential_offload boolean. Note that the default device + type and precision are set up for a CUDA system running at half precision. """ # prevent nasty-looking CLIP log message transformers.logging.set_verbosity_error() + if not isinstance(config, DictConfig): + config = OmegaConf.load(config) self.config = config self.precision = precision self.device = torch.device(device_type) @@ -76,6 +81,7 @@ class ModelManager(object): self.stack = [] # this is an LRU FIFO self.current_model = None self.sequential_offload = sequential_offload + self.embedding_path = embedding_path def valid_model(self, model_name: str) -> bool: """ @@ -84,12 +90,15 @@ class ModelManager(object): """ return model_name in self.config - def get_model(self, model_name: str): + def get_model(self, model_name: str=None)->dict: """ Given a model named identified in models.yaml, return the model object. If in RAM will load into GPU VRAM. If on disk, will load from there. """ + if not model_name: + return self.get_model(self.current_model) if self.current_model else self.get_model(self.default_model()) + if not self.valid_model(model_name): print( f'** "{model_name}" is not a known model name. Please check your models.yaml file' @@ -112,6 +121,7 @@ class ModelManager(object): else: # we're about to load a new model, so potentially offload the least recently used one requested_model, width, height, hash = self._load_model(model_name) self.models[model_name] = { + "model_name": model_name, "model": requested_model, "width": width, "height": height, @@ -121,6 +131,7 @@ class ModelManager(object): self.current_model = model_name self._push_newest_model(model_name) return { + "model_name": model_name, "model": requested_model, "width": width, "height": height, @@ -425,6 +436,7 @@ class ModelManager(object): height = width print(f" | Default image dimensions = {width} x {height}") + self._add_embeddings_to_model(pipeline) return pipeline, width, height, model_hash @@ -1061,6 +1073,19 @@ class ModelManager(object): self.stack.remove(model_name) self.stack.append(model_name) + def _add_embeddings_to_model(self, model: StableDiffusionGeneratorPipeline): + if self.embedding_path is not None: + print(f">> Loading embeddings from {self.embedding_path}") + for root, _, files in os.walk(self.embedding_path): + for name in files: + ti_path = os.path.join(root, name) + model.textual_inversion_manager.load_textual_inversion( + ti_path, defer_injecting_tokens=True + ) + print( + f'>> Textual inversion triggers: {", ".join(sorted(model.textual_inversion_manager.get_all_trigger_strings()))}' + ) + def _has_cuda(self) -> bool: return self.device.type == "cuda" diff --git a/invokeai/backend/safety_checker.py b/invokeai/backend/safety_checker.py new file mode 100644 index 0000000000..2e6c4fd479 --- /dev/null +++ b/invokeai/backend/safety_checker.py @@ -0,0 +1,82 @@ +''' +SafetyChecker class - checks images against the StabilityAI NSFW filter +and blurs images that contain potential NSFW content. +''' +import diffusers +import numpy as np +import torch +import traceback +from diffusers.pipelines.stable_diffusion.safety_checker import ( + StableDiffusionSafetyChecker, +) +from pathlib import Path +from PIL import Image, ImageFilter +from transformers import AutoFeatureExtractor + +import invokeai.assets.web as web_assets +from .globals import global_cache_dir +from .util import CPU_DEVICE + +class SafetyChecker(object): + CAUTION_IMG = "caution.png" + + def __init__(self, device: torch.device): + path = Path(web_assets.__path__[0]) / self.CAUTION_IMG + caution = Image.open(path) + self.caution_img = caution.resize((caution.width // 2, caution.height // 2)) + self.device = device + + try: + safety_model_id = "CompVis/stable-diffusion-safety-checker" + safety_model_path = global_cache_dir("hub") + self.safety_checker = StableDiffusionSafetyChecker.from_pretrained( + safety_model_id, + local_files_only=True, + cache_dir=safety_model_path, + ) + self.safety_feature_extractor = AutoFeatureExtractor.from_pretrained( + safety_model_id, + local_files_only=True, + cache_dir=safety_model_path, + ) + except Exception: + print( + "** An error was encountered while installing the safety checker:" + ) + print(traceback.format_exc()) + + def check(self, image: Image.Image): + """ + Check provided image against the StabilityAI safety checker and return + + """ + + self.safety_checker.to(self.device) + features = self.safety_feature_extractor([image], return_tensors="pt") + features.to(self.device) + + # unfortunately checker requires the numpy version, so we have to convert back + x_image = np.array(image).astype(np.float32) / 255.0 + x_image = x_image[None].transpose(0, 3, 1, 2) + + diffusers.logging.set_verbosity_error() + checked_image, has_nsfw_concept = self.safety_checker( + images=x_image, clip_input=features.pixel_values + ) + self.safety_checker.to(CPU_DEVICE) # offload + if has_nsfw_concept[0]: + print( + "** An image with potential non-safe content has been detected. A blurred image will be returned. **" + ) + return self.blur(image) + else: + return image + + def blur(self, input): + blurry = input.filter(filter=ImageFilter.GaussianBlur(radius=32)) + try: + if caution := self.caution_img: + blurry.paste(caution, (0, 0), caution) + except FileNotFoundError: + pass + return blurry diff --git a/invokeai/backend/stable_diffusion/diffusers_pipeline.py b/invokeai/backend/stable_diffusion/diffusers_pipeline.py index 51e7b1ee1d..152e079693 100644 --- a/invokeai/backend/stable_diffusion/diffusers_pipeline.py +++ b/invokeai/backend/stable_diffusion/diffusers_pipeline.py @@ -9,6 +9,7 @@ from typing import Any, Callable, Generic, List, Optional, Type, TypeVar, Union import einops import PIL.Image +from accelerate.utils import set_seed import psutil import torch import torchvision.transforms as T @@ -694,7 +695,9 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): device=self._model_group.device_for(self.unet), dtype=self.unet.dtype, ) - noise = noise_func(initial_latents, seed) + if seed is not None: + set_seed(seed) + noise = noise_func(initial_latents) return self.img2img_from_latents_and_embeddings( initial_latents, @@ -796,7 +799,9 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline): init_image_latents = self.non_noised_latents_from_image( init_image, device=device, dtype=latents_dtype ) - noise = noise_func(init_image_latents, seed) + if seed is not None: + set_seed(seed) + noise = noise_func(init_image_latents) if mask.dim() == 3: mask = mask.unsqueeze(0) diff --git a/invokeai/frontend/web/.eslintrc.js b/invokeai/frontend/web/.eslintrc.js index 489d3cfdff..b1a2b6a7e4 100644 --- a/invokeai/frontend/web/.eslintrc.js +++ b/invokeai/frontend/web/.eslintrc.js @@ -35,6 +35,7 @@ module.exports = { { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }, ], 'prettier/prettier': ['error', { endOfLine: 'auto' }], + '@typescript-eslint/ban-ts-comment': 'warn', }, settings: { react: { diff --git a/invokeai/frontend/web/dist/assets/App-06f6cac1.css b/invokeai/frontend/web/dist/assets/App-06f6cac1.css deleted file mode 100644 index d5ee537736..0000000000 --- a/invokeai/frontend/web/dist/assets/App-06f6cac1.css +++ /dev/null @@ -1 +0,0 @@ -.ltr-image-gallery-css-transition-enter{transform:translate(150%)}.ltr-image-gallery-css-transition-enter-active{transform:translate(0);transition:all .12s ease-out}.ltr-image-gallery-css-transition-exit{transform:translate(0)}.ltr-image-gallery-css-transition-exit-active{transform:translate(150%);transition:all .12s ease-out}.rtl-image-gallery-css-transition-enter{transform:translate(-150%)}.rtl-image-gallery-css-transition-enter-active{transform:translate(0);transition:all .12s ease-out}.rtl-image-gallery-css-transition-exit{transform:translate(0)}.rtl-image-gallery-css-transition-exit-active{transform:translate(-150%);transition:all .12s ease-out}.ltr-parameters-panel-transition-enter{transform:translate(-150%)}.ltr-parameters-panel-transition-enter-active{transform:translate(0);transition:all .12s ease-out}.ltr-parameters-panel-transition-exit{transform:translate(0)}.ltr-parameters-panel-transition-exit-active{transform:translate(-150%);transition:all .12s ease-out}.rtl-parameters-panel-transition-enter{transform:translate(150%)}.rtl-parameters-panel-transition-enter-active{transform:translate(0);transition:all .12s ease-out}.rtl-parameters-panel-transition-exit{transform:translate(0)}.rtl-parameters-panel-transition-exit-active{transform:translate(150%);transition:all .12s ease-out} diff --git a/invokeai/frontend/web/dist/assets/App-08e5c546.css b/invokeai/frontend/web/dist/assets/App-08e5c546.css new file mode 100644 index 0000000000..27d0052b89 --- /dev/null +++ b/invokeai/frontend/web/dist/assets/App-08e5c546.css @@ -0,0 +1 @@ +.ltr-image-gallery-css-transition-enter{transform:translate(150%)}.ltr-image-gallery-css-transition-enter-active{transform:translate(0);transition:all .12s ease-out}.ltr-image-gallery-css-transition-exit{transform:translate(0)}.ltr-image-gallery-css-transition-exit-active{transform:translate(150%);transition:all .12s ease-out}.rtl-image-gallery-css-transition-enter{transform:translate(-150%)}.rtl-image-gallery-css-transition-enter-active{transform:translate(0);transition:all .12s ease-out}.rtl-image-gallery-css-transition-exit{transform:translate(0)}.rtl-image-gallery-css-transition-exit-active{transform:translate(-150%);transition:all .12s ease-out} diff --git a/invokeai/frontend/web/dist/assets/App-2afdb3c5.js b/invokeai/frontend/web/dist/assets/App-2afdb3c5.js deleted file mode 100644 index 1e07c56671..0000000000 --- a/invokeai/frontend/web/dist/assets/App-2afdb3c5.js +++ /dev/null @@ -1,188 +0,0 @@ -import{r as x,f as he,j as l,u as RS,c as re,a as Ae,b as Pe,w as is,d as fn,o as At,S as Qf,e as pi,g as Ye,h as Dr,k as Zi,i as yc,_ as Ql,l as NS,m as FS,R as ke,n as zv,p as LS,q as Kd,s as Ji,t as j1,v as E1,x as BS,y as HS,z as te,A as P1,B as I1,C as bc,D as os,F as B,E as Z,T as Ce,G as WS,H as Hl,I as Zl,J as Qd,K as Zd,L as Jd,U as VS,M as M1,N as T1,O as US,P as _1,Q as D1,V as $S,W as O1,X as A1,Y as Bi,Z as jn,$ as z1,a0 as as,a1 as GS,a2 as qS,a3 as R1,a4 as on,a5 as YS,a6 as vl,a7 as Sc,a8 as XS,a9 as Rv,aa as Fi,ab as KS,ac as QS,ad as Da,ae as gl,af as ZS,ag as JS,ah as eC,ai as tC,aj as nC,ak as N1,al as F1,am as ef,an as tf,ao as L1,ap as nf,aq as rf,ar as Nv,as as B1,at as H1,au as W1,av as Wl,aw as Vl,ax as rC,ay as of,az as V1,aA as iC,aB as dd,aC as Fv,aD as U1,aE as $1,aF as af,aG as Hi,aH as oC,aI as aC,aJ as Lv,aK as Bv,aL as sC,aM as lC,aN as cC,aO as G1,aP as q1,aQ as uC,aR as dC,aS as Hv,aT as fC,aU as Wv,aV as hC,aW as pC,aX as mC,aY as vC,aZ as gC,a_ as xC,a$ as yC,b0 as bC,b1 as Vv,b2 as Ul,b3 as SC,b4 as CC,b5 as qa,b6 as Jl,b7 as Y1,b8 as ec,b9 as wC,ba as kC,bb as xr,bc as X1,bd as Zf,be as ss,bf as jC,bg as EC,bh as PC,bi as Sr,bj as K1,bk as IC,bl as MC,bm as Q1,bn as TC,bo as _C,bp as DC,bq as OC,br as AC,bs as zC,bt as RC,bu as NC,bv as FC,bw as Uv,bx as LC,by as BC,bz as HC,bA as WC,bB as VC,bC as UC,bD as fd,bE as Na,bF as xl,bG as $v,bH as hd,bI as pd,bJ as yl,bK as Gv,bL as sf,bM as $C,bN as GC,bO as qC,bP as YC,bQ as XC,bR as KC,bS as QC,bT as bl,bU as md,bV as Sl,bW as nr,bX as ZC,bY as JC,bZ as Z1,b_ as tc,b$ as Jf,c0 as J1,c1 as e2,c2 as t2,c3 as e3,c4 as n2,c5 as r2,c6 as i2,c7 as o2,c8 as a2,c9 as Wo,ca as Vo,cb as s2,cc as l2,cd as c2,ce as u2,cf as d2,cg as t3,ch as n3,ci as qv,cj as Cl,ck as r3,cl as Yv,cm as Xv,cn as Kv,co as Qv,cp as vd,cq as f2,cr as i3,cs as ls,ct as Zv,cu as o3,cv as a3,cw as s3,cx as Wi,cy as h2,cz as Jv,cA as l3,cB as c3,cC as u3,cD as d3,cE as f3,cF as h3,cG as p3,cH as m3,cI as v3,cJ as g3,cK as x3,cL as y3}from"./index-61f10aa8.js";import{I as Jt,u as b3,c as S3,a as Et,b as Ut,A as ia,m as Wr,d as Uo,e as eo,P as eh,f as C3,C as w3,g as O,h as Y,n as p2}from"./scrollbar-7e342734.js";function th(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,s;for(s=0;s=0)&&(n[i]=e[i]);return n}var nc="NOT_FOUND";function k3(e){var t;return{get:function(r){return t&&e(t.key,r)?t.value:nc},put:function(r,i){t={key:r,value:i}},getEntries:function(){return t?[t]:[]},clear:function(){t=void 0}}}function j3(e,t){var n=[];function r(u){var f=n.findIndex(function(p){return t(u,p.key)});if(f>-1){var h=n[f];return f>0&&(n.splice(f,1),n.unshift(h)),h.value}return nc}function i(u,f){r(u)===nc&&(n.unshift({key:u,value:f}),n.length>e&&n.pop())}function s(){return n}function c(){n=[]}return{get:r,put:i,getEntries:s,clear:c}}var E3=function(t,n){return t===n};function P3(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,s=0;s1?t-1:0),r=1;rperformance.now():()=>Date.now(),v2=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(O3()),m2);function A3(e){let t=[],n=[],r=0,i=!1,s=!1;const c=new WeakSet,u={schedule:(f,h=!1,p=!1)=>{const g=p&&i,y=g?t:n;return h&&c.add(f),y.indexOf(f)===-1&&(y.push(f),g&&i&&(r=t.length)),f},cancel:f=>{const h=n.indexOf(f);h!==-1&&n.splice(h,1),c.delete(f)},process:f=>{if(i){s=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let h=0;h(e[t]=A3(()=>Ya=!0),e),{}),R3=cs.reduce((e,t)=>{const n=Cc[t];return e[t]=(r,i=!1,s=!1)=>(Ya||L3(),n.schedule(r,i,s)),e},{}),N3=cs.reduce((e,t)=>(e[t]=Cc[t].cancel,e),{});cs.reduce((e,t)=>(e[t]=()=>Cc[t].process($o),e),{});const F3=e=>Cc[e].process($o),g2=e=>{Ya=!1,$o.delta=lf?m2:Math.max(Math.min(e-$o.timestamp,z3),1),$o.timestamp=e,cf=!0,cs.forEach(F3),cf=!1,Ya&&(lf=!1,v2(g2))},L3=()=>{Ya=!0,lf=!0,cf||v2(g2)},eg=()=>$o;function nh(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:i={}}=e,s=x.Children.toArray(e.path),c=he((u,f)=>l.jsx(Jt,{ref:f,viewBox:t,...i,...u,children:s.length?s:l.jsx("path",{fill:"currentColor",d:n})}));return c.displayName=r,c}function us(e){const{theme:t}=RS(),n=b3();return x.useMemo(()=>S3(t.direction,{...n,...e}),[e,t.direction,n])}var B3=Object.defineProperty,H3=(e,t,n)=>t in e?B3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rt=(e,t,n)=>(H3(e,typeof t!="symbol"?t+"":t,n),n);function tg(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 W3=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function ng(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function rg(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var uf=typeof window<"u"?x.useLayoutEffect:x.useEffect,rc=e=>e,V3=class{constructor(){Rt(this,"descendants",new Map),Rt(this,"register",e=>{if(e!=null)return W3(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),Rt(this,"unregister",e=>{this.descendants.delete(e);const t=tg(Array.from(this.descendants.keys()));this.assignIndex(t)}),Rt(this,"destroy",()=>{this.descendants.clear()}),Rt(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),Rt(this,"count",()=>this.descendants.size),Rt(this,"enabledCount",()=>this.enabledValues().length),Rt(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),Rt(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),Rt(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),Rt(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),Rt(this,"first",()=>this.item(0)),Rt(this,"firstEnabled",()=>this.enabledItem(0)),Rt(this,"last",()=>this.item(this.descendants.size-1)),Rt(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),Rt(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),Rt(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),Rt(this,"next",(e,t=!0)=>{const n=ng(e,this.count(),t);return this.item(n)}),Rt(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),i=ng(r,this.enabledCount(),t);return this.enabledItem(i)}),Rt(this,"prev",(e,t=!0)=>{const n=rg(e,this.count()-1,t);return this.item(n)}),Rt(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),i=rg(r,this.enabledCount()-1,t);return this.enabledItem(i)}),Rt(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=tg(n);t!=null&&t.disabled&&(t.disabled=!!t.disabled);const i={node:e,index:-1,...t};this.descendants.set(e,i),this.assignIndex(r)})}};function U3(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 ct(...e){return t=>{e.forEach(n=>{U3(n,t)})}}function $3(...e){return x.useMemo(()=>ct(...e),e)}function G3(){const e=x.useRef(new V3);return uf(()=>()=>e.current.destroy()),e.current}var[q3,x2]=Et({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function Y3(e){const t=x2(),[n,r]=x.useState(-1),i=x.useRef(null);uf(()=>()=>{i.current&&t.unregister(i.current)},[]),uf(()=>{if(!i.current)return;const c=Number(i.current.dataset.index);n!=c&&!Number.isNaN(c)&&r(c)});const s=rc(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(i.current),register:ct(s,i)}}function rh(){return[rc(q3),()=>rc(x2()),()=>G3(),i=>Y3(i)]}var[X3,wc]=Et({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[K3,ih]=Et({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[Q3,_F,Z3,J3]=rh(),zo=he(function(t,n){const{getButtonProps:r}=ih(),i=r(t,n),c={display:"flex",alignItems:"center",width:"100%",outline:0,...wc().button};return l.jsx(re.button,{...i,className:Ae("chakra-accordion__button",t.className),__css:c})});zo.displayName="AccordionButton";function oh(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:i=(y,S)=>y!==S}=e,s=Ut(r),c=Ut(i),[u,f]=x.useState(n),h=t!==void 0,p=h?t:u,g=Ut(y=>{const C=typeof y=="function"?y(p):y;c(p,C)&&(h||f(C),s(C))},[h,s,p,c]);return[p,g]}function ew(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:i,allowToggle:s,...c}=e;rw(e),iw(e);const u=Z3(),[f,h]=x.useState(-1);x.useEffect(()=>()=>{h(-1)},[]);const[p,g]=oh({value:r,defaultValue(){return i?n??[]:n??-1},onChange:t});return{index:p,setIndex:g,htmlProps:c,getAccordionItemProps:S=>{let C=!1;return S!==null&&(C=Array.isArray(p)?p.includes(S):p===S),{isOpen:C,onChange:k=>{if(S!==null)if(i&&Array.isArray(p)){const j=k?p.concat(S):p.filter(M=>M!==S);g(j)}else k?g(S):s&&g(-1)}}},focusedIndex:f,setFocusedIndex:h,descendants:u}}var[tw,ah]=Et({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function nw(e){const{isDisabled:t,isFocusable:n,id:r,...i}=e,{getAccordionItemProps:s,setFocusedIndex:c}=ah(),u=x.useRef(null),f=x.useId(),h=r??f,p=`accordion-button-${h}`,g=`accordion-panel-${h}`;ow(e);const{register:y,index:S,descendants:C}=J3({disabled:t&&!n}),{isOpen:w,onChange:k}=s(S===-1?null:S);aw({isOpen:w,isDisabled:t});const j=()=>{k==null||k(!0)},M=()=>{k==null||k(!1)},P=x.useCallback(()=>{k==null||k(!w),c(S)},[S,c,w,k]),I=x.useCallback(z=>{const F={ArrowDown:()=>{const L=C.nextEnabled(S);L==null||L.node.focus()},ArrowUp:()=>{const L=C.prevEnabled(S);L==null||L.node.focus()},Home:()=>{const L=C.firstEnabled();L==null||L.node.focus()},End:()=>{const L=C.lastEnabled();L==null||L.node.focus()}}[z.key];F&&(z.preventDefault(),F(z))},[C,S]),T=x.useCallback(()=>{c(S)},[c,S]),D=x.useCallback(function(V={},F=null){return{...V,type:"button",ref:ct(y,u,F),id:p,disabled:!!t,"aria-expanded":!!w,"aria-controls":g,onClick:Pe(V.onClick,P),onFocus:Pe(V.onFocus,T),onKeyDown:Pe(V.onKeyDown,I)}},[p,t,w,P,T,I,g,y]),_=x.useCallback(function(V={},F=null){return{...V,ref:F,role:"region",id:g,"aria-labelledby":p,hidden:!w}},[p,w,g]);return{isOpen:w,isDisabled:t,isFocusable:n,onOpen:j,onClose:M,getButtonProps:D,getPanelProps:_,htmlProps:i}}function rw(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;is({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function iw(e){is({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 ow(e){is({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 aw(e){is({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Ro(e){const{isOpen:t,isDisabled:n}=ih(),{reduceMotion:r}=ah(),i=Ae("chakra-accordion__icon",e.className),s=wc(),c={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return l.jsx(Jt,{viewBox:"0 0 24 24","aria-hidden":!0,className:i,__css:c,...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Ro.displayName="AccordionIcon";var No=he(function(t,n){const{children:r,className:i}=t,{htmlProps:s,...c}=nw(t),f={...wc().container,overflowAnchor:"none"},h=x.useMemo(()=>c,[c]);return l.jsx(K3,{value:h,children:l.jsx(re.div,{ref:n,...s,className:Ae("chakra-accordion__item",i),__css:f,children:typeof r=="function"?r({isExpanded:!!c.isOpen,isDisabled:!!c.isDisabled}):r})})});No.displayName="AccordionItem";var Fo={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Vi={enter:{duration:.2,ease:Fo.easeOut},exit:{duration:.1,ease:Fo.easeIn}},Or={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})},sw=e=>e!=null&&parseInt(e.toString(),10)>0,ig={exit:{height:{duration:.2,ease:Fo.ease},opacity:{duration:.3,ease:Fo.ease}},enter:{height:{duration:.3,ease:Fo.ease},opacity:{duration:.4,ease:Fo.ease}}},lw={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:i})=>{var s;return{...e&&{opacity:sw(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:Or.exit(ig.exit,i)}},enter:({animateOpacity:e,endingHeight:t,transition:n,transitionEnd:r,delay:i})=>{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:Or.enter(ig.enter,i)}}},y2=x.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:i=!0,startingHeight:s=0,endingHeight:c="auto",style:u,className:f,transition:h,transitionEnd:p,...g}=e,[y,S]=x.useState(!1);x.useEffect(()=>{const M=setTimeout(()=>{S(!0)});return()=>clearTimeout(M)},[]),is({condition:Boolean(s>0&&r),message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const C=parseFloat(s.toString())>0,w={startingHeight:s,endingHeight:c,animateOpacity:i,transition:y?h:{enter:{duration:0}},transitionEnd:{enter:p==null?void 0:p.enter,exit:r?p==null?void 0:p.exit:{...p==null?void 0:p.exit,display:C?"block":"none"}}},k=r?n:!0,j=n||r?"enter":"exit";return l.jsx(ia,{initial:!1,custom:w,children:k&&l.jsx(Wr.div,{ref:t,...g,className:Ae("chakra-collapse",f),style:{overflow:"hidden",display:"block",...u},custom:w,variants:lw,initial:r?"exit":!1,animate:j,exit:"exit"})})});y2.displayName="Collapse";var cw={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:Or.enter(Vi.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:Or.exit(Vi.exit,n),transitionEnd:t==null?void 0:t.exit}}},b2={initial:"exit",animate:"enter",exit:"exit",variants:cw},uw=x.forwardRef(function(t,n){const{unmountOnExit:r,in:i,className:s,transition:c,transitionEnd:u,delay:f,...h}=t,p=i||r?"enter":"exit",g=r?i&&r:!0,y={transition:c,transitionEnd:u,delay:f};return l.jsx(ia,{custom:y,children:g&&l.jsx(Wr.div,{ref:n,className:Ae("chakra-fade",s),custom:y,...b2,animate:p,...h})})});uw.displayName="Fade";var dw={exit:({reverse:e,initialScale:t,transition:n,transitionEnd:r,delay:i})=>{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:Or.exit(Vi.exit,i)}},enter:({transitionEnd:e,transition:t,delay:n})=>{var r;return{opacity:1,scale:1,transition:(r=t==null?void 0:t.enter)!=null?r:Or.enter(Vi.enter,n),transitionEnd:e==null?void 0:e.enter}}},S2={initial:"exit",animate:"enter",exit:"exit",variants:dw},fw=x.forwardRef(function(t,n){const{unmountOnExit:r,in:i,reverse:s=!0,initialScale:c=.95,className:u,transition:f,transitionEnd:h,delay:p,...g}=t,y=r?i&&r:!0,S=i||r?"enter":"exit",C={initialScale:c,reverse:s,transition:f,transitionEnd:h,delay:p};return l.jsx(ia,{custom:C,children:y&&l.jsx(Wr.div,{ref:n,className:Ae("chakra-offset-slide",u),...S2,animate:S,custom:C,...g})})});fw.displayName="ScaleFade";var hw={initial:({offsetX:e,offsetY:t,transition:n,transitionEnd:r,delay:i})=>{var s;return{opacity:0,x:e,y:t,transition:(s=n==null?void 0:n.exit)!=null?s:Or.exit(Vi.exit,i),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:Or.enter(Vi.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:i,delay:s})=>{var c;const u={x:t,y:e};return{opacity:0,transition:(c=n==null?void 0:n.exit)!=null?c:Or.exit(Vi.exit,s),...i?{...u,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...u,...r==null?void 0:r.exit}}}}},df={initial:"initial",animate:"enter",exit:"exit",variants:hw},pw=x.forwardRef(function(t,n){const{unmountOnExit:r,in:i,reverse:s=!0,className:c,offsetX:u=0,offsetY:f=8,transition:h,transitionEnd:p,delay:g,...y}=t,S=r?i&&r:!0,C=i||r?"enter":"exit",w={offsetX:u,offsetY:f,reverse:s,transition:h,transitionEnd:p,delay:g};return l.jsx(ia,{custom:w,children:S&&l.jsx(Wr.div,{ref:n,className:Ae("chakra-offset-slide",c),custom:w,...df,animate:C,...y})})});pw.displayName="SlideFade";var Lo=he(function(t,n){const{className:r,motionProps:i,...s}=t,{reduceMotion:c}=ah(),{getPanelProps:u,isOpen:f}=ih(),h=u(s,n),p=Ae("chakra-accordion__panel",r),g=wc();c||delete h.hidden;const y=l.jsx(re.div,{...h,__css:g.panel,className:p});return c?y:l.jsx(y2,{in:f,...i,children:y})});Lo.displayName="AccordionPanel";var sh=he(function({children:t,reduceMotion:n,...r},i){const s=fn("Accordion",r),c=At(r),{htmlProps:u,descendants:f,...h}=ew(c),p=x.useMemo(()=>({...h,reduceMotion:!!n}),[h,n]);return l.jsx(Q3,{value:f,children:l.jsx(tw,{value:p,children:l.jsx(X3,{value:s,children:l.jsx(re.div,{ref:i,...u,className:Ae("chakra-accordion",r.className),__css:s.root,children:t})})})})});sh.displayName="Accordion";var ff=he(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:s,...c}=t;return l.jsx("img",{width:r,height:i,ref:n,alt:s,...c})});ff.displayName="NativeImage";function mw(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:s,crossOrigin:c,sizes:u,ignoreFallback:f}=e,[h,p]=x.useState("pending");x.useEffect(()=>{p(n?"loading":"pending")},[n]);const g=x.useRef(),y=x.useCallback(()=>{if(!n)return;S();const C=new Image;C.src=n,c&&(C.crossOrigin=c),r&&(C.srcset=r),u&&(C.sizes=u),t&&(C.loading=t),C.onload=w=>{S(),p("loaded"),i==null||i(w)},C.onerror=w=>{S(),p("failed"),s==null||s(w)},g.current=C},[n,c,r,u,i,s,t]),S=()=>{g.current&&(g.current.onload=null,g.current.onerror=null,g.current=null)};return Uo(()=>{if(!f)return h==="loading"&&y(),()=>{S()}},[h,y,f]),f?"loaded":h}var vw=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function gw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var ds=he(function(t,n){const{fallbackSrc:r,fallback:i,src:s,srcSet:c,align:u,fit:f,loading:h,ignoreFallback:p,crossOrigin:g,fallbackStrategy:y="beforeLoadOrError",referrerPolicy:S,...C}=t,w=r!==void 0||i!==void 0,k=h!=null||p||!w,j=mw({...t,ignoreFallback:k}),M=vw(j,y),P={ref:n,objectFit:f,objectPosition:u,...k?C:gw(C,["onError","onLoad"])};return M?i||l.jsx(re.img,{as:ff,className:"chakra-image__placeholder",src:r,...P}):l.jsx(re.img,{as:ff,src:s,srcSet:c,crossOrigin:g,loading:h,referrerPolicy:S,className:"chakra-image",...P})});ds.displayName="Image";function lh(e){return x.Children.toArray(e).filter(t=>x.isValidElement(t))}var[xw,yw]=Et({strict:!1,name:"ButtonGroupContext"}),bw={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}}},Sw={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},en=he(function(t,n){const{size:r,colorScheme:i,variant:s,className:c,spacing:u="0.5rem",isAttached:f,isDisabled:h,orientation:p="horizontal",...g}=t,y=Ae("chakra-button__group",c),S=x.useMemo(()=>({size:r,colorScheme:i,variant:s,isDisabled:h}),[r,i,s,h]);let C={display:"inline-flex",...f?bw[p]:Sw[p](u)};const w=p==="vertical";return l.jsx(xw,{value:S,children:l.jsx(re.div,{ref:n,role:"group",__css:C,className:y,"data-attached":f?"":void 0,"data-orientation":p,flexDir:w?"column":void 0,...g})})});en.displayName="ButtonGroup";function Cw(e){const[t,n]=x.useState(!e);return{ref:x.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function hf(e){const{children:t,className:n,...r}=e,i=x.isValidElement(t)?x.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ae("chakra-button__icon",n);return l.jsx(re.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:i})}hf.displayName="ButtonIcon";function ic(e){const{label:t,placement:n,spacing:r="0.5rem",children:i=l.jsx(Qf,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:c,...u}=e,f=Ae("chakra-button__spinner",s),h=n==="start"?"marginEnd":"marginStart",p=x.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[h]:t?r:0,fontSize:"1em",lineHeight:"normal",...c}),[c,t,h,r]);return l.jsx(re.div,{className:f,...u,__css:p,children:i})}ic.displayName="ButtonSpinner";var to=he((e,t)=>{const n=yw(),r=pi("Button",{...n,...e}),{isDisabled:i=n==null?void 0:n.isDisabled,isLoading:s,isActive:c,children:u,leftIcon:f,rightIcon:h,loadingText:p,iconSpacing:g="0.5rem",type:y,spinner:S,spinnerPlacement:C="start",className:w,as:k,...j}=At(e),M=x.useMemo(()=>{const D={...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:D}}},[r,n]),{ref:P,type:I}=Cw(k),T={rightIcon:h,leftIcon:f,iconSpacing:g,children:u};return l.jsxs(re.button,{ref:$3(t,P),as:k,type:y??I,"data-active":Ye(c),"data-loading":Ye(s),__css:M,className:Ae("chakra-button",w),...j,disabled:i||s,children:[s&&C==="start"&&l.jsx(ic,{className:"chakra-button__spinner--start",label:p,placement:"start",spacing:g,children:S}),s?p||l.jsx(re.span,{opacity:0,children:l.jsx(og,{...T})}):l.jsx(og,{...T}),s&&C==="end"&&l.jsx(ic,{className:"chakra-button__spinner--end",label:p,placement:"end",spacing:g,children:S})]})});to.displayName="Button";function og(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:i}=e;return l.jsxs(l.Fragment,{children:[t&&l.jsx(hf,{marginEnd:i,children:t}),r,n&&l.jsx(hf,{marginStart:i,children:n})]})}var ci=he((e,t)=>{const{icon:n,children:r,isRound:i,"aria-label":s,...c}=e,u=n||r,f=x.isValidElement(u)?x.cloneElement(u,{"aria-hidden":!0,focusable:!1}):null;return l.jsx(to,{padding:"0",borderRadius:i?"full":void 0,ref:t,"aria-label":s,...c,children:f})});ci.displayName="IconButton";var[DF,ww]=Et({name:"CheckboxGroupContext",strict:!1});function kw(e){return l.jsx(re.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:l.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function jw(e){return l.jsx(re.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:l.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function Ew(e){const{isIndeterminate:t,isChecked:n,...r}=e,i=t?jw:kw;return n||t?l.jsx(re.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:l.jsx(i,{...r})}):null}var[Pw,C2]=Et({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Iw,no]=Et({strict:!1,name:"FormControlContext"});function Mw(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:i,isReadOnly:s,...c}=e,u=x.useId(),f=t||`field-${u}`,h=`${f}-label`,p=`${f}-feedback`,g=`${f}-helptext`,[y,S]=x.useState(!1),[C,w]=x.useState(!1),[k,j]=x.useState(!1),M=x.useCallback((_={},z=null)=>({id:g,..._,ref:ct(z,V=>{V&&w(!0)})}),[g]),P=x.useCallback((_={},z=null)=>{var V,F;return{..._,ref:z,"data-focus":Ye(k),"data-disabled":Ye(i),"data-invalid":Ye(r),"data-readonly":Ye(s),id:(V=_.id)!=null?V:h,htmlFor:(F=_.htmlFor)!=null?F:f}},[f,i,k,r,s,h]),I=x.useCallback((_={},z=null)=>({id:p,..._,ref:ct(z,V=>{V&&S(!0)}),"aria-live":"polite"}),[p]),T=x.useCallback((_={},z=null)=>({..._,...c,ref:z,role:"group"}),[c]),D=x.useCallback((_={},z=null)=>({..._,ref:z,role:"presentation","aria-hidden":!0,children:_.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!i,isFocused:!!k,onFocus:()=>j(!0),onBlur:()=>j(!1),hasFeedbackText:y,setHasFeedbackText:S,hasHelpText:C,setHasHelpText:w,id:f,labelId:h,feedbackId:p,helpTextId:g,htmlProps:c,getHelpTextProps:M,getErrorMessageProps:I,getRootProps:T,getLabelProps:P,getRequiredIndicatorProps:D}}var rt=he(function(t,n){const r=fn("Form",t),i=At(t),{getRootProps:s,htmlProps:c,...u}=Mw(i),f=Ae("chakra-form-control",t.className);return l.jsx(Iw,{value:u,children:l.jsx(Pw,{value:r,children:l.jsx(re.div,{...s({},n),className:f,__css:r.container})})})});rt.displayName="FormControl";var wt=he(function(t,n){const r=no(),i=C2(),s=Ae("chakra-form__helper-text",t.className);return l.jsx(re.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:i.helperText,className:s})});wt.displayName="FormHelperText";var[Tw,_w]=Et({name:"FormErrorStylesContext",errorMessage:`useFormErrorStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),kt=he((e,t)=>{const n=fn("FormError",e),r=At(e),i=no();return i!=null&&i.isInvalid?l.jsx(Tw,{value:n,children:l.jsx(re.div,{...i==null?void 0:i.getErrorMessageProps(r,t),className:Ae("chakra-form__error-message",e.className),__css:{display:"flex",alignItems:"center",...n.text}})}):null});kt.displayName="FormErrorMessage";var Dw=he((e,t)=>{const n=_w(),r=no();if(!(r!=null&&r.isInvalid))return null;const i=Ae("chakra-form__error-icon",e.className);return l.jsx(Jt,{ref:t,"aria-hidden":!0,...e,__css:n.icon,className:i,children:l.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"})})});Dw.displayName="FormErrorIcon";var st=he(function(t,n){var r;const i=pi("FormLabel",t),s=At(t),{className:c,children:u,requiredIndicator:f=l.jsx(w2,{}),optionalIndicator:h=null,...p}=s,g=no(),y=(r=g==null?void 0:g.getLabelProps(p,n))!=null?r:{ref:n,...p};return l.jsxs(re.label,{...y,className:Ae("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...i},children:[u,g!=null&&g.isRequired?f:h]})});st.displayName="FormLabel";var w2=he(function(t,n){const r=no(),i=C2();if(!(r!=null&&r.isRequired))return null;const s=Ae("chakra-form__required-indicator",t.className);return l.jsx(re.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:i.requiredIndicator,className:s})});w2.displayName="RequiredIndicator";function ch(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:i,...s}=uh(e);return{...s,disabled:t,readOnly:r,required:i,"aria-invalid":Dr(n),"aria-required":Dr(i),"aria-readonly":Dr(r)}}function uh(e){var t,n,r;const i=no(),{id:s,disabled:c,readOnly:u,required:f,isRequired:h,isInvalid:p,isReadOnly:g,isDisabled:y,onFocus:S,onBlur:C,...w}=e,k=e["aria-describedby"]?[e["aria-describedby"]]:[];return i!=null&&i.hasFeedbackText&&(i!=null&&i.isInvalid)&&k.push(i.feedbackId),i!=null&&i.hasHelpText&&k.push(i.helpTextId),{...w,"aria-describedby":k.join(" ")||void 0,id:s??(i==null?void 0:i.id),isDisabled:(t=c??y)!=null?t:i==null?void 0:i.isDisabled,isReadOnly:(n=u??g)!=null?n:i==null?void 0:i.isReadOnly,isRequired:(r=f??h)!=null?r:i==null?void 0:i.isRequired,isInvalid:p??(i==null?void 0:i.isInvalid),onFocus:Pe(i==null?void 0:i.onFocus,S),onBlur:Pe(i==null?void 0:i.onBlur,C)}}var dh={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},k2=re("span",{baseStyle:dh});k2.displayName="VisuallyHidden";var Ow=re("input",{baseStyle:dh});Ow.displayName="VisuallyHiddenInput";var ag=!1,fs=null,Yi=!1,pf=!1,mf=new Set;function fh(e,t){mf.forEach(n=>n(e,t))}var Aw=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function zw(e){return!(e.metaKey||!Aw&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function sg(e){Yi=!0,zw(e)&&(fs="keyboard",fh("keyboard",e))}function jo(e){if(fs="pointer",e.type==="mousedown"||e.type==="pointerdown"){Yi=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;fh("pointer",e)}}function Rw(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function Nw(e){Rw(e)&&(Yi=!0,fs="virtual")}function Fw(e){e.target===window||e.target===document||(!Yi&&!pf&&(fs="virtual",fh("virtual",e)),Yi=!1,pf=!1)}function Lw(){Yi=!1,pf=!0}function lg(){return fs!=="pointer"}function Bw(){if(typeof window>"u"||ag)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Yi=!0,e.apply(this,n)},document.addEventListener("keydown",sg,!0),document.addEventListener("keyup",sg,!0),document.addEventListener("click",Nw,!0),window.addEventListener("focus",Fw,!0),window.addEventListener("blur",Lw,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",jo,!0),document.addEventListener("pointermove",jo,!0),document.addEventListener("pointerup",jo,!0)):(document.addEventListener("mousedown",jo,!0),document.addEventListener("mousemove",jo,!0),document.addEventListener("mouseup",jo,!0)),ag=!0}function j2(e){Bw(),e(lg());const t=()=>e(lg());return mf.add(t),()=>{mf.delete(t)}}function Hw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function E2(e={}){const t=uh(e),{isDisabled:n,isReadOnly:r,isRequired:i,isInvalid:s,id:c,onBlur:u,onFocus:f,"aria-describedby":h}=t,{defaultChecked:p,isChecked:g,isFocusable:y,onChange:S,isIndeterminate:C,name:w,value:k,tabIndex:j=void 0,"aria-label":M,"aria-labelledby":P,"aria-invalid":I,...T}=e,D=Hw(T,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),_=Ut(S),z=Ut(u),V=Ut(f),[F,L]=x.useState(!1),[X,$]=x.useState(!1),[Q,ie]=x.useState(!1),[oe,U]=x.useState(!1);x.useEffect(()=>j2(L),[]);const K=x.useRef(null),[ne,ce]=x.useState(!0),[Re,ze]=x.useState(!!p),Me=g!==void 0,J=Me?g:Re,ue=x.useCallback(ge=>{if(r||n){ge.preventDefault();return}Me||ze(J?ge.target.checked:C?!0:ge.target.checked),_==null||_(ge)},[r,n,J,Me,C,_]);Uo(()=>{K.current&&(K.current.indeterminate=Boolean(C))},[C]),eo(()=>{n&&$(!1)},[n,$]),Uo(()=>{const ge=K.current;ge!=null&&ge.form&&(ge.form.onreset=()=>{ze(!!p)})},[]);const Ie=n&&!y,Be=x.useCallback(ge=>{ge.key===" "&&U(!0)},[U]),Ne=x.useCallback(ge=>{ge.key===" "&&U(!1)},[U]);Uo(()=>{if(!K.current)return;K.current.checked!==J&&ze(K.current.checked)},[K.current]);const Ge=x.useCallback((ge={},Te=null)=>{const et=Ve=>{X&&Ve.preventDefault(),U(!0)};return{...ge,ref:Te,"data-active":Ye(oe),"data-hover":Ye(Q),"data-checked":Ye(J),"data-focus":Ye(X),"data-focus-visible":Ye(X&&F),"data-indeterminate":Ye(C),"data-disabled":Ye(n),"data-invalid":Ye(s),"data-readonly":Ye(r),"aria-hidden":!0,onMouseDown:Pe(ge.onMouseDown,et),onMouseUp:Pe(ge.onMouseUp,()=>U(!1)),onMouseEnter:Pe(ge.onMouseEnter,()=>ie(!0)),onMouseLeave:Pe(ge.onMouseLeave,()=>ie(!1))}},[oe,J,n,X,F,Q,C,s,r]),Qe=x.useCallback((ge={},Te=null)=>({...D,...ge,ref:ct(Te,et=>{et&&ce(et.tagName==="LABEL")}),onClick:Pe(ge.onClick,()=>{var et;ne||((et=K.current)==null||et.click(),requestAnimationFrame(()=>{var Ve;(Ve=K.current)==null||Ve.focus()}))}),"data-disabled":Ye(n),"data-checked":Ye(J),"data-invalid":Ye(s)}),[D,n,J,s,ne]),ve=x.useCallback((ge={},Te=null)=>({...ge,ref:ct(K,Te),type:"checkbox",name:w,value:k,id:c,tabIndex:j,onChange:Pe(ge.onChange,ue),onBlur:Pe(ge.onBlur,z,()=>$(!1)),onFocus:Pe(ge.onFocus,V,()=>$(!0)),onKeyDown:Pe(ge.onKeyDown,Be),onKeyUp:Pe(ge.onKeyUp,Ne),required:i,checked:J,disabled:Ie,readOnly:r,"aria-label":M,"aria-labelledby":P,"aria-invalid":I?Boolean(I):s,"aria-describedby":h,"aria-disabled":n,style:dh}),[w,k,c,ue,z,V,Be,Ne,i,J,Ie,r,M,P,I,s,h,n,j]),_e=x.useCallback((ge={},Te=null)=>({...ge,ref:Te,onMouseDown:Pe(ge.onMouseDown,cg),onTouchStart:Pe(ge.onTouchStart,cg),"data-disabled":Ye(n),"data-checked":Ye(J),"data-invalid":Ye(s)}),[J,n,s]);return{state:{isInvalid:s,isFocused:X,isChecked:J,isActive:oe,isHovered:Q,isIndeterminate:C,isDisabled:n,isReadOnly:r,isRequired:i},getRootProps:Qe,getCheckboxProps:Ge,getInputProps:ve,getLabelProps:_e,htmlProps:D}}function cg(e){e.preventDefault(),e.stopPropagation()}var Ww={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},Vw={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},Uw=Zi({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),$w=Zi({from:{opacity:0},to:{opacity:1}}),Gw=Zi({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),P2=he(function(t,n){const r=ww(),i={...r,...t},s=fn("Checkbox",i),c=At(t),{spacing:u="0.5rem",className:f,children:h,iconColor:p,iconSize:g,icon:y=l.jsx(Ew,{}),isChecked:S,isDisabled:C=r==null?void 0:r.isDisabled,onChange:w,inputProps:k,...j}=c;let M=S;r!=null&&r.value&&c.value&&(M=r.value.includes(c.value));let P=w;r!=null&&r.onChange&&c.value&&(P=yc(r.onChange,w));const{state:I,getInputProps:T,getCheckboxProps:D,getLabelProps:_,getRootProps:z}=E2({...j,isDisabled:C,isChecked:M,onChange:P}),V=x.useMemo(()=>({animation:I.isIndeterminate?`${$w} 20ms linear, ${Gw} 200ms linear`:`${Uw} 200ms linear`,fontSize:g,color:p,...s.icon}),[p,g,,I.isIndeterminate,s.icon]),F=x.cloneElement(y,{__css:V,isIndeterminate:I.isIndeterminate,isChecked:I.isChecked});return l.jsxs(re.label,{__css:{...Vw,...s.container},className:Ae("chakra-checkbox",f),...z(),children:[l.jsx("input",{className:"chakra-checkbox__input",...T(k,n)}),l.jsx(re.span,{__css:{...Ww,...s.control},className:"chakra-checkbox__control",...D(),children:F}),h&&l.jsx(re.span,{className:"chakra-checkbox__label",..._(),__css:{marginStart:u,...s.label},children:h})]})});P2.displayName="Checkbox";function qw(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function hh(e,t){let n=qw(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function vf(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 ug(e,t,n){return(e-t)*100/(n-t)}function Yw(e,t,n){return(n-t)*e+t}function dg(e,t,n){const r=Math.round((e-t)/n)*n+t,i=vf(n);return hh(r,i)}function $l(e,t,n){return e==null?e:(n{var F;return r==null?"":(F=gd(r,s,n))!=null?F:""}),y=typeof i<"u",S=y?i:p,C=I2(ni(S),s),w=n??C,k=x.useCallback(F=>{F!==S&&(y||g(F.toString()),h==null||h(F.toString(),ni(F)))},[h,y,S]),j=x.useCallback(F=>{let L=F;return f&&(L=$l(L,c,u)),hh(L,w)},[w,f,u,c]),M=x.useCallback((F=s)=>{let L;S===""?L=ni(F):L=ni(S)+F,L=j(L),k(L)},[j,s,k,S]),P=x.useCallback((F=s)=>{let L;S===""?L=ni(-F):L=ni(S)-F,L=j(L),k(L)},[j,s,k,S]),I=x.useCallback(()=>{var F;let L;r==null?L="":L=(F=gd(r,s,n))!=null?F:c,k(L)},[r,n,s,k,c]),T=x.useCallback(F=>{var L;const X=(L=gd(F,s,w))!=null?L:c;k(X)},[w,s,k,c]),D=ni(S);return{isOutOfRange:D>u||D{const s=typeof e=="function"?e():e??document;if(!(!n||!s))return s.addEventListener(t,i,r),()=>{s.removeEventListener(t,i,r)}},[t,e,r,i,n]),()=>{const s=typeof e=="function"?e():e??document;s==null||s.removeEventListener(t,i,r)}}function Kw(e){return"current"in e}var M2=()=>typeof window<"u";function Qw(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var Zw=e=>M2()&&e.test(navigator.vendor),Jw=e=>M2()&&e.test(Qw()),e5=()=>Jw(/mac|iphone|ipad|ipod/i),t5=()=>e5()&&Zw(/apple/i);function n5(e){const{ref:t,elements:n,enabled:r}=e,i=()=>{var s,c;return(c=(s=t.current)==null?void 0:s.ownerDocument)!=null?c:document};Ui(i,"pointerdown",s=>{if(!t5()||!r)return;const c=s.target,f=(n??[t]).some(h=>{const p=Kw(h)?h.current:h;return(p==null?void 0:p.contains(c))||p===c});i().activeElement!==c&&f&&(s.preventDefault(),c.focus())})}var lt={},r5={get exports(){return lt},set exports(e){lt=e}},i5="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",o5=i5,a5=o5;function T2(){}function _2(){}_2.resetWarningCache=T2;var s5=function(){function e(r,i,s,c,u,f){if(f!==a5){var h=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 h.name="Invariant Violation",h}}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:_2,resetWarningCache:T2};return n.PropTypes=n,n};r5.exports=s5();var gf="data-focus-lock",D2="data-focus-lock-disabled",l5="data-no-focus-lock",c5="data-autofocus-inside",u5="data-no-autofocus";function d5(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function f5(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}function O2(e,t){return f5(t||null,function(n){return e.forEach(function(r){return d5(r,n)})})}var xd={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},vr=function(){return vr=Object.assign||function(t){for(var n,r=1,i=arguments.length;r0&&s[s.length-1])&&(h[0]===6||h[0]===2)){n=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]0)&&!(i=r.next()).done;)s.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(c)throw c.error}}return s}function xf(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r=0}).sort(j5)},E5=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],xh=E5.join(","),P5="".concat(xh,", [data-focus-guard]"),Q2=function(e,t){return wr((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?P5:xh)?[r]:[],Q2(r))},[])},I5=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?kc([e.contentDocument.body],t):[e]},kc=function(e,t){return e.reduce(function(n,r){var i,s=Q2(r,t),c=(i=[]).concat.apply(i,s.map(function(u){return I5(u,t)}));return n.concat(c,r.parentNode?wr(r.parentNode.querySelectorAll(xh)).filter(function(u){return u===r}):[])},[])},M5=function(e){var t=e.querySelectorAll("[".concat(c5,"]"));return wr(t).map(function(n){return kc([n])}).reduce(function(n,r){return n.concat(r)},[])},yh=function(e,t){return wr(e).filter(function(n){return $2(t,n)}).filter(function(n){return C5(n)})},hg=function(e,t){return t===void 0&&(t=new Map),wr(e).filter(function(n){return G2(t,n)})},yf=function(e,t,n){return K2(yh(kc(e,n),t),!0,n)},pg=function(e,t){return K2(yh(kc(e),t),!1)},T5=function(e,t){return yh(M5(e),t)},Go=function(e,t){return e.shadowRoot?Go(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:wr(e.children).some(function(n){var r;if(n instanceof HTMLIFrameElement){var i=(r=n.contentDocument)===null||r===void 0?void 0:r.body;return i?Go(i,t):!1}return Go(n,t)})},_5=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(i),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(c,u){return!t.has(u)})},Z2=function(e){return e.parentNode?Z2(e.parentNode):e},bh=function(e){var t=oc(e);return t.filter(Boolean).reduce(function(n,r){var i=r.getAttribute(gf);return n.push.apply(n,i?_5(wr(Z2(r).querySelectorAll("[".concat(gf,'="').concat(i,'"]:not([').concat(D2,'="disabled"])')))):[r]),n},[])},D5=function(e){try{return e()}catch{return}},Xa=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Xa(t.shadowRoot):t instanceof HTMLIFrameElement&&D5(function(){return t.contentWindow.document})?Xa(t.contentWindow.document):t}},O5=function(e,t){return e===t},A5=function(e,t){return Boolean(wr(e.querySelectorAll("iframe")).some(function(n){return O5(n,t)}))},J2=function(e,t){return t===void 0&&(t=Xa(W2(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:bh(e).some(function(n){return Go(n,t)||A5(n,t)})},z5=function(e){e===void 0&&(e=document);var t=Xa(e);return t?wr(e.querySelectorAll("[".concat(l5,"]"))).some(function(n){return Go(n,t)}):!1},R5=function(e,t){return t.filter(X2).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},Sh=function(e,t){return X2(e)&&e.name?R5(e,t):e},N5=function(e){var t=new Set;return e.forEach(function(n){return t.add(Sh(n,e))}),e.filter(function(n){return t.has(n)})},mg=function(e){return e[0]&&e.length>1?Sh(e[0],e):e[0]},vg=function(e,t){return e.length>1?e.indexOf(Sh(e[t],e)):t},ex="NEW_FOCUS",F5=function(e,t,n,r){var i=e.length,s=e[0],c=e[i-1],u=gh(n);if(!(n&&e.indexOf(n)>=0)){var f=n!==void 0?t.indexOf(n):-1,h=r?t.indexOf(r):f,p=r?e.indexOf(r):-1,g=f-h,y=t.indexOf(s),S=t.indexOf(c),C=N5(t),w=n!==void 0?C.indexOf(n):-1,k=w-(r?C.indexOf(r):f),j=vg(e,0),M=vg(e,i-1);if(f===-1||p===-1)return ex;if(!g&&p>=0)return p;if(f<=y&&u&&Math.abs(g)>1)return M;if(f>=S&&u&&Math.abs(g)>1)return j;if(g&&Math.abs(k)>1)return p;if(f<=y)return M;if(f>S)return j;if(g)return Math.abs(g)>1?p:(i+p+g)%i}},L5=function(e){return function(t){var n,r=(n=q2(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},B5=function(e,t,n){var r=e.map(function(s){var c=s.node;return c}),i=hg(r.filter(L5(n)));return i&&i.length?mg(i):mg(hg(t))},bf=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&bf(e.parentNode.host||e.parentNode,t),t},yd=function(e,t){for(var n=bf(e),r=bf(t),i=0;i=0)return s}return!1},tx=function(e,t,n){var r=oc(e),i=oc(t),s=r[0],c=!1;return i.filter(Boolean).forEach(function(u){c=yd(c||u,u)||c,n.filter(Boolean).forEach(function(f){var h=yd(s,f);h&&(!c||Go(h,c)?c=h:c=yd(h,c))})}),c},H5=function(e,t){return e.reduce(function(n,r){return n.concat(T5(r,t))},[])},W5=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(k5)},V5=function(e,t){var n=Xa(oc(e).length>0?document:W2(e).ownerDocument),r=bh(e).filter(ac),i=tx(n||e,e,r),s=new Map,c=pg(r,s),u=yf(r,s).filter(function(S){var C=S.node;return ac(C)});if(!(!u[0]&&(u=c,!u[0]))){var f=pg([i],s).map(function(S){var C=S.node;return C}),h=W5(f,u),p=h.map(function(S){var C=S.node;return C}),g=F5(p,f,n,t);if(g===ex){var y=B5(c,p,H5(r,s));if(y)return{node:y};console.warn("focus-lock: cannot find any node to move focus into");return}return g===void 0?g:h[g]}},U5=function(e){var t=bh(e).filter(ac),n=tx(e,e,t),r=new Map,i=yf([n],r,!0),s=yf(t,r).filter(function(c){var u=c.node;return ac(u)}).map(function(c){var u=c.node;return u});return i.map(function(c){var u=c.node,f=c.index;return{node:u,index:f,lockItem:s.indexOf(u)>=0,guard:gh(u)}})},$5=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},bd=0,Sd=!1,nx=function(e,t,n){n===void 0&&(n={});var r=V5(e,t);if(!Sd&&r){if(bd>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Sd=!0,setTimeout(function(){Sd=!1},1);return}bd++,$5(r.node,n.focusOptions),bd--}};function rx(e){var t=window,n=t.setImmediate;typeof n<"u"?n(e):setTimeout(e,1)}var G5=function(){return document&&document.activeElement===document.body},q5=function(){return G5()||z5()},qo=null,Bo=null,Yo=null,Ka=!1,Y5=function(){return!0},X5=function(t){return(qo.whiteList||Y5)(t)},K5=function(t,n){Yo={observerNode:t,portaledElement:n}},Q5=function(t){return Yo&&Yo.portaledElement===t};function gg(e,t,n,r){var i=null,s=e;do{var c=r[s];if(c.guard)c.node.dataset.focusAutoGuard&&(i=c);else if(c.lockItem){if(s!==e)return;i=null}else break}while((s+=n)!==t);i&&(i.node.tabIndex=0)}var Z5=function(t){return t&&"current"in t?t.current:t},J5=function(t){return t?Boolean(Ka):Ka==="meanwhile"},e6=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},t6=function(t,n){return n.some(function(r){return e6(t,r,r)})},sc=function(){var t=!1;if(qo){var n=qo,r=n.observed,i=n.persistentFocus,s=n.autoFocus,c=n.shards,u=n.crossFrame,f=n.focusOptions,h=r||Yo&&Yo.portaledElement,p=document&&document.activeElement;if(h){var g=[h].concat(c.map(Z5).filter(Boolean));if((!p||X5(p))&&(i||J5(u)||!q5()||!Bo&&s)&&(h&&!(J2(g)||p&&t6(p,g)||Q5(p))&&(document&&!Bo&&p&&!s?(p.blur&&p.blur(),document.body.focus()):(t=nx(g,Bo,{focusOptions:f}),Yo={})),Ka=!1,Bo=document&&document.activeElement),document){var y=document&&document.activeElement,S=U5(g),C=S.map(function(w){var k=w.node;return k}).indexOf(y);C>-1&&(S.filter(function(w){var k=w.guard,j=w.node;return k&&j.dataset.focusAutoGuard}).forEach(function(w){var k=w.node;return k.removeAttribute("tabIndex")}),gg(C,S.length,1,S),gg(C,-1,-1,S))}}}return t},ix=function(t){sc()&&t&&(t.stopPropagation(),t.preventDefault())},Ch=function(){return rx(sc)},n6=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||K5(r,n)},r6=function(){return null},ox=function(){Ka="just",setTimeout(function(){Ka="meanwhile"},0)},i6=function(){document.addEventListener("focusin",ix),document.addEventListener("focusout",Ch),window.addEventListener("blur",ox)},o6=function(){document.removeEventListener("focusin",ix),document.removeEventListener("focusout",Ch),window.removeEventListener("blur",ox)};function a6(e){return e.filter(function(t){var n=t.disabled;return!n})}function s6(e){var t=e.slice(-1)[0];t&&!qo&&i6();var n=qo,r=n&&t&&t.id===n.id;qo=t,n&&!r&&(n.onDeactivation(),e.filter(function(i){var s=i.id;return s===n.id}).length||n.returnFocus(!t)),t?(Bo=null,(!r||n.observed!==t.observed)&&t.onActivation(),sc(),rx(sc)):(o6(),Bo=null)}L2.assignSyncMedium(n6);B2.assignMedium(Ch);p5.assignMedium(function(e){return e({moveFocusInside:nx,focusInside:J2})});const l6=g5(a6,s6)(r6);var ax=x.forwardRef(function(t,n){return x.createElement(H2,Ql({sideCar:l6,ref:n},t))}),sx=H2.propTypes||{};sx.sideCar;th(sx,["sideCar"]);ax.propTypes={};const xg=ax;function lx(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function cx(e){var t;if(!lx(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function c6(e){var t,n;return(n=(t=ux(e))==null?void 0:t.defaultView)!=null?n:window}function ux(e){return lx(e)?e.ownerDocument:document}function u6(e){return ux(e).activeElement}var dx=e=>e.hasAttribute("tabindex"),d6=e=>dx(e)&&e.tabIndex===-1;function f6(e){return Boolean(e.getAttribute("disabled"))===!0||Boolean(e.getAttribute("aria-disabled"))===!0}function fx(e){return e.parentElement&&fx(e.parentElement)?!0:e.hidden}function h6(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function hx(e){if(!cx(e)||fx(e)||f6(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]():h6(e)?!0:dx(e)}function p6(e){return e?cx(e)&&hx(e)&&!d6(e):!1}var m6=["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]"],v6=m6.join(),g6=e=>e.offsetWidth>0&&e.offsetHeight>0;function px(e){const t=Array.from(e.querySelectorAll(v6));return t.unshift(e),t.filter(n=>hx(n)&&g6(n))}var yg,x6=(yg=xg.default)!=null?yg:xg,mx=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:i,children:s,isDisabled:c,autoFocus:u,persistentFocus:f,lockFocusAcrossFrames:h}=e,p=x.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&px(r.current).length===0&&requestAnimationFrame(()=>{var C;(C=r.current)==null||C.focus()})},[t,r]),g=x.useCallback(()=>{var S;(S=n==null?void 0:n.current)==null||S.focus()},[n]),y=i&&!n;return l.jsx(x6,{crossFrame:h,persistentFocus:f,autoFocus:u,disabled:c,onActivation:p,onDeactivation:g,returnFocus:y,children:s})};mx.displayName="FocusLock";var y6=D3?x.useLayoutEffect:x.useEffect;function Sf(e,t=[]){const n=x.useRef(e);return y6(()=>{n.current=e}),x.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function b6(e,t,n,r){const i=Sf(t);return x.useEffect(()=>{var s;const c=(s=zv(n))!=null?s:document;if(t)return c.addEventListener(e,i,r),()=>{c.removeEventListener(e,i,r)}},[e,n,r,i,t]),()=>{var s;((s=zv(n))!=null?s:document).removeEventListener(e,i,r)}}function S6(e,t){const n=x.useId();return x.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function C6(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function ui(e={}){const{onClose:t,onOpen:n,isOpen:r,id:i}=e,s=Sf(n),c=Sf(t),[u,f]=x.useState(e.defaultIsOpen||!1),[h,p]=C6(r,u),g=S6(i,"disclosure"),y=x.useCallback(()=>{h||f(!1),c==null||c()},[h,c]),S=x.useCallback(()=>{h||f(!0),s==null||s()},[h,s]),C=x.useCallback(()=>{(p?y:S)()},[p,S,y]);return{isOpen:!!p,onOpen:S,onClose:y,onToggle:C,isControlled:h,getButtonProps:(w={})=>({...w,"aria-expanded":p,"aria-controls":g,onClick:LS(w.onClick,C)}),getDisclosureProps:(w={})=>({...w,hidden:!p,id:g})}}var wh=he(function(t,n){const{htmlSize:r,...i}=t,s=fn("Input",i),c=At(i),u=ch(c),f=Ae("chakra-input",t.className);return l.jsx(re.input,{size:r,...u,__css:s.field,ref:n,className:f})});wh.displayName="Input";wh.id="Input";var[w6,vx]=Et({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),kh=he(function(t,n){const r=fn("List",t),{children:i,styleType:s="none",stylePosition:c,spacing:u,...f}=At(t),h=lh(i),g=u?{["& > *:not(style) ~ *:not(style)"]:{mt:u}}:{};return l.jsx(w6,{value:r,children:l.jsx(re.ul,{ref:n,listStyleType:s,listStylePosition:c,role:"list",__css:{...r.container,...g},...f,children:h})})});kh.displayName="List";var k6=he((e,t)=>{const{as:n,...r}=e;return l.jsx(kh,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});k6.displayName="OrderedList";var gx=he(function(t,n){const{as:r,...i}=t;return l.jsx(kh,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...i})});gx.displayName="UnorderedList";var Fa=he(function(t,n){const r=vx();return l.jsx(re.li,{ref:n,...t,__css:r.item})});Fa.displayName="ListItem";var j6=he(function(t,n){const r=vx();return l.jsx(Jt,{ref:n,role:"presentation",...t,__css:r.icon})});j6.displayName="ListIcon";var $n=he(function(t,n){const{templateAreas:r,gap:i,rowGap:s,columnGap:c,column:u,row:f,autoFlow:h,autoRows:p,templateRows:g,autoColumns:y,templateColumns:S,...C}=t,w={display:"grid",gridTemplateAreas:r,gridGap:i,gridRowGap:s,gridColumnGap:c,gridAutoColumns:y,gridColumn:u,gridRow:f,gridAutoFlow:h,gridAutoRows:p,gridTemplateRows:g,gridTemplateColumns:S};return l.jsx(re.div,{ref:n,__css:w,...C})});$n.displayName="Grid";function xx(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):Kd(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var jc=re("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});jc.displayName="Spacer";var yx=e=>l.jsx(re.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});yx.displayName="StackItem";var Cf="& > *:not(style) ~ *:not(style)";function E6(e){const{spacing:t,direction:n}=e,r={column:{marginTop:t,marginEnd:0,marginBottom:0,marginStart:0},row:{marginTop:0,marginEnd:0,marginBottom:0,marginStart:t},"column-reverse":{marginTop:0,marginEnd:0,marginBottom:t,marginStart:0},"row-reverse":{marginTop:0,marginEnd:t,marginBottom:0,marginStart:0}};return{flexDirection:n,[Cf]:xx(n,i=>r[i])}}function P6(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{"&":xx(n,i=>r[i])}}var jh=he((e,t)=>{const{isInline:n,direction:r,align:i,justify:s,spacing:c="0.5rem",wrap:u,children:f,divider:h,className:p,shouldWrapChildren:g,...y}=e,S=n?"row":r??"column",C=x.useMemo(()=>E6({direction:S,spacing:c}),[S,c]),w=x.useMemo(()=>P6({spacing:c,direction:S}),[c,S]),k=!!h,j=!g&&!k,M=x.useMemo(()=>{const I=lh(f);return j?I:I.map((T,D)=>{const _=typeof T.key<"u"?T.key:D,z=D+1===I.length,F=g?l.jsx(yx,{children:T},_):T;if(!k)return F;const L=x.cloneElement(h,{__css:w}),X=z?null:L;return l.jsxs(x.Fragment,{children:[F,X]},_)})},[h,w,k,j,g,f]),P=Ae("chakra-stack",p);return l.jsx(re.div,{ref:t,display:"flex",alignItems:i,justifyContent:s,flexDirection:C.flexDirection,flexWrap:u,className:P,__css:k?{}:{[Cf]:C[Cf]},...y,children:M})});jh.displayName="Stack";var Le=he((e,t)=>l.jsx(jh,{align:"center",...e,direction:"column",ref:t}));Le.displayName="VStack";var sa=he((e,t)=>l.jsx(jh,{align:"center",...e,direction:"row",ref:t}));sa.displayName="HStack";var Vn=he(function(t,n){const r=pi("Heading",t),{className:i,...s}=At(t);return l.jsx(re.h2,{ref:n,className:Ae("chakra-heading",t.className),...s,__css:r})});Vn.displayName="Heading";var We=re("div");We.displayName="Box";var bx=he(function(t,n){const{size:r,centerContent:i=!0,...s}=t,c=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return l.jsx(We,{ref:n,boxSize:r,__css:{...c,flexShrink:0,flexGrow:0},...s})});bx.displayName="Square";var I6=he(function(t,n){const{size:r,...i}=t;return l.jsx(bx,{size:r,ref:n,borderRadius:"9999px",...i})});I6.displayName="Circle";var $i=he(function(t,n){const r=pi("Link",t),{className:i,isExternal:s,...c}=At(t);return l.jsx(re.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ae("chakra-link",i),...c,__css:r})});$i.displayName="Link";var Sx=he(function(t,n){const r=pi("Badge",t),{className:i,...s}=At(t);return l.jsx(re.span,{ref:n,className:Ae("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Sx.displayName="Badge";var Cx=re("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center"}});Cx.displayName="Center";var M6={horizontal:{insetStart:"50%",transform:"translateX(-50%)"},vertical:{top:"50%",transform:"translateY(-50%)"},both:{insetStart:"50%",top:"50%",transform:"translate(-50%, -50%)"}};he(function(t,n){const{axis:r="both",...i}=t;return l.jsx(re.div,{ref:n,__css:M6[r],...i,position:"absolute"})});var wx=he(function(t,n){const{borderLeftWidth:r,borderBottomWidth:i,borderTopWidth:s,borderRightWidth:c,borderWidth:u,borderStyle:f,borderColor:h,...p}=pi("Divider",t),{className:g,orientation:y="horizontal",__css:S,...C}=At(t),w={vertical:{borderLeftWidth:r||c||u||"1px",height:"100%"},horizontal:{borderBottomWidth:i||s||u||"1px",width:"100%"}};return l.jsx(re.hr,{ref:n,"aria-orientation":y,...C,__css:{...p,border:"0",borderColor:h,borderStyle:f,...w[y],...S},className:Ae("chakra-divider",g)})});wx.displayName="Divider";function T6(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function _6(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,i]=x.useState([]),s=x.useRef(),c=()=>{s.current&&(clearTimeout(s.current),s.current=null)},u=()=>{c(),s.current=setTimeout(()=>{i([]),s.current=null},t)};x.useEffect(()=>c,[]);function f(h){return p=>{if(p.key==="Backspace"){const g=[...r];g.pop(),i(g);return}if(T6(p)){const g=r.concat(p.key);n(p)&&(p.preventDefault(),p.stopPropagation()),i(g),h(g.join("")),u()}}}return f}function D6(e,t,n,r){if(t==null)return r;if(!r)return e.find(c=>n(c).toLowerCase().startsWith(t.toLowerCase()));const i=e.filter(s=>n(s).toLowerCase().startsWith(t.toLowerCase()));if(i.length>0){let s;return i.includes(r)?(s=i.indexOf(r)+1,s===i.length&&(s=0),i[s]):(s=e.indexOf(i[0]),e[s])}return r}function O6(){const e=x.useRef(new Map),t=e.current,n=x.useCallback((i,s,c,u)=>{e.current.set(c,{type:s,el:i,options:u}),i.addEventListener(s,c,u)},[]),r=x.useCallback((i,s,c,u)=>{i.removeEventListener(s,c,u),e.current.delete(c)},[]);return x.useEffect(()=>()=>{t.forEach((i,s)=>{r(i.el,i.type,s,i.options)})},[r,t]),{add:n,remove:r}}function Cd(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function kx(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:i=!0,clickOnSpace:s=!0,onMouseDown:c,onMouseUp:u,onClick:f,onKeyDown:h,onKeyUp:p,tabIndex:g,onMouseOver:y,onMouseLeave:S,...C}=e,[w,k]=x.useState(!0),[j,M]=x.useState(!1),P=O6(),I=U=>{U&&U.tagName!=="BUTTON"&&k(!1)},T=w?g:g||0,D=n&&!r,_=x.useCallback(U=>{if(n){U.stopPropagation(),U.preventDefault();return}U.currentTarget.focus(),f==null||f(U)},[n,f]),z=x.useCallback(U=>{j&&Cd(U)&&(U.preventDefault(),U.stopPropagation(),M(!1),P.remove(document,"keyup",z,!1))},[j,P]),V=x.useCallback(U=>{if(h==null||h(U),n||U.defaultPrevented||U.metaKey||!Cd(U.nativeEvent)||w)return;const K=i&&U.key==="Enter";s&&U.key===" "&&(U.preventDefault(),M(!0)),K&&(U.preventDefault(),U.currentTarget.click()),P.add(document,"keyup",z,!1)},[n,w,h,i,s,P,z]),F=x.useCallback(U=>{if(p==null||p(U),n||U.defaultPrevented||U.metaKey||!Cd(U.nativeEvent)||w)return;s&&U.key===" "&&(U.preventDefault(),M(!1),U.currentTarget.click())},[s,w,n,p]),L=x.useCallback(U=>{U.button===0&&(M(!1),P.remove(document,"mouseup",L,!1))},[P]),X=x.useCallback(U=>{if(U.button!==0)return;if(n){U.stopPropagation(),U.preventDefault();return}w||M(!0),U.currentTarget.focus({preventScroll:!0}),P.add(document,"mouseup",L,!1),c==null||c(U)},[n,w,c,P,L]),$=x.useCallback(U=>{U.button===0&&(w||M(!1),u==null||u(U))},[u,w]),Q=x.useCallback(U=>{if(n){U.preventDefault();return}y==null||y(U)},[n,y]),ie=x.useCallback(U=>{j&&(U.preventDefault(),M(!1)),S==null||S(U)},[j,S]),oe=ct(t,I);return w?{...C,ref:oe,type:"button","aria-disabled":D?void 0:n,disabled:D,onClick:_,onMouseDown:c,onMouseUp:u,onKeyUp:p,onKeyDown:h,onMouseOver:y,onMouseLeave:S}:{...C,ref:oe,role:"button","data-active":Ye(j),"aria-disabled":n?"true":void 0,tabIndex:D?void 0:T,onClick:_,onMouseDown:X,onMouseUp:$,onKeyUp:F,onKeyDown:V,onMouseOver:Q,onMouseLeave:ie}}function A6(e){const t=e.current;if(!t)return!1;const n=u6(t);return!n||t.contains(n)?!1:!!p6(n)}function jx(e,t){const{shouldFocus:n,visible:r,focusRef:i}=t,s=n&&!r;eo(()=>{if(!s||A6(e))return;const c=(i==null?void 0:i.current)||e.current;c&&requestAnimationFrame(()=>{c.focus()})},[s,e,i])}var z6={preventScroll:!0,shouldFocus:!1};function R6(e,t=z6){const{focusRef:n,preventScroll:r,shouldFocus:i,visible:s}=t,c=N6(e)?e.current:e,u=i&&s,f=x.useRef(u),h=x.useRef(s);Uo(()=>{!h.current&&s&&(f.current=u),h.current=s},[s,u]);const p=x.useCallback(()=>{if(!(!s||!c||!f.current)&&(f.current=!1,!c.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var g;(g=n.current)==null||g.focus({preventScroll:r})});else{const g=px(c);g.length>0&&requestAnimationFrame(()=>{g[0].focus({preventScroll:r})})}},[s,r,c,n]);eo(()=>{p()},[p]),Ui(c,"transitionend",p)}function N6(e){return"current"in e}var Eo=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Vt={arrowShadowColor:Eo("--popper-arrow-shadow-color"),arrowSize:Eo("--popper-arrow-size","8px"),arrowSizeHalf:Eo("--popper-arrow-size-half"),arrowBg:Eo("--popper-arrow-bg"),transformOrigin:Eo("--popper-transform-origin"),arrowOffset:Eo("--popper-arrow-offset")};function F6(e){if(e.includes("top"))return"1px 1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 1px 0 var(--popper-arrow-shadow-color)"}var L6={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"},B6=e=>L6[e],bg={scroll:!0,resize:!0};function H6(e){let t;return typeof e=="object"?t={enabled:!0,options:{...bg,...e}}:t={enabled:e,options:bg},t}var W6={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`}},V6={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{Sg(e)},effect:({state:e})=>()=>{Sg(e)}},Sg=e=>{e.elements.popper.style.setProperty(Vt.transformOrigin.var,B6(e.placement))},U6={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{$6(e)}},$6=e=>{var t;if(!e.placement)return;const n=G6(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:Vt.arrowSize.varRef,height:Vt.arrowSize.varRef,zIndex:-1});const r={[Vt.arrowSizeHalf.var]:`calc(${Vt.arrowSize.varRef} / 2)`,[Vt.arrowOffset.var]:`calc(${Vt.arrowSizeHalf.varRef} * -1)`};for(const i in r)e.elements.arrow.style.setProperty(i,r[i])}},G6=e=>{if(e.startsWith("top"))return{property:"bottom",value:Vt.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:Vt.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:Vt.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:Vt.arrowOffset.varRef}},q6={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{Cg(e)},effect:({state:e})=>()=>{Cg(e)}},Cg=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=F6(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:Vt.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},Y6={"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"}},X6={"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 K6(e,t="ltr"){var n,r;const i=((n=Y6[e])==null?void 0:n[t])||e;return t==="ltr"?i:(r=X6[e])!=null?r:i}var Pn="top",Gn="bottom",qn="right",In="left",Eh="auto",hs=[Pn,Gn,qn,In],Xo="start",Qa="end",Q6="clippingParents",Ex="viewport",Oa="popper",Z6="reference",wg=hs.reduce(function(e,t){return e.concat([t+"-"+Xo,t+"-"+Qa])},[]),Px=[].concat(hs,[Eh]).reduce(function(e,t){return e.concat([t,t+"-"+Xo,t+"-"+Qa])},[]),J6="beforeRead",ek="read",tk="afterRead",nk="beforeMain",rk="main",ik="afterMain",ok="beforeWrite",ak="write",sk="afterWrite",lk=[J6,ek,tk,nk,rk,ik,ok,ak,sk];function Cr(e){return e?(e.nodeName||"").toLowerCase():null}function Yn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Xi(e){var t=Yn(e).Element;return e instanceof t||e instanceof Element}function Un(e){var t=Yn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Ph(e){if(typeof ShadowRoot>"u")return!1;var t=Yn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function ck(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},i=t.attributes[n]||{},s=t.elements[n];!Un(s)||!Cr(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(c){var u=i[c];u===!1?s.removeAttribute(c):s.setAttribute(c,u===!0?"":u)}))})}function uk(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 i=t.elements[r],s=t.attributes[r]||{},c=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),u=c.reduce(function(f,h){return f[h]="",f},{});!Un(i)||!Cr(i)||(Object.assign(i.style,u),Object.keys(s).forEach(function(f){i.removeAttribute(f)}))})}}const dk={name:"applyStyles",enabled:!0,phase:"write",fn:ck,effect:uk,requires:["computeStyles"]};function yr(e){return e.split("-")[0]}var Gi=Math.max,lc=Math.min,Ko=Math.round;function wf(){var e=navigator.userAgentData;return e!=null&&e.brands?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Ix(){return!/^((?!chrome|android).)*safari/i.test(wf())}function Qo(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,s=1;t&&Un(e)&&(i=e.offsetWidth>0&&Ko(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&Ko(r.height)/e.offsetHeight||1);var c=Xi(e)?Yn(e):window,u=c.visualViewport,f=!Ix()&&n,h=(r.left+(f&&u?u.offsetLeft:0))/i,p=(r.top+(f&&u?u.offsetTop:0))/s,g=r.width/i,y=r.height/s;return{width:g,height:y,top:p,right:h+g,bottom:p+y,left:h,x:h,y:p}}function Ih(e){var t=Qo(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 Mx(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Ph(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Ar(e){return Yn(e).getComputedStyle(e)}function fk(e){return["table","td","th"].indexOf(Cr(e))>=0}function mi(e){return((Xi(e)?e.ownerDocument:e.document)||window.document).documentElement}function Ec(e){return Cr(e)==="html"?e:e.assignedSlot||e.parentNode||(Ph(e)?e.host:null)||mi(e)}function kg(e){return!Un(e)||Ar(e).position==="fixed"?null:e.offsetParent}function hk(e){var t=/firefox/i.test(wf()),n=/Trident/i.test(wf());if(n&&Un(e)){var r=Ar(e);if(r.position==="fixed")return null}var i=Ec(e);for(Ph(i)&&(i=i.host);Un(i)&&["html","body"].indexOf(Cr(i))<0;){var s=Ar(i);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 i;i=i.parentNode}return null}function ps(e){for(var t=Yn(e),n=kg(e);n&&fk(n)&&Ar(n).position==="static";)n=kg(n);return n&&(Cr(n)==="html"||Cr(n)==="body"&&Ar(n).position==="static")?t:n||hk(e)||t}function Mh(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Ha(e,t,n){return Gi(e,lc(t,n))}function pk(e,t,n){var r=Ha(e,t,n);return r>n?n:r}function Tx(){return{top:0,right:0,bottom:0,left:0}}function _x(e){return Object.assign({},Tx(),e)}function Dx(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var mk=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,_x(typeof t!="number"?t:Dx(t,hs))};function vk(e){var t,n=e.state,r=e.name,i=e.options,s=n.elements.arrow,c=n.modifiersData.popperOffsets,u=yr(n.placement),f=Mh(u),h=[In,qn].indexOf(u)>=0,p=h?"height":"width";if(!(!s||!c)){var g=mk(i.padding,n),y=Ih(s),S=f==="y"?Pn:In,C=f==="y"?Gn:qn,w=n.rects.reference[p]+n.rects.reference[f]-c[f]-n.rects.popper[p],k=c[f]-n.rects.reference[f],j=ps(s),M=j?f==="y"?j.clientHeight||0:j.clientWidth||0:0,P=w/2-k/2,I=g[S],T=M-y[p]-g[C],D=M/2-y[p]/2+P,_=Ha(I,D,T),z=f;n.modifiersData[r]=(t={},t[z]=_,t.centerOffset=_-D,t)}}function gk(e){var t=e.state,n=e.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=t.elements.popper.querySelector(i),!i)||Mx(t.elements.popper,i)&&(t.elements.arrow=i))}const xk={name:"arrow",enabled:!0,phase:"main",fn:vk,effect:gk,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Zo(e){return e.split("-")[1]}var yk={top:"auto",right:"auto",bottom:"auto",left:"auto"};function bk(e){var t=e.x,n=e.y,r=window,i=r.devicePixelRatio||1;return{x:Ko(t*i)/i||0,y:Ko(n*i)/i||0}}function jg(e){var t,n=e.popper,r=e.popperRect,i=e.placement,s=e.variation,c=e.offsets,u=e.position,f=e.gpuAcceleration,h=e.adaptive,p=e.roundOffsets,g=e.isFixed,y=c.x,S=y===void 0?0:y,C=c.y,w=C===void 0?0:C,k=typeof p=="function"?p({x:S,y:w}):{x:S,y:w};S=k.x,w=k.y;var j=c.hasOwnProperty("x"),M=c.hasOwnProperty("y"),P=In,I=Pn,T=window;if(h){var D=ps(n),_="clientHeight",z="clientWidth";if(D===Yn(n)&&(D=mi(n),Ar(D).position!=="static"&&u==="absolute"&&(_="scrollHeight",z="scrollWidth")),D=D,i===Pn||(i===In||i===qn)&&s===Qa){I=Gn;var V=g&&D===T&&T.visualViewport?T.visualViewport.height:D[_];w-=V-r.height,w*=f?1:-1}if(i===In||(i===Pn||i===Gn)&&s===Qa){P=qn;var F=g&&D===T&&T.visualViewport?T.visualViewport.width:D[z];S-=F-r.width,S*=f?1:-1}}var L=Object.assign({position:u},h&&yk),X=p===!0?bk({x:S,y:w}):{x:S,y:w};if(S=X.x,w=X.y,f){var $;return Object.assign({},L,($={},$[I]=M?"0":"",$[P]=j?"0":"",$.transform=(T.devicePixelRatio||1)<=1?"translate("+S+"px, "+w+"px)":"translate3d("+S+"px, "+w+"px, 0)",$))}return Object.assign({},L,(t={},t[I]=M?w+"px":"",t[P]=j?S+"px":"",t.transform="",t))}function Sk(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,s=n.adaptive,c=s===void 0?!0:s,u=n.roundOffsets,f=u===void 0?!0:u,h={placement:yr(t.placement),variation:Zo(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,jg(Object.assign({},h,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:c,roundOffsets:f})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,jg(Object.assign({},h,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const Ck={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Sk,data:{}};var wl={passive:!0};function wk(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,s=i===void 0?!0:i,c=r.resize,u=c===void 0?!0:c,f=Yn(t.elements.popper),h=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&h.forEach(function(p){p.addEventListener("scroll",n.update,wl)}),u&&f.addEventListener("resize",n.update,wl),function(){s&&h.forEach(function(p){p.removeEventListener("scroll",n.update,wl)}),u&&f.removeEventListener("resize",n.update,wl)}}const kk={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:wk,data:{}};var jk={left:"right",right:"left",bottom:"top",top:"bottom"};function Gl(e){return e.replace(/left|right|bottom|top/g,function(t){return jk[t]})}var Ek={start:"end",end:"start"};function Eg(e){return e.replace(/start|end/g,function(t){return Ek[t]})}function Th(e){var t=Yn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function _h(e){return Qo(mi(e)).left+Th(e).scrollLeft}function Pk(e,t){var n=Yn(e),r=mi(e),i=n.visualViewport,s=r.clientWidth,c=r.clientHeight,u=0,f=0;if(i){s=i.width,c=i.height;var h=Ix();(h||!h&&t==="fixed")&&(u=i.offsetLeft,f=i.offsetTop)}return{width:s,height:c,x:u+_h(e),y:f}}function Ik(e){var t,n=mi(e),r=Th(e),i=(t=e.ownerDocument)==null?void 0:t.body,s=Gi(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),c=Gi(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),u=-r.scrollLeft+_h(e),f=-r.scrollTop;return Ar(i||n).direction==="rtl"&&(u+=Gi(n.clientWidth,i?i.clientWidth:0)-s),{width:s,height:c,x:u,y:f}}function Dh(e){var t=Ar(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Ox(e){return["html","body","#document"].indexOf(Cr(e))>=0?e.ownerDocument.body:Un(e)&&Dh(e)?e:Ox(Ec(e))}function Wa(e,t){var n;t===void 0&&(t=[]);var r=Ox(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),s=Yn(r),c=i?[s].concat(s.visualViewport||[],Dh(r)?r:[]):r,u=t.concat(c);return i?u:u.concat(Wa(Ec(c)))}function kf(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Mk(e,t){var n=Qo(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 Pg(e,t,n){return t===Ex?kf(Pk(e,n)):Xi(t)?Mk(t,n):kf(Ik(mi(e)))}function Tk(e){var t=Wa(Ec(e)),n=["absolute","fixed"].indexOf(Ar(e).position)>=0,r=n&&Un(e)?ps(e):e;return Xi(r)?t.filter(function(i){return Xi(i)&&Mx(i,r)&&Cr(i)!=="body"}):[]}function _k(e,t,n,r){var i=t==="clippingParents"?Tk(e):[].concat(t),s=[].concat(i,[n]),c=s[0],u=s.reduce(function(f,h){var p=Pg(e,h,r);return f.top=Gi(p.top,f.top),f.right=lc(p.right,f.right),f.bottom=lc(p.bottom,f.bottom),f.left=Gi(p.left,f.left),f},Pg(e,c,r));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function Ax(e){var t=e.reference,n=e.element,r=e.placement,i=r?yr(r):null,s=r?Zo(r):null,c=t.x+t.width/2-n.width/2,u=t.y+t.height/2-n.height/2,f;switch(i){case Pn:f={x:c,y:t.y-n.height};break;case Gn:f={x:c,y:t.y+t.height};break;case qn:f={x:t.x+t.width,y:u};break;case In:f={x:t.x-n.width,y:u};break;default:f={x:t.x,y:t.y}}var h=i?Mh(i):null;if(h!=null){var p=h==="y"?"height":"width";switch(s){case Xo:f[h]=f[h]-(t[p]/2-n[p]/2);break;case Qa:f[h]=f[h]+(t[p]/2-n[p]/2);break}}return f}function Za(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,s=n.strategy,c=s===void 0?e.strategy:s,u=n.boundary,f=u===void 0?Q6:u,h=n.rootBoundary,p=h===void 0?Ex:h,g=n.elementContext,y=g===void 0?Oa:g,S=n.altBoundary,C=S===void 0?!1:S,w=n.padding,k=w===void 0?0:w,j=_x(typeof k!="number"?k:Dx(k,hs)),M=y===Oa?Z6:Oa,P=e.rects.popper,I=e.elements[C?M:y],T=_k(Xi(I)?I:I.contextElement||mi(e.elements.popper),f,p,c),D=Qo(e.elements.reference),_=Ax({reference:D,element:P,strategy:"absolute",placement:i}),z=kf(Object.assign({},P,_)),V=y===Oa?z:D,F={top:T.top-V.top+j.top,bottom:V.bottom-T.bottom+j.bottom,left:T.left-V.left+j.left,right:V.right-T.right+j.right},L=e.modifiersData.offset;if(y===Oa&&L){var X=L[i];Object.keys(F).forEach(function($){var Q=[qn,Gn].indexOf($)>=0?1:-1,ie=[Pn,Gn].indexOf($)>=0?"y":"x";F[$]+=X[ie]*Q})}return F}function Dk(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,s=n.rootBoundary,c=n.padding,u=n.flipVariations,f=n.allowedAutoPlacements,h=f===void 0?Px:f,p=Zo(r),g=p?u?wg:wg.filter(function(C){return Zo(C)===p}):hs,y=g.filter(function(C){return h.indexOf(C)>=0});y.length===0&&(y=g);var S=y.reduce(function(C,w){return C[w]=Za(e,{placement:w,boundary:i,rootBoundary:s,padding:c})[yr(w)],C},{});return Object.keys(S).sort(function(C,w){return S[C]-S[w]})}function Ok(e){if(yr(e)===Eh)return[];var t=Gl(e);return[Eg(e),t,Eg(t)]}function Ak(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,s=i===void 0?!0:i,c=n.altAxis,u=c===void 0?!0:c,f=n.fallbackPlacements,h=n.padding,p=n.boundary,g=n.rootBoundary,y=n.altBoundary,S=n.flipVariations,C=S===void 0?!0:S,w=n.allowedAutoPlacements,k=t.options.placement,j=yr(k),M=j===k,P=f||(M||!C?[Gl(k)]:Ok(k)),I=[k].concat(P).reduce(function(J,ue){return J.concat(yr(ue)===Eh?Dk(t,{placement:ue,boundary:p,rootBoundary:g,padding:h,flipVariations:C,allowedAutoPlacements:w}):ue)},[]),T=t.rects.reference,D=t.rects.popper,_=new Map,z=!0,V=I[0],F=0;F=0,ie=Q?"width":"height",oe=Za(t,{placement:L,boundary:p,rootBoundary:g,altBoundary:y,padding:h}),U=Q?$?qn:In:$?Gn:Pn;T[ie]>D[ie]&&(U=Gl(U));var K=Gl(U),ne=[];if(s&&ne.push(oe[X]<=0),u&&ne.push(oe[U]<=0,oe[K]<=0),ne.every(function(J){return J})){V=L,z=!1;break}_.set(L,ne)}if(z)for(var ce=C?3:1,Re=function(ue){var Ie=I.find(function(Be){var Ne=_.get(Be);if(Ne)return Ne.slice(0,ue).every(function(Ge){return Ge})});if(Ie)return V=Ie,"break"},ze=ce;ze>0;ze--){var Me=Re(ze);if(Me==="break")break}t.placement!==V&&(t.modifiersData[r]._skip=!0,t.placement=V,t.reset=!0)}}const zk={name:"flip",enabled:!0,phase:"main",fn:Ak,requiresIfExists:["offset"],data:{_skip:!1}};function Ig(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 Mg(e){return[Pn,qn,Gn,In].some(function(t){return e[t]>=0})}function Rk(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,s=t.modifiersData.preventOverflow,c=Za(t,{elementContext:"reference"}),u=Za(t,{altBoundary:!0}),f=Ig(c,r),h=Ig(u,i,s),p=Mg(f),g=Mg(h);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:h,isReferenceHidden:p,hasPopperEscaped:g},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":g})}const Nk={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Rk};function Fk(e,t,n){var r=yr(e),i=[In,Pn].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,c=s[0],u=s[1];return c=c||0,u=(u||0)*i,[In,qn].indexOf(r)>=0?{x:u,y:c}:{x:c,y:u}}function Lk(e){var t=e.state,n=e.options,r=e.name,i=n.offset,s=i===void 0?[0,0]:i,c=Px.reduce(function(p,g){return p[g]=Fk(g,t.rects,s),p},{}),u=c[t.placement],f=u.x,h=u.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=h),t.modifiersData[r]=c}const Bk={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Lk};function Hk(e){var t=e.state,n=e.name;t.modifiersData[n]=Ax({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Wk={name:"popperOffsets",enabled:!0,phase:"read",fn:Hk,data:{}};function Vk(e){return e==="x"?"y":"x"}function Uk(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,s=i===void 0?!0:i,c=n.altAxis,u=c===void 0?!1:c,f=n.boundary,h=n.rootBoundary,p=n.altBoundary,g=n.padding,y=n.tether,S=y===void 0?!0:y,C=n.tetherOffset,w=C===void 0?0:C,k=Za(t,{boundary:f,rootBoundary:h,padding:g,altBoundary:p}),j=yr(t.placement),M=Zo(t.placement),P=!M,I=Mh(j),T=Vk(I),D=t.modifiersData.popperOffsets,_=t.rects.reference,z=t.rects.popper,V=typeof w=="function"?w(Object.assign({},t.rects,{placement:t.placement})):w,F=typeof V=="number"?{mainAxis:V,altAxis:V}:Object.assign({mainAxis:0,altAxis:0},V),L=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,X={x:0,y:0};if(D){if(s){var $,Q=I==="y"?Pn:In,ie=I==="y"?Gn:qn,oe=I==="y"?"height":"width",U=D[I],K=U+k[Q],ne=U-k[ie],ce=S?-z[oe]/2:0,Re=M===Xo?_[oe]:z[oe],ze=M===Xo?-z[oe]:-_[oe],Me=t.elements.arrow,J=S&&Me?Ih(Me):{width:0,height:0},ue=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Tx(),Ie=ue[Q],Be=ue[ie],Ne=Ha(0,_[oe],J[oe]),Ge=P?_[oe]/2-ce-Ne-Ie-F.mainAxis:Re-Ne-Ie-F.mainAxis,Qe=P?-_[oe]/2+ce+Ne+Be+F.mainAxis:ze+Ne+Be+F.mainAxis,ve=t.elements.arrow&&ps(t.elements.arrow),_e=ve?I==="y"?ve.clientTop||0:ve.clientLeft||0:0,qe=($=L==null?void 0:L[I])!=null?$:0,ge=U+Ge-qe-_e,Te=U+Qe-qe,et=Ha(S?lc(K,ge):K,U,S?Gi(ne,Te):ne);D[I]=et,X[I]=et-U}if(u){var Ve,vt=I==="x"?Pn:In,Nt=I==="x"?Gn:qn,N=D[T],de=T==="y"?"height":"width",xe=N+k[vt],je=N-k[Nt],q=[Pn,In].indexOf(j)!==-1,se=(Ve=L==null?void 0:L[T])!=null?Ve:0,Fe=q?xe:N-_[de]-z[de]-se+F.altAxis,Ze=q?N+_[de]+z[de]-se-F.altAxis:je,ee=S&&q?pk(Fe,N,Ze):Ha(S?Fe:xe,N,S?Ze:je);D[T]=ee,X[T]=ee-N}t.modifiersData[r]=X}}const $k={name:"preventOverflow",enabled:!0,phase:"main",fn:Uk,requiresIfExists:["offset"]};function Gk(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function qk(e){return e===Yn(e)||!Un(e)?Th(e):Gk(e)}function Yk(e){var t=e.getBoundingClientRect(),n=Ko(t.width)/e.offsetWidth||1,r=Ko(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Xk(e,t,n){n===void 0&&(n=!1);var r=Un(t),i=Un(t)&&Yk(t),s=mi(t),c=Qo(e,i,n),u={scrollLeft:0,scrollTop:0},f={x:0,y:0};return(r||!r&&!n)&&((Cr(t)!=="body"||Dh(s))&&(u=qk(t)),Un(t)?(f=Qo(t,!0),f.x+=t.clientLeft,f.y+=t.clientTop):s&&(f.x=_h(s))),{x:c.left+u.scrollLeft-f.x,y:c.top+u.scrollTop-f.y,width:c.width,height:c.height}}function Kk(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function i(s){n.add(s.name);var c=[].concat(s.requires||[],s.requiresIfExists||[]);c.forEach(function(u){if(!n.has(u)){var f=t.get(u);f&&i(f)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||i(s)}),r}function Qk(e){var t=Kk(e);return lk.reduce(function(n,r){return n.concat(t.filter(function(i){return i.phase===r}))},[])}function Zk(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function Jk(e){var t=e.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var Tg={placement:"bottom",modifiers:[],strategy:"absolute"};function _g(){for(var e=arguments.length,t=new Array(e),n=0;n{}),P=x.useCallback(()=>{var F;!t||!C.current||!w.current||((F=M.current)==null||F.call(M),k.current=nj(C.current,w.current,{placement:j,modifiers:[q6,U6,V6,{...W6,enabled:!!y},{name:"eventListeners",...H6(c)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:u??[0,f]}},{name:"flip",enabled:!!h,options:{padding:8}},{name:"preventOverflow",enabled:!!g,options:{boundary:p}},...n??[]],strategy:i}),k.current.forceUpdate(),M.current=k.current.destroy)},[j,t,n,y,c,s,u,f,h,g,p,i]);x.useEffect(()=>()=>{var F;!C.current&&!w.current&&((F=k.current)==null||F.destroy(),k.current=null)},[]);const I=x.useCallback(F=>{C.current=F,P()},[P]),T=x.useCallback((F={},L=null)=>({...F,ref:ct(I,L)}),[I]),D=x.useCallback(F=>{w.current=F,P()},[P]),_=x.useCallback((F={},L=null)=>({...F,ref:ct(D,L),style:{...F.style,position:i,minWidth:y?void 0:"max-content",inset:"0 auto auto 0"}}),[i,D,y]),z=x.useCallback((F={},L=null)=>{const{size:X,shadowColor:$,bg:Q,style:ie,...oe}=F;return{...oe,ref:L,"data-popper-arrow":"",style:rj(F)}},[]),V=x.useCallback((F={},L=null)=>({...F,ref:L,"data-popper-arrow-inner":""}),[]);return{update(){var F;(F=k.current)==null||F.update()},forceUpdate(){var F;(F=k.current)==null||F.forceUpdate()},transformOrigin:Vt.transformOrigin.varRef,referenceRef:I,popperRef:D,getPopperProps:_,getArrowProps:z,getArrowInnerProps:V,getReferenceProps:T}}function rj(e){const{size:t,shadowColor:n,bg:r,style:i}=e,s={...i,position:"absolute"};return t&&(s["--popper-arrow-size"]=t),n&&(s["--popper-arrow-shadow-color"]=n),r&&(s["--popper-arrow-bg"]=r),s}function Ah(e={}){const{onClose:t,onOpen:n,isOpen:r,id:i}=e,s=Ut(n),c=Ut(t),[u,f]=x.useState(e.defaultIsOpen||!1),h=r!==void 0?r:u,p=r!==void 0,g=x.useId(),y=i??`disclosure-${g}`,S=x.useCallback(()=>{p||f(!1),c==null||c()},[p,c]),C=x.useCallback(()=>{p||f(!0),s==null||s()},[p,s]),w=x.useCallback(()=>{h?S():C()},[h,C,S]);function k(M={}){return{...M,"aria-expanded":h,"aria-controls":y,onClick(P){var I;(I=M.onClick)==null||I.call(M,P),w()}}}function j(M={}){return{...M,hidden:!h,id:y}}return{isOpen:h,onOpen:C,onClose:S,onToggle:w,isControlled:p,getButtonProps:k,getDisclosureProps:j}}function ij(e){const{ref:t,handler:n,enabled:r=!0}=e,i=Ut(n),c=x.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;x.useEffect(()=>{if(!r)return;const u=g=>{wd(g,t)&&(c.isPointerDown=!0)},f=g=>{if(c.ignoreEmulatedMouseEvents){c.ignoreEmulatedMouseEvents=!1;return}c.isPointerDown&&n&&wd(g,t)&&(c.isPointerDown=!1,i(g))},h=g=>{c.ignoreEmulatedMouseEvents=!0,n&&c.isPointerDown&&wd(g,t)&&(c.isPointerDown=!1,i(g))},p=zx(t.current);return p.addEventListener("mousedown",u,!0),p.addEventListener("mouseup",f,!0),p.addEventListener("touchstart",u,!0),p.addEventListener("touchend",h,!0),()=>{p.removeEventListener("mousedown",u,!0),p.removeEventListener("mouseup",f,!0),p.removeEventListener("touchstart",u,!0),p.removeEventListener("touchend",h,!0)}},[n,t,i,c,r])}function wd(e,t){var n;const r=e.target;return e.button>0||r&&!zx(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function zx(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Rx(e){const{isOpen:t,ref:n}=e,[r,i]=x.useState(t),[s,c]=x.useState(!1);return x.useEffect(()=>{s||(i(t),c(!0))},[t,s,r]),Ui(()=>n.current,"animationend",()=>{i(t)}),{present:!(t?!1:!r),onComplete(){var f;const h=c6(n.current),p=new h.CustomEvent("animationend",{bubbles:!0});(f=n.current)==null||f.dispatchEvent(p)}}}function zh(e){const{wasSelected:t,enabled:n,isSelected:r,mode:i="unmount"}=e;return!!(!n||r||i==="keepMounted"&&t)}var[oj,aj,sj,lj]=rh(),[cj,ms]=Et({strict:!1,name:"MenuContext"});function uj(e,...t){const n=x.useId(),r=e||n;return x.useMemo(()=>t.map(i=>`${i}-${r}`),[r,t])}function Nx(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Dg(e){return Nx(e).activeElement===e}function dj(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:i,autoSelect:s=!0,isLazy:c,isOpen:u,defaultIsOpen:f,onClose:h,onOpen:p,placement:g="bottom-start",lazyBehavior:y="unmount",direction:S,computePositionOnMount:C=!1,...w}=e,k=x.useRef(null),j=x.useRef(null),M=sj(),P=x.useCallback(()=>{requestAnimationFrame(()=>{var Me;(Me=k.current)==null||Me.focus({preventScroll:!1})})},[]),I=x.useCallback(()=>{const Me=setTimeout(()=>{var J;if(i)(J=i.current)==null||J.focus();else{const ue=M.firstEnabled();ue&&$(ue.index)}});K.current.add(Me)},[M,i]),T=x.useCallback(()=>{const Me=setTimeout(()=>{const J=M.lastEnabled();J&&$(J.index)});K.current.add(Me)},[M]),D=x.useCallback(()=>{p==null||p(),s?I():P()},[s,I,P,p]),{isOpen:_,onOpen:z,onClose:V,onToggle:F}=Ah({isOpen:u,defaultIsOpen:f,onClose:h,onOpen:D});ij({enabled:_&&r,ref:k,handler:Me=>{var J;(J=j.current)!=null&&J.contains(Me.target)||V()}});const L=Oh({...w,enabled:_||C,placement:g,direction:S}),[X,$]=x.useState(-1);eo(()=>{_||$(-1)},[_]),jx(k,{focusRef:j,visible:_,shouldFocus:!0});const Q=Rx({isOpen:_,ref:k}),[ie,oe]=uj(t,"menu-button","menu-list"),U=x.useCallback(()=>{z(),P()},[z,P]),K=x.useRef(new Set([]));xj(()=>{K.current.forEach(Me=>clearTimeout(Me)),K.current.clear()});const ne=x.useCallback(()=>{z(),I()},[I,z]),ce=x.useCallback(()=>{z(),T()},[z,T]),Re=x.useCallback(()=>{var Me,J;const ue=Nx(k.current),Ie=(Me=k.current)==null?void 0:Me.contains(ue.activeElement);if(!(_&&!Ie))return;const Ne=(J=M.item(X))==null?void 0:J.node;Ne==null||Ne.focus()},[_,X,M]),ze=x.useRef(null);return{openAndFocusMenu:U,openAndFocusFirstItem:ne,openAndFocusLastItem:ce,onTransitionEnd:Re,unstable__animationState:Q,descendants:M,popper:L,buttonId:ie,menuId:oe,forceUpdate:L.forceUpdate,orientation:"vertical",isOpen:_,onToggle:F,onOpen:z,onClose:V,menuRef:k,buttonRef:j,focusedIndex:X,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:$,isLazy:c,lazyBehavior:y,initialFocusRef:i,rafId:ze}}function fj(e={},t=null){const n=ms(),{onToggle:r,popper:i,openAndFocusFirstItem:s,openAndFocusLastItem:c}=n,u=x.useCallback(f=>{const h=f.key,g={Enter:s,ArrowDown:s,ArrowUp:c}[h];g&&(f.preventDefault(),f.stopPropagation(),g(f))},[s,c]);return{...e,ref:ct(n.buttonRef,t,i.referenceRef),id:n.buttonId,"data-active":Ye(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:Pe(e.onClick,r),onKeyDown:Pe(e.onKeyDown,u)}}function jf(e){var t;return vj(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function hj(e={},t=null){const n=ms();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:i,menuRef:s,isOpen:c,onClose:u,menuId:f,isLazy:h,lazyBehavior:p,unstable__animationState:g}=n,y=aj(),S=_6({preventDefault:j=>j.key!==" "&&jf(j.target)}),C=x.useCallback(j=>{const M=j.key,I={Tab:D=>D.preventDefault(),Escape:u,ArrowDown:()=>{const D=y.nextEnabled(r);D&&i(D.index)},ArrowUp:()=>{const D=y.prevEnabled(r);D&&i(D.index)}}[M];if(I){j.preventDefault(),I(j);return}const T=S(D=>{const _=D6(y.values(),D,z=>{var V,F;return(F=(V=z==null?void 0:z.node)==null?void 0:V.textContent)!=null?F:""},y.item(r));if(_){const z=y.indexOf(_.node);i(z)}});jf(j.target)&&T(j)},[y,r,S,u,i]),w=x.useRef(!1);c&&(w.current=!0);const k=zh({wasSelected:w.current,enabled:h,mode:p,isSelected:g.present});return{...e,ref:ct(s,t),children:k?e.children:null,tabIndex:-1,role:"menu",id:f,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:Pe(e.onKeyDown,C)}}function pj(e={}){const{popper:t,isOpen:n}=ms();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function mj(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onClick:s,onFocus:c,isDisabled:u,isFocusable:f,closeOnSelect:h,type:p,...g}=e,y=ms(),{setFocusedIndex:S,focusedIndex:C,closeOnSelect:w,onClose:k,menuRef:j,isOpen:M,menuId:P,rafId:I}=y,T=x.useRef(null),D=`${P}-menuitem-${x.useId()}`,{index:_,register:z}=lj({disabled:u&&!f}),V=x.useCallback(U=>{n==null||n(U),!u&&S(_)},[S,_,u,n]),F=x.useCallback(U=>{r==null||r(U),T.current&&!Dg(T.current)&&V(U)},[V,r]),L=x.useCallback(U=>{i==null||i(U),!u&&S(-1)},[S,u,i]),X=x.useCallback(U=>{s==null||s(U),jf(U.currentTarget)&&(h??w)&&k()},[k,s,w,h]),$=x.useCallback(U=>{c==null||c(U),S(_)},[S,c,_]),Q=_===C,ie=u&&!f;eo(()=>{M&&(Q&&!ie&&T.current?(I.current&&cancelAnimationFrame(I.current),I.current=requestAnimationFrame(()=>{var U;(U=T.current)==null||U.focus(),I.current=null})):j.current&&!Dg(j.current)&&j.current.focus())},[Q,ie,j,M]);const oe=kx({onClick:X,onFocus:$,onMouseEnter:V,onMouseMove:F,onMouseLeave:L,ref:ct(z,T,t),isDisabled:u,isFocusable:f});return{...g,...oe,type:p??oe.type,id:D,role:"menuitem",tabIndex:Q?0:-1}}function vj(e){var t;if(!gj(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function gj(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function xj(e,t=[]){return x.useEffect(()=>()=>e(),t)}var[yj,Pc]=Et({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Rh=e=>{const{children:t}=e,n=fn("Menu",e),r=At(e),{direction:i}=Ji(),{descendants:s,...c}=dj({...r,direction:i}),u=x.useMemo(()=>c,[c]),{isOpen:f,onClose:h,forceUpdate:p}=u;return l.jsx(oj,{value:s,children:l.jsx(cj,{value:u,children:l.jsx(yj,{value:n,children:j1(t,{isOpen:f,onClose:h,forceUpdate:p})})})})};Rh.displayName="Menu";var Fx=he((e,t)=>{const n=Pc();return l.jsx(re.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});Fx.displayName="MenuCommand";var bj=he((e,t)=>{const{type:n,...r}=e,i=Pc(),s=r.as||n?n??void 0:"button",c=x.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...i.item}),[i.item]);return l.jsx(re.button,{ref:t,type:s,...r,__css:c})}),Lx=e=>{const{className:t,children:n,...r}=e,i=x.Children.only(n),s=x.isValidElement(i)?x.cloneElement(i,{focusable:"false","aria-hidden":!0,className:Ae("chakra-menu__icon",i.props.className)}):null,c=Ae("chakra-menu__icon-wrapper",t);return l.jsx(re.span,{className:c,...r,__css:{flexShrink:0},children:s})};Lx.displayName="MenuIcon";var pr=he((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:i,commandSpacing:s="0.75rem",children:c,...u}=e,f=mj(u,t),p=n||i?l.jsx("span",{style:{pointerEvents:"none",flex:1},children:c}):c;return l.jsxs(bj,{...f,className:Ae("chakra-menu__menuitem",f.className),children:[n&&l.jsx(Lx,{fontSize:"0.8em",marginEnd:r,children:n}),p,i&&l.jsx(Fx,{marginStart:s,children:i})]})});pr.displayName="MenuItem";var Sj={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"}}},Cj=re(Wr.div),Nh=he(function(t,n){var r,i;const{rootProps:s,motionProps:c,...u}=t,{isOpen:f,onTransitionEnd:h,unstable__animationState:p}=ms(),g=hj(u,n),y=pj(s),S=Pc();return l.jsx(re.div,{...y,__css:{zIndex:(i=t.zIndex)!=null?i:(r=S.list)==null?void 0:r.zIndex},children:l.jsx(Cj,{variants:Sj,initial:!1,animate:f?"enter":"exit",__css:{outline:0,...S.list},...c,className:Ae("chakra-menu__menu-list",g.className),...g,onUpdate:h,onAnimationComplete:yc(p.onComplete,g.onAnimationComplete)})})});Nh.displayName="MenuList";var wj=he((e,t)=>{const n=Pc();return l.jsx(re.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Fh=he((e,t)=>{const{children:n,as:r,...i}=e,s=fj(i,t),c=r||wj;return l.jsx(c,{...s,className:Ae("chakra-menu__menu-button",e.className),children:l.jsx(re.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Fh.displayName="MenuButton";var kj={slideInBottom:{...df,custom:{offsetY:16,reverse:!0}},slideInRight:{...df,custom:{offsetX:16,reverse:!0}},scale:{...S2,custom:{initialScale:.95,reverse:!0}},none:{}},jj=re(Wr.section),Ej=e=>kj[e||"none"],Bx=x.forwardRef((e,t)=>{const{preset:n,motionProps:r=Ej(n),...i}=e;return l.jsx(jj,{ref:t,...r,...i})});Bx.displayName="ModalTransition";var Pj=Object.defineProperty,Ij=(e,t,n)=>t in e?Pj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mj=(e,t,n)=>(Ij(e,typeof t!="symbol"?t+"":t,n),n),Tj=class{constructor(){Mj(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}},Ef=new Tj;function Hx(e,t){const[n,r]=x.useState(0);return x.useEffect(()=>{const i=e.current;if(i){if(t){const s=Ef.add(i);r(s)}return()=>{Ef.remove(i),r(0)}}},[t,e]),n}var _j=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Po=new WeakMap,kl=new WeakMap,jl={},kd=0,Wx=function(e){return e&&(e.host||Wx(e.parentNode))},Dj=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Wx(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return Boolean(n)})},Oj=function(e,t,n,r){var i=Dj(t,Array.isArray(e)?e:[e]);jl[n]||(jl[n]=new WeakMap);var s=jl[n],c=[],u=new Set,f=new Set(i),h=function(g){!g||u.has(g)||(u.add(g),h(g.parentNode))};i.forEach(h);var p=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(y){if(u.has(y))p(y);else{var S=y.getAttribute(r),C=S!==null&&S!=="false",w=(Po.get(y)||0)+1,k=(s.get(y)||0)+1;Po.set(y,w),s.set(y,k),c.push(y),w===1&&C&&kl.set(y,!0),k===1&&y.setAttribute(n,"true"),C||y.setAttribute(r,"true")}})};return p(t),u.clear(),kd++,function(){c.forEach(function(g){var y=Po.get(g)-1,S=s.get(g)-1;Po.set(g,y),s.set(g,S),y||(kl.has(g)||g.removeAttribute(r),kl.delete(g)),S||g.removeAttribute(n)}),kd--,kd||(Po=new WeakMap,Po=new WeakMap,kl=new WeakMap,jl={})}},Aj=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||_j(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),Oj(r,i,n,"aria-hidden")):function(){return null}};function zj(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:i=!0,closeOnEsc:s=!0,useInert:c=!0,onOverlayClick:u,onEsc:f}=e,h=x.useRef(null),p=x.useRef(null),[g,y,S]=Nj(r,"chakra-modal","chakra-modal--header","chakra-modal--body");Rj(h,t&&c),Hx(h,t);const C=x.useRef(null),w=x.useCallback(z=>{C.current=z.target},[]),k=x.useCallback(z=>{z.key==="Escape"&&(z.stopPropagation(),s&&(n==null||n()),f==null||f())},[s,n,f]),[j,M]=x.useState(!1),[P,I]=x.useState(!1),T=x.useCallback((z={},V=null)=>({role:"dialog",...z,ref:ct(V,h),id:g,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?y:void 0,"aria-describedby":P?S:void 0,onClick:Pe(z.onClick,F=>F.stopPropagation())}),[S,P,g,y,j]),D=x.useCallback(z=>{z.stopPropagation(),C.current===z.target&&Ef.isTopModal(h.current)&&(i&&(n==null||n()),u==null||u())},[n,i,u]),_=x.useCallback((z={},V=null)=>({...z,ref:ct(V,p),onClick:Pe(z.onClick,D),onKeyDown:Pe(z.onKeyDown,k),onMouseDown:Pe(z.onMouseDown,w)}),[k,w,D]);return{isOpen:t,onClose:n,headerId:y,bodyId:S,setBodyMounted:I,setHeaderMounted:M,dialogRef:h,overlayRef:p,getDialogProps:T,getDialogContainerProps:_}}function Rj(e,t){const n=e.current;x.useEffect(()=>{if(!(!e.current||!t))return Aj(e.current)},[t,e,n])}function Nj(e,...t){const n=x.useId(),r=e||n;return x.useMemo(()=>t.map(i=>`${i}-${r}`),[r,t])}var[Fj,la]=Et({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Lj,Ki]=Et({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),di=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:i,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:h,allowPinchZoom:p,preserveScrollBarGap:g,motionPreset:y,lockFocusAcrossFrames:S,onCloseComplete:C}=t,w=fn("Modal",t),j={...zj(t),autoFocus:i,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:h,allowPinchZoom:p,preserveScrollBarGap:g,motionPreset:y,lockFocusAcrossFrames:S};return l.jsx(Lj,{value:j,children:l.jsx(Fj,{value:w,children:l.jsx(ia,{onExitComplete:C,children:j.isOpen&&l.jsx(eh,{...n,children:r})})})})};di.displayName="Modal";var ql="right-scroll-bar-position",Yl="width-before-scroll-bar",Bj="with-scroll-bars-hidden",Hj="--removed-body-scroll-bar-size",Vx=N2(),jd=function(){},Ic=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:jd,onWheelCapture:jd,onTouchMoveCapture:jd}),i=r[0],s=r[1],c=e.forwardProps,u=e.children,f=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,y=e.sideCar,S=e.noIsolation,C=e.inert,w=e.allowPinchZoom,k=e.as,j=k===void 0?"div":k,M=A2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),P=y,I=O2([n,t]),T=vr(vr({},M),i);return x.createElement(x.Fragment,null,p&&x.createElement(P,{sideCar:Vx,removeScrollBar:h,shards:g,noIsolation:S,inert:C,setCallbacks:s,allowPinchZoom:!!w,lockRef:n}),c?x.cloneElement(x.Children.only(u),vr(vr({},T),{ref:I})):x.createElement(j,vr({},T,{className:f,ref:I}),u))});Ic.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ic.classNames={fullWidth:Yl,zeroRight:ql};var Og,Wj=function(){if(Og)return Og;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Vj(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Wj();return t&&e.setAttribute("nonce",t),e}function Uj(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function $j(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Gj=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Vj())&&(Uj(t,n),$j(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},qj=function(){var e=Gj();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ux=function(){var e=qj(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},Yj={left:0,top:0,right:0,gap:0},Ed=function(e){return parseInt(e||"",10)||0},Xj=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Ed(n),Ed(r),Ed(i)]},Kj=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Yj;var t=Xj(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])}},Qj=Ux(),Zj=function(e,t,n,r){var i=e.left,s=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),` - .`.concat(Bj,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(u,"px ").concat(r,`; - } - body { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(i,`px; - padding-top: `).concat(s,`px; - padding-right: `).concat(c,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(u,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(ql,` { - right: `).concat(u,"px ").concat(r,`; - } - - .`).concat(Yl,` { - margin-right: `).concat(u,"px ").concat(r,`; - } - - .`).concat(ql," .").concat(ql,` { - right: 0 `).concat(r,`; - } - - .`).concat(Yl," .").concat(Yl,` { - margin-right: 0 `).concat(r,`; - } - - body { - `).concat(Hj,": ").concat(u,`px; - } -`)},Jj=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r,s=x.useMemo(function(){return Kj(i)},[i]);return x.createElement(Qj,{styles:Zj(s,!t,i,n?"":"!important")})},Pf=!1;if(typeof window<"u")try{var El=Object.defineProperty({},"passive",{get:function(){return Pf=!0,!0}});window.addEventListener("test",El,El),window.removeEventListener("test",El,El)}catch{Pf=!1}var Io=Pf?{passive:!1}:!1,eE=function(e){return e.tagName==="TEXTAREA"},$x=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!eE(e)&&n[t]==="visible")},tE=function(e){return $x(e,"overflowY")},nE=function(e){return $x(e,"overflowX")},Ag=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=Gx(e,n);if(r){var i=qx(e,n),s=i[1],c=i[2];if(s>c)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},rE=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},iE=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Gx=function(e,t){return e==="v"?tE(t):nE(t)},qx=function(e,t){return e==="v"?rE(t):iE(t)},oE=function(e,t){return e==="h"&&t==="rtl"?-1:1},aE=function(e,t,n,r,i){var s=oE(e,window.getComputedStyle(t).direction),c=s*r,u=n.target,f=t.contains(u),h=!1,p=c>0,g=0,y=0;do{var S=qx(e,u),C=S[0],w=S[1],k=S[2],j=w-k-s*C;(C||j)&&Gx(e,u)&&(g+=j,y+=C),u=u.parentNode}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(p&&(i&&g===0||!i&&c>g)||!p&&(i&&y===0||!i&&-c>y))&&(h=!0),h},Pl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},zg=function(e){return[e.deltaX,e.deltaY]},Rg=function(e){return e&&"current"in e?e.current:e},sE=function(e,t){return e[0]===t[0]&&e[1]===t[1]},lE=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},cE=0,Mo=[];function uE(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),i=x.useState(cE++)[0],s=x.useState(function(){return Ux()})[0],c=x.useRef(e);x.useEffect(function(){c.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var w=xf([e.lockRef.current],(e.shards||[]).map(Rg),!0).filter(Boolean);return w.forEach(function(k){return k.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var u=x.useCallback(function(w,k){if("touches"in w&&w.touches.length===2)return!c.current.allowPinchZoom;var j=Pl(w),M=n.current,P="deltaX"in w?w.deltaX:M[0]-j[0],I="deltaY"in w?w.deltaY:M[1]-j[1],T,D=w.target,_=Math.abs(P)>Math.abs(I)?"h":"v";if("touches"in w&&_==="h"&&D.type==="range")return!1;var z=Ag(_,D);if(!z)return!0;if(z?T=_:(T=_==="v"?"h":"v",z=Ag(_,D)),!z)return!1;if(!r.current&&"changedTouches"in w&&(P||I)&&(r.current=T),!T)return!0;var V=r.current||T;return aE(V,k,w,V==="h"?P:I,!0)},[]),f=x.useCallback(function(w){var k=w;if(!(!Mo.length||Mo[Mo.length-1]!==s)){var j="deltaY"in k?zg(k):Pl(k),M=t.current.filter(function(T){return T.name===k.type&&T.target===k.target&&sE(T.delta,j)})[0];if(M&&M.should){k.cancelable&&k.preventDefault();return}if(!M){var P=(c.current.shards||[]).map(Rg).filter(Boolean).filter(function(T){return T.contains(k.target)}),I=P.length>0?u(k,P[0]):!c.current.noIsolation;I&&k.cancelable&&k.preventDefault()}}},[]),h=x.useCallback(function(w,k,j,M){var P={name:w,delta:k,target:j,should:M};t.current.push(P),setTimeout(function(){t.current=t.current.filter(function(I){return I!==P})},1)},[]),p=x.useCallback(function(w){n.current=Pl(w),r.current=void 0},[]),g=x.useCallback(function(w){h(w.type,zg(w),w.target,u(w,e.lockRef.current))},[]),y=x.useCallback(function(w){h(w.type,Pl(w),w.target,u(w,e.lockRef.current))},[]);x.useEffect(function(){return Mo.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",f,Io),document.addEventListener("touchmove",f,Io),document.addEventListener("touchstart",p,Io),function(){Mo=Mo.filter(function(w){return w!==s}),document.removeEventListener("wheel",f,Io),document.removeEventListener("touchmove",f,Io),document.removeEventListener("touchstart",p,Io)}},[]);var S=e.removeScrollBar,C=e.inert;return x.createElement(x.Fragment,null,C?x.createElement(s,{styles:lE(i)}):null,S?x.createElement(Jj,{gapMode:"margin"}):null)}const dE=h5(Vx,uE);var Yx=x.forwardRef(function(e,t){return x.createElement(Ic,vr({},e,{ref:t,sideCar:dE}))});Yx.classNames=Ic.classNames;const fE=Yx;function hE(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:i,blockScrollOnMount:s,allowPinchZoom:c,finalFocusRef:u,returnFocusOnClose:f,preserveScrollBarGap:h,lockFocusAcrossFrames:p,isOpen:g}=Ki(),[y,S]=C3();x.useEffect(()=>{!y&&S&&setTimeout(S)},[y,S]);const C=Hx(r,g);return l.jsx(mx,{autoFocus:t,isDisabled:!n,initialFocusRef:i,finalFocusRef:u,restoreFocus:f,contentRef:r,lockFocusAcrossFrames:p,children:l.jsx(fE,{removeScrollBar:!h,allowPinchZoom:c,enabled:C===1&&s,forwardProps:!0,children:e.children})})}var fi=he((e,t)=>{const{className:n,children:r,containerProps:i,motionProps:s,...c}=e,{getDialogProps:u,getDialogContainerProps:f}=Ki(),h=u(c,t),p=f(i),g=Ae("chakra-modal__content",n),y=la(),S={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...y.dialog},C={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...y.dialogContainer},{motionPreset:w}=Ki();return l.jsx(hE,{children:l.jsx(re.div,{...p,className:"chakra-modal__content-container",tabIndex:-1,__css:C,children:l.jsx(Bx,{preset:w,motionProps:s,className:g,...h,__css:S,children:r})})})});fi.displayName="ModalContent";function Xx(e){const{leastDestructiveRef:t,...n}=e;return l.jsx(di,{...n,initialFocusRef:t})}var Kx=he((e,t)=>l.jsx(fi,{ref:t,role:"alertdialog",...e})),zr=he((e,t)=>{const{className:n,...r}=e,i=Ae("chakra-modal__footer",n),c={display:"flex",alignItems:"center",justifyContent:"flex-end",...la().footer};return l.jsx(re.footer,{ref:t,...r,__css:c,className:i})});zr.displayName="ModalFooter";var Rr=he((e,t)=>{const{className:n,...r}=e,{headerId:i,setHeaderMounted:s}=Ki();x.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__header",n),f={flex:0,...la().header};return l.jsx(re.header,{ref:t,className:c,id:i,...r,__css:f})});Rr.displayName="ModalHeader";var pE=re(Wr.div),Nr=he((e,t)=>{const{className:n,transition:r,motionProps:i,...s}=e,c=Ae("chakra-modal__overlay",n),f={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...la().overlay},{motionPreset:h}=Ki(),g=i||(h==="none"?{}:b2);return l.jsx(pE,{...g,__css:f,ref:t,className:c,...s})});Nr.displayName="ModalOverlay";var Fr=he((e,t)=>{const{className:n,...r}=e,{bodyId:i,setBodyMounted:s}=Ki();x.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__body",n),u=la();return l.jsx(re.div,{ref:t,className:c,id:i,...r,__css:u.body})});Fr.displayName="ModalBody";var ca=he((e,t)=>{const{onClick:n,className:r,...i}=e,{onClose:s}=Ki(),c=Ae("chakra-modal__close-btn",r),u=la();return l.jsx(w3,{ref:t,__css:u.closeButton,className:c,onClick:Pe(n,f=>{f.stopPropagation(),s()}),...i})});ca.displayName="ModalCloseButton";var mE=e=>l.jsx(Jt,{viewBox:"0 0 24 24",...e,children:l.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"})}),vE=e=>l.jsx(Jt,{viewBox:"0 0 24 24",...e,children:l.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 Ng(e,t,n,r){x.useEffect(()=>{var i;if(!e.current||!r)return;const s=(i=e.current.ownerDocument.defaultView)!=null?i:window,c=Array.isArray(t)?t:[t],u=new s.MutationObserver(f=>{for(const h of f)h.type==="attributes"&&h.attributeName&&c.includes(h.attributeName)&&n(h)});return u.observe(e.current,{attributes:!0,attributeFilter:c}),()=>u.disconnect()})}function gE(e,t){const n=Ut(e);x.useEffect(()=>{let r=null;const i=()=>n();return t!==null&&(r=window.setInterval(i,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var xE=50,Fg=300;function yE(e,t){const[n,r]=x.useState(!1),[i,s]=x.useState(null),[c,u]=x.useState(!0),f=x.useRef(null),h=()=>clearTimeout(f.current);gE(()=>{i==="increment"&&e(),i==="decrement"&&t()},n?xE:null);const p=x.useCallback(()=>{c&&e(),f.current=setTimeout(()=>{u(!1),r(!0),s("increment")},Fg)},[e,c]),g=x.useCallback(()=>{c&&t(),f.current=setTimeout(()=>{u(!1),r(!0),s("decrement")},Fg)},[t,c]),y=x.useCallback(()=>{u(!0),r(!1),h()},[]);return x.useEffect(()=>()=>h(),[]),{up:p,down:g,stop:y,isSpinning:n}}var bE=/^[Ee0-9+\-.]$/;function SE(e){return bE.test(e)}function CE(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 wE(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:i=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:c=1,isReadOnly:u,isDisabled:f,isRequired:h,isInvalid:p,pattern:g="[0-9]*(.[0-9]+)?",inputMode:y="decimal",allowMouseWheel:S,id:C,onChange:w,precision:k,name:j,"aria-describedby":M,"aria-label":P,"aria-labelledby":I,onFocus:T,onBlur:D,onInvalid:_,getAriaValueText:z,isValidCharacter:V,format:F,parse:L,...X}=e,$=Ut(T),Q=Ut(D),ie=Ut(_),oe=Ut(V??SE),U=Ut(z),K=Xw(e),{update:ne,increment:ce,decrement:Re}=K,[ze,Me]=x.useState(!1),J=!(u||f),ue=x.useRef(null),Ie=x.useRef(null),Be=x.useRef(null),Ne=x.useRef(null),Ge=x.useCallback(ee=>ee.split("").filter(oe).join(""),[oe]),Qe=x.useCallback(ee=>{var He;return(He=L==null?void 0:L(ee))!=null?He:ee},[L]),ve=x.useCallback(ee=>{var He;return((He=F==null?void 0:F(ee))!=null?He:ee).toString()},[F]);eo(()=>{(K.valueAsNumber>s||K.valueAsNumber{if(!ue.current)return;if(ue.current.value!=K.value){const He=Qe(ue.current.value);K.setValue(Ge(He))}},[Qe,Ge]);const _e=x.useCallback((ee=c)=>{J&&ce(ee)},[ce,J,c]),qe=x.useCallback((ee=c)=>{J&&Re(ee)},[Re,J,c]),ge=yE(_e,qe);Ng(Be,"disabled",ge.stop,ge.isSpinning),Ng(Ne,"disabled",ge.stop,ge.isSpinning);const Te=x.useCallback(ee=>{if(ee.nativeEvent.isComposing)return;const nt=Qe(ee.currentTarget.value);ne(Ge(nt)),Ie.current={start:ee.currentTarget.selectionStart,end:ee.currentTarget.selectionEnd}},[ne,Ge,Qe]),et=x.useCallback(ee=>{var He,nt,Ft;$==null||$(ee),Ie.current&&(ee.target.selectionStart=(nt=Ie.current.start)!=null?nt:(He=ee.currentTarget.value)==null?void 0:He.length,ee.currentTarget.selectionEnd=(Ft=Ie.current.end)!=null?Ft:ee.currentTarget.selectionStart)},[$]),Ve=x.useCallback(ee=>{if(ee.nativeEvent.isComposing)return;CE(ee,oe)||ee.preventDefault();const He=vt(ee)*c,nt=ee.key,pe={ArrowUp:()=>_e(He),ArrowDown:()=>qe(He),Home:()=>ne(i),End:()=>ne(s)}[nt];pe&&(ee.preventDefault(),pe(ee))},[oe,c,_e,qe,ne,i,s]),vt=ee=>{let He=1;return(ee.metaKey||ee.ctrlKey)&&(He=.1),ee.shiftKey&&(He=10),He},Nt=x.useMemo(()=>{const ee=U==null?void 0:U(K.value);if(ee!=null)return ee;const He=K.value.toString();return He||void 0},[K.value,U]),N=x.useCallback(()=>{let ee=K.value;if(K.value==="")return;/^[eE]/.test(K.value.toString())?K.setValue(""):(K.valueAsNumbers&&(ee=s),K.cast(ee))},[K,s,i]),de=x.useCallback(()=>{Me(!1),n&&N()},[n,Me,N]),xe=x.useCallback(()=>{t&&requestAnimationFrame(()=>{var ee;(ee=ue.current)==null||ee.focus()})},[t]),je=x.useCallback(ee=>{ee.preventDefault(),ge.up(),xe()},[xe,ge]),q=x.useCallback(ee=>{ee.preventDefault(),ge.down(),xe()},[xe,ge]);Ui(()=>ue.current,"wheel",ee=>{var He,nt;const pe=((nt=(He=ue.current)==null?void 0:He.ownerDocument)!=null?nt:document).activeElement===ue.current;if(!S||!pe)return;ee.preventDefault();const De=vt(ee)*c,hn=Math.sign(ee.deltaY);hn===-1?_e(De):hn===1&&qe(De)},{passive:!1});const se=x.useCallback((ee={},He=null)=>{const nt=f||r&&K.isAtMax;return{...ee,ref:ct(He,Be),role:"button",tabIndex:-1,onPointerDown:Pe(ee.onPointerDown,Ft=>{Ft.button!==0||nt||je(Ft)}),onPointerLeave:Pe(ee.onPointerLeave,ge.stop),onPointerUp:Pe(ee.onPointerUp,ge.stop),disabled:nt,"aria-disabled":Dr(nt)}},[K.isAtMax,r,je,ge.stop,f]),Fe=x.useCallback((ee={},He=null)=>{const nt=f||r&&K.isAtMin;return{...ee,ref:ct(He,Ne),role:"button",tabIndex:-1,onPointerDown:Pe(ee.onPointerDown,Ft=>{Ft.button!==0||nt||q(Ft)}),onPointerLeave:Pe(ee.onPointerLeave,ge.stop),onPointerUp:Pe(ee.onPointerUp,ge.stop),disabled:nt,"aria-disabled":Dr(nt)}},[K.isAtMin,r,q,ge.stop,f]),Ze=x.useCallback((ee={},He=null)=>{var nt,Ft,pe,De;return{name:j,inputMode:y,type:"text",pattern:g,"aria-labelledby":I,"aria-label":P,"aria-describedby":M,id:C,disabled:f,...ee,readOnly:(nt=ee.readOnly)!=null?nt:u,"aria-readonly":(Ft=ee.readOnly)!=null?Ft:u,"aria-required":(pe=ee.required)!=null?pe:h,required:(De=ee.required)!=null?De:h,ref:ct(ue,He),value:ve(K.value),role:"spinbutton","aria-valuemin":i,"aria-valuemax":s,"aria-valuenow":Number.isNaN(K.valueAsNumber)?void 0:K.valueAsNumber,"aria-invalid":Dr(p??K.isOutOfRange),"aria-valuetext":Nt,autoComplete:"off",autoCorrect:"off",onChange:Pe(ee.onChange,Te),onKeyDown:Pe(ee.onKeyDown,Ve),onFocus:Pe(ee.onFocus,et,()=>Me(!0)),onBlur:Pe(ee.onBlur,Q,de)}},[j,y,g,I,P,ve,M,C,f,h,u,p,K.value,K.valueAsNumber,K.isOutOfRange,i,s,Nt,Te,Ve,et,Q,de]);return{value:ve(K.value),valueAsNumber:K.valueAsNumber,isFocused:ze,isDisabled:f,isReadOnly:u,getIncrementButtonProps:se,getDecrementButtonProps:Fe,getInputProps:Ze,htmlProps:X}}var[kE,Mc]=Et({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[jE,Lh]=Et({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Bh=he(function(t,n){const r=fn("NumberInput",t),i=At(t),s=uh(i),{htmlProps:c,...u}=wE(s),f=x.useMemo(()=>u,[u]);return l.jsx(jE,{value:f,children:l.jsx(kE,{value:r,children:l.jsx(re.div,{...c,ref:n,className:Ae("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Bh.displayName="NumberInput";var Hh=he(function(t,n){const r=Mc();return l.jsx(re.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}})});Hh.displayName="NumberInputStepper";var Wh=he(function(t,n){const{getInputProps:r}=Lh(),i=r(t,n),s=Mc();return l.jsx(re.input,{...i,className:Ae("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});Wh.displayName="NumberInputField";var Qx=re("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Vh=he(function(t,n){var r;const i=Mc(),{getDecrementButtonProps:s}=Lh(),c=s(t,n);return l.jsx(Qx,{...c,__css:i.stepper,children:(r=t.children)!=null?r:l.jsx(mE,{})})});Vh.displayName="NumberDecrementStepper";var Uh=he(function(t,n){var r;const{getIncrementButtonProps:i}=Lh(),s=i(t,n),c=Mc();return l.jsx(Qx,{...s,__css:c.stepper,children:(r=t.children)!=null?r:l.jsx(vE,{})})});Uh.displayName="NumberIncrementStepper";var[EE,vs]=Et({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[PE,$h]=Et({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Gh(e){const t=x.Children.only(e.children),{getTriggerProps:n}=vs();return x.cloneElement(t,n(t.props,t.ref))}Gh.displayName="PopoverTrigger";var To={click:"click",hover:"hover"};function IE(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:i,returnFocusOnClose:s=!0,autoFocus:c=!0,arrowSize:u,arrowShadowColor:f,trigger:h=To.click,openDelay:p=200,closeDelay:g=200,isLazy:y,lazyBehavior:S="unmount",computePositionOnMount:C,...w}=e,{isOpen:k,onClose:j,onOpen:M,onToggle:P}=Ah(e),I=x.useRef(null),T=x.useRef(null),D=x.useRef(null),_=x.useRef(!1),z=x.useRef(!1);k&&(z.current=!0);const[V,F]=x.useState(!1),[L,X]=x.useState(!1),$=x.useId(),Q=i??$,[ie,oe,U,K]=["popover-trigger","popover-content","popover-header","popover-body"].map(Te=>`${Te}-${Q}`),{referenceRef:ne,getArrowProps:ce,getPopperProps:Re,getArrowInnerProps:ze,forceUpdate:Me}=Oh({...w,enabled:k||!!C}),J=Rx({isOpen:k,ref:D});n5({enabled:k,ref:T}),jx(D,{focusRef:T,visible:k,shouldFocus:s&&h===To.click}),R6(D,{focusRef:r,visible:k,shouldFocus:c&&h===To.click});const ue=zh({wasSelected:z.current,enabled:y,mode:S,isSelected:J.present}),Ie=x.useCallback((Te={},et=null)=>{const Ve={...Te,style:{...Te.style,transformOrigin:Vt.transformOrigin.varRef,[Vt.arrowSize.var]:u?`${u}px`:void 0,[Vt.arrowShadowColor.var]:f},ref:ct(D,et),children:ue?Te.children:null,id:oe,tabIndex:-1,role:"dialog",onKeyDown:Pe(Te.onKeyDown,vt=>{n&&vt.key==="Escape"&&j()}),onBlur:Pe(Te.onBlur,vt=>{const Nt=Lg(vt),N=Pd(D.current,Nt),de=Pd(T.current,Nt);k&&t&&(!N&&!de)&&j()}),"aria-labelledby":V?U:void 0,"aria-describedby":L?K:void 0};return h===To.hover&&(Ve.role="tooltip",Ve.onMouseEnter=Pe(Te.onMouseEnter,()=>{_.current=!0}),Ve.onMouseLeave=Pe(Te.onMouseLeave,vt=>{vt.nativeEvent.relatedTarget!==null&&(_.current=!1,setTimeout(()=>j(),g))})),Ve},[ue,oe,V,U,L,K,h,n,j,k,t,g,f,u]),Be=x.useCallback((Te={},et=null)=>Re({...Te,style:{visibility:k?"visible":"hidden",...Te.style}},et),[k,Re]),Ne=x.useCallback((Te,et=null)=>({...Te,ref:ct(et,I,ne)}),[I,ne]),Ge=x.useRef(),Qe=x.useRef(),ve=x.useCallback(Te=>{I.current==null&&ne(Te)},[ne]),_e=x.useCallback((Te={},et=null)=>{const Ve={...Te,ref:ct(T,et,ve),id:ie,"aria-haspopup":"dialog","aria-expanded":k,"aria-controls":oe};return h===To.click&&(Ve.onClick=Pe(Te.onClick,P)),h===To.hover&&(Ve.onFocus=Pe(Te.onFocus,()=>{Ge.current===void 0&&M()}),Ve.onBlur=Pe(Te.onBlur,vt=>{const Nt=Lg(vt),N=!Pd(D.current,Nt);k&&t&&N&&j()}),Ve.onKeyDown=Pe(Te.onKeyDown,vt=>{vt.key==="Escape"&&j()}),Ve.onMouseEnter=Pe(Te.onMouseEnter,()=>{_.current=!0,Ge.current=window.setTimeout(()=>M(),p)}),Ve.onMouseLeave=Pe(Te.onMouseLeave,()=>{_.current=!1,Ge.current&&(clearTimeout(Ge.current),Ge.current=void 0),Qe.current=window.setTimeout(()=>{_.current===!1&&j()},g)})),Ve},[ie,k,oe,h,ve,P,M,t,j,p,g]);x.useEffect(()=>()=>{Ge.current&&clearTimeout(Ge.current),Qe.current&&clearTimeout(Qe.current)},[]);const qe=x.useCallback((Te={},et=null)=>({...Te,id:U,ref:ct(et,Ve=>{F(!!Ve)})}),[U]),ge=x.useCallback((Te={},et=null)=>({...Te,id:K,ref:ct(et,Ve=>{X(!!Ve)})}),[K]);return{forceUpdate:Me,isOpen:k,onAnimationComplete:J.onComplete,onClose:j,getAnchorProps:Ne,getArrowProps:ce,getArrowInnerProps:ze,getPopoverPositionerProps:Be,getPopoverProps:Ie,getTriggerProps:_e,getHeaderProps:qe,getBodyProps:ge}}function Pd(e,t){return e===t||(e==null?void 0:e.contains(t))}function Lg(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function qh(e){const t=fn("Popover",e),{children:n,...r}=At(e),i=Ji(),s=IE({...r,direction:i.direction});return l.jsx(EE,{value:s,children:l.jsx(PE,{value:t,children:j1(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}qh.displayName="Popover";function Yh(e){var t;const{bg:n,bgColor:r,backgroundColor:i,shadow:s,boxShadow:c}=e,{getArrowProps:u,getArrowInnerProps:f}=vs(),h=$h(),p=(t=n??r)!=null?t:i,g=s??c;return l.jsx(re.div,{...u(),className:"chakra-popover__arrow-positioner",children:l.jsx(re.div,{className:Ae("chakra-popover__arrow",e.className),...f(e),__css:{"--popper-arrow-bg":p?`colors.${p}, ${p}`:void 0,"--popper-arrow-shadow":g?`shadows.${g}, ${g}`:void 0,...h.arrow}})})}Yh.displayName="PopoverArrow";var Zx=he(function(t,n){const{getBodyProps:r}=vs(),i=$h();return l.jsx(re.div,{...r(t,n),className:Ae("chakra-popover__body",t.className),__css:i.body})});Zx.displayName="PopoverBody";function ME(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var TE={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]}}},_E=re(Wr.section),Jx=he(function(t,n){const{variants:r=TE,...i}=t,{isOpen:s}=vs();return l.jsx(_E,{ref:n,variants:ME(r),initial:!1,animate:s?"enter":"exit",...i})});Jx.displayName="PopoverTransition";var Xh=he(function(t,n){const{rootProps:r,motionProps:i,...s}=t,{getPopoverProps:c,getPopoverPositionerProps:u,onAnimationComplete:f}=vs(),h=$h(),p={position:"relative",display:"flex",flexDirection:"column",...h.content};return l.jsx(re.div,{...u(r),__css:h.popper,className:"chakra-popover__popper",children:l.jsx(Jx,{...i,...c(s,n),onAnimationComplete:yc(f,s.onAnimationComplete),className:Ae("chakra-popover__content",t.className),__css:p})})});Xh.displayName="PopoverContent";function DE(e,t,n){return(e-t)*100/(n-t)}Zi({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});Zi({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var OE=Zi({"0%":{left:"-40%"},"100%":{left:"100%"}}),AE=Zi({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function zE(e){const{value:t=0,min:n,max:r,valueText:i,getValueText:s,isIndeterminate:c,role:u="progressbar"}=e,f=DE(t,n,r);return{bind:{"data-indeterminate":c?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":c?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,f):i})(),role:u},percent:f,value:t}}var[RE,NE]=Et({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),FE=he((e,t)=>{const{min:n,max:r,value:i,isIndeterminate:s,role:c,...u}=e,f=zE({value:i,min:n,max:r,isIndeterminate:s,role:c}),p={height:"100%",...NE().filledTrack};return l.jsx(re.div,{ref:t,style:{width:`${f.percent}%`,...u.style},...f.bind,...u,__css:p})}),ey=he((e,t)=>{var n;const{value:r,min:i=0,max:s=100,hasStripe:c,isAnimated:u,children:f,borderRadius:h,isIndeterminate:p,"aria-label":g,"aria-labelledby":y,"aria-valuetext":S,title:C,role:w,...k}=At(e),j=fn("Progress",e),M=h??((n=j.track)==null?void 0:n.borderRadius),P={animation:`${AE} 1s linear infinite`},D={...!p&&c&&u&&P,...p&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${OE} 1s ease infinite normal none running`}},_={overflow:"hidden",position:"relative",...j.track};return l.jsx(re.div,{ref:t,borderRadius:M,__css:_,...k,children:l.jsxs(RE,{value:j,children:[l.jsx(FE,{"aria-label":g,"aria-labelledby":y,"aria-valuetext":S,min:i,max:s,value:r,isIndeterminate:p,css:D,borderRadius:M,title:C,role:w}),f]})})});ey.displayName="Progress";function LE(e){return e&&Kd(e)&&Kd(e.target)}function BE(e={}){const{onChange:t,value:n,defaultValue:r,name:i,isDisabled:s,isFocusable:c,isNative:u,...f}=e,[h,p]=x.useState(r||""),g=typeof n<"u",y=g?n:h,S=x.useRef(null),C=x.useCallback(()=>{const T=S.current;if(!T)return;let D="input:not(:disabled):checked";const _=T.querySelector(D);if(_){_.focus();return}D="input:not(:disabled)";const z=T.querySelector(D);z==null||z.focus()},[]),k=`radio-${x.useId()}`,j=i||k,M=x.useCallback(T=>{const D=LE(T)?T.target.value:T;g||p(D),t==null||t(String(D))},[t,g]),P=x.useCallback((T={},D=null)=>({...T,ref:ct(D,S),role:"radiogroup"}),[]),I=x.useCallback((T={},D=null)=>({...T,ref:D,name:j,[u?"checked":"isChecked"]:y!=null?T.value===y:void 0,onChange(z){M(z)},"data-radiogroup":!0}),[u,j,M,y]);return{getRootProps:P,getRadioProps:I,name:j,ref:S,focus:C,setValue:p,value:y,onChange:M,isDisabled:s,isFocusable:c,htmlProps:f}}var[HE,ty]=Et({name:"RadioGroupContext",strict:!1}),Ja=he((e,t)=>{const{colorScheme:n,size:r,variant:i,children:s,className:c,isDisabled:u,isFocusable:f,...h}=e,{value:p,onChange:g,getRootProps:y,name:S,htmlProps:C}=BE(h),w=x.useMemo(()=>({name:S,size:r,onChange:g,colorScheme:n,value:p,variant:i,isDisabled:u,isFocusable:f}),[S,r,g,n,p,i,u,f]);return l.jsx(HE,{value:w,children:l.jsx(re.div,{...y(C,t),className:Ae("chakra-radio-group",c),children:s})})});Ja.displayName="RadioGroup";var WE={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function VE(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:i,isReadOnly:s,isRequired:c,onChange:u,isInvalid:f,name:h,value:p,id:g,"data-radiogroup":y,"aria-describedby":S,...C}=e,w=`radio-${x.useId()}`,k=no(),M=!!ty()||!!y;let I=!!k&&!M?k.id:w;I=g??I;const T=i??(k==null?void 0:k.isDisabled),D=s??(k==null?void 0:k.isReadOnly),_=c??(k==null?void 0:k.isRequired),z=f??(k==null?void 0:k.isInvalid),[V,F]=x.useState(!1),[L,X]=x.useState(!1),[$,Q]=x.useState(!1),[ie,oe]=x.useState(!1),[U,K]=x.useState(Boolean(t)),ne=typeof n<"u",ce=ne?n:U;x.useEffect(()=>j2(F),[]);const Re=x.useCallback(ve=>{if(D||T){ve.preventDefault();return}ne||K(ve.target.checked),u==null||u(ve)},[ne,T,D,u]),ze=x.useCallback(ve=>{ve.key===" "&&oe(!0)},[oe]),Me=x.useCallback(ve=>{ve.key===" "&&oe(!1)},[oe]),J=x.useCallback((ve={},_e=null)=>({...ve,ref:_e,"data-active":Ye(ie),"data-hover":Ye($),"data-disabled":Ye(T),"data-invalid":Ye(z),"data-checked":Ye(ce),"data-focus":Ye(L),"data-focus-visible":Ye(L&&V),"data-readonly":Ye(D),"aria-hidden":!0,onMouseDown:Pe(ve.onMouseDown,()=>oe(!0)),onMouseUp:Pe(ve.onMouseUp,()=>oe(!1)),onMouseEnter:Pe(ve.onMouseEnter,()=>Q(!0)),onMouseLeave:Pe(ve.onMouseLeave,()=>Q(!1))}),[ie,$,T,z,ce,L,D,V]),{onFocus:ue,onBlur:Ie}=k??{},Be=x.useCallback((ve={},_e=null)=>{const qe=T&&!r;return{...ve,id:I,ref:_e,type:"radio",name:h,value:p,onChange:Pe(ve.onChange,Re),onBlur:Pe(Ie,ve.onBlur,()=>X(!1)),onFocus:Pe(ue,ve.onFocus,()=>X(!0)),onKeyDown:Pe(ve.onKeyDown,ze),onKeyUp:Pe(ve.onKeyUp,Me),checked:ce,disabled:qe,readOnly:D,required:_,"aria-invalid":Dr(z),"aria-disabled":Dr(qe),"aria-required":Dr(_),"data-readonly":Ye(D),"aria-describedby":S,style:WE}},[T,r,I,h,p,Re,Ie,ue,ze,Me,ce,D,_,z,S]);return{state:{isInvalid:z,isFocused:L,isChecked:ce,isActive:ie,isHovered:$,isDisabled:T,isReadOnly:D,isRequired:_},getCheckboxProps:J,getInputProps:Be,getLabelProps:(ve={},_e=null)=>({...ve,ref:_e,onMouseDown:Pe(ve.onMouseDown,Bg),onTouchStart:Pe(ve.onTouchStart,Bg),"data-disabled":Ye(T),"data-checked":Ye(ce),"data-invalid":Ye(z)}),getRootProps:(ve,_e=null)=>({...ve,ref:_e,"data-disabled":Ye(T),"data-checked":Ye(ce),"data-invalid":Ye(z)}),htmlProps:C}}function Bg(e){e.preventDefault(),e.stopPropagation()}function UE(e,t){const n={},r={};for(const[i,s]of Object.entries(e))t.includes(i)?n[i]=s:r[i]=s;return[n,r]}var vn=he((e,t)=>{var n;const r=ty(),{onChange:i,value:s}=e,c=fn("Radio",{...r,...e}),u=At(e),{spacing:f="0.5rem",children:h,isDisabled:p=r==null?void 0:r.isDisabled,isFocusable:g=r==null?void 0:r.isFocusable,inputProps:y,...S}=u;let C=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(C=r.value===s);let w=i;r!=null&&r.onChange&&s!=null&&(w=yc(r.onChange,i));const k=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:j,getCheckboxProps:M,getLabelProps:P,getRootProps:I,htmlProps:T}=VE({...S,isChecked:C,isFocusable:g,isDisabled:p,onChange:w,name:k}),[D,_]=UE(T,E1),z=M(_),V=j(y,t),F=P(),L=Object.assign({},D,I()),X={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...c.container},$={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...c.control},Q={userSelect:"none",marginStart:f,...c.label};return l.jsxs(re.label,{className:"chakra-radio",...L,__css:X,children:[l.jsx("input",{className:"chakra-radio__input",...V}),l.jsx(re.span,{className:"chakra-radio__control",...z,__css:$}),h&&l.jsx(re.span,{className:"chakra-radio__label",...F,__css:Q,children:h})]})});vn.displayName="Radio";var ny=he(function(t,n){const{children:r,placeholder:i,className:s,...c}=t;return l.jsxs(re.select,{...c,ref:n,className:Ae("chakra-select",s),children:[i&&l.jsx("option",{value:"",children:i}),r]})});ny.displayName="SelectField";function $E(e,t){const n={},r={};for(const[i,s]of Object.entries(e))t.includes(i)?n[i]=s:r[i]=s;return[n,r]}var ry=he((e,t)=>{var n;const r=fn("Select",e),{rootProps:i,placeholder:s,icon:c,color:u,height:f,h,minH:p,minHeight:g,iconColor:y,iconSize:S,...C}=At(e),[w,k]=$E(C,E1),j=ch(k),M={width:"100%",height:"fit-content",position:"relative",color:u},P={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return l.jsxs(re.div,{className:"chakra-select__wrapper",__css:M,...w,...i,children:[l.jsx(ny,{ref:t,height:h??f,minH:p??g,placeholder:s,...j,__css:P,children:e.children}),l.jsx(iy,{"data-disabled":Ye(j.disabled),...(y||u)&&{color:y||u},__css:r.icon,...S&&{fontSize:S},children:c})]})});ry.displayName="Select";var GE=e=>l.jsx("svg",{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),qE=re("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),iy=e=>{const{children:t=l.jsx(GE,{}),...n}=e,r=x.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx(qE,{...n,className:"chakra-select__icon-wrapper",children:x.isValidElement(t)?r:null})};iy.displayName="SelectIcon";var _o=e=>e?"":void 0,Id=e=>e?!0:void 0,gs=(...e)=>e.filter(Boolean).join(" ");function Md(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function Il(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var Xl={width:0,height:0},Ml=e=>e||Xl;function YE(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:i}=e,s=w=>{var k;const j=(k=r[w])!=null?k:Xl;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Il({orientation:t,vertical:{bottom:`calc(${n[w]}% - ${j.height/2}px)`},horizontal:{left:`calc(${n[w]}% - ${j.width/2}px)`}})}},c=t==="vertical"?r.reduce((w,k)=>Ml(w).height>Ml(k).height?w:k,Xl):r.reduce((w,k)=>Ml(w).width>Ml(k).width?w:k,Xl),u={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Il({orientation:t,vertical:c?{paddingLeft:c.width/2,paddingRight:c.width/2}:{},horizontal:c?{paddingTop:c.height/2,paddingBottom:c.height/2}:{}})},f={position:"absolute",...Il({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},h=n.length===1,p=[0,i?100-n[0]:n[0]],g=h?p:n;let y=g[0];!h&&i&&(y=100-y);const S=Math.abs(g[g.length-1]-g[0]),C={...f,...Il({orientation:t,vertical:i?{height:`${S}%`,top:`${y}%`}:{height:`${S}%`,bottom:`${y}%`},horizontal:i?{width:`${S}%`,right:`${y}%`}:{width:`${S}%`,left:`${y}%`}})};return{trackStyle:f,innerTrackStyle:C,rootStyle:u,getThumbStyle:s}}function XE(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function KE(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function QE(e){const t=JE(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function oy(e){return!!e.touches}function ZE(e){return oy(e)&&e.touches.length>1}function JE(e){var t;return(t=e.view)!=null?t:window}function e7(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function t7(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function ay(e,t="page"){return oy(e)?e7(e,t):t7(e,t)}function n7(e){return t=>{const n=QE(t);(!n||n&&t.button===0)&&e(t)}}function r7(e,t=!1){function n(i){e(i,{point:ay(i)})}return t?n7(n):n}function Kl(e,t,n,r){return KE(e,t,r7(n,t==="pointerdown"),r)}var i7=Object.defineProperty,o7=(e,t,n)=>t in e?i7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tr=(e,t,n)=>(o7(e,typeof t!="symbol"?t+"":t,n),n),a7=class{constructor(e,t,n){tr(this,"history",[]),tr(this,"startEvent",null),tr(this,"lastEvent",null),tr(this,"lastEventInfo",null),tr(this,"handlers",{}),tr(this,"removeListeners",()=>{}),tr(this,"threshold",3),tr(this,"win"),tr(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const u=Td(this.lastEventInfo,this.history),f=this.startEvent!==null,h=u7(u.offset,{x:0,y:0})>=this.threshold;if(!f&&!h)return;const{timestamp:p}=eg();this.history.push({...u.point,timestamp:p});const{onStart:g,onMove:y}=this.handlers;f||(g==null||g(this.lastEvent,u),this.startEvent=this.lastEvent),y==null||y(this.lastEvent,u)}),tr(this,"onPointerMove",(u,f)=>{this.lastEvent=u,this.lastEventInfo=f,R3.update(this.updatePoint,!0)}),tr(this,"onPointerUp",(u,f)=>{const h=Td(f,this.history),{onEnd:p,onSessionEnd:g}=this.handlers;g==null||g(u,h),this.end(),!(!p||!this.startEvent)&&(p==null||p(u,h))});var r;if(this.win=(r=e.view)!=null?r:window,ZE(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const i={point:ay(e)},{timestamp:s}=eg();this.history=[{...i.point,timestamp:s}];const{onSessionStart:c}=t;c==null||c(e,Td(i,this.history)),this.removeListeners=c7(Kl(this.win,"pointermove",this.onPointerMove),Kl(this.win,"pointerup",this.onPointerUp),Kl(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),N3.update(this.updatePoint)}};function Hg(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Td(e,t){return{point:e.point,delta:Hg(e.point,t[t.length-1]),offset:Hg(e.point,t[0]),velocity:l7(t,.1)}}var s7=e=>e*1e3;function l7(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=e[e.length-1];for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>s7(t)));)n--;if(!r)return{x:0,y:0};const s=(i.timestamp-r.timestamp)/1e3;if(s===0)return{x:0,y:0};const c={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function c7(...e){return t=>e.reduce((n,r)=>r(n),t)}function _d(e,t){return Math.abs(e-t)}function Wg(e){return"x"in e&&"y"in e}function u7(e,t){if(typeof e=="number"&&typeof t=="number")return _d(e,t);if(Wg(e)&&Wg(t)){const n=_d(e.x,t.x),r=_d(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function sy(e){const t=x.useRef(null);return t.current=e,t}function d7(e,t){const{onPan:n,onPanStart:r,onPanEnd:i,onPanSessionStart:s,onPanSessionEnd:c,threshold:u}=t,f=Boolean(n||r||i||s||c),h=x.useRef(null),p=sy({onSessionStart:s,onSessionEnd:c,onStart:r,onMove:n,onEnd(g,y){h.current=null,i==null||i(g,y)}});x.useEffect(()=>{var g;(g=h.current)==null||g.updateHandlers(p.current)}),x.useEffect(()=>{const g=e.current;if(!g||!f)return;function y(S){h.current=new a7(S,p.current,u)}return Kl(g,"pointerdown",y)},[e,f,p,u]),x.useEffect(()=>()=>{var g;(g=h.current)==null||g.end(),h.current=null},[])}function f7(e,t){var n;if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const r=(n=e.ownerDocument.defaultView)!=null?n:window,i=new r.ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const[c]=s;let u,f;if("borderBoxSize"in c){const h=c.borderBoxSize,p=Array.isArray(h)?h[0]:h;u=p.inlineSize,f=p.blockSize}else u=e.offsetWidth,f=e.offsetHeight;t({width:u,height:f})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}var h7=Boolean(globalThis==null?void 0:globalThis.document)?x.useLayoutEffect:x.useEffect;function p7(e,t){var n,r;if(!e||!e.parentElement)return;const i=(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window,s=new i.MutationObserver(()=>{t()});return s.observe(e.parentElement,{childList:!0}),()=>{s.disconnect()}}function m7({getNodes:e,observeMutation:t=!0}){const[n,r]=x.useState([]),[i,s]=x.useState(0);return h7(()=>{const c=e(),u=c.map((f,h)=>f7(f,p=>{r(g=>[...g.slice(0,h),p,...g.slice(h+1)])}));if(t){const f=c[0];u.push(p7(f,()=>{s(h=>h+1)}))}return()=>{u.forEach(f=>{f==null||f()})}},[i]),n}function v7(e){return typeof e=="object"&&e!==null&&"current"in e}function g7(e){const[t]=m7({observeMutation:!1,getNodes(){return[v7(e)?e.current:e]}});return t}function x7(e){var t;const{min:n=0,max:r=100,onChange:i,value:s,defaultValue:c,isReversed:u,direction:f="ltr",orientation:h="horizontal",id:p,isDisabled:g,isReadOnly:y,onChangeStart:S,onChangeEnd:C,step:w=1,getAriaValueText:k,"aria-valuetext":j,"aria-label":M,"aria-labelledby":P,name:I,focusThumbOnChange:T=!0,...D}=e,_=Ut(S),z=Ut(C),V=Ut(k),F=XE({isReversed:u,direction:f,orientation:h}),[L,X]=oh({value:s,defaultValue:c??b7(n,r),onChange:i}),[$,Q]=x.useState(!1),[ie,oe]=x.useState(!1),U=!(g||y),K=(r-n)/10,ne=w||(r-n)/100,ce=$l(L,n,r),Re=r-ce+n,Me=ug(F?Re:ce,n,r),J=h==="vertical",ue=sy({min:n,max:r,step:w,isDisabled:g,value:ce,isInteractive:U,isReversed:F,isVertical:J,eventSource:null,focusThumbOnChange:T,orientation:h}),Ie=x.useRef(null),Be=x.useRef(null),Ne=x.useRef(null),Ge=x.useId(),Qe=p??Ge,[ve,_e]=[`slider-thumb-${Qe}`,`slider-track-${Qe}`],qe=x.useCallback(pe=>{var De,hn;if(!Ie.current)return;const $t=ue.current;$t.eventSource="pointer";const pn=Ie.current.getBoundingClientRect(),{clientX:ir,clientY:yi}=(hn=(De=pe.touches)==null?void 0:De[0])!=null?hn:pe,da=J?pn.bottom-yi:ir-pn.left,Kc=J?pn.height:pn.width;let fa=da/Kc;F&&(fa=1-fa);let bi=Yw(fa,$t.min,$t.max);return $t.step&&(bi=parseFloat(dg(bi,$t.min,$t.step))),bi=$l(bi,$t.min,$t.max),bi},[J,F,ue]),ge=x.useCallback(pe=>{const De=ue.current;De.isInteractive&&(pe=parseFloat(dg(pe,De.min,ne)),pe=$l(pe,De.min,De.max),X(pe))},[ne,X,ue]),Te=x.useMemo(()=>({stepUp(pe=ne){const De=F?ce-pe:ce+pe;ge(De)},stepDown(pe=ne){const De=F?ce+pe:ce-pe;ge(De)},reset(){ge(c||0)},stepTo(pe){ge(pe)}}),[ge,F,ce,ne,c]),et=x.useCallback(pe=>{const De=ue.current,$t={ArrowRight:()=>Te.stepUp(),ArrowUp:()=>Te.stepUp(),ArrowLeft:()=>Te.stepDown(),ArrowDown:()=>Te.stepDown(),PageUp:()=>Te.stepUp(K),PageDown:()=>Te.stepDown(K),Home:()=>ge(De.min),End:()=>ge(De.max)}[pe.key];$t&&(pe.preventDefault(),pe.stopPropagation(),$t(pe),De.eventSource="keyboard")},[Te,ge,K,ue]),Ve=(t=V==null?void 0:V(ce))!=null?t:j,vt=g7(Be),{getThumbStyle:Nt,rootStyle:N,trackStyle:de,innerTrackStyle:xe}=x.useMemo(()=>{const pe=ue.current,De=vt??{width:0,height:0};return YE({isReversed:F,orientation:pe.orientation,thumbRects:[De],thumbPercents:[Me]})},[F,vt,Me,ue]),je=x.useCallback(()=>{ue.current.focusThumbOnChange&&setTimeout(()=>{var De;return(De=Be.current)==null?void 0:De.focus()})},[ue]);eo(()=>{const pe=ue.current;je(),pe.eventSource==="keyboard"&&(z==null||z(pe.value))},[ce,z]);function q(pe){const De=qe(pe);De!=null&&De!==ue.current.value&&X(De)}d7(Ne,{onPanSessionStart(pe){const De=ue.current;De.isInteractive&&(Q(!0),je(),q(pe),_==null||_(De.value))},onPanSessionEnd(){const pe=ue.current;pe.isInteractive&&(Q(!1),z==null||z(pe.value))},onPan(pe){ue.current.isInteractive&&q(pe)}});const se=x.useCallback((pe={},De=null)=>({...pe,...D,ref:ct(De,Ne),tabIndex:-1,"aria-disabled":Id(g),"data-focused":_o(ie),style:{...pe.style,...N}}),[D,g,ie,N]),Fe=x.useCallback((pe={},De=null)=>({...pe,ref:ct(De,Ie),id:_e,"data-disabled":_o(g),style:{...pe.style,...de}}),[g,_e,de]),Ze=x.useCallback((pe={},De=null)=>({...pe,ref:De,style:{...pe.style,...xe}}),[xe]),ee=x.useCallback((pe={},De=null)=>({...pe,ref:ct(De,Be),role:"slider",tabIndex:U?0:void 0,id:ve,"data-active":_o($),"aria-valuetext":Ve,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":ce,"aria-orientation":h,"aria-disabled":Id(g),"aria-readonly":Id(y),"aria-label":M,"aria-labelledby":M?void 0:P,style:{...pe.style,...Nt(0)},onKeyDown:Md(pe.onKeyDown,et),onFocus:Md(pe.onFocus,()=>oe(!0)),onBlur:Md(pe.onBlur,()=>oe(!1))}),[U,ve,$,Ve,n,r,ce,h,g,y,M,P,Nt,et]),He=x.useCallback((pe,De=null)=>{const hn=!(pe.valuer),$t=ce>=pe.value,pn=ug(pe.value,n,r),ir={position:"absolute",pointerEvents:"none",...y7({orientation:h,vertical:{bottom:F?`${100-pn}%`:`${pn}%`},horizontal:{left:F?`${100-pn}%`:`${pn}%`}})};return{...pe,ref:De,role:"presentation","aria-hidden":!0,"data-disabled":_o(g),"data-invalid":_o(!hn),"data-highlighted":_o($t),style:{...pe.style,...ir}}},[g,F,r,n,h,ce]),nt=x.useCallback((pe={},De=null)=>({...pe,ref:De,type:"hidden",value:ce,name:I}),[I,ce]);return{state:{value:ce,isFocused:ie,isDragging:$},actions:Te,getRootProps:se,getTrackProps:Fe,getInnerTrackProps:Ze,getThumbProps:ee,getMarkerProps:He,getInputProps:nt}}function y7(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function b7(e,t){return t"}),[C7,_c]=Et({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),ly=he((e,t)=>{const n={orientation:"horizontal",...e},r=fn("Slider",n),i=At(n),{direction:s}=Ji();i.direction=s;const{getInputProps:c,getRootProps:u,...f}=x7(i),h=u(),p=c({},t);return l.jsx(S7,{value:f,children:l.jsx(C7,{value:r,children:l.jsxs(re.div,{...h,className:gs("chakra-slider",n.className),__css:r.container,children:[n.children,l.jsx("input",{...p})]})})})});ly.displayName="Slider";var cy=he((e,t)=>{const{getThumbProps:n}=Tc(),r=_c(),i=n(e,t);return l.jsx(re.div,{...i,className:gs("chakra-slider__thumb",e.className),__css:r.thumb})});cy.displayName="SliderThumb";var uy=he((e,t)=>{const{getTrackProps:n}=Tc(),r=_c(),i=n(e,t);return l.jsx(re.div,{...i,className:gs("chakra-slider__track",e.className),__css:r.track})});uy.displayName="SliderTrack";var dy=he((e,t)=>{const{getInnerTrackProps:n}=Tc(),r=_c(),i=n(e,t);return l.jsx(re.div,{...i,className:gs("chakra-slider__filled-track",e.className),__css:r.filledTrack})});dy.displayName="SliderFilledTrack";var If=he((e,t)=>{const{getMarkerProps:n}=Tc(),r=_c(),i=n(e,t);return l.jsx(re.div,{...i,className:gs("chakra-slider__marker",e.className),__css:r.mark})});If.displayName="SliderMark";var fy=he(function(t,n){const r=fn("Switch",t),{spacing:i="0.5rem",children:s,...c}=At(t),{state:u,getInputProps:f,getCheckboxProps:h,getRootProps:p,getLabelProps:g}=E2(c),y=x.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),S=x.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),C=x.useMemo(()=>({userSelect:"none",marginStart:i,...r.label}),[i,r.label]);return l.jsxs(re.label,{...p(),className:Ae("chakra-switch",t.className),__css:y,children:[l.jsx("input",{className:"chakra-switch__input",...f({},n)}),l.jsx(re.span,{...h(),className:"chakra-switch__track",__css:S,children:l.jsx(re.span,{__css:r.thumb,className:"chakra-switch__thumb","data-checked":Ye(u.isChecked),"data-hover":Ye(u.isHovered)})}),s&&l.jsx(re.span,{className:"chakra-switch__label",...g(),__css:C,children:s})]})});fy.displayName="Switch";var[w7,k7,j7,E7]=rh();function P7(e){var t;const{defaultIndex:n,onChange:r,index:i,isManual:s,isLazy:c,lazyBehavior:u="unmount",orientation:f="horizontal",direction:h="ltr",...p}=e,[g,y]=x.useState(n??0),[S,C]=oh({defaultValue:n??0,value:i,onChange:r});x.useEffect(()=>{i!=null&&y(i)},[i]);const w=j7(),k=x.useId();return{id:`tabs-${(t=e.id)!=null?t:k}`,selectedIndex:S,focusedIndex:g,setSelectedIndex:C,setFocusedIndex:y,isManual:s,isLazy:c,lazyBehavior:u,orientation:f,descendants:w,direction:h,htmlProps:p}}var[I7,Dc]=Et({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function M7(e){const{focusedIndex:t,orientation:n,direction:r}=Dc(),i=k7(),s=x.useCallback(c=>{const u=()=>{var M;const P=i.nextEnabled(t);P&&((M=P.node)==null||M.focus())},f=()=>{var M;const P=i.prevEnabled(t);P&&((M=P.node)==null||M.focus())},h=()=>{var M;const P=i.firstEnabled();P&&((M=P.node)==null||M.focus())},p=()=>{var M;const P=i.lastEnabled();P&&((M=P.node)==null||M.focus())},g=n==="horizontal",y=n==="vertical",S=c.key,C=r==="ltr"?"ArrowLeft":"ArrowRight",w=r==="ltr"?"ArrowRight":"ArrowLeft",j={[C]:()=>g&&f(),[w]:()=>g&&u(),ArrowDown:()=>y&&u(),ArrowUp:()=>y&&f(),Home:h,End:p}[S];j&&(c.preventDefault(),j(c))},[i,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:Pe(e.onKeyDown,s)}}function T7(e){const{isDisabled:t,isFocusable:n,...r}=e,{setSelectedIndex:i,isManual:s,id:c,setFocusedIndex:u,selectedIndex:f}=Dc(),{index:h,register:p}=E7({disabled:t&&!n}),g=h===f,y=()=>{i(h)},S=()=>{u(h),!s&&!(t&&n)&&i(h)},C=kx({...r,ref:ct(p,e.ref),isDisabled:t,isFocusable:n,onClick:Pe(e.onClick,y)}),w="button";return{...C,id:hy(c,h),role:"tab",tabIndex:g?0:-1,type:w,"aria-selected":g,"aria-controls":py(c,h),onFocus:t?void 0:Pe(e.onFocus,S)}}var[_7,D7]=Et({});function O7(e){const t=Dc(),{id:n,selectedIndex:r}=t,s=lh(e.children).map((c,u)=>x.createElement(_7,{key:u,value:{isSelected:u===r,id:py(n,u),tabId:hy(n,u),selectedIndex:r}},c));return{...e,children:s}}function A7(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:i}=Dc(),{isSelected:s,id:c,tabId:u}=D7(),f=x.useRef(!1);s&&(f.current=!0);const h=zh({wasSelected:f.current,isSelected:s,enabled:r,mode:i});return{tabIndex:0,...n,children:h?t:null,role:"tabpanel","aria-labelledby":u,hidden:!s,id:c}}function hy(e,t){return`${e}--tab-${t}`}function py(e,t){return`${e}--tabpanel-${t}`}var[z7,Oc]=Et({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),my=he(function(t,n){const r=fn("Tabs",t),{children:i,className:s,...c}=At(t),{htmlProps:u,descendants:f,...h}=P7(c),p=x.useMemo(()=>h,[h]),{isFitted:g,...y}=u;return l.jsx(w7,{value:f,children:l.jsx(I7,{value:p,children:l.jsx(z7,{value:r,children:l.jsx(re.div,{className:Ae("chakra-tabs",s),ref:n,...y,__css:r.root,children:i})})})})});my.displayName="Tabs";var vy=he(function(t,n){const r=M7({...t,ref:n}),s={display:"flex",...Oc().tablist};return l.jsx(re.div,{...r,className:Ae("chakra-tabs__tablist",t.className),__css:s})});vy.displayName="TabList";var gy=he(function(t,n){const r=A7({...t,ref:n}),i=Oc();return l.jsx(re.div,{outline:"0",...r,className:Ae("chakra-tabs__tab-panel",t.className),__css:i.tabpanel})});gy.displayName="TabPanel";var xy=he(function(t,n){const r=O7(t),i=Oc();return l.jsx(re.div,{...r,width:"100%",ref:n,className:Ae("chakra-tabs__tab-panels",t.className),__css:i.tabpanels})});xy.displayName="TabPanels";var yy=he(function(t,n){const r=Oc(),i=T7({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return l.jsx(re.button,{...i,className:Ae("chakra-tabs__tab",t.className),__css:s})});yy.displayName="Tab";function R7(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var N7=["h","minH","height","minHeight"],Kh=he((e,t)=>{const n=pi("Textarea",e),{className:r,rows:i,...s}=At(e),c=ch(s),u=i?R7(n,N7):n;return l.jsx(re.textarea,{ref:t,rows:i,...c,className:Ae("chakra-textarea",r),__css:u})});Kh.displayName="Textarea";var F7={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]}}}},cc=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},Mf=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function L7(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:i,closeOnScroll:s,closeOnPointerDown:c=i,closeOnEsc:u=!0,onOpen:f,onClose:h,placement:p,id:g,isOpen:y,defaultIsOpen:S,arrowSize:C=10,arrowShadowColor:w,arrowPadding:k,modifiers:j,isDisabled:M,gutter:P,offset:I,direction:T,...D}=e,{isOpen:_,onOpen:z,onClose:V}=Ah({isOpen:y,defaultIsOpen:S,onOpen:f,onClose:h}),{referenceRef:F,getPopperProps:L,getArrowInnerProps:X,getArrowProps:$}=Oh({enabled:_,placement:p,arrowPadding:k,modifiers:j,gutter:P,offset:I,direction:T}),Q=x.useId(),oe=`tooltip-${g??Q}`,U=x.useRef(null),K=x.useRef(),ne=x.useCallback(()=>{K.current&&(clearTimeout(K.current),K.current=void 0)},[]),ce=x.useRef(),Re=x.useCallback(()=>{ce.current&&(clearTimeout(ce.current),ce.current=void 0)},[]),ze=x.useCallback(()=>{Re(),V()},[V,Re]),Me=B7(U,ze),J=x.useCallback(()=>{if(!M&&!K.current){Me();const _e=Mf(U);K.current=_e.setTimeout(z,t)}},[Me,M,z,t]),ue=x.useCallback(()=>{ne();const _e=Mf(U);ce.current=_e.setTimeout(ze,n)},[n,ze,ne]),Ie=x.useCallback(()=>{_&&r&&ue()},[r,ue,_]),Be=x.useCallback(()=>{_&&c&&ue()},[c,ue,_]),Ne=x.useCallback(_e=>{_&&_e.key==="Escape"&&ue()},[_,ue]);Ui(()=>cc(U),"keydown",u?Ne:void 0),Ui(()=>cc(U),"scroll",()=>{_&&s&&ze()}),x.useEffect(()=>{M&&(ne(),_&&V())},[M,_,V,ne]),x.useEffect(()=>()=>{ne(),Re()},[ne,Re]),Ui(()=>U.current,"pointerleave",ue);const Ge=x.useCallback((_e={},qe=null)=>({..._e,ref:ct(U,qe,F),onPointerEnter:Pe(_e.onPointerEnter,Te=>{Te.pointerType!=="touch"&&J()}),onClick:Pe(_e.onClick,Ie),onPointerDown:Pe(_e.onPointerDown,Be),onFocus:Pe(_e.onFocus,J),onBlur:Pe(_e.onBlur,ue),"aria-describedby":_?oe:void 0}),[J,ue,Be,_,oe,Ie,F]),Qe=x.useCallback((_e={},qe=null)=>L({..._e,style:{..._e.style,[Vt.arrowSize.var]:C?`${C}px`:void 0,[Vt.arrowShadowColor.var]:w}},qe),[L,C,w]),ve=x.useCallback((_e={},qe=null)=>{const ge={..._e.style,position:"relative",transformOrigin:Vt.transformOrigin.varRef};return{ref:qe,...D,..._e,id:oe,role:"tooltip",style:ge}},[D,oe]);return{isOpen:_,show:J,hide:ue,getTriggerProps:Ge,getTooltipProps:ve,getTooltipPositionerProps:Qe,getArrowProps:$,getArrowInnerProps:X}}var Dd="chakra-ui:close-tooltip";function B7(e,t){return x.useEffect(()=>{const n=cc(e);return n.addEventListener(Dd,t),()=>n.removeEventListener(Dd,t)},[t,e]),()=>{const n=cc(e),r=Mf(e);n.dispatchEvent(new r.CustomEvent(Dd))}}function H7(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function W7(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var V7=re(Wr.div),Yt=he((e,t)=>{var n,r;const i=pi("Tooltip",e),s=At(e),c=Ji(),{children:u,label:f,shouldWrapChildren:h,"aria-label":p,hasArrow:g,bg:y,portalProps:S,background:C,backgroundColor:w,bgColor:k,motionProps:j,...M}=s,P=(r=(n=C??w)!=null?n:y)!=null?r:k;if(P){i.bg=P;const L=BS(c,"colors",P);i[Vt.arrowBg.var]=L}const I=L7({...M,direction:c.direction}),T=typeof u=="string"||h;let D;if(T)D=l.jsx(re.span,{display:"inline-block",tabIndex:0,...I.getTriggerProps(),children:u});else{const L=x.Children.only(u);D=x.cloneElement(L,I.getTriggerProps(L.props,L.ref))}const _=!!p,z=I.getTooltipProps({},t),V=_?H7(z,["role","id"]):z,F=W7(z,["role","id"]);return f?l.jsxs(l.Fragment,{children:[D,l.jsx(ia,{children:I.isOpen&&l.jsx(eh,{...S,children:l.jsx(re.div,{...I.getTooltipPositionerProps(),__css:{zIndex:i.zIndex,pointerEvents:"none"},children:l.jsxs(V7,{variants:F7,initial:"exit",animate:"enter",exit:"exit",...j,...V,__css:i,children:[f,_&&l.jsx(re.span,{srOnly:!0,...F,children:p}),g&&l.jsx(re.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:l.jsx(re.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:i.bg}})})]})})})})]}):l.jsx(l.Fragment,{children:u})});Yt.displayName="Tooltip";const Qh=x.createContext(null);let Vg;const Zh=()=>({setOpenUploader:e=>{e&&(Vg=e)},openUploader:Vg}),Bt=be(e=>e.ui,e=>HS[e.activeTab],{memoizeOptions:{equalityCheck:te.isEqual}}),U7=be(e=>e.ui,e=>e.activeTab,{memoizeOptions:{equalityCheck:te.isEqual}}),ro=be(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:te.isEqual}}),Ug=e=>async(t,n)=>{const{imageFile:r}=e,i=n(),s=Bt(i),c=new FormData;c.append("file",r,r.name),c.append("data",JSON.stringify({kind:"init"}));const f=await(await fetch(`${window.location.origin}/upload`,{method:"POST",body:c})).json(),h={uuid:P1(),category:"user",...f};t(I1({image:h,category:"user"})),s==="unifiedCanvas"?t(bc(h)):s==="img2img"&&t(os(h))},Jh=e=>{const{children:t}=e;return l.jsx(B,{sx:{width:"100%",height:"100%",bg:"base.850"},children:t})};function $7(){const{t:e}=Z();return l.jsx(Jh,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Vn,{children:e("common.nodes")}),l.jsx(Le,{maxW:"50rem",gap:4,children:l.jsx(Ce,{children:e("common.nodesDesc")})})]})})}const G7=()=>{const{t:e}=Z();return l.jsx(Jh,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Vn,{children:e("common.postProcessing")}),l.jsxs(Le,{maxW:"50rem",gap:4,children:[l.jsx(Ce,{children:e("common.postProcessDesc1")}),l.jsx(Ce,{children:e("common.postProcessDesc2")}),l.jsx(Ce,{children:e("common.postProcessDesc3")})]})]})})};function q7(){const{t:e}=Z();return l.jsx(Jh,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Vn,{children:e("common.training")}),l.jsxs(Le,{maxW:"50rem",gap:4,children:[l.jsx(Ce,{children:e("common.trainingDesc1")}),l.jsx(Ce,{children:e("common.trainingDesc2")})]})]})})}function Y7(e){const{i18n:t}=Z(),n=localStorage.getItem("i18nextLng");ke.useEffect(()=>{e()},[e]),ke.useEffect(()=>{t.on("languageChanged",()=>{e()})},[e,t,n])}const le=he((e,t)=>{const{tooltip:n="",tooltipProps:r,isChecked:i,...s}=e;return l.jsx(Yt,{label:n,hasArrow:!0,...r,...r!=null&&r.placement?{placement:r.placement}:{placement:"top"},children:l.jsx(ci,{ref:t,"aria-checked":i!==void 0?i:void 0,...s})})}),Je=he((e,t)=>{const{children:n,tooltip:r="",tooltipProps:i,isChecked:s,...c}=e;return l.jsx(Yt,{label:r,...i,children:l.jsx(to,{ref:t,"aria-checked":s,...c,children:n})})}),rr=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:i=!0,...s}=e;return l.jsxs(qh,{isLazy:i,...s,children:[l.jsx(Gh,{children:t}),l.jsxs(Xh,{children:[r&&l.jsx(Yh,{}),n]})]})},Ac=be(e=>e.lightbox,e=>e,{memoizeOptions:{equalityCheck:te.isEqual}}),Mn=e=>{const{label:t,isDisabled:n,validValues:r,tooltip:i,tooltipProps:s,...c}=e;return l.jsxs(rt,{isDisabled:n,onClick:u=>{u.stopPropagation(),u.nativeEvent.stopImmediatePropagation(),u.nativeEvent.stopPropagation(),u.nativeEvent.cancelBubble=!0},children:[t&&l.jsx(st,{children:t}),l.jsx(Yt,{label:i,...s,children:l.jsx(ry,{...c,children:r.map(u=>typeof u=="string"||typeof u=="number"?l.jsx("option",{value:u,children:u},u):l.jsx("option",{value:u.value,children:u.key},u.value))})})]})};function X7(){const e=O(i=>i.postprocessing.facetoolType),t=Y(),{t:n}=Z(),r=i=>t(Hl(i.target.value));return l.jsx(Mn,{label:n("parameters.type"),validValues:WS.concat(),value:e,onChange:r})}var by={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},$g=ke.createContext&&ke.createContext(by),si=globalThis&&globalThis.__assign||function(){return si=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{K(i)},[i]);const ne=x.useMemo(()=>L!=null&&L.max?L.max:c,[c,L==null?void 0:L.max]),ce=J=>{f(J)},Re=J=>{J.target.value===""&&(J.target.value=String(s));const ue=te.clamp(y?Math.floor(Number(J.target.value)):Number(U),s,ne);f(ue)},ze=J=>{K(J)},Me=()=>{M&&M()};return l.jsxs(rt,{sx:j?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},...D,children:[l.jsx(st,{..._,mb:-1,children:r}),l.jsxs(sa,{w:"100%",gap:2,alignItems:"center",children:[l.jsxs(ly,{"aria-label":r,value:i,min:s,max:c,step:u,onChange:ce,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),focusThumbOnChange:!1,isDisabled:I,...oe,children:[p&&l.jsxs(l.Fragment,{children:[l.jsx(If,{value:s,insetInlineStart:0,sx:{insetInlineStart:"unset !important"},...z,children:s}),l.jsx(If,{value:c,insetInlineEnd:0,sx:{insetInlineStart:"unset !important"},...z,children:c})]}),l.jsx(uy,{...V,children:l.jsx(dy,{})}),l.jsx(Yt,{hasArrow:!0,placement:"top",isOpen:t,label:`${i}${h}`,hidden:k,...Q,children:l.jsx(cy,{...F})})]}),g&&l.jsxs(Bh,{min:s,max:ne,step:u,value:U,onChange:ze,onBlur:Re,isDisabled:T,...L,children:[l.jsx(Wh,{readOnly:C,minWidth:S,...X}),l.jsxs(Hh,{...$,children:[l.jsx(Uh,{onClick:()=>f(Number(U))}),l.jsx(Vh,{onClick:()=>f(Number(U))})]})]}),w&&l.jsx(le,{size:"sm","aria-label":"Reset",tooltip:"Reset",icon:l.jsx(ep,{}),onClick:Me,isDisabled:P,...ie})]})]})}function r8(){const e=O(i=>i.system.isGFPGANAvailable),t=O(i=>i.postprocessing.facetoolStrength),{t:n}=Z(),r=Y();return l.jsx(ut,{isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e,label:n("parameters.strength"),step:.05,min:0,max:1,onChange:i=>r(Zl(i)),handleReset:()=>r(Zl(.75)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}function i8(){const e=O(i=>i.system.isGFPGANAvailable),t=O(i=>i.postprocessing.codeformerFidelity),{t:n}=Z(),r=Y();return l.jsx(ut,{isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e,label:n("parameters.codeformerFidelity"),step:.05,min:0,max:1,onChange:i=>r(Qd(i)),handleReset:()=>r(Qd(1)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}const tp=()=>{const e=O(t=>t.postprocessing.facetoolType);return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(X7,{}),l.jsx(r8,{}),e==="codeformer"&&l.jsx(i8,{})]})};function o8(){const e=O(i=>i.system.isESRGANAvailable),t=O(i=>i.postprocessing.upscalingDenoising),{t:n}=Z(),r=Y();return l.jsx(ut,{label:n("parameters.denoisingStrength"),value:t,min:0,max:1,step:.01,onChange:i=>{r(Zd(i))},handleReset:()=>r(Zd(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function a8(){const e=O(i=>i.system.isESRGANAvailable),t=O(i=>i.postprocessing.upscalingStrength),{t:n}=Z(),r=Y();return l.jsx(ut,{label:`${n("parameters.upscale")} ${n("parameters.strength")}`,value:t,min:0,max:1,step:.05,onChange:i=>r(Jd(i)),handleReset:()=>r(Jd(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function s8(){const e=O(s=>s.system.isESRGANAvailable),t=O(s=>s.postprocessing.upscalingLevel),{t:n}=Z(),r=Y(),i=s=>r(M1(Number(s.target.value)));return l.jsx(Mn,{isDisabled:!e,label:n("parameters.scale"),value:t,onChange:i,validValues:VS})}const np=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(s8,{}),l.jsx(o8,{}),l.jsx(a8,{})]}),rp=e=>e.postprocessing,Pt=e=>e.system,l8=e=>e.system.toastQueue,wy=be(Pt,e=>{const{model_list:t}=e,n=te.reduce(t,(r,i,s)=>(i.status==="active"&&(r=s),r),"");return{...t[n],name:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),c8=be(Pt,e=>{const{model_list:t}=e;return te.pickBy(t,(r,i)=>{if(r.format==="diffusers")return{name:i,...r}})},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function Tf(){return Tf=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 g8=function(t,n,r){r===void 0&&(r=!1);var i=n.alt,s=n.meta,c=n.mod,u=n.shift,f=n.ctrl,h=n.keys,p=t.key,g=t.code,y=t.ctrlKey,S=t.metaKey,C=t.shiftKey,w=t.altKey,k=ii(g),j=p.toLowerCase();if(!r){if(i===!w&&j!=="alt"||u===!C&&j!=="shift")return!1;if(c){if(!S&&!y)return!1}else if(s===!S&&j!=="meta"||f===!y&&j!=="ctrl")return!1}return h&&h.length===1&&(h.includes(j)||h.includes(k))?!0:h?f8(h):!h},x8=x.createContext(void 0),y8=function(){return x.useContext(x8)};function Iy(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&&Iy(e[r],t[r])},!0):e===t}var b8=x.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),S8=function(){return x.useContext(b8)};function C8(e){var t=x.useRef(void 0);return Iy(t.current,e)||(t.current=e),t.current}var Gg=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},w8=typeof window<"u"?x.useLayoutEffect:x.useEffect;function fe(e,t,n,r){var i=x.useRef(null),s=x.useRef(!1),c=n instanceof Array?r instanceof Array?void 0:r:n,u=n instanceof Array?n:r instanceof Array?r:void 0,f=x.useCallback(t,u??[]),h=x.useRef(f);u?h.current=f:h.current=t;var p=C8(c),g=S8(),y=g.enabledScopes,S=y8();return w8(function(){if(!((p==null?void 0:p.enabled)===!1||!v8(y,p==null?void 0:p.scopes))){var C=function(M,P){var I;if(P===void 0&&(P=!1),!(m8(M)&&!Py(M,p==null?void 0:p.enableOnFormTags))){if(i.current!==null&&document.activeElement!==i.current&&!i.current.contains(document.activeElement)){Gg(M);return}(I=M.target)!=null&&I.isContentEditable&&!(p!=null&&p.enableOnContentEditable)||Od(e,p==null?void 0:p.splitKey).forEach(function(T){var D,_=Ad(T,p==null?void 0:p.combinationKey);if(g8(M,_,p==null?void 0:p.ignoreModifiers)||(D=_.keys)!=null&&D.includes("*")){if(P&&s.current)return;if(h8(M,_,p==null?void 0:p.preventDefault),!p8(M,_,p==null?void 0:p.enabled)){Gg(M);return}h.current(M,_),P||(s.current=!0)}})}},w=function(M){M.key!==void 0&&(jy(ii(M.code)),((p==null?void 0:p.keydown)===void 0&&(p==null?void 0:p.keyup)!==!0||p!=null&&p.keydown)&&C(M))},k=function(M){M.key!==void 0&&(Ey(ii(M.code)),s.current=!1,p!=null&&p.keyup&&C(M,!0))};return(i.current||(c==null?void 0:c.document)||document).addEventListener("keyup",k),(i.current||(c==null?void 0:c.document)||document).addEventListener("keydown",w),S&&Od(e,p==null?void 0:p.splitKey).forEach(function(j){return S.addHotkey(Ad(j,p==null?void 0:p.combinationKey))}),function(){(i.current||(c==null?void 0:c.document)||document).removeEventListener("keyup",k),(i.current||(c==null?void 0:c.document)||document).removeEventListener("keydown",w),S&&Od(e,p==null?void 0:p.splitKey).forEach(function(j){return S.removeHotkey(Ad(j,p==null?void 0:p.combinationKey))})}}},[e,p,y]),i}function k8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M524.531,69.836a1.5,1.5,0,0,0-.764-.7A485.065,485.065,0,0,0,404.081,32.03a1.816,1.816,0,0,0-1.923.91,337.461,337.461,0,0,0-14.9,30.6,447.848,447.848,0,0,0-134.426,0,309.541,309.541,0,0,0-15.135-30.6,1.89,1.89,0,0,0-1.924-.91A483.689,483.689,0,0,0,116.085,69.137a1.712,1.712,0,0,0-.788.676C39.068,183.651,18.186,294.69,28.43,404.354a2.016,2.016,0,0,0,.765,1.375A487.666,487.666,0,0,0,176.02,479.918a1.9,1.9,0,0,0,2.063-.676A348.2,348.2,0,0,0,208.12,430.4a1.86,1.86,0,0,0-1.019-2.588,321.173,321.173,0,0,1-45.868-21.853,1.885,1.885,0,0,1-.185-3.126c3.082-2.309,6.166-4.711,9.109-7.137a1.819,1.819,0,0,1,1.9-.256c96.229,43.917,200.41,43.917,295.5,0a1.812,1.812,0,0,1,1.924.233c2.944,2.426,6.027,4.851,9.132,7.16a1.884,1.884,0,0,1-.162,3.126,301.407,301.407,0,0,1-45.89,21.83,1.875,1.875,0,0,0-1,2.611,391.055,391.055,0,0,0,30.014,48.815,1.864,1.864,0,0,0,2.063.7A486.048,486.048,0,0,0,610.7,405.729a1.882,1.882,0,0,0,.765-1.352C623.729,277.594,590.933,167.465,524.531,69.836ZM222.491,337.58c-28.972,0-52.844-26.587-52.844-59.239S193.056,219.1,222.491,219.1c29.665,0,53.306,26.82,52.843,59.239C275.334,310.993,251.924,337.58,222.491,337.58Zm195.38,0c-28.971,0-52.843-26.587-52.843-59.239S388.437,219.1,417.871,219.1c29.667,0,53.307,26.82,52.844,59.239C470.715,310.993,447.538,337.58,417.871,337.58Z"}}]})(e)}function j8(e){return me({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"}}]})(e)}function E8(e){return me({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M143 256.3L7 120.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0L313 86.3c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.4 9.5-24.6 9.5-34 .1zm34 192l136-136c9.4-9.4 9.4-24.6 0-33.9l-22.6-22.6c-9.4-9.4-24.6-9.4-33.9 0L160 352.1l-96.4-96.4c-9.4-9.4-24.6-9.4-33.9 0L7 278.3c-9.4 9.4-9.4 24.6 0 33.9l136 136c9.4 9.5 24.6 9.5 34 .1z"}}]})(e)}function P8(e){return me({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"}}]})(e)}function I8(e){return me({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"}}]})(e)}function M8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"}}]})(e)}function T8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"}}]})(e)}function My(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"}}]})(e)}function _8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M478.21 334.093L336 256l142.21-78.093c11.795-6.477 15.961-21.384 9.232-33.037l-19.48-33.741c-6.728-11.653-21.72-15.499-33.227-8.523L296 186.718l3.475-162.204C299.763 11.061 288.937 0 275.48 0h-38.96c-13.456 0-24.283 11.061-23.994 24.514L216 186.718 77.265 102.607c-11.506-6.976-26.499-3.13-33.227 8.523l-19.48 33.741c-6.728 11.653-2.562 26.56 9.233 33.037L176 256 33.79 334.093c-11.795 6.477-15.961 21.384-9.232 33.037l19.48 33.741c6.728 11.653 21.721 15.499 33.227 8.523L216 325.282l-3.475 162.204C212.237 500.939 223.064 512 236.52 512h38.961c13.456 0 24.283-11.061 23.995-24.514L296 325.282l138.735 84.111c11.506 6.976 26.499 3.13 33.227-8.523l19.48-33.741c6.728-11.653 2.563-26.559-9.232-33.036z"}}]})(e)}function D8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M511.988 288.9c-.478 17.43-15.217 31.1-32.653 31.1H424v16c0 21.864-4.882 42.584-13.6 61.145l60.228 60.228c12.496 12.497 12.496 32.758 0 45.255-12.498 12.497-32.759 12.496-45.256 0l-54.736-54.736C345.886 467.965 314.351 480 280 480V236c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v244c-34.351 0-65.886-12.035-90.636-32.108l-54.736 54.736c-12.498 12.497-32.759 12.496-45.256 0-12.496-12.497-12.496-32.758 0-45.255l60.228-60.228C92.882 378.584 88 357.864 88 336v-16H32.666C15.23 320 .491 306.33.013 288.9-.484 270.816 14.028 256 32 256h56v-58.745l-46.628-46.628c-12.496-12.497-12.496-32.758 0-45.255 12.498-12.497 32.758-12.497 45.256 0L141.255 160h229.489l54.627-54.627c12.498-12.497 32.758-12.497 45.256 0 12.496 12.497 12.496 32.758 0 45.255L424 197.255V256h56c17.972 0 32.484 14.816 31.988 32.9zM257 0c-61.856 0-112 50.144-112 112h224C369 50.144 318.856 0 257 0z"}}]})(e)}function zc(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"}}]})(e)}function Ty(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"}}]})(e)}function Jo(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z"}}]})(e)}function _y(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500 224h-30.364C455.724 130.325 381.675 56.276 288 42.364V12c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v30.364C130.325 56.276 56.276 130.325 42.364 224H12c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h30.364C56.276 381.675 130.325 455.724 224 469.636V500c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-30.364C381.675 455.724 455.724 381.675 469.636 288H500c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12zM288 404.634V364c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40.634C165.826 392.232 119.783 346.243 107.366 288H148c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12h-40.634C119.768 165.826 165.757 119.783 224 107.366V148c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-40.634C346.174 119.768 392.217 165.757 404.634 224H364c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40.634C392.232 346.174 346.243 392.217 288 404.634zM288 256c0 17.673-14.327 32-32 32s-32-14.327-32-32c0-17.673 14.327-32 32-32s32 14.327 32 32z"}}]})(e)}function O8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z"}}]})(e)}function ip(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function Dy(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z"}}]})(e)}function A8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 344v112a23.94 23.94 0 0 1-24 24H312c-21.39 0-32.09-25.9-17-41l36.2-36.2L224 295.6 116.77 402.9 153 439c15.09 15.1 4.39 41-17 41H24a23.94 23.94 0 0 1-24-24V344c0-21.4 25.89-32.1 41-17l36.19 36.2L184.46 256 77.18 148.7 41 185c-15.1 15.1-41 4.4-41-17V56a23.94 23.94 0 0 1 24-24h112c21.39 0 32.09 25.9 17 41l-36.2 36.2L224 216.4l107.23-107.3L295 73c-15.09-15.1-4.39-41 17-41h112a23.94 23.94 0 0 1 24 24v112c0 21.4-25.89 32.1-41 17l-36.19-36.2L263.54 256l107.28 107.3L407 327.1c15.1-15.2 41-4.5 41 16.9z"}}]})(e)}function z8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z"}}]})(e)}function Oy(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M50.75 333.25c-12 12-18.75 28.28-18.75 45.26V424L0 480l32 32 56-32h45.49c16.97 0 33.25-6.74 45.25-18.74l126.64-126.62-128-128L50.75 333.25zM483.88 28.12c-37.47-37.5-98.28-37.5-135.75 0l-77.09 77.09-13.1-13.1c-9.44-9.44-24.65-9.31-33.94 0l-40.97 40.97c-9.37 9.37-9.37 24.57 0 33.94l161.94 161.94c9.44 9.44 24.65 9.31 33.94 0L419.88 288c9.37-9.37 9.37-24.57 0-33.94l-13.1-13.1 77.09-77.09c37.51-37.48 37.51-98.26.01-135.75z"}}]})(e)}function R8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"}}]})(e)}function N8(e){return me({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"}}]})(e)}function Ay(e){return me({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M512 320s-64 92.65-64 128c0 35.35 28.66 64 64 64s64-28.65 64-64-64-128-64-128zm-9.37-102.94L294.94 9.37C288.69 3.12 280.5 0 272.31 0s-16.38 3.12-22.62 9.37l-81.58 81.58L81.93 4.76c-6.25-6.25-16.38-6.25-22.62 0L36.69 27.38c-6.24 6.25-6.24 16.38 0 22.62l86.19 86.18-94.76 94.76c-37.49 37.48-37.49 98.26 0 135.75l117.19 117.19c18.74 18.74 43.31 28.12 67.87 28.12 24.57 0 49.13-9.37 67.87-28.12l221.57-221.57c12.5-12.5 12.5-32.75.01-45.25zm-116.22 70.97H65.93c1.36-3.84 3.57-7.98 7.43-11.83l13.15-13.15 81.61-81.61 58.6 58.6c12.49 12.49 32.75 12.49 45.24 0s12.49-32.75 0-45.24l-58.6-58.6 58.95-58.95 162.44 162.44-48.34 48.34z"}}]})(e)}function F8(e){return me({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zM94.6 168.9l34.9-5 15.5-31.6c2.9-5.8 11-5.8 13.9 0l15.5 31.6 34.9 5c6.2 1 8.9 8.6 4.3 13.2l-25.4 24.6 6 34.9c1 6.2-5.3 11-11 7.9L152 233.3l-31.3 16.3c-5.7 3.1-12-1.7-11-7.9l6-34.9-25.4-24.6c-4.6-4.7-1.9-12.3 4.3-13.3zM248 432c-60.6 0-134.5-38.3-143.8-93.3-2-11.8 9.3-21.5 20.7-17.9C155.1 330.5 200 336 248 336s92.9-5.5 123.1-15.2c11.5-3.7 22.6 6.1 20.7 17.9-9.3 55-83.2 93.3-143.8 93.3zm157.7-249.9l-25.4 24.6 6 34.9c1 6.2-5.3 11-11 7.9L344 233.3l-31.3 16.3c-5.7 3.1-12-1.7-11-7.9l6-34.9-25.4-24.6c-4.5-4.6-1.9-12.2 4.3-13.2l34.9-5 15.5-31.6c2.9-5.8 11-5.8 13.9 0l15.5 31.6 34.9 5c6.3.9 9 8.5 4.4 13.1z"}}]})(e)}function L8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"}}]})(e)}function B8(e){return me({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M528 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h480c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM128 180v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm288 0v-40c0-6.627-5.373-12-12-12H172c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h232c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12z"}}]})(e)}function H8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M152.1 236.2c-3.5-12.1-7.8-33.2-7.8-33.2h-.5s-4.3 21.1-7.8 33.2l-11.1 37.5H163zM616 96H336v320h280c13.3 0 24-10.7 24-24V120c0-13.3-10.7-24-24-24zm-24 120c0 6.6-5.4 12-12 12h-11.4c-6.9 23.6-21.7 47.4-42.7 69.9 8.4 6.4 17.1 12.5 26.1 18 5.5 3.4 7.3 10.5 4.1 16.2l-7.9 13.9c-3.4 5.9-10.9 7.8-16.7 4.3-12.6-7.8-24.5-16.1-35.4-24.9-10.9 8.7-22.7 17.1-35.4 24.9-5.8 3.5-13.3 1.6-16.7-4.3l-7.9-13.9c-3.2-5.6-1.4-12.8 4.2-16.2 9.3-5.7 18-11.7 26.1-18-7.9-8.4-14.9-17-21-25.7-4-5.7-2.2-13.6 3.7-17.1l6.5-3.9 7.3-4.3c5.4-3.2 12.4-1.7 16 3.4 5 7 10.8 14 17.4 20.9 13.5-14.2 23.8-28.9 30-43.2H412c-6.6 0-12-5.4-12-12v-16c0-6.6 5.4-12 12-12h64v-16c0-6.6 5.4-12 12-12h16c6.6 0 12 5.4 12 12v16h64c6.6 0 12 5.4 12 12zM0 120v272c0 13.3 10.7 24 24 24h280V96H24c-13.3 0-24 10.7-24 24zm58.9 216.1L116.4 167c1.7-4.9 6.2-8.1 11.4-8.1h32.5c5.1 0 9.7 3.3 11.4 8.1l57.5 169.1c2.6 7.8-3.1 15.9-11.4 15.9h-22.9a12 12 0 0 1-11.5-8.6l-9.4-31.9h-60.2l-9.1 31.8c-1.5 5.1-6.2 8.7-11.5 8.7H70.3c-8.2 0-14-8.1-11.4-15.9z"}}]})(e)}function zy(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M12.41 148.02l232.94 105.67c6.8 3.09 14.49 3.09 21.29 0l232.94-105.67c16.55-7.51 16.55-32.52 0-40.03L266.65 2.31a25.607 25.607 0 0 0-21.29 0L12.41 107.98c-16.55 7.51-16.55 32.53 0 40.04zm487.18 88.28l-58.09-26.33-161.64 73.27c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.51 209.97l-58.1 26.33c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 276.3c16.55-7.5 16.55-32.5 0-40zm0 127.8l-57.87-26.23-161.86 73.37c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.29 337.87 12.41 364.1c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 404.1c16.55-7.5 16.55-32.5 0-40z"}}]})(e)}function W8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320.67 64c-442.6 0-357.57 384-158.46 384 39.9 0 77.47-20.69 101.42-55.86l25.73-37.79c15.66-22.99 46.97-22.99 62.63 0l25.73 37.79C401.66 427.31 439.23 448 479.13 448c189.86 0 290.63-384-158.46-384zM184 308.36c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05zm272 0c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05z"}}]})(e)}function V8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function Ry(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M167.02 309.34c-40.12 2.58-76.53 17.86-97.19 72.3-2.35 6.21-8 9.98-14.59 9.98-11.11 0-45.46-27.67-55.25-34.35C0 439.62 37.93 512 128 512c75.86 0 128-43.77 128-120.19 0-3.11-.65-6.08-.97-9.13l-88.01-73.34zM457.89 0c-15.16 0-29.37 6.71-40.21 16.45C213.27 199.05 192 203.34 192 257.09c0 13.7 3.25 26.76 8.73 38.7l63.82 53.18c7.21 1.8 14.64 3.03 22.39 3.03 62.11 0 98.11-45.47 211.16-256.46 7.38-14.35 13.9-29.85 13.9-45.99C512 20.64 486 0 457.89 0z"}}]})(e)}function U8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"}}]})(e)}function $8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"}}]})(e)}function xs(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function G8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 32H336c-26.5 0-48 21.5-48 48v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48zm-288 0H48C21.5 32 0 53.5 0 80v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48z"}}]})(e)}function q8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M184.561 261.903c3.232 13.997-12.123 24.635-24.068 17.168l-40.736-25.455-50.867 81.402C55.606 356.273 70.96 384 96.012 384H148c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12H96.115c-75.334 0-121.302-83.048-81.408-146.88l50.822-81.388-40.725-25.448c-12.081-7.547-8.966-25.961 4.879-29.158l110.237-25.45c8.611-1.988 17.201 3.381 19.189 11.99l25.452 110.237zm98.561-182.915l41.289 66.076-40.74 25.457c-12.051 7.528-9 25.953 4.879 29.158l110.237 25.45c8.672 1.999 17.215-3.438 19.189-11.99l25.45-110.237c3.197-13.844-11.99-24.719-24.068-17.168l-40.687 25.424-41.263-66.082c-37.521-60.033-125.209-60.171-162.816 0l-17.963 28.766c-3.51 5.62-1.8 13.021 3.82 16.533l33.919 21.195c5.62 3.512 13.024 1.803 16.536-3.817l17.961-28.743c12.712-20.341 41.973-19.676 54.257-.022zM497.288 301.12l-27.515-44.065c-3.511-5.623-10.916-7.334-16.538-3.821l-33.861 21.159c-5.62 3.512-7.33 10.915-3.818 16.536l27.564 44.112c13.257 21.211-2.057 48.96-27.136 48.96H320V336.02c0-14.213-17.242-21.383-27.313-11.313l-80 79.981c-6.249 6.248-6.249 16.379 0 22.627l80 79.989C302.689 517.308 320 510.3 320 495.989V448h95.88c75.274 0 121.335-82.997 81.408-146.88z"}}]})(e)}function Y8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500.33 0h-47.41a12 12 0 0 0-12 12.57l4 82.76A247.42 247.42 0 0 0 256 8C119.34 8 7.9 119.53 8 256.19 8.1 393.07 119.1 504 256 504a247.1 247.1 0 0 0 166.18-63.91 12 12 0 0 0 .48-17.43l-34-34a12 12 0 0 0-16.38-.55A176 176 0 1 1 402.1 157.8l-101.53-4.87a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12h200.33a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12z"}}]})(e)}function op(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"}}]})(e)}function X8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"}}]})(e)}function K8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M64 96H0c0 123.7 100.3 224 224 224v144c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V320C288 196.3 187.7 96 64 96zm384-64c-84.2 0-157.4 46.5-195.7 115.2 27.7 30.2 48.2 66.9 59 107.6C424 243.1 512 147.9 512 32h-64z"}}]})(e)}function Q8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 320c-22.608 0-43.387 7.819-59.79 20.895l-102.486-64.054a96.551 96.551 0 0 0 0-41.683l102.486-64.054C308.613 184.181 329.392 192 352 192c53.019 0 96-42.981 96-96S405.019 0 352 0s-96 42.981-96 96c0 7.158.79 14.13 2.276 20.841L155.79 180.895C139.387 167.819 118.608 160 96 160c-53.019 0-96 42.981-96 96s42.981 96 96 96c22.608 0 43.387-7.819 59.79-20.895l102.486 64.054A96.301 96.301 0 0 0 256 416c0 53.019 42.981 96 96 96s96-42.981 96-96-42.981-96-96-96z"}}]})(e)}function qg(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M503.691 189.836L327.687 37.851C312.281 24.546 288 35.347 288 56.015v80.053C127.371 137.907 0 170.1 0 322.326c0 61.441 39.581 122.309 83.333 154.132 13.653 9.931 33.111-2.533 28.077-18.631C66.066 312.814 132.917 274.316 288 272.085V360c0 20.7 24.3 31.453 39.687 18.164l176.004-152c11.071-9.562 11.086-26.753 0-36.328z"}}]})(e)}function ap(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H160v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h80v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h336c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160h-80v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h336v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h80c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160H288V48c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16C7.2 64 0 71.2 0 80v32c0 8.8 7.2 16 16 16h208v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h208c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16z"}}]})(e)}function Z8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"}}]})(e)}function io(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"}}]})(e)}function J8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M212.333 224.333H12c-6.627 0-12-5.373-12-12V12C0 5.373 5.373 0 12 0h48c6.627 0 12 5.373 12 12v78.112C117.773 39.279 184.26 7.47 258.175 8.007c136.906.994 246.448 111.623 246.157 248.532C504.041 393.258 393.12 504 256.333 504c-64.089 0-122.496-24.313-166.51-64.215-5.099-4.622-5.334-12.554-.467-17.42l33.967-33.967c4.474-4.474 11.662-4.717 16.401-.525C170.76 415.336 211.58 432 256.333 432c97.268 0 176-78.716 176-176 0-97.267-78.716-176-176-176-58.496 0-110.28 28.476-142.274 72.333h98.274c6.627 0 12 5.373 12 12v48c0 6.627-5.373 12-12 12z"}}]})(e)}function Rc(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function e9(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"}}]})(e)}function sp(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M507.73 109.1c-2.24-9.03-13.54-12.09-20.12-5.51l-74.36 74.36-67.88-11.31-11.31-67.88 74.36-74.36c6.62-6.62 3.43-17.9-5.66-20.16-47.38-11.74-99.55.91-136.58 37.93-39.64 39.64-50.55 97.1-34.05 147.2L18.74 402.76c-24.99 24.99-24.99 65.51 0 90.5 24.99 24.99 65.51 24.99 90.5 0l213.21-213.21c50.12 16.71 107.47 5.68 147.37-34.22 37.07-37.07 49.7-89.32 37.91-136.73zM64 472c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"}}]})(e)}const tt=e=>e.canvas,zt=be([tt,Bt,Pt],(e,t,n)=>e.layerState.stagingArea.images.length>0||t==="unifiedCanvas"&&n.isProcessing),Ny=e=>e.canvas.layerState.objects.find(T1),Vr=e=>e.gallery,t9=be([Vr,Ac,zt,Bt],(e,t,n,r)=>{const{categories:i,currentCategory:s,currentImageUuid:c,shouldPinGallery:u,shouldShowGallery:f,galleryImageMinimumWidth:h,galleryImageObjectFit:p,shouldHoldGalleryOpen:g,shouldAutoSwitchToNewImages:y,galleryWidth:S,shouldUseSingleGalleryColumn:C}=e,{isLightboxOpen:w}=t;return{currentImageUuid:c,shouldPinGallery:u,shouldShowGallery:f,galleryImageMinimumWidth:h,galleryImageObjectFit:p,galleryGridTemplateColumns:C?"auto":`repeat(auto-fill, minmax(${h}px, auto))`,activeTabName:r,shouldHoldGalleryOpen:g,shouldAutoSwitchToNewImages:y,images:i[s].images,areMoreImagesAvailable:i[s].areMoreImagesAvailable,currentCategory:s,galleryWidth:S,isLightboxOpen:w,isStaging:n,shouldEnableResize:!(w||r==="unifiedCanvas"&&u),shouldUseSingleGalleryColumn:C}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),n9=be([Vr,Pt,Ac,Bt],(e,t,n,r)=>({mayDeleteImage:t.isConnected&&!t.isProcessing,galleryImageObjectFit:e.galleryImageObjectFit,galleryImageMinimumWidth:e.galleryImageMinimumWidth,shouldUseSingleGalleryColumn:e.shouldUseSingleGalleryColumn,activeTabName:r,isLightboxOpen:n.isLightboxOpen}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),En=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:i,formLabelProps:s,...c}=e;return l.jsxs(rt,{isDisabled:n,width:r,display:"flex",gap:4,alignItems:"center",justifyContent:"space-between",...i,children:[l.jsx(st,{my:1,...s,children:t}),l.jsx(fy,{...c})]})},r9=be(Pt,e=>{const{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}=e;return{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),uc=he(({image:e,children:t},n)=>{const{isOpen:r,onOpen:i,onClose:s}=ui(),c=Y(),{shouldConfirmOnDelete:u,isConnected:f,isProcessing:h}=O(r9),p=x.useRef(null),g=C=>{C.stopPropagation(),u?i():y()},y=()=>{f&&!h&&e&&c(US(e)),s()};fe("delete",()=>{u?i():y()},[e,u,f,h]);const S=C=>c(_1(!C.target.checked));return l.jsxs(l.Fragment,{children:[x.cloneElement(t,{onClick:e?g:void 0,ref:n}),l.jsx(Xx,{isOpen:r,leastDestructiveRef:p,onClose:s,children:l.jsx(Nr,{children:l.jsxs(Kx,{children:[l.jsx(Rr,{fontSize:"lg",fontWeight:"bold",children:"Delete image"}),l.jsx(Fr,{children:l.jsxs(B,{direction:"column",gap:5,children:[l.jsx(Ce,{children:"Are you sure? Deleted images will be sent to the Bin. You can restore from there if you wish to."}),l.jsx(En,{label:"Don't ask me again",isChecked:!u,onChange:S})]})}),l.jsxs(zr,{children:[l.jsx(Je,{ref:p,onClick:s,children:"Cancel"}),l.jsx(Je,{colorScheme:"error",onClick:y,ml:3,children:"Delete"})]})]})})})]})});uc.displayName="DeleteImageModal";const lp=()=>{const e=Y();return t=>{const n=typeof t=="string"?t:D1(t),[r,i]=$S(n);e(O1(r)),e(A1(i))}},i9=be([Pt,Vr,rp,ro,Ac,Bt],(e,t,n,r,i,s)=>{const{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:h}=e,{upscalingLevel:p,facetoolStrength:g}=n,{isLightboxOpen:y}=i,{shouldShowImageDetails:S}=r,{intermediateImage:C,currentImage:w}=t;return{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:h,upscalingLevel:p,facetoolStrength:g,shouldDisableToolbarButtons:Boolean(C)||!w,currentImage:w,shouldShowImageDetails:S,activeTabName:s,isLightboxOpen:y}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Fy=e=>{var L,X,$,Q,ie,oe,U,K;const t=Y(),{isProcessing:n,isConnected:r,isGFPGANAvailable:i,isESRGANAvailable:s,upscalingLevel:c,facetoolStrength:u,shouldDisableToolbarButtons:f,shouldShowImageDetails:h,currentImage:p,isLightboxOpen:g,activeTabName:y}=O(i9),S=us(),{t:C}=Z(),w=lp(),k=()=>{p&&(g&&t(Bi(!1)),t(os(p)),t(jn("img2img")))},j=async()=>{if(!p)return;const ne=await fetch(p.url).then(Re=>Re.blob()),ce=[new ClipboardItem({[ne.type]:ne})];await navigator.clipboard.write(ce),S({title:C("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})},M=()=>{navigator.clipboard.writeText(p?window.location.toString()+p.url:"").then(()=>{S({title:C("toast.imageLinkCopied"),status:"success",duration:2500,isClosable:!0})})};fe("shift+i",()=>{p?(k(),S({title:C("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.imageNotLoaded"),description:C("toast.imageNotLoadedDesc"),status:"error",duration:2500,isClosable:!0})},[p]);const P=()=>{var ne,ce;p&&(p.metadata&&t(z1(p.metadata)),((ne=p.metadata)==null?void 0:ne.image.type)==="img2img"?t(jn("img2img")):((ce=p.metadata)==null?void 0:ce.image.type)==="txt2img"&&t(jn("txt2img")))};fe("a",()=>{var ne,ce;["txt2img","img2img"].includes((ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)==null?void 0:ce.type)?(P(),S({title:C("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.parametersNotSet"),description:C("toast.parametersNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[p]);const I=()=>{p!=null&&p.metadata&&t(as(p.metadata.image.seed))};fe("s",()=>{var ne,ce;(ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)!=null&&ce.seed?(I(),S({title:C("toast.seedSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.seedNotSet"),description:C("toast.seedNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[p]);const T=x.useCallback(()=>{var ne,ce,Re,ze;(ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)!=null&&ce.prompt&&w((ze=(Re=p==null?void 0:p.metadata)==null?void 0:Re.image)==null?void 0:ze.prompt)},[(X=(L=p==null?void 0:p.metadata)==null?void 0:L.image)==null?void 0:X.prompt,w]);fe("p",()=>{var ne,ce;(ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)!=null&&ce.prompt?(T(),S({title:C("toast.promptSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.promptNotSet"),description:C("toast.promptNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[p]);const D=()=>{p&&t(GS(p))};fe("Shift+U",()=>{s&&!f&&r&&!n&&c?D():S({title:C("toast.upscalingFailed"),status:"error",duration:2500,isClosable:!0})},[p,s,f,r,n,c]);const _=()=>{p&&t(qS(p))};fe("Shift+R",()=>{i&&!f&&r&&!n&&u?_():S({title:C("toast.faceRestoreFailed"),status:"error",duration:2500,isClosable:!0})},[p,i,f,r,n,u]);const z=()=>t(R1(!h)),V=()=>{p&&(g&&t(Bi(!1)),t(bc(p)),t(on(!0)),y!=="unifiedCanvas"&&t(jn("unifiedCanvas")),S({title:C("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0}))};fe("i",()=>{p?z():S({title:C("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[p,h]);const F=()=>{t(Bi(!g))};return l.jsxs(B,{sx:{justifyContent:"center",alignItems:"center",columnGap:"0.5em"},...e,children:[l.jsxs(en,{isAttached:!0,children:[l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{"aria-label":`${C("parameters.sendTo")}...`,icon:l.jsx(Q8,{})}),children:l.jsxs(B,{sx:{flexDirection:"column",rowGap:2,w:52},children:[l.jsx(Je,{size:"sm",onClick:k,leftIcon:l.jsx(qg,{}),children:C("parameters.sendToImg2Img")}),l.jsx(Je,{size:"sm",onClick:V,leftIcon:l.jsx(qg,{}),children:C("parameters.sendToUnifiedCanvas")}),l.jsx(Je,{size:"sm",onClick:j,leftIcon:l.jsx(Jo,{}),children:C("parameters.copyImage")}),l.jsx(Je,{size:"sm",onClick:M,leftIcon:l.jsx(Jo,{}),children:C("parameters.copyImageToLink")}),l.jsx($i,{download:!0,href:p==null?void 0:p.url,children:l.jsx(Je,{leftIcon:l.jsx(ip,{}),size:"sm",w:"100%",children:C("parameters.downloadImage")})})]})}),l.jsx(le,{icon:l.jsx(z8,{}),tooltip:g?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,"aria-label":g?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,isChecked:g,onClick:F})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{icon:l.jsx(G8,{}),tooltip:`${C("parameters.usePrompt")} (P)`,"aria-label":`${C("parameters.usePrompt")} (P)`,isDisabled:!((Q=($=p==null?void 0:p.metadata)==null?void 0:$.image)!=null&&Q.prompt),onClick:T}),l.jsx(le,{icon:l.jsx(K8,{}),tooltip:`${C("parameters.useSeed")} (S)`,"aria-label":`${C("parameters.useSeed")} (S)`,isDisabled:!((oe=(ie=p==null?void 0:p.metadata)==null?void 0:ie.image)!=null&&oe.seed),onClick:I}),l.jsx(le,{icon:l.jsx(_8,{}),tooltip:`${C("parameters.useAll")} (A)`,"aria-label":`${C("parameters.useAll")} (A)`,isDisabled:!["txt2img","img2img"].includes((K=(U=p==null?void 0:p.metadata)==null?void 0:U.image)==null?void 0:K.type),onClick:P})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{icon:l.jsx(F8,{}),"aria-label":C("parameters.restoreFaces")}),children:l.jsxs(B,{sx:{flexDirection:"column",rowGap:4},children:[l.jsx(tp,{}),l.jsx(Je,{isDisabled:!i||!p||!(r&&!n)||!u,onClick:_,children:C("parameters.restoreFaces")})]})}),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{icon:l.jsx(A8,{}),"aria-label":C("parameters.upscale")}),children:l.jsxs(B,{sx:{flexDirection:"column",gap:4},children:[l.jsx(np,{}),l.jsx(Je,{isDisabled:!s||!p||!(r&&!n)||!c,onClick:D,children:C("parameters.upscaleImage")})]})})]}),l.jsx(en,{isAttached:!0,children:l.jsx(le,{icon:l.jsx(Ty,{}),tooltip:`${C("parameters.info")} (I)`,"aria-label":`${C("parameters.info")} (I)`,isChecked:h,onClick:z})}),l.jsx(uc,{image:p,children:l.jsx(le,{icon:l.jsx(io,{}),tooltip:`${C("parameters.deleteImage")} (Del)`,"aria-label":`${C("parameters.deleteImage")} (Del)`,isDisabled:!p||!r||n,colorScheme:"error"})})]})};var o9=globalThis&&globalThis.__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 s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Wt=globalThis&&globalThis.__assign||function(){return Wt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"u"?void 0:Number(r),maxHeight:typeof i>"u"?void 0:Number(i),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof c>"u"?void 0:Number(c)}},f9=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],Zg="__resizable_base__",Ly=function(e){l9(t,e);function t(n){var r=e.call(this,n)||this;return r.ratio=1,r.resizable=null,r.parentLeft=0,r.parentTop=0,r.resizableLeft=0,r.resizableRight=0,r.resizableTop=0,r.resizableBottom=0,r.targetLeft=0,r.targetTop=0,r.appendBase=function(){if(!r.resizable||!r.window)return null;var i=r.parentNode;if(!i)return null;var s=r.window.document.createElement("div");return s.style.width="100%",s.style.height="100%",s.style.position="absolute",s.style.transform="scale(0, 0)",s.style.left="0",s.style.flex="0 0 100%",s.classList?s.classList.add(Zg):s.className+=Zg,i.appendChild(s),s},r.removeBase=function(i){var s=r.parentNode;s&&s.removeChild(i)},r.ref=function(i){i&&(r.resizable=i)},r.state={isResizing:!1,width:typeof(r.propsSize&&r.propsSize.width)>"u"?"auto":r.propsSize&&r.propsSize.width,height:typeof(r.propsSize&&r.propsSize.height)>"u"?"auto":r.propsSize&&r.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},r.onResizeStart=r.onResizeStart.bind(r),r.onMouseMove=r.onMouseMove.bind(r),r.onMouseUp=r.onMouseUp.bind(r),r}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||c9},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,s=this.resizable.offsetHeight,c=this.resizable.style.position;c!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:i,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=c}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,i=function(u){if(typeof n.state[u]>"u"||n.state[u]==="auto")return"auto";if(n.propsSize&&n.propsSize[u]&&n.propsSize[u].toString().endsWith("%")){if(n.state[u].toString().endsWith("%"))return n.state[u].toString();var f=n.getParentSize(),h=Number(n.state[u].toString().replace("px","")),p=h/f[u]*100;return p+"%"}return zd(n.state[u])},s=r&&typeof r.width<"u"&&!this.state.isResizing?zd(r.width):i("width"),c=r&&typeof r.height<"u"&&!this.state.isResizing?zd(r.height):i("height");return{width:s,height:c}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var r=!1,i=this.parentNode.style.flexWrap;i!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var s={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=i),this.removeBase(n),s},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,r){var i=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof i>"u"||i==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var i=this.props.boundsByDirection,s=this.state.direction,c=i&&Do("left",s),u=i&&Do("top",s),f,h;if(this.props.bounds==="parent"){var p=this.parentNode;p&&(f=c?this.resizableRight-this.parentLeft:p.offsetWidth+(this.parentLeft-this.resizableLeft),h=u?this.resizableBottom-this.parentTop:p.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(f=c?this.resizableRight:this.window.innerWidth-this.resizableLeft,h=u?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(f=c?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),h=u?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return f&&Number.isFinite(f)&&(n=n&&n"u"?10:s.width,g=typeof i.width>"u"||i.width<0?n:i.width,y=typeof s.height>"u"?10:s.height,S=typeof i.height>"u"||i.height<0?r:i.height,C=f||0,w=h||0;if(u){var k=(y-C)*this.ratio+w,j=(S-C)*this.ratio+w,M=(p-w)/this.ratio+C,P=(g-w)/this.ratio+C,I=Math.max(p,k),T=Math.min(g,j),D=Math.max(y,M),_=Math.min(S,P);n=_l(n,I,T),r=_l(r,D,_)}else n=_l(n,p,g),r=_l(r,y,S);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var r=n.getBoundingClientRect();this.parentLeft=r.left,this.parentTop=r.top}}if(this.props.bounds&&typeof this.props.bounds!="string"){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left,this.targetTop=i.top}if(this.resizable){var s=this.resizable.getBoundingClientRect(),c=s.left,u=s.top,f=s.right,h=s.bottom;this.resizableLeft=c,this.resizableRight=f,this.resizableTop=u,this.resizableBottom=h}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var i=0,s=0;if(n.nativeEvent&&u9(n.nativeEvent)?(i=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&Dl(n.nativeEvent)&&(i=n.nativeEvent.touches[0].clientX,s=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var c=this.props.onResizeStart(n,r,this.resizable);if(c===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var u,f=this.window.getComputedStyle(this.resizable);if(f.flexBasis!=="auto"){var h=this.parentNode;if(h){var p=this.window.getComputedStyle(h).flexDirection;this.flexDir=p.startsWith("row")?"row":"column",u=f.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var g={original:{x:i,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:mr(mr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:u};this.setState(g)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Dl(n))try{n.preventDefault(),n.stopPropagation()}catch{}var i=this.props,s=i.maxWidth,c=i.maxHeight,u=i.minWidth,f=i.minHeight,h=Dl(n)?n.touches[0].clientX:n.clientX,p=Dl(n)?n.touches[0].clientY:n.clientY,g=this.state,y=g.direction,S=g.original,C=g.width,w=g.height,k=this.getParentSize(),j=d9(k,this.window.innerWidth,this.window.innerHeight,s,c,u,f);s=j.maxWidth,c=j.maxHeight,u=j.minWidth,f=j.minHeight;var M=this.calculateNewSizeFromDirection(h,p),P=M.newHeight,I=M.newWidth,T=this.calculateNewMaxFromBoundary(s,c);this.props.snap&&this.props.snap.x&&(I=Qg(I,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(P=Qg(P,this.props.snap.y,this.props.snapGap));var D=this.calculateNewSizeFromAspectRatio(I,P,{width:T.maxWidth,height:T.maxHeight},{width:u,height:f});if(I=D.newWidth,P=D.newHeight,this.props.grid){var _=Kg(I,this.props.grid[0]),z=Kg(P,this.props.grid[1]),V=this.props.snapGap||0;I=V===0||Math.abs(_-I)<=V?_:I,P=V===0||Math.abs(z-P)<=V?z:P}var F={width:I-S.width,height:P-S.height};if(C&&typeof C=="string"){if(C.endsWith("%")){var L=I/k.width*100;I=L+"%"}else if(C.endsWith("vw")){var X=I/this.window.innerWidth*100;I=X+"vw"}else if(C.endsWith("vh")){var $=I/this.window.innerHeight*100;I=$+"vh"}}if(w&&typeof w=="string"){if(w.endsWith("%")){var L=P/k.height*100;P=L+"%"}else if(w.endsWith("vw")){var X=P/this.window.innerWidth*100;P=X+"vw"}else if(w.endsWith("vh")){var $=P/this.window.innerHeight*100;P=$+"vh"}}var Q={width:this.createSizeForCssProperty(I,"width"),height:this.createSizeForCssProperty(P,"height")};this.flexDir==="row"?Q.flexBasis=Q.width:this.flexDir==="column"&&(Q.flexBasis=Q.height),YS.flushSync(function(){r.setState(Q)}),this.props.onResize&&this.props.onResize(n,y,this.resizable,F)}},t.prototype.onMouseUp=function(n){var r=this.state,i=r.isResizing,s=r.direction,c=r.original;if(!(!i||!this.resizable)){var u={width:this.size.width-c.width,height:this.size.height-c.height};this.props.onResizeStop&&this.props.onResizeStop(n,s,this.resizable,u),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:mr(mr({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){this.setState({width:n.width,height:n.height})},t.prototype.renderResizer=function(){var n=this,r=this.props,i=r.enable,s=r.handleStyles,c=r.handleClasses,u=r.handleWrapperStyle,f=r.handleWrapperClass,h=r.handleComponent;if(!i)return null;var p=Object.keys(i).map(function(g){return i[g]!==!1?x.createElement(s9,{key:g,direction:g,onResizeStart:n.onResizeStart,replaceStyles:s&&s[g],className:c&&c[g]},h&&h[g]?h[g]:null):null});return x.createElement("div",{className:f,style:u},p)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(c,u){return f9.indexOf(u)!==-1||(c[u]=n.props[u]),c},{}),i=mr(mr(mr({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(i.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return x.createElement(s,mr({ref:this.ref,style:i,className:this.props.className},r),this.state.isResizing&&x.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(x.PureComponent);const pt=e=>{const{label:t,...n}=e;return l.jsx(P2,{colorScheme:"accent",...n,children:t})};function By(e){return me({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z"}}]})(e)}function Hy(e){return me({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146zm.122 2.112v-.002.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a4.507 4.507 0 0 0-.288-.076 4.922 4.922 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a4.924 4.924 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034.114 0 .23-.011.343-.04L9.927 2.028c-.029.113-.04.23-.04.343a1.779 1.779 0 0 0 .062.46z"}}]})(e)}function h9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M16.5 9c-.42 0-.83.04-1.24.11L1.01 3 1 10l9 2-9 2 .01 7 8.07-3.46C9.59 21.19 12.71 24 16.5 24c4.14 0 7.5-3.36 7.5-7.5S20.64 9 16.5 9zm0 13c-3.03 0-5.5-2.47-5.5-5.5s2.47-5.5 5.5-5.5 5.5 2.47 5.5 5.5-2.47 5.5-5.5 5.5z"}},{tag:"path",attr:{d:"M18.27 14.03l-1.77 1.76-1.77-1.76-.7.7 1.76 1.77-1.76 1.77.7.7 1.77-1.76 1.77 1.76.7-.7-1.76-1.77 1.76-1.77z"}}]})(e)}function p9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}}]})(e)}function m9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 00.12-.61l-1.92-3.32a.488.488 0 00-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 00-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 00-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}}]})(e)}function v9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"}}]})(e)}function g9(e){return me({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 x9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 2v11h3v9l7-12h-4l4-8z"}}]})(e)}function Jg(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"}}]})(e)}function y9(e){return me({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 b9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.02 10v9H5V5h9V3H5.02c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-9h-2zM17 10l.94-2.06L20 7l-2.06-.94L17 4l-.94 2.06L14 7l2.06.94zm-3.75.75L12 8l-1.25 2.75L8 12l2.75 1.25L12 16l1.25-2.75L16 12z"}}]})(e)}function cp(e){return me({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 S9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"}}]})(e)}function C9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 10l5 5 5-5z"}}]})(e)}function w9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 14l5-5 5 5z"}}]})(e)}function k9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}}]})(e)}function j9(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function E9(e,t){e.classList?e.classList.add(t):j9(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function e0(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function P9(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=e0(e.className,t):e.setAttribute("class",e0(e.className&&e.className.baseVal||"",t))}const t0={disabled:!1},Wy=ke.createContext(null);var Vy=function(t){return t.scrollTop},La="unmounted",Ai="exited",zi="entering",Ao="entered",_f="exiting",Ur=function(e){vh(t,e);function t(r,i){var s;s=e.call(this,r,i)||this;var c=i,u=c&&!c.isMounting?r.enter:r.appear,f;return s.appearStatus=null,r.in?u?(f=Ai,s.appearStatus=zi):f=Ao:r.unmountOnExit||r.mountOnEnter?f=La:f=Ai,s.state={status:f},s.nextCallback=null,s}t.getDerivedStateFromProps=function(i,s){var c=i.in;return c&&s.status===La?{status:Ai}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(i){var s=null;if(i!==this.props){var c=this.state.status;this.props.in?c!==zi&&c!==Ao&&(s=zi):(c===zi||c===Ao)&&(s=_f)}this.updateStatus(!1,s)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var i=this.props.timeout,s,c,u;return s=c=u=i,i!=null&&typeof i!="number"&&(s=i.exit,c=i.enter,u=i.appear!==void 0?i.appear:c),{exit:s,enter:c,appear:u}},n.updateStatus=function(i,s){if(i===void 0&&(i=!1),s!==null)if(this.cancelNextCallback(),s===zi){if(this.props.unmountOnExit||this.props.mountOnEnter){var c=this.props.nodeRef?this.props.nodeRef.current:vl.findDOMNode(this);c&&Vy(c)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Ai&&this.setState({status:La})},n.performEnter=function(i){var s=this,c=this.props.enter,u=this.context?this.context.isMounting:i,f=this.props.nodeRef?[u]:[vl.findDOMNode(this),u],h=f[0],p=f[1],g=this.getTimeouts(),y=u?g.appear:g.enter;if(!i&&!c||t0.disabled){this.safeSetState({status:Ao},function(){s.props.onEntered(h)});return}this.props.onEnter(h,p),this.safeSetState({status:zi},function(){s.props.onEntering(h,p),s.onTransitionEnd(y,function(){s.safeSetState({status:Ao},function(){s.props.onEntered(h,p)})})})},n.performExit=function(){var i=this,s=this.props.exit,c=this.getTimeouts(),u=this.props.nodeRef?void 0:vl.findDOMNode(this);if(!s||t0.disabled){this.safeSetState({status:Ai},function(){i.props.onExited(u)});return}this.props.onExit(u),this.safeSetState({status:_f},function(){i.props.onExiting(u),i.onTransitionEnd(c.exit,function(){i.safeSetState({status:Ai},function(){i.props.onExited(u)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(i,s){s=this.setNextCallback(s),this.setState(i,s)},n.setNextCallback=function(i){var s=this,c=!0;return this.nextCallback=function(u){c&&(c=!1,s.nextCallback=null,i(u))},this.nextCallback.cancel=function(){c=!1},this.nextCallback},n.onTransitionEnd=function(i,s){this.setNextCallback(s);var c=this.props.nodeRef?this.props.nodeRef.current:vl.findDOMNode(this),u=i==null&&!this.props.addEndListener;if(!c||u){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var f=this.props.nodeRef?[this.nextCallback]:[c,this.nextCallback],h=f[0],p=f[1];this.props.addEndListener(h,p)}i!=null&&setTimeout(this.nextCallback,i)},n.render=function(){var i=this.state.status;if(i===La)return null;var s=this.props,c=s.children;s.in,s.mountOnEnter,s.unmountOnExit,s.appear,s.enter,s.exit,s.timeout,s.addEndListener,s.onEnter,s.onEntering,s.onEntered,s.onExit,s.onExiting,s.onExited,s.nodeRef;var u=th(s,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return ke.createElement(Wy.Provider,{value:null},typeof c=="function"?c(i,u):ke.cloneElement(ke.Children.only(c),u))},t}(ke.Component);Ur.contextType=Wy;Ur.propTypes={};function Oo(){}Ur.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Oo,onEntering:Oo,onEntered:Oo,onExit:Oo,onExiting:Oo,onExited:Oo};Ur.UNMOUNTED=La;Ur.EXITED=Ai;Ur.ENTERING=zi;Ur.ENTERED=Ao;Ur.EXITING=_f;const I9=Ur;var M9=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return E9(t,r)})},Rd=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return P9(t,r)})},up=function(e){vh(t,e);function t(){for(var r,i=arguments.length,s=new Array(i),c=0;ce.image.uuid===t.image.uuid&&e.isSelected===t.isSelected,$y=x.memo(e=>{const t=Y(),{activeTabName:n,galleryImageObjectFit:r,galleryImageMinimumWidth:i,mayDeleteImage:s,shouldUseSingleGalleryColumn:c}=O(n9),{image:u,isSelected:f}=e,{url:h,thumbnail:p,uuid:g,metadata:y}=u,[S,C]=x.useState(!1),w=us(),{direction:k}=Ji(),{t:j}=Z(),M=lp(),P=()=>C(!0),I=()=>C(!1),T=()=>{var Q,ie,oe,U;(ie=(Q=u.metadata)==null?void 0:Q.image)!=null&&ie.prompt&&M((U=(oe=u.metadata)==null?void 0:oe.image)==null?void 0:U.prompt),w({title:j("toast.promptSet"),status:"success",duration:2500,isClosable:!0})},D=()=>{u.metadata&&t(as(u.metadata.image.seed)),w({title:j("toast.seedSet"),status:"success",duration:2500,isClosable:!0})},_=()=>{t(os(u)),n!=="img2img"&&t(jn("img2img")),w({title:j("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})},z=()=>{t(bc(u)),t(Sc()),n!=="unifiedCanvas"&&t(jn("unifiedCanvas")),w({title:j("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},V=()=>{y&&t(z1(y)),w({title:j("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})},F=async()=>{var Q;if((Q=y==null?void 0:y.image)!=null&&Q.init_image_path&&(await fetch(y.image.init_image_path)).ok){t(jn("img2img")),t(XS(y)),w({title:j("toast.initialImageSet"),status:"success",duration:2500,isClosable:!0});return}w({title:j("toast.initialImageNotSet"),description:j("toast.initialImageNotSetDesc"),status:"error",duration:2500,isClosable:!0})},L=()=>t(Rv(u)),X=Q=>{Q.dataTransfer.setData("invokeai/imageUuid",g),Q.dataTransfer.effectAllowed="move"},$=()=>{t(Rv(u)),t(Bi(!0))};return l.jsx(T9,{menuProps:{size:"sm",isLazy:!0},renderMenu:()=>{var Q,ie,oe,U,K,ne,ce,Re;return l.jsxs(Nh,{children:[l.jsx(pr,{onClickCapture:$,children:j("parameters.openInViewer")}),l.jsx(pr,{onClickCapture:T,isDisabled:((ie=(Q=u==null?void 0:u.metadata)==null?void 0:Q.image)==null?void 0:ie.prompt)===void 0,children:j("parameters.usePrompt")}),l.jsx(pr,{onClickCapture:D,isDisabled:((U=(oe=u==null?void 0:u.metadata)==null?void 0:oe.image)==null?void 0:U.seed)===void 0,children:j("parameters.useSeed")}),l.jsx(pr,{onClickCapture:V,isDisabled:!["txt2img","img2img"].includes((ne=(K=u==null?void 0:u.metadata)==null?void 0:K.image)==null?void 0:ne.type),children:j("parameters.useAll")}),l.jsx(pr,{onClickCapture:F,isDisabled:((Re=(ce=u==null?void 0:u.metadata)==null?void 0:ce.image)==null?void 0:Re.type)!=="img2img",children:j("parameters.useInitImg")}),l.jsx(pr,{onClickCapture:_,children:j("parameters.sendToImg2Img")}),l.jsx(pr,{onClickCapture:z,children:j("parameters.sendToUnifiedCanvas")}),l.jsx(pr,{"data-warning":!0,children:l.jsx(uc,{image:u,children:l.jsx("p",{children:j("parameters.deleteImage")})})})]})},children:Q=>l.jsxs(We,{position:"relative",onMouseOver:P,onMouseOut:I,userSelect:"none",draggable:!0,onDragStart:X,ref:Q,sx:{padding:2,display:"flex",justifyContent:"center",transition:"transform 0.2s ease-out",_hover:{cursor:"pointer",zIndex:2},_before:{content:'""',display:"block",paddingBottom:"100%"}},children:[l.jsx(ds,{objectFit:c?"contain":r,rounded:"md",src:p||h,loading:"lazy",sx:{position:"absolute",width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",top:"50%",transform:"translate(-50%,-50%)",...k==="rtl"?{insetInlineEnd:"50%"}:{insetInlineStart:"50%"}}}),l.jsx(B,{onClick:L,sx:{position:"absolute",top:"0",insetInlineStart:"0",width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},children:f&&l.jsx(Jt,{as:zc,sx:{width:"50%",height:"50%",fill:"ok.500"}})}),S&&i>=64&&l.jsx(We,{sx:{position:"absolute",top:1,insetInlineEnd:1},children:l.jsx(uc,{image:u,children:l.jsx(le,{"aria-label":j("parameters.deleteImage"),icon:l.jsx(Z8,{}),size:"xs",fontSize:14,isDisabled:!s})})})]},g)})},_9);$y.displayName="HoverableImage";const D9="0px",dp="calc(70px + 1rem)",O9=4,fp=1.5,A9=`calc(100vw - ${D9})`,z9=`calc(100vh - ${fp*4}px)`,R9=`calc(100vh - ${dp})`,n0=`calc(100vh - (${dp} + 6rem))`,N9=`calc(100vh - (${dp} + 4.4rem))`,Al="22.5rem";const F9=re(Ly,{shouldForwardProp:e=>!["sx"].includes(e)}),zl=320,r0=40,L9={txt2img:{galleryMinWidth:200,galleryMaxWidth:500},img2img:{galleryMinWidth:200,galleryMaxWidth:500},unifiedCanvas:{galleryMinWidth:200,galleryMaxWidth:200},nodes:{galleryMinWidth:200,galleryMaxWidth:500},postprocess:{galleryMinWidth:200,galleryMaxWidth:500},training:{galleryMinWidth:200,galleryMaxWidth:500}},i0=400;function Gy(){const e=Y(),{direction:t}=Ji(),{t:n}=Z(),{images:r,currentCategory:i,currentImageUuid:s,shouldPinGallery:c,shouldShowGallery:u,galleryImageMinimumWidth:f,galleryGridTemplateColumns:h,activeTabName:p,galleryImageObjectFit:g,shouldHoldGalleryOpen:y,shouldAutoSwitchToNewImages:S,areMoreImagesAvailable:C,galleryWidth:w,isLightboxOpen:k,isStaging:j,shouldEnableResize:M,shouldUseSingleGalleryColumn:P}=O(t9),{galleryMinWidth:I,galleryMaxWidth:T}=k?{galleryMinWidth:i0,galleryMaxWidth:i0}:L9[p],[D,_]=x.useState(w>=zl),[z,V]=x.useState(!1),[F,L]=x.useState(0),X=x.useRef(null),$=x.useRef(null),Q=x.useRef(null);x.useEffect(()=>{_(w>=zl)},[w]);const ie=()=>{!c&&e(Fi(!0)),e(tC(!c)),e(on(!0))},oe=()=>{u?K():U()},U=()=>{e(Fi(!0)),c&&e(on(!0))},K=x.useCallback(()=>{e(Fi(!1)),e(KS(!1)),setTimeout(()=>c&&e(on(!0)),400)},[e,c]),ne=()=>{e(nC(i))},ce=J=>{e(Da(J))},Re=()=>{y||(Q.current=window.setTimeout(()=>K(),500))},ze=()=>{Q.current&&window.clearTimeout(Q.current)};fe("g",()=>{oe()},[u,c]),fe("left",()=>{e(N1())},{enabled:!j||p!=="unifiedCanvas"},[j]),fe("right",()=>{e(F1())},{enabled:!j||p!=="unifiedCanvas"},[j]),fe("shift+g",()=>{ie()},[c]),fe("esc",()=>{e(Fi(!1))},{enabled:()=>!c,preventDefault:!0},[c]);const Me=32;return fe("shift+up",()=>{if(f<256){const J=te.clamp(f+Me,32,256);e(Da(J))}},[f]),fe("shift+down",()=>{if(f>32){const J=te.clamp(f-Me,32,256);e(Da(J))}},[f]),x.useEffect(()=>{function J(ue){!c&&X.current&&!X.current.contains(ue.target)&&K()}return document.addEventListener("mousedown",J),()=>{document.removeEventListener("mousedown",J)}},[K,c]),l.jsx(Uy,{nodeRef:X,in:u||y,unmountOnExit:!0,timeout:200,classNames:`${t}-image-gallery-css-transition`,children:l.jsxs(We,{className:`${t}-image-gallery-css-transition`,sx:c?{zIndex:1,insetInlineEnd:0}:{zIndex:100,position:"fixed",height:"100vh",top:0,insetInlineEnd:0},ref:X,onMouseLeave:c?void 0:Re,onMouseEnter:c?void 0:ze,onMouseOver:c?void 0:ze,children:[l.jsxs(F9,{sx:{padding:4,display:"flex",flexDirection:"column",rowGap:4,borderRadius:c?"base":0,borderInlineStartWidth:5,bg:"base.850",borderColor:"base.700"},minWidth:I,maxWidth:c?T:window.innerWidth,"data-pinned":c,handleStyles:t==="rtl"?{right:{width:"15px"}}:{left:{width:"15px"}},enable:t==="rtl"?{right:M}:{left:M},size:{width:w,height:c?"100%":"100vh"},onResizeStart:(J,ue,Ie)=>{L(Ie.clientHeight),Ie.style.height=`${Ie.clientHeight}px`,c&&(Ie.style.position="fixed",Ie.style.insetInlineEnd="1rem",V(!0))},onResizeStop:(J,ue,Ie,Be)=>{const Ne=c?te.clamp(Number(w)+Be.width,I,Number(T)):Number(w)+Be.width;e(QS(Ne)),Ie.removeAttribute("data-resize-alert"),c&&(console.log("unpin"),Ie.style.position="relative",Ie.style.removeProperty("inset-inline-end"),Ie.style.setProperty("height",c?"100%":"100vh"),V(!1),e(on(!0)))},onResize:(J,ue,Ie,Be)=>{const Ne=te.clamp(Number(w)+Be.width,I,Number(c?T:.95*window.innerWidth));Ne>=zl&&!D?_(!0):NeNe-r0&&e(Da(Ne-r0)),c&&(Ne>=T?Ie.setAttribute("data-resize-alert","true"):Ie.removeAttribute("data-resize-alert")),Ie.style.height=`${F}px`},children:[l.jsxs(B,{alignItems:"center",gap:2,justifyContent:"space-between",children:[l.jsx(en,{size:"sm",isAttached:!0,w:"max-content",justifyContent:"stretch",children:D?l.jsxs(l.Fragment,{children:[l.jsx(Je,{size:"sm",isChecked:i==="result",onClick:()=>e(gl("result")),flexGrow:1,children:n("gallery.generations")}),l.jsx(Je,{size:"sm",isChecked:i==="user",onClick:()=>e(gl("user")),flexGrow:1,children:n("gallery.uploads")})]}):l.jsxs(l.Fragment,{children:[l.jsx(le,{"aria-label":n("gallery.showGenerations"),tooltip:n("gallery.showGenerations"),isChecked:i==="result",icon:l.jsx(L8,{}),onClick:()=>e(gl("result"))}),l.jsx(le,{"aria-label":n("gallery.showUploads"),tooltip:n("gallery.showUploads"),isChecked:i==="user",icon:l.jsx(e9,{}),onClick:()=>e(gl("user"))})]})}),l.jsxs(B,{gap:2,children:[l.jsx(rr,{triggerComponent:l.jsx(le,{size:"sm","aria-label":n("gallery.gallerySettings"),icon:l.jsx(sp,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(ut,{value:f,onChange:ce,min:32,max:256,hideTooltip:!0,label:n("gallery.galleryImageSize"),withReset:!0,handleReset:()=>e(Da(64))}),l.jsx(pt,{label:n("gallery.maintainAspectRatio"),isChecked:g==="contain",onChange:()=>e(ZS(g==="contain"?"cover":"contain"))}),l.jsx(pt,{label:n("gallery.autoSwitchNewImages"),isChecked:S,onChange:J=>e(JS(J.target.checked))}),l.jsx(pt,{label:n("gallery.singleColumnLayout"),isChecked:P,onChange:J=>e(eC(J.target.checked))})]})}),l.jsx(le,{size:"sm","aria-label":n("gallery.pinGallery"),tooltip:`${n("gallery.pinGallery")} (Shift+G)`,onClick:ie,icon:c?l.jsx(By,{}):l.jsx(Hy,{})})]})]}),l.jsx(B,{direction:"column",gap:2,h:c?n0:"100vh",maxH:c?n0:"100vh",overflowY:"scroll",ref:$,sx:{...p2},children:r.length||C?l.jsxs(l.Fragment,{children:[l.jsx($n,{gap:2,style:{gridTemplateColumns:h},children:r.map(J=>{const{uuid:ue}=J,Ie=s===ue;return l.jsx($y,{image:J,isSelected:Ie},ue)})}),l.jsx(Je,{onClick:ne,isDisabled:!C,flexShrink:0,children:n(C?"gallery.loadMore":"gallery.allImagesLoaded")})]}):l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,padding:8,h:"100%",w:"100%",color:"base.500"},children:[l.jsx(Jt,{as:cp,sx:{w:16,h:16}}),l.jsx("p",{children:n("gallery.noImagesInGallery")})]})})]}),z&&l.jsx(We,{style:{width:`${w}px`,height:"100%"}})]})})}var B9=nh({displayName:"EditIcon",path:l.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})}),qy=nh({displayName:"ExternalLinkIcon",path:l.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[l.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),l.jsx("path",{d:"M15 3h6v6"}),l.jsx("path",{d:"M10 14L21 3"})]})}),H9=nh({displayName:"DeleteIcon",path:l.jsx("g",{fill:"currentColor",children:l.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"})})});function W9(e){return me({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 xt=({label:e,value:t,onClick:n,isLink:r,labelPosition:i,withCopy:s=!1})=>l.jsxs(B,{gap:2,children:[n&&l.jsx(Yt,{label:`Recall ${e}`,children:l.jsx(ci,{"aria-label":"Use this parameter",icon:l.jsx(W9,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&l.jsx(Yt,{label:`Copy ${e}`,children:l.jsx(ci,{"aria-label":`Copy ${e}`,icon:l.jsx(Jo,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),l.jsxs(B,{direction:i?"column":"row",children:[l.jsxs(Ce,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?l.jsxs($i,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",l.jsx(qy,{mx:"2px"})]}):l.jsx(Ce,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}),V9=(e,t)=>e.image.uuid===t.image.uuid,hp=x.memo(({image:e,styleClass:t})=>{var F,L;const n=Y(),r=lp();fe("esc",()=>{n(R1(!1))});const i=((F=e==null?void 0:e.metadata)==null?void 0:F.image)||{},s=e==null?void 0:e.dreamPrompt,{cfg_scale:c,fit:u,height:f,hires_fix:h,init_image_path:p,mask_image_path:g,orig_path:y,perlin:S,postprocessing:C,prompt:w,sampler:k,seamless:j,seed:M,steps:P,strength:I,threshold:T,type:D,variations:_,width:z}=i,V=JSON.stringify(e.metadata,null,2);return l.jsx(We,{className:t,sx:{position:"absolute",top:"0",width:"100%",borderRadius:"base",padding:4,overflow:"scroll",maxHeight:N9,height:"100%",zIndex:"10",backdropFilter:"blur(10px)",bg:"blackAlpha.600"},children:l.jsxs(B,{gap:1,direction:"column",width:"100%",children:[l.jsxs(B,{gap:2,children:[l.jsx(Ce,{fontWeight:"semibold",children:"File:"}),l.jsxs($i,{href:e.url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.url.length>64?e.url.substring(0,64).concat("..."):e.url,l.jsx(qy,{mx:"2px"})]})]}),Object.keys(i).length>0?l.jsxs(l.Fragment,{children:[D&&l.jsx(xt,{label:"Generation type",value:D}),((L=e.metadata)==null?void 0:L.model_weights)&&l.jsx(xt,{label:"Model",value:e.metadata.model_weights}),["esrgan","gfpgan"].includes(D)&&l.jsx(xt,{label:"Original image",value:y}),w&&l.jsx(xt,{label:"Prompt",labelPosition:"top",value:typeof w=="string"?w:D1(w),onClick:()=>r(w)}),M!==void 0&&l.jsx(xt,{label:"Seed",value:M,onClick:()=>n(as(M))}),T!==void 0&&l.jsx(xt,{label:"Noise Threshold",value:T,onClick:()=>n(ef(T))}),S!==void 0&&l.jsx(xt,{label:"Perlin Noise",value:S,onClick:()=>n(tf(S))}),k&&l.jsx(xt,{label:"Sampler",value:k,onClick:()=>n(L1(k))}),P&&l.jsx(xt,{label:"Steps",value:P,onClick:()=>n(nf(P))}),c!==void 0&&l.jsx(xt,{label:"CFG scale",value:c,onClick:()=>n(rf(c))}),_&&_.length>0&&l.jsx(xt,{label:"Seed-weight pairs",value:Nv(_),onClick:()=>n(B1(Nv(_)))}),j&&l.jsx(xt,{label:"Seamless",value:j,onClick:()=>n(H1(j))}),h&&l.jsx(xt,{label:"High Resolution Optimization",value:h,onClick:()=>n(W1(h))}),z&&l.jsx(xt,{label:"Width",value:z,onClick:()=>n(Wl(z))}),f&&l.jsx(xt,{label:"Height",value:f,onClick:()=>n(Vl(f))}),p&&l.jsx(xt,{label:"Initial image",value:p,isLink:!0,onClick:()=>n(os(p))}),g&&l.jsx(xt,{label:"Mask image",value:g,isLink:!0,onClick:()=>n(rC(g))}),D==="img2img"&&I&&l.jsx(xt,{label:"Image to image strength",value:I,onClick:()=>n(of(I))}),u&&l.jsx(xt,{label:"Image to image fit",value:u,onClick:()=>n(V1(u))}),C&&C.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Vn,{size:"sm",children:"Postprocessing"}),C.map((X,$)=>{if(X.type==="esrgan"){const{scale:Q,strength:ie,denoise_str:oe}=X;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${$+1}: Upscale (ESRGAN)`}),l.jsx(xt,{label:"Scale",value:Q,onClick:()=>n(M1(Q))}),l.jsx(xt,{label:"Strength",value:ie,onClick:()=>n(Jd(ie))}),oe!==void 0&&l.jsx(xt,{label:"Denoising strength",value:oe,onClick:()=>n(Zd(oe))})]},$)}else if(X.type==="gfpgan"){const{strength:Q}=X;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${$+1}: Face restoration (GFPGAN)`}),l.jsx(xt,{label:"Strength",value:Q,onClick:()=>{n(Zl(Q)),n(Hl("gfpgan"))}})]},$)}else if(X.type==="codeformer"){const{strength:Q,fidelity:ie}=X;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${$+1}: Face restoration (Codeformer)`}),l.jsx(xt,{label:"Strength",value:Q,onClick:()=>{n(Zl(Q)),n(Hl("codeformer"))}}),ie&&l.jsx(xt,{label:"Fidelity",value:ie,onClick:()=>{n(Qd(ie)),n(Hl("codeformer"))}})]},$)}})]}),s&&l.jsx(xt,{withCopy:!0,label:"Dream Prompt",value:s}),l.jsxs(B,{gap:2,direction:"column",children:[l.jsxs(B,{gap:2,children:[l.jsx(Yt,{label:"Copy metadata JSON",children:l.jsx(ci,{"aria-label":"Copy metadata JSON",icon:l.jsx(Jo,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(V)})}),l.jsx(Ce,{fontWeight:"semibold",children:"Metadata JSON:"})]}),l.jsx(We,{sx:{mt:0,mr:2,mb:4,ml:2,padding:4,borderRadius:"base",overflowX:"scroll",wordBreak:"break-all",bg:"whiteAlpha.100"},children:l.jsx("pre",{children:V})})]})]}):l.jsx(Cx,{width:"100%",pt:10,children:l.jsx(Ce,{fontSize:"lg",fontWeight:"semibold",children:"No metadata available"})})]})})},V9);hp.displayName="ImageMetadataViewer";const o0={height:"100%",width:"15%",alignItems:"center",pointerEvents:"auto"},a0={color:"base.100"},U9=be(Vr,e=>{const{currentImage:t}=e,n=e.categories[t?t.category:"result"].images,r=n.findIndex(s=>{var c;return s.uuid===((c=e==null?void 0:e.currentImage)==null?void 0:c.uuid)}),i=n.length;return{isOnFirstImage:r===0,isOnLastImage:!isNaN(r)&&r===i-1}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Yy=()=>{const e=Y(),{isOnFirstImage:t,isOnLastImage:n}=O(U9),[r,i]=x.useState(!1),s=()=>{i(!0)},c=()=>{i(!1)},u=()=>{e(N1())},f=()=>{e(F1())};return l.jsxs(B,{sx:{justifyContent:"space-between",zIndex:1,height:"100%",width:"100%",pointerEvents:"none"},children:[l.jsx($n,{sx:{...o0,justifyContent:"flex-start"},onMouseOver:s,onMouseOut:c,children:r&&!t&&l.jsx(ci,{"aria-label":"Previous image",icon:l.jsx(P8,{size:64}),variant:"unstyled",onClick:u,boxSize:16,sx:a0})}),l.jsx($n,{sx:{...o0,justifyContent:"flex-end"},onMouseOver:s,onMouseOut:c,children:r&&!n&&l.jsx(ci,{"aria-label":"Next image",icon:l.jsx(I8,{size:64}),variant:"unstyled",onClick:f,boxSize:16,sx:a0})})]})};var Wn=function(e,t){return Number(e.toFixed(t))},$9=function(e,t){return typeof e=="number"?e:t},Tt=function(e,t,n){n&&typeof n=="function"&&n(e,t)},G9=function(e){return-Math.cos(e*Math.PI)/2+.5},q9=function(e){return e},Y9=function(e){return e*e},X9=function(e){return e*(2-e)},K9=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},Q9=function(e){return e*e*e},Z9=function(e){return--e*e*e+1},J9=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},eP=function(e){return e*e*e*e},tP=function(e){return 1- --e*e*e*e},nP=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},rP=function(e){return e*e*e*e*e},iP=function(e){return 1+--e*e*e*e*e},oP=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},Xy={easeOut:G9,linear:q9,easeInQuad:Y9,easeOutQuad:X9,easeInOutQuad:K9,easeInCubic:Q9,easeOutCubic:Z9,easeInOutCubic:J9,easeInQuart:eP,easeOutQuart:tP,easeInOutQuart:nP,easeInQuint:rP,easeOutQuint:iP,easeInOutQuint:oP},Ky=function(e){typeof e=="number"&&cancelAnimationFrame(e)},gr=function(e){e.mounted&&(Ky(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function Qy(e,t,n,r){if(e.mounted){var i=new Date().getTime(),s=1;gr(e),e.animation=function(){if(!e.mounted)return Ky(e.animation);var c=new Date().getTime()-i,u=c/n,f=Xy[t],h=f(u);c>=n?(r(s),e.animation=null):e.animation&&(r(h),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function aP(e){var t=e.scale,n=e.positionX,r=e.positionY;return!(Number.isNaN(t)||Number.isNaN(n)||Number.isNaN(r))}function vi(e,t,n,r){var i=aP(t);if(!(!e.mounted||!i)){var s=e.setTransformState,c=e.transformState,u=c.scale,f=c.positionX,h=c.positionY,p=t.scale-u,g=t.positionX-f,y=t.positionY-h;n===0?s(t.scale,t.positionX,t.positionY):Qy(e,r,n,function(S){var C=u+p*S,w=f+g*S,k=h+y*S;s(C,w,k)})}}function sP(e,t,n){var r=e.offsetWidth,i=e.offsetHeight,s=t.offsetWidth,c=t.offsetHeight,u=s*n,f=c*n,h=r-u,p=i-f;return{wrapperWidth:r,wrapperHeight:i,newContentWidth:u,newDiffWidth:h,newContentHeight:f,newDiffHeight:p}}var lP=function(e,t,n,r,i,s,c){var u=e>t?n*(c?1:.5):0,f=r>i?s*(c?1:.5):0,h=e-t-u,p=u,g=r-i-f,y=f;return{minPositionX:h,maxPositionX:p,minPositionY:g,maxPositionY:y}},pp=function(e,t){var n=e.wrapperComponent,r=e.contentComponent,i=e.setup.centerZoomedOut;if(!n||!r)throw new Error("Components are not mounted");var s=sP(n,r,t),c=s.wrapperWidth,u=s.wrapperHeight,f=s.newContentWidth,h=s.newDiffWidth,p=s.newContentHeight,g=s.newDiffHeight,y=lP(c,f,h,u,p,g,Boolean(i));return y},Df=function(e,t,n,r){return r?en?Wn(n,2):Wn(e,2):Wn(e,2)},ea=function(e,t){var n=pp(e,t);return e.bounds=n,n};function Nc(e,t,n,r,i,s,c){var u=n.minPositionX,f=n.minPositionY,h=n.maxPositionX,p=n.maxPositionY,g=0,y=0;c&&(g=i,y=s);var S=Df(e,u-g,h+g,r),C=Df(t,f-y,p+y,r);return{x:S,y:C}}function Fc(e,t,n,r,i,s){var c=e.transformState,u=c.scale,f=c.positionX,h=c.positionY,p=r-u;if(typeof t!="number"||typeof n!="number")return console.error("Mouse X and Y position were not provided!"),{x:f,y:h};var g=f-t*p,y=h-n*p,S=Nc(g,y,i,s,0,0,null);return S}function ys(e,t,n,r,i){var s=i?r:0,c=t-s;return!Number.isNaN(n)&&e>=n?n:!Number.isNaN(t)&&e<=c?c:e}var s0=function(e,t){var n=e.setup.panning.excluded,r=e.isInitialized,i=e.wrapperComponent,s=t.target,c=i==null?void 0:i.contains(s),u=r&&s&&c;if(!u)return!1;var f=Lc(s,n);return!f},l0=function(e){var t=e.isInitialized,n=e.isPanning,r=e.setup,i=r.panning.disabled,s=t&&n&&!i;return!!s},cP=function(e,t){var n=e.transformState,r=n.positionX,i=n.positionY;e.isPanning=!0;var s=t.clientX,c=t.clientY;e.startCoords={x:s-r,y:c-i}},uP=function(e,t){var n=t.touches,r=e.transformState,i=r.positionX,s=r.positionY;e.isPanning=!0;var c=n.length===1;if(c){var u=n[0].clientX,f=n[0].clientY;e.startCoords={x:u-i,y:f-s}}};function dP(e){var t=e.transformState,n=t.positionX,r=t.positionY,i=t.scale,s=e.setup,c=s.disabled,u=s.limitToBounds,f=s.centerZoomedOut,h=e.wrapperComponent;if(!(c||!h||!e.bounds)){var p=e.bounds,g=p.maxPositionX,y=p.minPositionX,S=p.maxPositionY,C=p.minPositionY,w=n>g||nS||rg?h.offsetWidth:e.setup.minPositionX||0,M=r>S?h.offsetHeight:e.setup.minPositionY||0,P=Fc(e,j,M,i,e.bounds,u||f),I=P.x,T=P.y;return{scale:i,positionX:w?I:n,positionY:k?T:r}}}function fP(e,t,n,r,i){var s=e.setup.limitToBounds,c=e.wrapperComponent,u=e.bounds,f=e.transformState,h=f.scale,p=f.positionX,g=f.positionY;if(!(c===null||u===null||t===p&&n===g)){var y=Nc(t,n,u,s,r,i,c),S=y.x,C=y.y;e.setTransformState(h,S,C)}}var hP=function(e,t,n){var r=e.startCoords,i=e.transformState,s=e.setup.panning,c=s.lockAxisX,u=s.lockAxisY,f=i.positionX,h=i.positionY;if(!r)return{x:f,y:h};var p=t-r.x,g=n-r.y,y=c?f:p,S=u?h:g;return{x:y,y:S}},dc=function(e,t){var n=e.setup,r=e.transformState,i=r.scale,s=n.minScale,c=n.disablePadding;return t>0&&i>=s&&!c?t:0},pP=function(e){var t=e.mounted,n=e.setup,r=n.disabled,i=n.velocityAnimation,s=e.transformState.scale,c=i.disabled,u=!c||s>1||!r||t;return!!u},mP=function(e){var t=e.mounted,n=e.velocity,r=e.bounds,i=e.setup,s=i.disabled,c=i.velocityAnimation,u=e.transformState.scale,f=c.disabled,h=!f||u>1||!s||t;return!(!h||!n||!r)};function vP(e,t){var n=e.setup.velocityAnimation,r=n.equalToMove,i=n.animationTime,s=n.sensitivity;return r?i*t*s:i}function c0(e,t,n,r,i,s,c,u,f,h){if(i){if(t>c&&n>c){var p=c+(e-c)*h;return p>f?f:ps?s:p}}return r?t:Df(e,s,c,i)}function gP(e,t){var n=1;return t?Math.min(n,e.offsetWidth/window.innerWidth):n}function xP(e,t){var n=pP(e);if(n){var r=e.lastMousePosition,i=e.velocityTime,s=e.setup,c=e.wrapperComponent,u=s.velocityAnimation.equalToMove,f=Date.now();if(r&&i&&c){var h=gP(c,u),p=t.x-r.x,g=t.y-r.y,y=p/h,S=g/h,C=f-i,w=p*p+g*g,k=Math.sqrt(w)/C;e.velocity={velocityX:y,velocityY:S,total:k}}e.lastMousePosition=t,e.velocityTime=f}}function yP(e){var t=e.velocity,n=e.bounds,r=e.setup,i=e.wrapperComponent,s=mP(e);if(!(!s||!t||!n||!i)){var c=t.velocityX,u=t.velocityY,f=t.total,h=n.maxPositionX,p=n.minPositionX,g=n.maxPositionY,y=n.minPositionY,S=r.limitToBounds,C=r.alignmentAnimation,w=r.zoomAnimation,k=r.panning,j=k.lockAxisY,M=k.lockAxisX,P=w.animationType,I=C.sizeX,T=C.sizeY,D=C.velocityAlignmentTime,_=D,z=vP(e,f),V=Math.max(z,_),F=dc(e,I),L=dc(e,T),X=F*i.offsetWidth/100,$=L*i.offsetHeight/100,Q=h+X,ie=p-X,oe=g+$,U=y-$,K=e.transformState,ne=new Date().getTime();Qy(e,P,V,function(ce){var Re=e.transformState,ze=Re.scale,Me=Re.positionX,J=Re.positionY,ue=new Date().getTime()-ne,Ie=ue/_,Be=Xy[C.animationType],Ne=1-Be(Math.min(1,Ie)),Ge=1-ce,Qe=Me+c*Ge,ve=J+u*Ge,_e=c0(Qe,K.positionX,Me,M,S,p,h,ie,Q,Ne),qe=c0(ve,K.positionY,J,j,S,y,g,U,oe,Ne);(Me!==Qe||J!==ve)&&e.setTransformState(ze,_e,qe)})}}function u0(e,t){var n=e.transformState.scale;gr(e),ea(e,n),window.TouchEvent!==void 0&&t instanceof TouchEvent?uP(e,t):cP(e,t)}function Zy(e){var t=e.transformState.scale,n=e.setup,r=n.minScale,i=n.alignmentAnimation,s=i.disabled,c=i.sizeX,u=i.sizeY,f=i.animationTime,h=i.animationType,p=s||t.1&&g;y?yP(e):Zy(e)}}function mp(e,t,n,r){var i=e.setup,s=i.minScale,c=i.maxScale,u=i.limitToBounds,f=ys(Wn(t,2),s,c,0,!1),h=ea(e,f),p=Fc(e,n,r,f,h,u),g=p.x,y=p.y;return{scale:f,positionX:g,positionY:y}}function Jy(e,t,n){var r=e.transformState.scale,i=e.wrapperComponent,s=e.setup,c=s.minScale,u=s.limitToBounds,f=s.zoomAnimation,h=f.disabled,p=f.animationTime,g=f.animationType,y=h||r>=c;if((r>=1||u)&&Zy(e),!(y||!i||!e.mounted)){var S=t||i.offsetWidth/2,C=n||i.offsetHeight/2,w=mp(e,c,S,C);w&&vi(e,w,p,g)}}var li=function(){return li=Object.assign||function(t){for(var n,r=1,i=arguments.length;rc||Math.sign(n.deltaY)!==Math.sign(t.deltaY)||n.deltaY>0&&n.deltaYt.deltaY||Math.sign(n.deltaY)!==Math.sign(t.deltaY):!1},RP=function(e,t){var n=e.setup.pinch,r=n.disabled,i=n.excluded,s=e.isInitialized,c=t.target,u=s&&!r&&c;if(!u)return!1;var f=Lc(c,i);return!f},NP=function(e){var t=e.setup.pinch.disabled,n=e.isInitialized,r=e.pinchStartDistance,i=n&&!t&&r;return!!i},FP=function(e,t,n){var r=n.getBoundingClientRect(),i=e.touches,s=Wn(i[0].clientX-r.left,5),c=Wn(i[0].clientY-r.top,5),u=Wn(i[1].clientX-r.left,5),f=Wn(i[1].clientY-r.top,5);return{x:(s+u)/2/t,y:(c+f)/2/t}},a4=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},LP=function(e,t){var n=e.pinchStartScale,r=e.pinchStartDistance,i=e.setup,s=i.maxScale,c=i.minScale,u=i.zoomAnimation,f=i.disablePadding,h=u.size,p=u.disabled;if(!n||r===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var g=t/r,y=g*n;return ys(Wn(y,2),c,s,h,!p&&!f)},BP=160,HP=100,WP=function(e,t){var n=e.props,r=n.onWheelStart,i=n.onZoomStart;e.wheelStopEventTimer||(gr(e),Tt(dt(e),t,r),Tt(dt(e),t,i))},VP=function(e,t){var n=e.props,r=n.onWheel,i=n.onZoom,s=e.contentComponent,c=e.setup,u=e.transformState,f=u.scale,h=c.limitToBounds,p=c.centerZoomedOut,g=c.zoomAnimation,y=c.wheel,S=c.disablePadding,C=g.size,w=g.disabled,k=y.step;if(!s)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var j=OP(t,null),M=AP(e,j,k,!t.ctrlKey);if(f!==M){var P=ea(e,M),I=o4(t,s,f),T=w||C===0||p||S,D=h&&T,_=Fc(e,I.x,I.y,M,P,D),z=_.x,V=_.y;e.previousWheelEvent=t,e.setTransformState(M,z,V),Tt(dt(e),t,r),Tt(dt(e),t,i)}},UP=function(e,t){var n=e.props,r=n.onWheelStop,i=n.onZoomStop;Of(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(Jy(e,t.x,t.y),e.wheelAnimationTimer=null)},HP);var s=zP(e,t);s&&(Of(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Tt(dt(e),t,r),Tt(dt(e),t,i))},BP))},$P=function(e,t){var n=a4(t);e.pinchStartDistance=n,e.lastDistance=n,e.pinchStartScale=e.transformState.scale,e.isPanning=!1,gr(e)},GP=function(e,t){var n=e.contentComponent,r=e.pinchStartDistance,i=e.transformState.scale,s=e.setup,c=s.limitToBounds,u=s.centerZoomedOut,f=s.zoomAnimation,h=f.disabled,p=f.size;if(!(r===null||!n)){var g=FP(t,i,n);if(!(!Number.isFinite(g.x)||!Number.isFinite(g.y))){var y=a4(t),S=LP(e,y);if(S!==i){var C=ea(e,S),w=h||p===0||u,k=c&&w,j=Fc(e,g.x,g.y,S,C,k),M=j.x,P=j.y;e.pinchMidpoint=g,e.lastDistance=y,e.setTransformState(S,M,P)}}}},qP=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,Jy(e,t==null?void 0:t.x,t==null?void 0:t.y)},s4=function(e,t){var n=e.props.onZoomStop,r=e.setup.doubleClick.animationTime;Of(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Tt(dt(e),t,n)},r)},YP=function(e,t){var n=e.props,r=n.onZoomStart,i=n.onZoom,s=e.setup.doubleClick,c=s.animationTime,u=s.animationType;Tt(dt(e),t,r),r4(e,c,u,function(){return Tt(dt(e),t,i)}),s4(e,t)};function XP(e,t){var n=e.setup,r=e.doubleClickStopEventTimer,i=e.transformState,s=e.contentComponent,c=i.scale,u=e.props,f=u.onZoomStart,h=u.onZoom,p=n.doubleClick,g=p.disabled,y=p.mode,S=p.step,C=p.animationTime,w=p.animationType;if(!g&&!r){if(y==="reset")return YP(e,t);if(!s)return console.error("No ContentComponent found");var k=y==="zoomOut"?-1:1,j=t4(e,k,S);if(c!==j){Tt(dt(e),t,f);var M=o4(t,s,c),P=mp(e,j,M.x,M.y);if(!P)return console.error("Error during zoom event. New transformation state was not calculated.");Tt(dt(e),t,h),vi(e,P,C,w),s4(e,t)}}}var KP=function(e,t){var n=e.isInitialized,r=e.setup,i=e.wrapperComponent,s=r.doubleClick,c=s.disabled,u=s.excluded,f=t.target,h=i==null?void 0:i.contains(f),p=n&&f&&h&&!c;if(!p)return!1;var g=Lc(f,u);return!g},QP=function(){function e(t){var n=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){n.initializeWindowEvents()},this.unmount=function(){n.cleanupWindowEvents()},this.update=function(r){ea(n,n.transformState.scale),n.setup=h0(r)},this.initializeWindowEvents=function(){var r,i=Fd(),s=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,c=s==null?void 0:s.defaultView;c==null||c.addEventListener("mousedown",n.onPanningStart,i),c==null||c.addEventListener("mousemove",n.onPanning,i),c==null||c.addEventListener("mouseup",n.onPanningStop,i),s==null||s.addEventListener("mouseleave",n.clearPanning,i),c==null||c.addEventListener("keyup",n.setKeyUnPressed,i),c==null||c.addEventListener("keydown",n.setKeyPressed,i)},this.cleanupWindowEvents=function(){var r,i,s=Fd(),c=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,u=c==null?void 0:c.defaultView;u==null||u.removeEventListener("mousedown",n.onPanningStart,s),u==null||u.removeEventListener("mousemove",n.onPanning,s),u==null||u.removeEventListener("mouseup",n.onPanningStop,s),c==null||c.removeEventListener("mouseleave",n.clearPanning,s),u==null||u.removeEventListener("keyup",n.setKeyUnPressed,s),u==null||u.removeEventListener("keydown",n.setKeyPressed,s),document.removeEventListener("mouseleave",n.clearPanning,s),gr(n),(i=n.observer)===null||i===void 0||i.disconnect()},this.handleInitializeWrapperEvents=function(r){var i=Fd();r.addEventListener("wheel",n.onWheelZoom,i),r.addEventListener("dblclick",n.onDoubleClick,i),r.addEventListener("touchstart",n.onTouchPanningStart,i),r.addEventListener("touchmove",n.onTouchPanning,i),r.addEventListener("touchend",n.onTouchPanningStop,i)},this.handleInitialize=function(r){var i=n.setup.centerOnInit;n.applyTransformation(),i&&(n.setCenter(),n.observer=new ResizeObserver(function(){var s;n.setCenter(),(s=n.observer)===null||s===void 0||s.disconnect()}),n.observer.observe(r))},this.onWheelZoom=function(r){var i=n.setup.disabled;if(!i){var s=_P(n,r);if(s){var c=n.isPressingKeys(n.setup.wheel.activationKeys);c&&(WP(n,r),VP(n,r),UP(n,r))}}},this.onPanningStart=function(r){var i=n.setup.disabled,s=n.props.onPanningStart;if(!i){var c=s0(n,r);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),gr(n),u0(n,r),Tt(dt(n),r,s))}}},this.onPanning=function(r){var i=n.setup.disabled,s=n.props.onPanning;if(!i){var c=l0(n);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),d0(n,r.clientX,r.clientY),Tt(dt(n),r,s))}}},this.onPanningStop=function(r){var i=n.props.onPanningStop;n.isPanning&&(bP(n),Tt(dt(n),r,i))},this.onPinchStart=function(r){var i=n.setup.disabled,s=n.props,c=s.onPinchingStart,u=s.onZoomStart;if(!i){var f=RP(n,r);f&&($P(n,r),gr(n),Tt(dt(n),r,c),Tt(dt(n),r,u))}},this.onPinch=function(r){var i=n.setup.disabled,s=n.props,c=s.onPinching,u=s.onZoom;if(!i){var f=NP(n);f&&(r.preventDefault(),r.stopPropagation(),GP(n,r),Tt(dt(n),r,c),Tt(dt(n),r,u))}},this.onPinchStop=function(r){var i=n.props,s=i.onPinchingStop,c=i.onZoomStop;n.pinchStartScale&&(qP(n),Tt(dt(n),r,s),Tt(dt(n),r,c))},this.onTouchPanningStart=function(r){var i=n.setup.disabled,s=n.props.onPanningStart;if(!i){var c=s0(n,r);if(c){var u=n.lastTouch&&+new Date-n.lastTouch<200;if(u&&r.touches.length===1)n.onDoubleClick(r);else{n.lastTouch=+new Date,gr(n);var f=r.touches,h=f.length===1,p=f.length===2;h&&(gr(n),u0(n,r),Tt(dt(n),r,s)),p&&n.onPinchStart(r)}}}},this.onTouchPanning=function(r){var i=n.setup.disabled,s=n.props.onPanning;if(n.isPanning&&r.touches.length===1){if(i)return;var c=l0(n);if(!c)return;r.preventDefault(),r.stopPropagation();var u=r.touches[0];d0(n,u.clientX,u.clientY),Tt(dt(n),r,s)}else r.touches.length>1&&n.onPinch(r)},this.onTouchPanningStop=function(r){n.onPanningStop(r),n.onPinchStop(r)},this.onDoubleClick=function(r){var i=n.setup.disabled;if(!i){var s=KP(n,r);s&&XP(n,r)}},this.clearPanning=function(r){n.isPanning&&n.onPanningStop(r)},this.setKeyPressed=function(r){n.pressedKeys[r.key]=!0},this.setKeyUnPressed=function(r){n.pressedKeys[r.key]=!1},this.isPressingKeys=function(r){return r.length?Boolean(r.find(function(i){return n.pressedKeys[i]})):!0},this.setTransformState=function(r,i,s){var c=n.props.onTransformed;if(!Number.isNaN(r)&&!Number.isNaN(i)&&!Number.isNaN(s)){r!==n.transformState.scale&&(n.transformState.previousScale=n.transformState.scale,n.transformState.scale=r),n.transformState.positionX=i,n.transformState.positionY=s;var u=dt(n);n.onChangeCallbacks.forEach(function(f){return f(u)}),Tt(u,{scale:r,positionX:i,positionY:s},c),n.applyTransformation()}else console.error("Detected NaN set state values")},this.setCenter=function(){if(n.wrapperComponent&&n.contentComponent){var r=i4(n.transformState.scale,n.wrapperComponent,n.contentComponent);n.setTransformState(r.scale,r.positionX,r.positionY)}},this.handleTransformStyles=function(r,i,s){return n.props.customTransform?n.props.customTransform(r,i,s):MP(r,i,s)},this.applyTransformation=function(){if(!(!n.mounted||!n.contentComponent)){var r=n.transformState,i=r.scale,s=r.positionX,c=r.positionY,u=n.handleTransformStyles(s,c,i);n.contentComponent.style.transform=u}},this.getContext=function(){return dt(n)},this.onChange=function(r){return n.onChangeCallbacks.has(r)||n.onChangeCallbacks.add(r),function(){n.onChangeCallbacks.delete(r)}},this.init=function(r,i){n.cleanupWindowEvents(),n.wrapperComponent=r,n.contentComponent=i,ea(n,n.transformState.scale),n.handleInitializeWrapperEvents(r),n.handleInitialize(i),n.initializeWindowEvents(),n.isInitialized=!0,Tt(dt(n),void 0,n.props.onInit)},this.props=t,this.setup=h0(this.props),this.transformState=e4(this.props)}return e}(),Bc=ke.createContext(null),ZP=function(e,t){return typeof e=="function"?e(t):e},JP=ke.forwardRef(function(e,t){var n=x.useState(0),r=n[1],i=e.children,s=x.useRef(new QP(e)).current,c=ZP(e.children,dt(s)),u=x.useCallback(function(){typeof i=="function"&&r(function(f){return f+1})},[i]);return x.useImperativeHandle(t,function(){return dt(s)},[s]),x.useEffect(function(){s.update(e)},[s,e]),x.useEffect(function(){return s.onChange(u)},[s,e,u]),ke.createElement(Bc.Provider,{value:s},c)});function eI(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",n==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var tI=`.transform-component-module_wrapper__7HFJe { - position: relative; - width: -moz-fit-content; - width: fit-content; - height: -moz-fit-content; - height: fit-content; - overflow: hidden; - -webkit-touch-callout: none; /* iOS Safari */ - -webkit-user-select: none; /* Safari */ - -khtml-user-select: none; /* Konqueror HTML */ - -moz-user-select: none; /* Firefox */ - -ms-user-select: none; /* Internet Explorer/Edge */ - user-select: none; - margin: 0; - padding: 0; -} -.transform-component-module_content__uCDPE { - display: flex; - flex-wrap: wrap; - width: -moz-fit-content; - width: fit-content; - height: -moz-fit-content; - height: fit-content; - margin: 0; - padding: 0; - transform-origin: 0% 0%; -} -.transform-component-module_content__uCDPE img { - pointer-events: none; -} -`,p0={wrapper:"transform-component-module_wrapper__7HFJe",content:"transform-component-module_content__uCDPE"};eI(tI);var nI=function(e){var t=e.children,n=e.wrapperClass,r=n===void 0?"":n,i=e.contentClass,s=i===void 0?"":i,c=e.wrapperStyle,u=e.contentStyle,f=e.wrapperProps,h=f===void 0?{}:f,p=e.contentProps,g=p===void 0?{}:p,y=x.useContext(Bc).init,S=x.useRef(null),C=x.useRef(null);return x.useEffect(function(){var w=S.current,k=C.current;w!==null&&k!==null&&y&&y(w,k)},[]),ke.createElement("div",li({},h,{ref:S,className:"react-transform-wrapper ".concat(p0.wrapper," ").concat(r),style:c}),ke.createElement("div",li({},g,{ref:C,className:"react-transform-component ".concat(p0.content," ").concat(s),style:u}),t))},l4=function(){var e=x.useContext(Bc),t=x.useState(dt(e||{})),n=t[0],r=t[1];if(!e)throw new Error("Transform context mus be placed inside TransformWrapper");return x.useEffect(function(){e.onChange(function(i){r(i)})},[e]),n};ke.forwardRef(function(e,t){var n=x.useRef(null),r=x.useContext(Bc);return x.useEffect(function(){return r.onChange(function(i){if(n.current){var s=0,c=0;n.current.style.transform=r.handleTransformStyles(s,c,1/i.state.scale)}})},[r]),ke.createElement("div",li({},e,{ref:TP([n,t])}))});const rI=()=>{const[e,t]=x.useState(0),[n,r]=x.useState(1),[i,s]=x.useState(1);return{rotation:e,scaleX:n,scaleY:i,flipHorizontally:()=>{r(n*-1)},flipVertically:()=>{s(i*-1)},rotateCounterClockwise:()=>{t(e===-270?0:e-90)},rotateClockwise:()=>{t(e===270?0:e+90)},reset:()=>{t(0),r(1),s(1)}}},iI=({flipHorizontally:e,flipVertically:t,rotateCounterClockwise:n,rotateClockwise:r,reset:i})=>{const{zoomIn:s,zoomOut:c,resetTransform:u}=l4();return l.jsxs(en,{isAttached:!0,orientation:"vertical",children:[l.jsx(le,{icon:l.jsx(t8,{}),"aria-label":"Zoom In",tooltip:"Zoom In",onClick:()=>s(),fontSize:20}),l.jsx(le,{icon:l.jsx(n8,{}),"aria-label":"Zoom Out",tooltip:"Zoom Out",onClick:()=>c(),fontSize:20}),l.jsx(le,{icon:l.jsx(J7,{}),"aria-label":"Rotate Counter-Clockwise",tooltip:"Rotate Counter-Clockwise",onClick:n,fontSize:20}),l.jsx(le,{icon:l.jsx(e8,{}),"aria-label":"Rotate Clockwise",tooltip:"Rotate Clockwise",onClick:r,fontSize:20}),l.jsx(le,{icon:l.jsx(Jg,{}),"aria-label":"Flip Horizontally",tooltip:"Flip Horizontally",onClick:e,fontSize:20}),l.jsx(le,{icon:l.jsx(Jg,{style:{transform:"rotate(90deg)"}}),"aria-label":"Flip Vertically",tooltip:"Flip Vertically",onClick:t,fontSize:20}),l.jsx(le,{icon:l.jsx(ep,{}),"aria-label":"Reset",tooltip:"Reset",onClick:()=>{u(),i()},fontSize:20})]})};function oI({image:e,alt:t,ref:n,styleClass:r,rotation:i,scaleX:s,scaleY:c}){const{centerView:u}=l4();return l.jsx(nI,{wrapperStyle:{width:"100%",height:"100%"},children:l.jsx("img",{style:{transform:`rotate(${i}deg) scaleX(${s}) scaleY(${c})`,width:"100%"},src:e,alt:t,ref:n,className:r||"",onLoad:()=>u(1,0,"easeOut")})})}const aI=be([Vr,ro],(e,t)=>{const{currentImage:n}=e,{shouldShowImageDetails:r}=t;return{viewerImageToDisplay:n,shouldShowImageDetails:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function sI(){const e=Y(),t=O(y=>y.lightbox.isLightboxOpen),{rotation:n,scaleX:r,scaleY:i,flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:h}=rI(),{viewerImageToDisplay:p,shouldShowImageDetails:g}=O(aI);return fe("Esc",()=>{t&&e(Bi(!1))},[t]),l.jsx(JP,{centerOnInit:!0,minScale:.1,initialPositionX:50,initialPositionY:50,children:l.jsxs(We,{sx:{width:"100%",height:"100%",overflow:"hidden",position:"absolute",insetInlineStart:0,top:0,zIndex:30,animation:"popIn 0.3s ease-in",bg:"base.800"},children:[l.jsxs(B,{sx:{flexDir:"column",position:"absolute",top:4,insetInlineStart:4,gap:4,zIndex:3},children:[l.jsx(le,{icon:l.jsx(Z7,{}),"aria-label":"Exit Viewer",onClick:()=>{e(Bi(!1))},fontSize:20}),l.jsx(iI,{flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:h})]}),l.jsxs(B,{children:[l.jsxs($n,{sx:{overflow:"hidden",gridTemplateColumns:"auto max-content",placeItems:"center",width:"100vw",height:"100vh",bg:"base.850"},children:[p&&l.jsxs(l.Fragment,{children:[l.jsx(oI,{rotation:n,scaleX:r,scaleY:i,image:p.url,styleClass:"lightbox-image"}),g&&l.jsx(hp,{image:p})]}),!g&&l.jsx(We,{sx:{position:"absolute",top:0,insetInlineStart:0,w:`calc(100vw - ${8*2*4}px)`,h:"100vh",mx:8,pointerEvents:"none"},children:l.jsx(Yy,{})}),l.jsx(We,{sx:{position:"absolute",top:4},children:l.jsx(Fy,{})})]}),l.jsx(Gy,{})]})]})})}function lI(e){const{menuType:t="icon",iconTooltip:n,buttonText:r,isLazy:i=!0,menuItems:s,menuProps:c,menuButtonProps:u,menuListProps:f,menuItemProps:h}=e,p=()=>{const g=[];return s.forEach((y,S)=>{g.push(l.jsx(pr,{onClick:y.onClick,fontSize:"sm",...h,children:y.item},S))}),g};return l.jsx(Rh,{...c,isLazy:i,children:({isOpen:g})=>l.jsxs(l.Fragment,{children:[l.jsx(Fh,{as:t==="icon"?ci:to,tooltip:n,"aria-label":n,icon:g?l.jsx(w9,{}):l.jsx(C9,{}),paddingX:0,paddingY:t==="regular"?2:0,...u,children:t==="regular"&&r}),l.jsx(Nh,{zIndex:15,padding:0,...f,children:p()})]})})}const cI=be(Pt,e=>({isProcessing:e.isProcessing,isConnected:e.isConnected,isCancelable:e.isCancelable,currentIteration:e.currentIteration,totalIterations:e.totalIterations,cancelType:e.cancelOptions.cancelType,cancelAfter:e.cancelOptions.cancelAfter}),{memoizeOptions:{resultEqualityCheck:te.isEqual}});function vp(e){const t=Y(),{btnGroupWidth:n="auto",...r}=e,{isProcessing:i,isConnected:s,isCancelable:c,currentIteration:u,totalIterations:f,cancelType:h,cancelAfter:p}=O(cI),g=x.useCallback(()=>{t(iC()),t(dd(null))},[t]),{t:y}=Z(),S=p!==null;fe("shift+x",()=>{(s||i)&&c&&g()},[s,i,c]),x.useEffect(()=>{p!==null&&pt(Fv("immediate"))},{item:y("parameters.cancel.schedule"),onClick:()=>t(Fv("scheduled"))}];return l.jsxs(en,{isAttached:!0,width:n,children:[h==="immediate"?l.jsx(le,{icon:l.jsx(k9,{}),tooltip:y("parameters.cancel.immediate"),"aria-label":y("parameters.cancel.immediate"),isDisabled:!s||!i||!c,onClick:g,colorScheme:"error",...r}):l.jsx(le,{icon:S?l.jsx(ic,{}):l.jsx(h9,{}),tooltip:y(S?"parameters.cancel.isScheduled":"parameters.cancel.schedule"),"aria-label":y(S?"parameters.cancel.isScheduled":"parameters.cancel.schedule"),isDisabled:!s||!i||!c||u===f,onClick:()=>{t(S?dd(null):dd(u))},colorScheme:"error",...r}),l.jsx(lI,{menuItems:C,iconTooltip:y("parameters.cancel.setType"),menuButtonProps:{colorScheme:"error",minWidth:5}})]})}const gp=e=>e.generation;be(gp,({shouldRandomizeSeed:e,shouldGenerateVariations:t})=>e||t,{memoizeOptions:{resultEqualityCheck:te.isEqual}});const c4=be([gp,Pt,Ny,Bt],(e,t,n,r)=>{const{prompt:i,shouldGenerateVariations:s,seedWeights:c,initialImage:u,seed:f}=e,{isProcessing:h,isConnected:p}=t;let g=!0;const y=[];return(!i||Boolean(i.match(/^[\s\r\n]+$/)))&&(g=!1,y.push("Missing prompt")),r==="img2img"&&!u&&(g=!1,y.push("No initial image selected")),h&&(g=!1,y.push("System Busy")),p||(g=!1,y.push("System Disconnected")),s&&(!(U1(c)||c==="")||f===-1)&&(g=!1,y.push("Seed-Weights badly formatted.")),{isReady:g,reasonsWhyNotReady:y}},{memoizeOptions:{equalityCheck:te.isEqual,resultEqualityCheck:te.isEqual}});function xp(e){const{iconButton:t=!1,...n}=e,r=Y(),{isReady:i}=O(c4),s=O(Bt),c=()=>{r(af(s))},{t:u}=Z();return fe(["ctrl+enter","meta+enter"],()=>{r($1()),r(af(s))},{enabled:()=>i,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[i,s]),l.jsx(We,{style:{flexGrow:4},children:t?l.jsx(le,{"aria-label":u("parameters.invoke"),type:"submit",icon:l.jsx($8,{}),isDisabled:!i,onClick:c,flexGrow:1,w:"100%",tooltip:u("parameters.invoke"),tooltipProps:{placement:"bottom"},colorScheme:"accent",...n}):l.jsx(Je,{"aria-label":u("parameters.invoke"),type:"submit",isDisabled:!i,onClick:c,flexGrow:1,w:"100%",colorScheme:"accent",fontWeight:700,...n,children:"Invoke"})})}const Ld={borderStartStartRadius:0,borderEndStartRadius:0},yp=be([Vr,ro,Bt],(e,t,n)=>{const{shouldPinParametersPanel:r,shouldShowParametersPanel:i,shouldHoldParametersPanelOpen:s,shouldUseCanvasBetaLayout:c}=t,{shouldShowGallery:u,shouldPinGallery:f,shouldHoldGalleryOpen:h}=e,p=c&&n==="unifiedCanvas",g=!p&&!(i||s&&!r)&&["txt2img","img2img","unifiedCanvas"].includes(n),y=!(u||h&&!f)&&["txt2img","img2img","unifiedCanvas"].includes(n);return{shouldPinParametersPanel:r,shouldShowProcessButtons:!p&&(!r||!i),shouldShowParametersPanelButton:g,shouldShowParametersPanel:i,shouldShowGallery:u,shouldPinGallery:f,shouldShowGalleryButton:y}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),uI=()=>{const e=Y(),{shouldShowParametersPanelButton:t,shouldShowProcessButtons:n,shouldPinParametersPanel:r}=O(yp),i=()=>{e(Hi(!0)),r&&setTimeout(()=>e(on(!0)),400)};return t?l.jsxs(B,{pos:"absolute",transform:"translate(0, -50%)",zIndex:20,minW:8,top:"50%",insetInlineStart:"4.5rem",direction:"column",gap:2,children:[l.jsx(le,{tooltip:"Show Options Panel (O)",tooltipProps:{placement:"top"},"aria-label":"Show Options Panel",onClick:i,sx:Ld,children:l.jsx(ap,{})}),n&&l.jsxs(l.Fragment,{children:[l.jsx(xp,{iconButton:!0,sx:Ld}),l.jsx(vp,{sx:Ld})]})]}):null},dI=be(Vr,e=>({resultImages:e.categories.result.images,userImages:e.categories.user.images})),fI=()=>{const{resultImages:e,userImages:t}=O(dI);return n=>{const r=e.find(s=>s.uuid===n);if(r)return r;const i=t.find(s=>s.uuid===n);if(i)return i}},hI=be([ro,Ac,Bt],(e,t,n)=>{const{shouldPinParametersPanel:r}=e,{isLightboxOpen:i}=t;return{shouldPinParametersPanel:r,isLightboxOpen:i,activeTabName:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),bp=e=>{const t=Y(),{optionsPanel:n,children:r,...i}=e,{activeTabName:s,isLightboxOpen:c}=O(hI),u=fI(),f=h=>{const p=h.dataTransfer.getData("invokeai/imageUuid"),g=u(p);g&&(s==="img2img"?t(os(g)):s==="unifiedCanvas"&&t(bc(g)))};return l.jsx(We,{...i,pos:"relative",w:"100%",h:"100%",children:l.jsxs(B,{gap:4,h:"100%",children:[n,l.jsx(We,{pos:"relative",w:"100%",h:"100%",onDrop:f,children:r}),!c&&l.jsx(Gy,{})]})})},pI=e=>{const{styleClass:t}=e,n=x.useContext(Qh),r=()=>{n&&n()};return l.jsx(B,{sx:{width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},className:t,children:l.jsxs(B,{onClick:r,sx:{display:"flex",flexDirection:"column",rowGap:8,p:8,borderRadius:"base",alignItems:"center",justifyContent:"center",textAlign:"center",cursor:"pointer",color:"base.600",bg:"base.800",_hover:{bg:"base.700"}},children:[l.jsx(Jt,{as:Rc,boxSize:24}),l.jsx(Vn,{size:"md",children:"Click or Drag and Drop"})]})})},mI=be([Vr,ro],(e,t)=>{const{currentImage:n,intermediateImage:r}=e,{shouldShowImageDetails:i}=t;return{imageToDisplay:r||n,isIntermediate:Boolean(r),shouldShowImageDetails:i}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function vI(){const{shouldShowImageDetails:e,imageToDisplay:t,isIntermediate:n}=O(mI);return l.jsxs(B,{sx:{position:"relative",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:[t&&l.jsx(ds,{src:t.url,sx:{objectFit:"contain",maxWidth:"100%",maxHeight:"100%",height:"auto",position:"absolute",imageRendering:n?"pixelated":"initial",borderRadius:"base"},...n&&{width:t.width,height:t.height}}),!e&&l.jsx(Yy,{}),e&&t&&l.jsx(hp,{image:t,styleClass:"current-image-metadata"})]})}const gI=be([Vr],e=>{const{currentImage:t,intermediateImage:n}=e;return{hasAnImageToDisplay:t||n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),u4=()=>{const{hasAnImageToDisplay:e}=O(gI);return l.jsx(B,{sx:{flexDirection:"column",height:"100%",width:"100%",rowGap:4,borderRadius:"base"},children:e?l.jsxs(l.Fragment,{children:[l.jsx(Fy,{}),l.jsx(vI,{})]}):l.jsx(B,{sx:{alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:l.jsx(Jt,{as:S9,sx:{boxSize:24,color:"base.500"}})})})},xI=()=>{const e=x.useContext(Qh);return l.jsx(le,{"aria-label":"Upload Image",tooltip:"Upload Image",icon:l.jsx(Rc,{}),onClick:e||void 0})};function yI(){const e=O(s=>s.generation.initialImage),{t}=Z(),n=Y(),r=us(),i=()=>{r({title:t("toast.parametersFailed"),description:t("toast.parametersFailedDesc"),status:"error",isClosable:!0}),n(oC())};return l.jsxs(l.Fragment,{children:[l.jsxs(B,{sx:{alignItems:"center",justifyContent:"center",w:"100%",gap:4},children:[l.jsx(Ce,{sx:{fontSize:"lg"},variant:"subtext",children:t("parameters.initialImage")}),l.jsx(xI,{})]}),e&&l.jsx(B,{sx:{position:"relative",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:l.jsx(ds,{sx:{fit:"contain",maxWidth:"100%",maxHeight:"100%",borderRadius:"base",objectFit:"contain",position:"absolute"},src:typeof e=="string"?e:e.url,onError:i})})]})}const m0={flexDirection:"column",height:"100%",width:"100%",gap:4,padding:4},bI=()=>{const t=O(n=>n.generation.initialImage)?l.jsx(B,{flexDirection:"column",gap:4,w:"100%",h:"100%",children:l.jsx(yI,{})}):l.jsx(pI,{});return l.jsxs($n,{sx:{w:"100%",h:"100%",gridTemplateColumns:"1fr 1fr",borderRadius:"base",bg:"base.850"},children:[l.jsx(B,{sx:{...m0,paddingInlineEnd:2},children:t}),l.jsx(B,{sx:{...m0,paddingInlineStart:2},children:l.jsx(u4,{})})]})};var dn=(e=>(e[e.PROMPT=0]="PROMPT",e[e.GALLERY=1]="GALLERY",e[e.OTHER=2]="OTHER",e[e.SEED=3]="SEED",e[e.VARIATIONS=4]="VARIATIONS",e[e.UPSCALE=5]="UPSCALE",e[e.FACE_CORRECTION=6]="FACE_CORRECTION",e[e.IMAGE_TO_IMAGE=7]="IMAGE_TO_IMAGE",e[e.BOUNDING_BOX=8]="BOUNDING_BOX",e[e.SEAM_CORRECTION=9]="SEAM_CORRECTION",e[e.INFILL_AND_SCALING=10]="INFILL_AND_SCALING",e))(dn||{});const SI=()=>{const{t:e}=Z();return x.useMemo(()=>({[0]:{text:e("tooltip.feature.prompt"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[1]:{text:e("tooltip.feature.gallery"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[2]:{text:e("tooltip.feature.other"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[3]:{text:e("tooltip.feature.seed"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[4]:{text:e("tooltip.feature.variations"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[5]:{text:e("tooltip.feature.upscale"),href:"link/to/docs/feature1.html",guideImage:"asset/path.gif"},[6]:{text:e("tooltip.feature.faceCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[7]:{text:e("tooltip.feature.imageToImage"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[8]:{text:e("tooltip.feature.boundingBox"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[9]:{text:e("tooltip.feature.seamCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[10]:{text:e("tooltip.feature.infillAndScaling"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"}}),[e])},CI=e=>SI()[e];function d4(){const e=O(i=>i.system.isGFPGANAvailable),t=O(i=>i.postprocessing.shouldRunFacetool),n=Y(),r=i=>n(aC(i.target.checked));return l.jsx(En,{isDisabled:!e,isChecked:t,onChange:r})}const f4=()=>{const e=Y(),t=O(i=>i.generation.seamless),n=i=>e(H1(i.target.checked)),{t:r}=Z();return l.jsx(En,{label:r("parameters.seamlessTiling"),fontSize:"md",isChecked:t,onChange:n})},wI=()=>l.jsx(Le,{gap:2,alignItems:"stretch",children:l.jsx(f4,{})});function Sp(){const e=O(s=>s.generation.horizontalSymmetrySteps),t=O(s=>s.generation.verticalSymmetrySteps),n=O(s=>s.generation.steps),r=Y(),{t:i}=Z();return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(ut,{label:i("parameters.hSymmetryStep"),value:e,onChange:s=>r(Lv(s)),min:0,max:n,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>r(Lv(0))}),l.jsx(ut,{label:i("parameters.vSymmetryStep"),value:t,onChange:s=>r(Bv(s)),min:0,max:n,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>r(Bv(0))})]})}function Cp(){const e=O(n=>n.generation.shouldUseSymmetry),t=Y();return l.jsx(En,{isChecked:e,onChange:n=>t(sC(n.target.checked))})}function kI(){const e=Y(),t=O(r=>r.generation.perlin),{t:n}=Z();return l.jsx(ut,{label:n("parameters.perlinNoise"),min:0,max:1,step:.05,onChange:r=>e(tf(r)),handleReset:()=>e(tf(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}function jI(){const e=Y(),{t}=Z(),n=O(i=>i.generation.shouldRandomizeSeed),r=i=>e(lC(i.target.checked));return l.jsx(En,{label:t("parameters.randomizeSeed"),isChecked:n,onChange:r})}const v0=/^-?(0\.)?\.?$/,Lr=e=>{const{label:t,isDisabled:n=!1,showStepper:r=!0,isInvalid:i,value:s,onChange:c,min:u,max:f,isInteger:h=!0,formControlProps:p,formLabelProps:g,numberInputFieldProps:y,numberInputStepperProps:S,tooltipProps:C,...w}=e,[k,j]=x.useState(String(s));x.useEffect(()=>{!k.match(v0)&&s!==Number(k)&&j(String(s))},[s,k]);const M=I=>{j(I),I.match(v0)||c(h?Math.floor(Number(I)):Number(I))},P=I=>{const T=te.clamp(h?Math.floor(Number(I.target.value)):Number(I.target.value),u,f);j(String(T)),c(T)};return l.jsx(Yt,{...C,children:l.jsxs(rt,{isDisabled:n,isInvalid:i,...p,children:[t&&l.jsx(st,{...g,children:t}),l.jsxs(Bh,{value:k,min:u,max:f,keepWithinRange:!0,clampValueOnBlur:!1,onChange:M,onBlur:P,...w,children:[l.jsx(Wh,{...y}),r&&l.jsxs(Hh,{children:[l.jsx(Uh,{...S}),l.jsx(Vh,{...S})]})]})]})})};function EI(){const e=Y(),t=O(i=>i.generation.shouldRandomizeSeed),{t:n}=Z(),r=()=>e(as(cC(q1,G1)));return l.jsx(to,{size:"sm",isDisabled:t,onClick:r,padding:"0 1.5rem",children:l.jsx("p",{children:n("parameters.shuffle")})})}function PI(){const e=O(c=>c.generation.seed),t=O(c=>c.generation.shouldRandomizeSeed),n=O(c=>c.generation.shouldGenerateVariations),{t:r}=Z(),i=Y(),s=c=>i(as(c));return l.jsxs(sa,{gap:2,children:[l.jsx(Lr,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:q1,max:G1,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e,formControlProps:{display:"flex",alignItems:"center",gap:3}}),l.jsx(EI,{})]})}function II(){const e=Y(),t=O(r=>r.generation.threshold),{t:n}=Z();return l.jsx(ut,{label:n("parameters.noiseThreshold"),min:0,max:20,step:.1,onChange:r=>e(ef(r)),handleReset:()=>e(ef(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}const wp=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(jI,{}),l.jsx(PI,{}),l.jsx(II,{}),l.jsx(kI,{})]});function h4(){const e=O(i=>i.system.isESRGANAvailable),t=O(i=>i.postprocessing.shouldRunESRGAN),n=Y(),r=i=>n(uC(i.target.checked));return l.jsx(En,{isDisabled:!e,isChecked:t,onChange:r})}function kp(){const e=O(r=>r.generation.shouldGenerateVariations),t=Y(),n=r=>t(dC(r.target.checked));return l.jsx(En,{isChecked:e,width:"auto",onChange:n})}function mt(e){const{label:t="",isDisabled:n=!1,isInvalid:r,formControlProps:i,...s}=e;return l.jsxs(rt,{isInvalid:r,isDisabled:n,...i,children:[t!==""&&l.jsx(st,{children:t}),l.jsx(wh,{...s})]})}function MI(){const e=O(s=>s.generation.seedWeights),t=O(s=>s.generation.shouldGenerateVariations),{t:n}=Z(),r=Y(),i=s=>r(B1(s.target.value));return l.jsx(mt,{label:n("parameters.seedWeights"),value:e,isInvalid:t&&!(U1(e)||e===""),isDisabled:!t,onChange:i})}function TI(){const e=O(i=>i.generation.variationAmount),t=O(i=>i.generation.shouldGenerateVariations),{t:n}=Z(),r=Y();return l.jsx(ut,{label:n("parameters.variationAmount"),value:e,step:.01,min:0,max:1,isSliderDisabled:!t,isInputDisabled:!t,isResetDisabled:!t,onChange:i=>r(Hv(i)),handleReset:()=>r(Hv(.1)),withInput:!0,withReset:!0,withSliderMarks:!0})}const jp=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(TI,{}),l.jsx(MI,{})]});function g0(){const e=Y(),t=O(s=>s.generation.cfgScale),n=O(s=>s.ui.shouldUseSliders),{t:r}=Z(),i=s=>e(rf(s));return n?l.jsx(ut,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:30,onChange:i,handleReset:()=>e(rf(7.5)),value:t,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0}):l.jsx(Lr,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:200,onChange:i,value:t,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})}function x0(){const e=O(s=>s.generation.height),t=O(s=>s.ui.shouldUseSliders),n=O(Bt),r=Y(),{t:i}=Z();return t?l.jsx(ut,{isSliderDisabled:n==="unifiedCanvas",isInputDisabled:n==="unifiedCanvas",isResetDisabled:n==="unifiedCanvas",label:i("parameters.height"),value:e,min:64,step:64,max:2048,onChange:s=>r(Vl(s)),handleReset:()=>r(Vl(512)),withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:15360}}):l.jsx(Mn,{isDisabled:n==="unifiedCanvas",label:i("parameters.height"),value:e,flexGrow:1,onChange:s=>r(Vl(Number(s.target.value))),validValues:fC})}function y0(){const e=O(s=>s.generation.iterations),t=O(s=>s.ui.shouldUseSliders),n=Y(),{t:r}=Z(),i=s=>n(Wv(s));return t?l.jsx(ut,{label:r("parameters.images"),step:1,min:1,max:16,onChange:i,handleReset:()=>n(Wv(1)),value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:9999}}):l.jsx(Lr,{label:r("parameters.images"),step:1,min:1,max:9999,onChange:i,value:e,numberInputFieldProps:{textAlign:"center"}})}function b0(){const e=O(s=>s.generation.sampler),t=O(wy),n=Y(),{t:r}=Z(),i=s=>n(L1(s.target.value));return l.jsx(Mn,{label:r("parameters.sampler"),value:e,onChange:i,validValues:t.format==="diffusers"?hC:pC,minWidth:36})}function S0(){const e=Y(),t=O(c=>c.generation.steps),n=O(c=>c.ui.shouldUseSliders),{t:r}=Z(),i=c=>{e(nf(c))},s=()=>{e($1())};return n?l.jsx(ut,{label:r("parameters.steps"),min:1,step:1,onChange:i,handleReset:()=>e(nf(20)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:9999}}):l.jsx(Lr,{label:r("parameters.steps"),min:1,max:9999,step:1,onChange:i,value:t,numberInputFieldProps:{textAlign:"center"},onBlur:s})}function C0(){const e=O(s=>s.generation.width),t=O(s=>s.ui.shouldUseSliders),n=O(Bt),{t:r}=Z(),i=Y();return t?l.jsx(ut,{isSliderDisabled:n==="unifiedCanvas",isInputDisabled:n==="unifiedCanvas",isResetDisabled:n==="unifiedCanvas",label:r("parameters.width"),value:e,min:64,step:64,max:2048,onChange:s=>i(Wl(s)),handleReset:()=>i(Wl(512)),withInput:!0,withReset:!0,withSliderMarks:!0,inputReadOnly:!0,sliderNumberInputProps:{max:15360}}):l.jsx(Mn,{isDisabled:n==="unifiedCanvas",label:r("parameters.width"),value:e,flexGrow:1,onChange:s=>i(Wl(Number(s.target.value))),validValues:mC})}function Ep(){return O(t=>t.ui.shouldUseSliders)?l.jsxs(Le,{gap:2,children:[l.jsx(y0,{}),l.jsx(S0,{}),l.jsx(g0,{}),l.jsx(C0,{}),l.jsx(x0,{}),l.jsx(b0,{})]}):l.jsxs(B,{rowGap:2,flexDirection:"column",children:[l.jsxs(B,{columnGap:1,children:[l.jsx(y0,{}),l.jsx(S0,{}),l.jsx(g0,{})]}),l.jsxs(B,{columnGap:1,children:[l.jsx(C0,{}),l.jsx(x0,{}),l.jsx(b0,{})]})]})}const _I=be(Pt,e=>e.shouldDisplayGuides),DI=({children:e,feature:t})=>{const n=O(_I),{text:r}=CI(t);return n?l.jsxs(qh,{trigger:"hover",children:[l.jsx(Gh,{children:l.jsx(We,{children:e})}),l.jsxs(Xh,{maxWidth:"400px",onClick:i=>i.preventDefault(),cursor:"initial",children:[l.jsx(Yh,{}),l.jsx(Zx,{children:r})]})]}):null},OI=he(({feature:e,icon:t=p9},n)=>l.jsx(DI,{feature:e,children:l.jsx(We,{ref:n,children:l.jsx(Jt,{marginBottom:"-.15rem",as:t})})}));function AI(e){const{header:t,feature:n,content:r,additionalHeaderComponents:i}=e;return l.jsxs(No,{children:[l.jsx(zo,{children:l.jsxs(B,{width:"100%",gap:2,align:"center",children:[l.jsx(We,{flexGrow:1,textAlign:"start",children:t}),i,n&&l.jsx(OI,{feature:n}),l.jsx(Ro,{})]})}),l.jsx(Lo,{children:r})]})}const Pp=e=>{const{accordionInfo:t}=e,n=O(c=>c.system.openAccordions),r=Y(),i=c=>r(vC(c)),s=()=>{const c=[];return t&&Object.keys(t).forEach(u=>{const{header:f,feature:h,content:p,additionalHeaderComponents:g}=t[u];c.push(l.jsx(AI,{header:f,feature:h,content:p,additionalHeaderComponents:g},u))}),c};return l.jsx(sh,{defaultIndex:n,allowMultiple:!0,reduceMotion:!0,onChange:i,children:s()})},zI=be(rp,({shouldLoopback:e})=>e),RI=()=>{const e=Y(),t=O(zI),{t:n}=Z();return l.jsx(le,{"aria-label":n("parameters.toggleLoopback"),tooltip:n("parameters.toggleLoopback"),isChecked:t,icon:l.jsx(q8,{}),onClick:()=>{e(gC(!t))}})},Ip=()=>{const e=O(Bt);return l.jsxs(B,{gap:2,children:[l.jsx(xp,{}),e==="img2img"&&l.jsx(RI,{}),l.jsx(vp,{})]})},Mp=()=>{const e=O(r=>r.generation.negativePrompt),t=Y(),{t:n}=Z();return l.jsx(rt,{children:l.jsx(Kh,{id:"negativePrompt",name:"negativePrompt",value:e,onChange:r=>t(A1(r.target.value)),placeholder:n("parameters.negativePrompts"),_focusVisible:{borderColor:"error.600"},fontSize:"sm"})})},NI=be([e=>e.generation,Bt],(e,t)=>({prompt:e.prompt,activeTabName:t}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Tp=()=>{const e=Y(),{prompt:t,activeTabName:n}=O(NI),{isReady:r}=O(c4),i=x.useRef(null),{t:s}=Z(),c=f=>{e(O1(f.target.value))};fe("alt+a",()=>{var f;(f=i.current)==null||f.focus()},[]);const u=f=>{f.key==="Enter"&&f.shiftKey===!1&&r&&(f.preventDefault(),e(af(n)))};return l.jsx(We,{children:l.jsx(rt,{isInvalid:t.length===0||Boolean(t.match(/^[\s\r\n]+$/)),children:l.jsx(Kh,{id:"prompt",name:"prompt",placeholder:s("parameters.promptPlaceholder"),value:t,onChange:c,onKeyDown:u,resize:"vertical",ref:i,minH:40})})})},FI=""+new URL("logo-13003d72.png",import.meta.url).href,p4=()=>{const e=O(t=>t.system.app_version);return l.jsxs(B,{alignItems:"center",gap:3,ps:1,children:[l.jsx(ds,{src:FI,alt:"invoke-ai-logo",w:"32px",h:"32px"}),l.jsxs(Ce,{fontSize:"xl",children:["invoke ",l.jsx("strong",{children:"ai"})]}),l.jsx(Ce,{sx:{fontWeight:300,marginTop:1},variant:"subtext",children:e})]})};const LI=be(ro,e=>{const{shouldShowParametersPanel:t,shouldHoldParametersPanelOpen:n,shouldPinParametersPanel:r,parametersPanelScrollPosition:i}=e;return{shouldShowParametersPanel:t,shouldHoldParametersPanelOpen:n,shouldPinParametersPanel:r,parametersPanelScrollPosition:i}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),_p=e=>{const t=Y(),{direction:n}=Ji(),{shouldShowParametersPanel:r,shouldHoldParametersPanelOpen:i,shouldPinParametersPanel:s}=O(LI),c=x.useRef(null),u=x.useRef(null),f=x.useRef(null),{children:h}=e,{t:p}=Z();fe("o",()=>{t(Hi(!r)),s&&setTimeout(()=>t(on(!0)),400)},[r,s]),fe("esc",()=>{t(Hi(!1))},{enabled:()=>!s,preventDefault:!0},[s]),fe("shift+o",()=>{C(),t(on(!0))},[s]);const g=x.useCallback(()=>{s||(t(xC(u.current?u.current.scrollTop:0)),t(Hi(!1)),t(yC(!1)))},[t,s]),y=()=>{f.current=window.setTimeout(()=>g(),500)},S=()=>{f.current&&window.clearTimeout(f.current)},C=()=>{t(bC(!s)),t(on(!0))};return x.useEffect(()=>{function w(k){c.current&&!c.current.contains(k.target)&&g()}return document.addEventListener("mousedown",w),()=>{document.removeEventListener("mousedown",w)}},[g]),l.jsx(Uy,{nodeRef:c,in:r||i&&!s,unmountOnExit:!0,timeout:200,classNames:`${n}-parameters-panel-transition`,children:l.jsx(We,{className:`${n}-parameters-panel-transition`,tabIndex:1,ref:c,onMouseEnter:s?void 0:S,onMouseOver:s?void 0:S,sx:{borderInlineEndWidth:s?0:5,borderInlineEndStyle:"solid",bg:"base.900",borderColor:"base.700",height:R9,width:Al,maxWidth:Al,flexShrink:0,position:"relative",overflowY:"scroll",overflowX:"hidden",...p2,...!s&&{zIndex:20,position:"fixed",top:0,insetInlineStart:0,width:`calc(${Al} + 2rem)`,maxWidth:`calc(${Al} + 2rem)`,height:"100%"}},children:l.jsx(We,{sx:{margin:!s&&4},children:l.jsxs(B,{ref:u,onMouseLeave:w=>{w.target!==u.current?S():!s&&y()},sx:{display:"flex",flexDirection:"column",rowGap:2,height:"100%"},children:[l.jsx(Yt,{label:p("common.pinOptionsPanel"),children:l.jsx(We,{onClick:C,sx:{position:"absolute",cursor:"pointer",padding:2,top:4,insetInlineEnd:4,zIndex:20,...s&&{top:0,insetInlineEnd:0}},children:l.jsx(Jt,{sx:{opacity:.2},as:s?By:Hy})})}),!s&&l.jsx(We,{sx:{pt:fp,pb:2},children:l.jsx(p4,{})}),h]})})})})};function BI(){const e=Y(),t=O(i=>i.generation.shouldFitToWidthHeight),n=i=>e(V1(i.target.checked)),{t:r}=Z();return l.jsx(En,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function m4(e){const{t}=Z(),{label:n=`${t("parameters.strength")}`}=e,r=O(u=>u.generation.img2imgStrength),i=Y(),s=u=>i(of(u)),c=()=>{i(of(.75))};return l.jsx(ut,{label:n,step:.01,min:.01,max:1,onChange:s,value:r,isInteger:!1,withInput:!0,withSliderMarks:!0,inputWidth:22,withReset:!0,handleReset:c})}function HI(){const{t:e}=Z();return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(m4,{label:e("parameters.img2imgStrength")}),l.jsx(BI,{})]})}function WI(){const{t:e}=Z(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(Ep,{})},imageToImage:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(HI,{})},seed:{header:`${e("parameters.seed")}`,feature:dn.SEED,content:l.jsx(wp,{})},variations:{header:`${e("parameters.variations")}`,feature:dn.VARIATIONS,content:l.jsx(jp,{}),additionalHeaderComponents:l.jsx(kp,{})},face_restore:{header:`${e("parameters.faceRestoration")}`,feature:dn.FACE_CORRECTION,content:l.jsx(tp,{}),additionalHeaderComponents:l.jsx(d4,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:dn.UPSCALE,content:l.jsx(np,{}),additionalHeaderComponents:l.jsx(h4,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(Sp,{}),additionalHeaderComponents:l.jsx(Cp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:dn.OTHER,content:l.jsx(wI,{})}};return l.jsxs(_p,{children:[l.jsxs(B,{flexDir:"column",rowGap:2,children:[l.jsx(Tp,{}),l.jsx(Mp,{})]}),l.jsx(Ip,{}),l.jsx(Pp,{accordionInfo:t})]})}function VI(){return l.jsx(bp,{optionsPanel:l.jsx(WI,{}),children:l.jsx(bI,{})})}const UI=()=>l.jsx(We,{sx:{width:"100%",height:"100%",borderRadius:"base",bg:"base.850"},children:l.jsx(B,{sx:{p:4,width:"100%",height:"100%"},children:l.jsx(u4,{})})}),$I=be([rp],({hiresFix:e,hiresStrength:t})=>({hiresFix:e,hiresStrength:t}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),GI=()=>{const{hiresFix:e,hiresStrength:t}=O($I),n=Y(),{t:r}=Z(),i=c=>{n(Vv(c))},s=()=>{n(Vv(.75))};return l.jsx(ut,{label:r("parameters.hiresStrength"),step:.01,min:.01,max:.99,onChange:i,value:t,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})},qI=()=>{const e=Y(),t=O(i=>i.postprocessing.hiresFix),{t:n}=Z(),r=i=>e(W1(i.target.checked));return l.jsx(En,{label:n("parameters.hiresOptim"),fontSize:"md",isChecked:t,onChange:r})},YI=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(f4,{}),l.jsx(qI,{}),l.jsx(GI,{})]});function XI(){const{t:e}=Z(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(Ep,{})},seed:{header:`${e("parameters.seed")}`,feature:dn.SEED,content:l.jsx(wp,{})},variations:{header:`${e("parameters.variations")}`,feature:dn.VARIATIONS,content:l.jsx(jp,{}),additionalHeaderComponents:l.jsx(kp,{})},face_restore:{header:`${e("parameters.faceRestoration")}`,feature:dn.FACE_CORRECTION,content:l.jsx(tp,{}),additionalHeaderComponents:l.jsx(d4,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:dn.UPSCALE,content:l.jsx(np,{}),additionalHeaderComponents:l.jsx(h4,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(Sp,{}),additionalHeaderComponents:l.jsx(Cp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:dn.OTHER,content:l.jsx(YI,{})}};return l.jsxs(_p,{children:[l.jsxs(B,{flexDir:"column",rowGap:2,children:[l.jsx(Tp,{}),l.jsx(Mp,{})]}),l.jsx(Ip,{}),l.jsx(Pp,{accordionInfo:t})]})}function KI(){return l.jsx(bp,{optionsPanel:l.jsx(XI,{}),children:l.jsx(UI,{})})}var Af={},QI={get exports(){return Af},set exports(e){Af=e}};/** - * @license React - * react-reconciler.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 ZI=function(t){var n={},r=x,i=Ul,s=Object.assign;function c(o){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+o,d=1;dA||v[E]!==b[A]){var W=` -`+v[E].replace(" at new "," at ");return o.displayName&&W.includes("")&&(W=W.replace("",o.displayName)),W}while(1<=E&&0<=A);break}}}finally{eu=!1,Error.prepareStackTrace=d}return(o=o?o.displayName||o.name:"")?ha(o):""}var Ub=Object.prototype.hasOwnProperty,nu=[],uo=-1;function Gr(o){return{current:o}}function bt(o){0>uo||(o.current=nu[uo],nu[uo]=null,uo--)}function gt(o,a){uo++,nu[uo]=o.current,o.current=a}var qr={},an=Gr(qr),xn=Gr(!1),Si=qr;function fo(o,a){var d=o.type.contextTypes;if(!d)return qr;var m=o.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===a)return m.__reactInternalMemoizedMaskedChildContext;var v={},b;for(b in d)v[b]=a[b];return m&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=a,o.__reactInternalMemoizedMaskedChildContext=v),v}function yn(o){return o=o.childContextTypes,o!=null}function js(){bt(xn),bt(an)}function Jp(o,a,d){if(an.current!==qr)throw Error(c(168));gt(an,a),gt(xn,d)}function em(o,a,d){var m=o.stateNode;if(a=a.childContextTypes,typeof m.getChildContext!="function")return d;m=m.getChildContext();for(var v in m)if(!(v in a))throw Error(c(108,z(o)||"Unknown",v));return s({},d,m)}function Es(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||qr,Si=an.current,gt(an,o),gt(xn,xn.current),!0}function tm(o,a,d){var m=o.stateNode;if(!m)throw Error(c(169));d?(o=em(o,a,Si),m.__reactInternalMemoizedMergedChildContext=o,bt(xn),bt(an),gt(an,o)):bt(xn),gt(xn,d)}var Xn=Math.clz32?Math.clz32:qb,$b=Math.log,Gb=Math.LN2;function qb(o){return o>>>=0,o===0?32:31-($b(o)/Gb|0)|0}var Ps=64,Is=4194304;function pa(o){switch(o&-o){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 o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function Ms(o,a){var d=o.pendingLanes;if(d===0)return 0;var m=0,v=o.suspendedLanes,b=o.pingedLanes,E=d&268435455;if(E!==0){var A=E&~v;A!==0?m=pa(A):(b&=E,b!==0&&(m=pa(b)))}else E=d&~v,E!==0?m=pa(E):b!==0&&(m=pa(b));if(m===0)return 0;if(a!==0&&a!==m&&!(a&v)&&(v=m&-m,b=a&-a,v>=b||v===16&&(b&4194240)!==0))return a;if(m&4&&(m|=d&16),a=o.entangledLanes,a!==0)for(o=o.entanglements,a&=m;0d;d++)a.push(o);return a}function ma(o,a,d){o.pendingLanes|=a,a!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,a=31-Xn(a),o[a]=d}function Kb(o,a){var d=o.pendingLanes&~a;o.pendingLanes=a,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=a,o.mutableReadLanes&=a,o.entangledLanes&=a,a=o.entanglements;var m=o.eventTimes;for(o=o.expirationTimes;0>=E,v-=E,Er=1<<32-Xn(a)+v|d<ot?(Zt=$e,$e=null):Zt=$e.sibling;var at=ye(H,$e,G[ot],Se);if(at===null){$e===null&&($e=Zt);break}o&&$e&&at.alternate===null&&a(H,$e),R=b(at,R,ot),Xe===null?Oe=at:Xe.sibling=at,Xe=at,$e=Zt}if(ot===G.length)return d(H,$e),It&&wi(H,ot),Oe;if($e===null){for(;otot?(Zt=$e,$e=null):Zt=$e.sibling;var ti=ye(H,$e,at.value,Se);if(ti===null){$e===null&&($e=Zt);break}o&&$e&&ti.alternate===null&&a(H,$e),R=b(ti,R,ot),Xe===null?Oe=ti:Xe.sibling=ti,Xe=ti,$e=Zt}if(at.done)return d(H,$e),It&&wi(H,ot),Oe;if($e===null){for(;!at.done;ot++,at=G.next())at=Ue(H,at.value,Se),at!==null&&(R=b(at,R,ot),Xe===null?Oe=at:Xe.sibling=at,Xe=at);return It&&wi(H,ot),Oe}for($e=m(H,$e);!at.done;ot++,at=G.next())at=St($e,H,ot,at.value,Se),at!==null&&(o&&at.alternate!==null&&$e.delete(at.key===null?ot:at.key),R=b(at,R,ot),Xe===null?Oe=at:Xe.sibling=at,Xe=at);return o&&$e.forEach(function(zS){return a(H,zS)}),It&&wi(H,ot),Oe}function _r(H,R,G,Se){if(typeof G=="object"&&G!==null&&G.type===p&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case f:e:{for(var Oe=G.key,Xe=R;Xe!==null;){if(Xe.key===Oe){if(Oe=G.type,Oe===p){if(Xe.tag===7){d(H,Xe.sibling),R=v(Xe,G.props.children),R.return=H,H=R;break e}}else if(Xe.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===P&&bm(Oe)===Xe.type){d(H,Xe.sibling),R=v(Xe,G.props),R.ref=ga(H,Xe,G),R.return=H,H=R;break e}d(H,Xe);break}else a(H,Xe);Xe=Xe.sibling}G.type===p?(R=Ti(G.props.children,H.mode,Se,G.key),R.return=H,H=R):(Se=hl(G.type,G.key,G.props,null,H.mode,Se),Se.ref=ga(H,R,G),Se.return=H,H=Se)}return E(H);case h:e:{for(Xe=G.key;R!==null;){if(R.key===Xe)if(R.tag===4&&R.stateNode.containerInfo===G.containerInfo&&R.stateNode.implementation===G.implementation){d(H,R.sibling),R=v(R,G.children||[]),R.return=H,H=R;break e}else{d(H,R);break}else a(H,R);R=R.sibling}R=ud(G,H.mode,Se),R.return=H,H=R}return E(H);case P:return Xe=G._init,_r(H,R,Xe(G._payload),Se)}if(ie(G))return ft(H,R,G,Se);if(D(G))return wn(H,R,G,Se);Hs(H,G)}return typeof G=="string"&&G!==""||typeof G=="number"?(G=""+G,R!==null&&R.tag===6?(d(H,R.sibling),R=v(R,G),R.return=H,H=R):(d(H,R),R=cd(G,H.mode,Se),R.return=H,H=R),E(H)):d(H,R)}return _r}var xo=Sm(!0),Cm=Sm(!1),xa={},Nn=Gr(xa),ya=Gr(xa),yo=Gr(xa);function lr(o){if(o===xa)throw Error(c(174));return o}function wu(o,a){gt(yo,a),gt(ya,o),gt(Nn,xa),o=U(a),bt(Nn),gt(Nn,o)}function bo(){bt(Nn),bt(ya),bt(yo)}function wm(o){var a=lr(yo.current),d=lr(Nn.current);a=K(d,o.type,a),d!==a&&(gt(ya,o),gt(Nn,a))}function ku(o){ya.current===o&&(bt(Nn),bt(ya))}var _t=Gr(0);function Ws(o){for(var a=o;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Zp(d)||Zc(d)))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if(a.flags&128)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var ju=[];function Eu(){for(var o=0;od?d:4,o(!0);var m=Pu.transition;Pu.transition={};try{o(!1),a()}finally{it=d,Pu.transition=m}}function Hm(){return Fn().memoizedState}function lS(o,a,d){var m=Zr(o);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},Wm(o))Vm(a,d);else if(d=fm(o,a,d,m),d!==null){var v=un();Ln(d,o,m,v),Um(d,a,m)}}function cS(o,a,d){var m=Zr(o),v={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(Wm(o))Vm(a,v);else{var b=o.alternate;if(o.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var E=a.lastRenderedState,A=b(E,d);if(v.hasEagerState=!0,v.eagerState=A,Kn(A,E)){var W=a.interleaved;W===null?(v.next=v,yu(a)):(v.next=W.next,W.next=v),a.interleaved=v;return}}catch{}finally{}d=fm(o,a,v,m),d!==null&&(v=un(),Ln(d,o,m,v),Um(d,a,m))}}function Wm(o){var a=o.alternate;return o===Dt||a!==null&&a===Dt}function Vm(o,a){ba=Us=!0;var d=o.pending;d===null?a.next=a:(a.next=d.next,d.next=a),o.pending=a}function Um(o,a,d){if(d&4194240){var m=a.lanes;m&=o.pendingLanes,d|=m,a.lanes=d,ou(o,d)}}var qs={readContext:Rn,useCallback:sn,useContext:sn,useEffect:sn,useImperativeHandle:sn,useInsertionEffect:sn,useLayoutEffect:sn,useMemo:sn,useReducer:sn,useRef:sn,useState:sn,useDebugValue:sn,useDeferredValue:sn,useTransition:sn,useMutableSource:sn,useSyncExternalStore:sn,useId:sn,unstable_isNewReconciler:!1},uS={readContext:Rn,useCallback:function(o,a){return cr().memoizedState=[o,a===void 0?null:a],o},useContext:Rn,useEffect:Om,useImperativeHandle:function(o,a,d){return d=d!=null?d.concat([o]):null,$s(4194308,4,Rm.bind(null,a,o),d)},useLayoutEffect:function(o,a){return $s(4194308,4,o,a)},useInsertionEffect:function(o,a){return $s(4,2,o,a)},useMemo:function(o,a){var d=cr();return a=a===void 0?null:a,o=o(),d.memoizedState=[o,a],o},useReducer:function(o,a,d){var m=cr();return a=d!==void 0?d(a):a,m.memoizedState=m.baseState=a,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:a},m.queue=o,o=o.dispatch=lS.bind(null,Dt,o),[m.memoizedState,o]},useRef:function(o){var a=cr();return o={current:o},a.memoizedState=o},useState:_m,useDebugValue:Au,useDeferredValue:function(o){return cr().memoizedState=o},useTransition:function(){var o=_m(!1),a=o[0];return o=sS.bind(null,o[1]),cr().memoizedState=o,[a,o]},useMutableSource:function(){},useSyncExternalStore:function(o,a,d){var m=Dt,v=cr();if(It){if(d===void 0)throw Error(c(407));d=d()}else{if(d=a(),Qt===null)throw Error(c(349));ji&30||Em(m,a,d)}v.memoizedState=d;var b={value:d,getSnapshot:a};return v.queue=b,Om(Im.bind(null,m,b,o),[o]),m.flags|=2048,wa(9,Pm.bind(null,m,b,d,a),void 0,null),d},useId:function(){var o=cr(),a=Qt.identifierPrefix;if(It){var d=Pr,m=Er;d=(m&~(1<<32-Xn(m)-1)).toString(32)+d,a=":"+a+"R"+d,d=Sa++,0td&&(a.flags|=128,m=!0,Ea(v,!1),a.lanes=4194304)}else{if(!m)if(o=Ws(b),o!==null){if(a.flags|=128,m=!0,o=o.updateQueue,o!==null&&(a.updateQueue=o,a.flags|=4),Ea(v,!0),v.tail===null&&v.tailMode==="hidden"&&!b.alternate&&!It)return ln(a),null}else 2*Xt()-v.renderingStartTime>td&&d!==1073741824&&(a.flags|=128,m=!0,Ea(v,!1),a.lanes=4194304);v.isBackwards?(b.sibling=a.child,a.child=b):(o=v.last,o!==null?o.sibling=b:a.child=b,v.last=b)}return v.tail!==null?(a=v.tail,v.rendering=a,v.tail=a.sibling,v.renderingStartTime=Xt(),a.sibling=null,o=_t.current,gt(_t,m?o&1|2:o&1),a):(ln(a),null);case 22:case 23:return ad(),d=a.memoizedState!==null,o!==null&&o.memoizedState!==null!==d&&(a.flags|=8192),d&&a.mode&1?_n&1073741824&&(ln(a),ve&&a.subtreeFlags&6&&(a.flags|=8192)):ln(a),null;case 24:return null;case 25:return null}throw Error(c(156,a.tag))}function xS(o,a){switch(du(a),a.tag){case 1:return yn(a.type)&&js(),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return bo(),bt(xn),bt(an),Eu(),o=a.flags,o&65536&&!(o&128)?(a.flags=o&-65537|128,a):null;case 5:return ku(a),null;case 13:if(bt(_t),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(c(340));mo()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return bt(_t),null;case 4:return bo(),null;case 10:return gu(a.type._context),null;case 22:case 23:return ad(),null;case 24:return null;default:return null}}var Zs=!1,cn=!1,yS=typeof WeakSet=="function"?WeakSet:Set,we=null;function Co(o,a){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(m){Mt(o,a,m)}else d.current=null}function Vu(o,a,d){try{d()}catch(m){Mt(o,a,m)}}var cv=!1;function bS(o,a){for(ne(o.containerInfo),we=a;we!==null;)if(o=we,a=o.child,(o.subtreeFlags&1028)!==0&&a!==null)a.return=o,we=a;else for(;we!==null;){o=we;try{var d=o.alternate;if(o.flags&1024)switch(o.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var m=d.memoizedProps,v=d.memoizedState,b=o.stateNode,E=b.getSnapshotBeforeUpdate(o.elementType===o.type?m:Zn(o.type,m),v);b.__reactInternalSnapshotBeforeUpdate=E}break;case 3:ve&&bi(o.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(c(163))}}catch(A){Mt(o,o.return,A)}if(a=o.sibling,a!==null){a.return=o.return,we=a;break}we=o.return}return d=cv,cv=!1,d}function Pa(o,a,d){var m=a.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var v=m=m.next;do{if((v.tag&o)===o){var b=v.destroy;v.destroy=void 0,b!==void 0&&Vu(a,d,b)}v=v.next}while(v!==m)}}function Js(o,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&o)===o){var m=d.create;d.destroy=m()}d=d.next}while(d!==a)}}function Uu(o){var a=o.ref;if(a!==null){var d=o.stateNode;switch(o.tag){case 5:o=oe(d);break;default:o=d}typeof a=="function"?a(o):a.current=o}}function uv(o){var a=o.alternate;a!==null&&(o.alternate=null,uv(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&Ve(a)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function dv(o){return o.tag===5||o.tag===3||o.tag===4}function fv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||dv(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function $u(o,a,d){var m=o.tag;if(m===5||m===6)o=o.stateNode,a?hn(d,o,a):He(d,o);else if(m!==4&&(o=o.child,o!==null))for($u(o,a,d),o=o.sibling;o!==null;)$u(o,a,d),o=o.sibling}function Gu(o,a,d){var m=o.tag;if(m===5||m===6)o=o.stateNode,a?De(d,o,a):ee(d,o);else if(m!==4&&(o=o.child,o!==null))for(Gu(o,a,d),o=o.sibling;o!==null;)Gu(o,a,d),o=o.sibling}var tn=null,Jn=!1;function dr(o,a,d){for(d=d.child;d!==null;)qu(o,a,d),d=d.sibling}function qu(o,a,d){if(or&&typeof or.onCommitFiberUnmount=="function")try{or.onCommitFiberUnmount(Ts,d)}catch{}switch(d.tag){case 5:cn||Co(d,a);case 6:if(ve){var m=tn,v=Jn;tn=null,dr(o,a,d),tn=m,Jn=v,tn!==null&&(Jn?pn(tn,d.stateNode):$t(tn,d.stateNode))}else dr(o,a,d);break;case 18:ve&&tn!==null&&(Jn?Bb(tn,d.stateNode):Lb(tn,d.stateNode));break;case 4:ve?(m=tn,v=Jn,tn=d.stateNode.containerInfo,Jn=!0,dr(o,a,d),tn=m,Jn=v):(_e&&(m=d.stateNode.containerInfo,v=Yp(m),Qc(m,v)),dr(o,a,d));break;case 0:case 11:case 14:case 15:if(!cn&&(m=d.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){v=m=m.next;do{var b=v,E=b.destroy;b=b.tag,E!==void 0&&(b&2||b&4)&&Vu(d,a,E),v=v.next}while(v!==m)}dr(o,a,d);break;case 1:if(!cn&&(Co(d,a),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(A){Mt(d,a,A)}dr(o,a,d);break;case 21:dr(o,a,d);break;case 22:d.mode&1?(cn=(m=cn)||d.memoizedState!==null,dr(o,a,d),cn=m):dr(o,a,d);break;default:dr(o,a,d)}}function hv(o){var a=o.updateQueue;if(a!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new yS),a.forEach(function(m){var v=MS.bind(null,o,m);d.has(m)||(d.add(m),m.then(v,v))})}}function er(o,a){var d=a.deletions;if(d!==null)for(var m=0;m";case tl:return":has("+(Ku(o)||"")+")";case nl:return'[role="'+o.value+'"]';case il:return'"'+o.value+'"';case rl:return'[data-testname="'+o.value+'"]';default:throw Error(c(365))}}function yv(o,a){var d=[];o=[o,0];for(var m=0;mv&&(v=E),m&=~b}if(m=v,m=Xt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*CS(m/1960))-m,10o?16:o,Qr===null)var m=!1;else{if(o=Qr,Qr=null,cl=0,Ke&6)throw Error(c(331));var v=Ke;for(Ke|=4,we=o.current;we!==null;){var b=we,E=b.child;if(we.flags&16){var A=b.deletions;if(A!==null){for(var W=0;WXt()-ed?Pi(o,0):Ju|=d),Cn(o,a)}function Iv(o,a){a===0&&(o.mode&1?(a=Is,Is<<=1,!(Is&130023424)&&(Is=4194304)):a=1);var d=un();o=sr(o,a),o!==null&&(ma(o,a,d),Cn(o,d))}function IS(o){var a=o.memoizedState,d=0;a!==null&&(d=a.retryLane),Iv(o,d)}function MS(o,a){var d=0;switch(o.tag){case 13:var m=o.stateNode,v=o.memoizedState;v!==null&&(d=v.retryLane);break;case 19:m=o.stateNode;break;default:throw Error(c(314))}m!==null&&m.delete(a),Iv(o,d)}var Mv;Mv=function(o,a,d){if(o!==null)if(o.memoizedProps!==a.pendingProps||xn.current)bn=!0;else{if(!(o.lanes&d)&&!(a.flags&128))return bn=!1,vS(o,a,d);bn=!!(o.flags&131072)}else bn=!1,It&&a.flags&1048576&&am(a,Os,a.index);switch(a.lanes=0,a.tag){case 2:var m=a.type;Xs(o,a),o=a.pendingProps;var v=fo(a,an.current);go(a,d),v=Mu(null,a,m,o,v,d);var b=Tu();return a.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,yn(m)?(b=!0,Es(a)):b=!1,a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,bu(a),v.updater=Bs,a.stateNode=v,v._reactInternals=a,Cu(a,m,o,d),a=Fu(null,a,m,!0,b,d)):(a.tag=0,It&&b&&uu(a),mn(null,a,v,d),a=a.child),a;case 16:m=a.elementType;e:{switch(Xs(o,a),o=a.pendingProps,v=m._init,m=v(m._payload),a.type=m,v=a.tag=_S(m),o=Zn(m,o),v){case 0:a=Nu(null,a,m,o,d);break e;case 1:a=tv(null,a,m,o,d);break e;case 11:a=Km(null,a,m,o,d);break e;case 14:a=Qm(null,a,m,Zn(m.type,o),d);break e}throw Error(c(306,m,""))}return a;case 0:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),Nu(o,a,m,v,d);case 1:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),tv(o,a,m,v,d);case 3:e:{if(nv(a),o===null)throw Error(c(387));m=a.pendingProps,b=a.memoizedState,v=b.element,hm(o,a),Ls(a,m,null,d);var E=a.memoizedState;if(m=E.element,qe&&b.isDehydrated)if(b={element:m,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){v=So(Error(c(423)),a),a=rv(o,a,m,d,v);break e}else if(m!==v){v=So(Error(c(424)),a),a=rv(o,a,m,d,v);break e}else for(qe&&(zn=_b(a.stateNode.containerInfo),Tn=a,It=!0,Qn=null,va=!1),d=Cm(a,null,m,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(mo(),m===v){a=Mr(o,a,d);break e}mn(o,a,m,d)}a=a.child}return a;case 5:return wm(a),o===null&&hu(a),m=a.type,v=a.pendingProps,b=o!==null?o.memoizedProps:null,E=v.children,ue(m,v)?E=null:b!==null&&ue(m,b)&&(a.flags|=32),ev(o,a),mn(o,a,E,d),a.child;case 6:return o===null&&hu(a),null;case 13:return iv(o,a,d);case 4:return wu(a,a.stateNode.containerInfo),m=a.pendingProps,o===null?a.child=xo(a,null,m,d):mn(o,a,m,d),a.child;case 11:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),Km(o,a,m,v,d);case 7:return mn(o,a,a.pendingProps,d),a.child;case 8:return mn(o,a,a.pendingProps.children,d),a.child;case 12:return mn(o,a,a.pendingProps.children,d),a.child;case 10:e:{if(m=a.type._context,v=a.pendingProps,b=a.memoizedProps,E=v.value,dm(a,m,E),b!==null)if(Kn(b.value,E)){if(b.children===v.children&&!xn.current){a=Mr(o,a,d);break e}}else for(b=a.child,b!==null&&(b.return=a);b!==null;){var A=b.dependencies;if(A!==null){E=b.child;for(var W=A.firstContext;W!==null;){if(W.context===m){if(b.tag===1){W=Ir(-1,d&-d),W.tag=2;var ae=b.updateQueue;if(ae!==null){ae=ae.shared;var Ee=ae.pending;Ee===null?W.next=W:(W.next=Ee.next,Ee.next=W),ae.pending=W}}b.lanes|=d,W=b.alternate,W!==null&&(W.lanes|=d),xu(b.return,d,a),A.lanes|=d;break}W=W.next}}else if(b.tag===10)E=b.type===a.type?null:b.child;else if(b.tag===18){if(E=b.return,E===null)throw Error(c(341));E.lanes|=d,A=E.alternate,A!==null&&(A.lanes|=d),xu(E,d,a),E=b.sibling}else E=b.child;if(E!==null)E.return=b;else for(E=b;E!==null;){if(E===a){E=null;break}if(b=E.sibling,b!==null){b.return=E.return,E=b;break}E=E.return}b=E}mn(o,a,v.children,d),a=a.child}return a;case 9:return v=a.type,m=a.pendingProps.children,go(a,d),v=Rn(v),m=m(v),a.flags|=1,mn(o,a,m,d),a.child;case 14:return m=a.type,v=Zn(m,a.pendingProps),v=Zn(m.type,v),Qm(o,a,m,v,d);case 15:return Zm(o,a,a.type,a.pendingProps,d);case 17:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),Xs(o,a),a.tag=1,yn(m)?(o=!0,Es(a)):o=!1,go(a,d),xm(a,m,v),Cu(a,m,v,d),Fu(null,a,m,!0,o,d);case 19:return av(o,a,d);case 22:return Jm(o,a,d)}throw Error(c(156,a.tag))};function Tv(o,a){return au(o,a)}function TS(o,a,d,m){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bn(o,a,d,m){return new TS(o,a,d,m)}function ld(o){return o=o.prototype,!(!o||!o.isReactComponent)}function _S(o){if(typeof o=="function")return ld(o)?1:0;if(o!=null){if(o=o.$$typeof,o===w)return 11;if(o===M)return 14}return 2}function ei(o,a){var d=o.alternate;return d===null?(d=Bn(o.tag,a,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=a,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&14680064,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,a=o.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d}function hl(o,a,d,m,v,b){var E=2;if(m=o,typeof o=="function")ld(o)&&(E=1);else if(typeof o=="string")E=5;else e:switch(o){case p:return Ti(d.children,v,b,a);case g:E=8,v|=8;break;case y:return o=Bn(12,d,a,v|2),o.elementType=y,o.lanes=b,o;case k:return o=Bn(13,d,a,v),o.elementType=k,o.lanes=b,o;case j:return o=Bn(19,d,a,v),o.elementType=j,o.lanes=b,o;case I:return pl(d,v,b,a);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case S:E=10;break e;case C:E=9;break e;case w:E=11;break e;case M:E=14;break e;case P:E=16,m=null;break e}throw Error(c(130,o==null?o:typeof o,""))}return a=Bn(E,d,a,v),a.elementType=o,a.type=m,a.lanes=b,a}function Ti(o,a,d,m){return o=Bn(7,o,m,a),o.lanes=d,o}function pl(o,a,d,m){return o=Bn(22,o,m,a),o.elementType=I,o.lanes=d,o.stateNode={isHidden:!1},o}function cd(o,a,d){return o=Bn(6,o,null,a),o.lanes=d,o}function ud(o,a,d){return a=Bn(4,o.children!==null?o.children:[],o.key,a),a.lanes=d,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}function DS(o,a,d,m,v){this.tag=a,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ge,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=iu(0),this.expirationTimes=iu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=iu(0),this.identifierPrefix=m,this.onRecoverableError=v,qe&&(this.mutableSourceEagerHydrationData=null)}function _v(o,a,d,m,v,b,E,A,W){return o=new DS(o,a,d,A,W),a===1?(a=1,b===!0&&(a|=8)):a=0,b=Bn(3,null,null,a),o.current=b,b.stateNode=o,b.memoizedState={element:m,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},bu(b),o}function Dv(o){if(!o)return qr;o=o._reactInternals;e:{if(V(o)!==o||o.tag!==1)throw Error(c(170));var a=o;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(yn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(c(171))}if(o.tag===1){var d=o.type;if(yn(d))return em(o,d,a)}return a}function Ov(o){var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(c(188)):(o=Object.keys(o).join(","),Error(c(268,o)));return o=X(a),o===null?null:o.stateNode}function Av(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d=ae&&b>=Ue&&v<=Ee&&E<=ye){o.splice(a,1);break}else if(m!==ae||d.width!==W.width||yeE){if(!(b!==Ue||d.height!==W.height||Eev)){ae>m&&(W.width+=ae-m,W.x=m),Eeb&&(W.height+=Ue-b,W.y=b),yed&&(d=E)),E ")+` - -No matching component was found for: - `)+o.join(" > ")}return null},n.getPublicRootInstance=function(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return oe(o.child.stateNode);default:return o.child.stateNode}},n.injectIntoDevTools=function(o){if(o={bundleType:o.bundleType,version:o.version,rendererPackageName:o.rendererPackageName,rendererConfig:o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:u.ReactCurrentDispatcher,findHostInstanceByFiber:OS,findFiberByHostInstance:o.findFiberByHostInstance||AS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")o=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)o=!0;else{try{Ts=a.inject(o),or=a}catch{}o=!!a.checkDCE}}return o},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(o,a,d,m){if(!N)throw Error(c(363));o=Qu(o,a);var v=Ze(o,d,m).disconnect;return{disconnect:function(){v()}}},n.registerMutableSourceForHydration=function(o,a){var d=a._getVersion;d=d(a._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[a,d]:o.mutableSourceEagerHydrationData.push(a,d)},n.runWithPriority=function(o,a){var d=it;try{return it=o,a()}finally{it=d}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(o,a,d,m){var v=a.current,b=un(),E=Zr(v);return d=Dv(d),a.context===null?a.context=d:a.pendingContext=d,a=Ir(b,E),a.payload={element:o},m=m===void 0?null:m,m!==null&&(a.callback=m),o=Xr(v,a,E),o!==null&&(Ln(o,v,E,b),Fs(o,v,E)),E},n};(function(e){e.exports=ZI})(QI);const JI=SC(Af);var fc={},eM={get exports(){return fc},set exports(e){fc=e}},oo={};/** - * @license React - * react-reconciler-constants.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. - */oo.ConcurrentRoot=1;oo.ContinuousEventPriority=4;oo.DefaultEventPriority=16;oo.DiscreteEventPriority=1;oo.IdleEventPriority=536870912;oo.LegacyRoot=0;(function(e){e.exports=oo})(eM);const w0={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let k0=!1,j0=!1;const Dp=".react-konva-event",tM=`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 -`,nM=`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 -`,rM={};function Hc(e,t,n=rM){if(!k0&&"zIndex"in t&&(console.warn(nM),k0=!0),!j0&&t.draggable){var r=t.x!==void 0||t.y!==void 0,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(tM),j0=!0)}for(var s in n)if(!w0[s]){var c=s.slice(0,2)==="on",u=n[s]!==t[s];if(c&&u){var f=s.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),e.off(f,n[s])}var h=!t.hasOwnProperty(s);h&&e.setAttr(s,void 0)}var p=t._useStrictMode,g={},y=!1;const S={};for(var s in t)if(!w0[s]){var c=s.slice(0,2)==="on",C=n[s]!==t[s];if(c&&C){var f=s.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),t[s]&&(S[f]=t[s])}!c&&(t[s]!==n[s]||p&&t[s]!==e.getAttr(s))&&(y=!0,g[s]=t[s])}y&&(e.setAttrs(g),gi(e));for(var f in S)e.on(f+Dp,S[f])}function gi(e){if(!CC.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const v4={},iM={};qa.Node.prototype._applyProps=Hc;function oM(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),gi(e)}function aM(e,t,n){let r=qa[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=qa.Group);const i={},s={};for(var c in t){var u=c.slice(0,2)==="on";u?s[c]=t[c]:i[c]=t[c]}const f=new r(i);return Hc(f,s),f}function sM(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function lM(e,t,n){return!1}function cM(e){return e}function uM(){return null}function dM(){return null}function fM(e,t,n,r){return iM}function hM(){}function pM(e){}function mM(e,t){return!1}function vM(){return v4}function gM(){return v4}const xM=setTimeout,yM=clearTimeout,bM=-1;function SM(e,t){return!1}const CM=!1,wM=!0,kM=!0;function jM(e,t){t.parent===e?t.moveToTop():e.add(t),gi(e)}function EM(e,t){t.parent===e?t.moveToTop():e.add(t),gi(e)}function g4(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),gi(e)}function PM(e,t,n){g4(e,t,n)}function IM(e,t){t.destroy(),t.off(Dp),gi(e)}function MM(e,t){t.destroy(),t.off(Dp),gi(e)}function TM(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function _M(e,t,n){}function DM(e,t,n,r,i){Hc(e,i,r)}function OM(e){e.hide(),gi(e)}function AM(e){}function zM(e,t){(t.visible==null||t.visible)&&e.show()}function RM(e,t){}function NM(e){}function FM(){}const LM=()=>fc.DefaultEventPriority,BM=Object.freeze(Object.defineProperty({__proto__:null,appendChild:jM,appendChildToContainer:EM,appendInitialChild:oM,cancelTimeout:yM,clearContainer:NM,commitMount:_M,commitTextUpdate:TM,commitUpdate:DM,createInstance:aM,createTextInstance:sM,detachDeletedInstance:FM,finalizeInitialChildren:lM,getChildHostContext:gM,getCurrentEventPriority:LM,getPublicInstance:cM,getRootHostContext:vM,hideInstance:OM,hideTextInstance:AM,idlePriority:Ul.unstable_IdlePriority,insertBefore:g4,insertInContainerBefore:PM,isPrimaryRenderer:CM,noTimeout:bM,now:Ul.unstable_now,prepareForCommit:uM,preparePortalMount:dM,prepareUpdate:fM,removeChild:IM,removeChildFromContainer:MM,resetAfterCommit:hM,resetTextContent:pM,run:Ul.unstable_runWithPriority,scheduleTimeout:xM,shouldDeprioritizeSubtree:mM,shouldSetTextContent:SM,supportsMutation:kM,unhideInstance:zM,unhideTextInstance:RM,warnsIfNotActing:wM},Symbol.toStringTag,{value:"Module"}));var HM=Object.defineProperty,WM=Object.defineProperties,VM=Object.getOwnPropertyDescriptors,E0=Object.getOwnPropertySymbols,UM=Object.prototype.hasOwnProperty,$M=Object.prototype.propertyIsEnumerable,P0=(e,t,n)=>t in e?HM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I0=(e,t)=>{for(var n in t||(t={}))UM.call(t,n)&&P0(e,n,t[n]);if(E0)for(var n of E0(t))$M.call(t,n)&&P0(e,n,t[n]);return e},GM=(e,t)=>WM(e,VM(t));function x4(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const i=x4(r,t,n);if(i)return i;r=t?null:r.sibling}}function y4(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const Op=y4(x.createContext(null));class b4 extends x.Component{render(){return x.createElement(Op.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:qM,ReactCurrentDispatcher:YM}=x.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function XM(){const e=x.useContext(Op);if(!e)throw new Error("its-fine: useFiber must be called within a !");const t=x.useId();return x.useMemo(()=>{var r;return(r=qM.current)!=null?r:x4(e,!1,i=>{let s=i.memoizedState;for(;s;){if(s.memoizedState===t)return!0;s=s.next}})},[e,t])}function KM(){var e,t;const n=XM(),[r]=x.useState(()=>new Map);r.clear();let i=n;for(;i;){const s=(e=i.type)==null?void 0:e._context;s&&s!==Op&&!r.has(s)&&r.set(s,(t=YM.current)==null?void 0:t.readContext(y4(s))),i=i.return}return x.useMemo(()=>Array.from(r.keys()).reduce((s,c)=>u=>x.createElement(s,null,x.createElement(c.Provider,GM(I0({},u),{value:r.get(c)}))),s=>x.createElement(b4,I0({},s))),[r])}function QM(e){const t=ke.useRef();return ke.useLayoutEffect(()=>{t.current=e}),t.current}const ZM=e=>{const t=ke.useRef(),n=ke.useRef(),r=ke.useRef(),i=QM(e),s=KM(),c=u=>{const{forwardedRef:f}=e;f&&(typeof f=="function"?f(u):f.current=u)};return ke.useLayoutEffect(()=>(n.current=new qa.Stage({width:e.width,height:e.height,container:t.current}),c(n.current),r.current=Ba.createContainer(n.current,fc.LegacyRoot,!1,null),Ba.updateContainer(ke.createElement(s,{},e.children),r.current),()=>{qa.isBrowser&&(c(null),Ba.updateContainer(null,r.current,null),n.current.destroy())}),[]),ke.useLayoutEffect(()=>{c(n.current),Hc(n.current,e,i),Ba.updateContainer(ke.createElement(s,{},e.children),r.current,null)}),ke.createElement("div",{ref:t,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},za="Layer",Br="Group",Hr="Rect",_i="Circle",hc="Line",S4="Image",JM="Transformer",Ba=JI(BM);Ba.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:ke.version,rendererPackageName:"react-konva"});const eT=ke.forwardRef((e,t)=>ke.createElement(b4,{},ke.createElement(ZM,{...e,forwardedRef:t}))),tT=be([tt,zt],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),nT=()=>{const e=Y(),{tool:t,isStaging:n,isMovingBoundingBox:r}=O(tT);return{handleDragStart:x.useCallback(()=>{(t==="move"||n)&&!r&&e(Jl(!0))},[e,r,n,t]),handleDragMove:x.useCallback(i=>{if(!((t==="move"||n)&&!r))return;const s={x:i.target.x(),y:i.target.y()};e(Y1(s))},[e,r,n,t]),handleDragEnd:x.useCallback(()=>{(t==="move"||n)&&!r&&e(Jl(!1))},[e,r,n,t])}},rT=be([tt,Bt,zt],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:i,shouldShowBoundingBox:s,tool:c,isMaskEnabled:u,shouldSnapToGrid:f}=e;return{activeTabName:t,isCursorOnCanvas:Boolean(r),shouldLockBoundingBox:i,shouldShowBoundingBox:s,tool:c,isStaging:n,isMaskEnabled:u,shouldSnapToGrid:f}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),iT=()=>{const e=Y(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:i,isMaskEnabled:s,shouldSnapToGrid:c}=O(rT),u=x.useRef(null),f=X1(),h=()=>e(Zf());fe(["shift+c"],()=>{h()},{enabled:()=>!i,preventDefault:!0},[]);const p=()=>e(ss(!s));fe(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[s]),fe(["n"],()=>{e(ec(!c))},{enabled:!0,preventDefault:!0},[c]),fe("esc",()=>{e(wC())},{enabled:()=>!0,preventDefault:!0}),fe("shift+h",()=>{e(kC(!n))},{enabled:()=>!i,preventDefault:!0},[t,n]),fe(["space"],g=>{g.repeat||(f==null||f.container().focus(),r!=="move"&&(u.current=r,e(xr("move"))),r==="move"&&u.current&&u.current!=="move"&&(e(xr(u.current)),u.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,u])},Ap=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}},C4=()=>{const e=Y(),t=Sr(),n=X1();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const i=jC.pixelRatio,[s,c,u,f]=t.getContext().getImageData(r.x*i,r.y*i,1,1).data;e(EC({r:s,g:c,b:u,a:f}))},commitColorUnderCursor:()=>{e(PC())}}},oT=be([Bt,tt,zt],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),aT=e=>{const t=Y(),{tool:n,isStaging:r}=O(oT),{commitColorUnderCursor:i}=C4();return x.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Jl(!0));return}if(n==="colorPicker"){i();return}const c=Ap(e.current);c&&(s.evt.preventDefault(),t(K1(!0)),t(IC([c.x,c.y])))},[e,n,r,t,i])},sT=be([Bt,tt,zt],(e,t,n)=>{const{tool:r,isDrawing:i}=t;return{tool:r,isDrawing:i,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),lT=(e,t,n)=>{const r=Y(),{isDrawing:i,tool:s,isStaging:c}=O(sT),{updateColorUnderCursor:u}=C4();return x.useCallback(()=>{if(!e.current)return;const f=Ap(e.current);if(f){if(r(MC(f)),n.current=f,s==="colorPicker"){u();return}!i||s==="move"||c||(t.current=!0,r(Q1([f.x,f.y])))}},[t,r,i,c,n,e,s,u])},cT=()=>{const e=Y();return x.useCallback(()=>{e(TC())},[e])},uT=be([Bt,tt,zt],(e,t,n)=>{const{tool:r,isDrawing:i}=t;return{tool:r,isDrawing:i,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),dT=(e,t)=>{const n=Y(),{tool:r,isDrawing:i,isStaging:s}=O(uT);return x.useCallback(()=>{if(r==="move"||s){n(Jl(!1));return}if(!t.current&&i&&e.current){const c=Ap(e.current);if(!c)return;n(Q1([c.x,c.y]))}else t.current=!1;n(K1(!1))},[t,n,i,s,e,r])},fT=be([tt],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),hT=e=>{const t=Y(),{isMoveStageKeyHeld:n,stageScale:r}=O(fT);return x.useCallback(i=>{if(!e.current||n)return;i.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const c={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let u=i.evt.deltaY;i.evt.ctrlKey&&(u=-u);const f=te.clamp(r*_C**u,DC,OC),h={x:s.x-c.x*f,y:s.y-c.y*f};t(AC(f)),t(Y1(h))},[e,n,r,t])},pT=be(tt,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:i,shouldDarkenOutsideBoundingBox:s,stageCoordinates:c}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:c,stageDimensions:r,stageScale:i}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),mT=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:i,stageScale:s}=O(pT);return l.jsxs(Br,{children:[l.jsx(Hr,{offsetX:r.x/s,offsetY:r.y/s,height:i.height/s,width:i.width/s,fill:"rgba(0,0,0,0.4)",listening:!1,visible:n}),l.jsx(Hr,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},vT=be([tt],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),gT={dark:"rgba(255, 255, 255, 0.2)",green:"rgba(255, 255, 255, 0.2)",light:"rgba(0, 0, 0, 0.2)",ocean:"rgba(136, 148, 184, 0.2)"},xT=()=>{const e=O(u=>u.ui.currentTheme),{stageScale:t,stageCoordinates:n,stageDimensions:r}=O(vT),[i,s]=x.useState([]),c=x.useCallback(u=>u/t,[t]);return x.useLayoutEffect(()=>{const u=gT[e],{width:f,height:h}=r,{x:p,y:g}=n,y={x1:0,y1:0,x2:f,y2:h,offset:{x:c(p),y:c(g)}},S={x:Math.ceil(c(p)/64)*64,y:Math.ceil(c(g)/64)*64},C={x1:-S.x,y1:-S.y,x2:c(f)-S.x+64,y2:c(h)-S.y+64},k={x1:Math.min(y.x1,C.x1),y1:Math.min(y.y1,C.y1),x2:Math.max(y.x2,C.x2),y2:Math.max(y.y2,C.y2)},j=k.x2-k.x1,M=k.y2-k.y1,P=Math.round(j/64)+1,I=Math.round(M/64)+1,T=te.range(0,P).map(_=>l.jsx(hc,{x:k.x1+_*64,y:k.y1,points:[0,0,0,M],stroke:u,strokeWidth:1},`x_${_}`)),D=te.range(0,I).map(_=>l.jsx(hc,{x:k.x1,y:k.y1+_*64,points:[0,0,j,0],stroke:u,strokeWidth:1},`y_${_}`));s(T.concat(D))},[t,n,r,e,c]),l.jsx(Br,{children:i})},yT=be([e=>e.gallery],e=>e.intermediateImage?e.intermediateImage:null,{memoizeOptions:{resultEqualityCheck:te.isEqual}}),bT=e=>{const{...t}=e,n=O(yT),[r,i]=x.useState(null);if(x.useEffect(()=>{if(!n)return;const h=new Image;h.onload=()=>{i(h)},h.src=n.url},[n]),!(n!=null&&n.boundingBox))return null;const{boundingBox:{x:s,y:c,width:u,height:f}}=n;return r?l.jsx(S4,{x:s,y:c,width:u,height:f,image:r,listening:!1,...t}):null},qi=e=>{const{r:t,g:n,b:r,a:i}=e;return`rgba(${t}, ${n}, ${r}, ${i})`},ST=be(tt,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:i}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:i,maskColorString:qi(t)}}),M0=e=>`data:image/svg+xml;utf8, - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`.replaceAll("black",e),CT=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:i,stageScale:s}=O(ST),[c,u]=x.useState(null),[f,h]=x.useState(0),p=x.useRef(null),g=x.useCallback(()=>{h(f+1),setTimeout(g,500)},[f]);return x.useEffect(()=>{if(c)return;const y=new Image;y.onload=()=>{u(y)},y.src=M0(n)},[c,n]),x.useEffect(()=>{c&&(c.src=M0(n))},[c,n]),x.useEffect(()=>{const y=setInterval(()=>h(S=>(S+1)%5),50);return()=>clearInterval(y)},[]),!c||!te.isNumber(r.x)||!te.isNumber(r.y)||!te.isNumber(s)||!te.isNumber(i.width)||!te.isNumber(i.height)?null:l.jsx(Hr,{ref:p,offsetX:r.x/s,offsetY:r.y/s,height:i.height/s,width:i.width/s,fillPatternImage:c,fillPatternOffsetY:te.isNumber(f)?f:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},wT=be([tt],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),kT=e=>{const{...t}=e,{objects:n}=O(wT);return l.jsx(Br,{listening:!1,...t,children:n.filter(zC).map((r,i)=>l.jsx(hc,{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"},i))})};var Di=x,jT=function(t,n,r){const i=Di.useRef("loading"),s=Di.useRef(),[c,u]=Di.useState(0),f=Di.useRef(),h=Di.useRef(),p=Di.useRef();return(f.current!==t||h.current!==n||p.current!==r)&&(i.current="loading",s.current=void 0,f.current=t,h.current=n,p.current=r),Di.useLayoutEffect(function(){if(!t)return;var g=document.createElement("img");function y(){i.current="loaded",s.current=g,u(Math.random())}function S(){i.current="failed",s.current=void 0,u(Math.random())}return g.addEventListener("load",y),g.addEventListener("error",S),n&&(g.crossOrigin=n),r&&(g.referrerpolicy=r),g.src=t,function(){g.removeEventListener("load",y),g.removeEventListener("error",S)}},[t,n,r]),[s.current,i.current]};const w4=e=>{const{url:t,x:n,y:r}=e,[i]=jT(t);return l.jsx(S4,{x:n,y:r,image:i,listening:!1})},ET=be([tt],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),PT=()=>{const{objects:e}=O(ET);return e?l.jsx(Br,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(T1(t))return l.jsx(w4,{x:t.x,y:t.y,url:t.image.url},n);if(RC(t)){const r=l.jsx(hc,{points:t.points,stroke:t.color?qi(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?l.jsx(Br,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(NC(t))return l.jsx(Hr,{x:t.x,y:t.y,width:t.width,height:t.height,fill:qi(t.color)},n);if(FC(t))return l.jsx(Hr,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},IT=be([tt],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingImage:r,shouldShowStagingOutline:i,boundingBoxCoordinates:{x:s,y:c},boundingBoxDimensions:{width:u,height:f}}=e;return{currentStagingAreaImage:t.length>0?t[n]:void 0,isOnFirstImage:n===0,isOnLastImage:n===t.length-1,shouldShowStagingImage:r,shouldShowStagingOutline:i,x:s,y:c,width:u,height:f}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),MT=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:i,x:s,y:c,width:u,height:f}=O(IT);return l.jsxs(Br,{...t,children:[r&&n&&l.jsx(w4,{url:n.image.url,x:s,y:c}),i&&l.jsxs(Br,{children:[l.jsx(Hr,{x:s,y:c,width:u,height:f,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),l.jsx(Hr,{x:s,y:c,width:u,height:f,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},TT=be([tt],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingOutline:r,shouldShowStagingImage:i}=e;return{currentStagingAreaImage:t.length>0?t[n]:void 0,isOnFirstImage:n===0,isOnLastImage:n===t.length-1,shouldShowStagingImage:i,shouldShowStagingOutline:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),_T=()=>{const e=Y(),{isOnFirstImage:t,isOnLastImage:n,currentStagingAreaImage:r,shouldShowStagingImage:i}=O(TT),{t:s}=Z(),c=x.useCallback(()=>{e(Uv(!0))},[e]),u=x.useCallback(()=>{e(Uv(!1))},[e]);fe(["left"],()=>{f()},{enabled:()=>!0,preventDefault:!0}),fe(["right"],()=>{h()},{enabled:()=>!0,preventDefault:!0}),fe(["enter"],()=>{p()},{enabled:()=>!0,preventDefault:!0});const f=()=>e(LC()),h=()=>e(BC()),p=()=>e(HC());return r?l.jsx(B,{pos:"absolute",bottom:4,w:"100%",align:"center",justify:"center",filter:"drop-shadow(0 0.5rem 1rem rgba(0,0,0))",onMouseOver:c,onMouseOut:u,children:l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:l.jsx(M8,{}),onClick:f,colorScheme:"accent",isDisabled:t}),l.jsx(le,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:l.jsx(T8,{}),onClick:h,colorScheme:"accent",isDisabled:n}),l.jsx(le,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:l.jsx(zc,{}),onClick:p,colorScheme:"accent"}),l.jsx(le,{tooltip:s("unifiedCanvas.showHide"),"aria-label":s("unifiedCanvas.showHide"),"data-alert":!i,icon:i?l.jsx(N8,{}):l.jsx(R8,{}),onClick:()=>e(WC(!i)),colorScheme:"accent"}),l.jsx(le,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),icon:l.jsx(op,{}),onClick:()=>e(VC(r.image.url)),colorScheme:"accent"}),l.jsx(le,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),onClick:()=>e(UC()),colorScheme:"error",fontSize:20})]})}):null},Ho=e=>Math.round(e*100)/100,DT=be([tt],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${Ho(n)}, ${Ho(r)})`}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function OT(){const{cursorCoordinatesString:e}=O(DT),{t}=Z();return l.jsx(We,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const zf="var(--invokeai-colors-warning-500)",AT=be([tt],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:i},boundingBoxDimensions:{width:s,height:c},scaledBoundingBoxDimensions:{width:u,height:f},boundingBoxCoordinates:{x:h,y:p},stageScale:g,shouldShowCanvasDebugInfo:y,layer:S,boundingBoxScaleMethod:C,shouldPreserveMaskedArea:w}=e;let k="inherit";return(C==="none"&&(s<512||c<512)||C==="manual"&&u*f<512*512)&&(k=zf),{activeLayerColor:S==="mask"?zf:"inherit",activeLayerString:S.charAt(0).toUpperCase()+S.slice(1),boundingBoxColor:k,boundingBoxCoordinatesString:`(${Ho(h)}, ${Ho(p)})`,boundingBoxDimensionsString:`${s}×${c}`,scaledBoundingBoxDimensionsString:`${u}×${f}`,canvasCoordinatesString:`${Ho(r)}×${Ho(i)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(g*100),shouldShowCanvasDebugInfo:y,shouldShowBoundingBox:C!=="auto",shouldShowScaledBoundingBox:C!=="none",shouldPreserveMaskedArea:w}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),zT=()=>{const{activeLayerColor:e,activeLayerString:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:i,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:c,canvasCoordinatesString:u,canvasDimensionsString:f,canvasScaleString:h,shouldShowCanvasDebugInfo:p,shouldShowBoundingBox:g,shouldPreserveMaskedArea:y}=O(AT),{t:S}=Z();return l.jsxs(B,{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:"blackAlpha.500"},children:[l.jsx(We,{style:{color:e},children:`${S("unifiedCanvas.activeLayer")}: ${t}`}),l.jsx(We,{children:`${S("unifiedCanvas.canvasScale")}: ${h}%`}),y&&l.jsx(We,{style:{color:zf},children:"Preserve Masked Area: On"}),g&&l.jsx(We,{style:{color:n},children:`${S("unifiedCanvas.boundingBox")}: ${i}`}),c&&l.jsx(We,{style:{color:n},children:`${S("unifiedCanvas.scaledBoundingBox")}: ${s}`}),p&&l.jsxs(l.Fragment,{children:[l.jsx(We,{children:`${S("unifiedCanvas.boundingBoxPosition")}: ${r}`}),l.jsx(We,{children:`${S("unifiedCanvas.canvasDimensions")}: ${f}`}),l.jsx(We,{children:`${S("unifiedCanvas.canvasPosition")}: ${u}`}),l.jsx(OT,{})]})]})},RT=be(tt,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageScale:r,isDrawing:i,isTransformingBoundingBox:s,isMovingBoundingBox:c,tool:u,shouldSnapToGrid:f}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,isDrawing:i,isMovingBoundingBox:c,isTransformingBoundingBox:s,stageScale:r,shouldSnapToGrid:f,tool:u,hitStrokeWidth:20/r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),NT=e=>{const{...t}=e,n=Y(),{boundingBoxCoordinates:r,boundingBoxDimensions:i,isDrawing:s,isMovingBoundingBox:c,isTransformingBoundingBox:u,stageScale:f,shouldSnapToGrid:h,tool:p,hitStrokeWidth:g}=O(RT),y=x.useRef(null),S=x.useRef(null),[C,w]=x.useState(!1);x.useEffect(()=>{var X;!y.current||!S.current||(y.current.nodes([S.current]),(X=y.current.getLayer())==null||X.batchDraw())},[]);const k=64*f,j=x.useCallback(X=>{if(!h){n(fd({x:Math.floor(X.target.x()),y:Math.floor(X.target.y())}));return}const $=X.target.x(),Q=X.target.y(),ie=$v($,64),oe=$v(Q,64);X.target.x(ie),X.target.y(oe),n(fd({x:ie,y:oe}))},[n,h]),M=x.useCallback(()=>{if(!S.current)return;const X=S.current,$=X.scaleX(),Q=X.scaleY(),ie=Math.round(X.width()*$),oe=Math.round(X.height()*Q),U=Math.round(X.x()),K=Math.round(X.y());n(Na({width:ie,height:oe})),n(fd({x:h?xl(U,64):U,y:h?xl(K,64):K})),X.scaleX(1),X.scaleY(1)},[n,h]),P=x.useCallback((X,$,Q)=>{const ie=X.x%k,oe=X.y%k;return{x:xl($.x,k)+ie,y:xl($.y,k)+oe}},[k]),I=()=>{n(hd(!0))},T=()=>{n(hd(!1)),n(pd(!1)),n(yl(!1)),w(!1)},D=()=>{n(pd(!0))},_=()=>{n(hd(!1)),n(pd(!1)),n(yl(!1)),w(!1)},z=()=>{w(!0)},V=()=>{!u&&!c&&w(!1)},F=()=>{n(yl(!0))},L=()=>{n(yl(!1))};return l.jsxs(Br,{...t,children:[l.jsx(Hr,{height:i.height,width:i.width,x:r.x,y:r.y,onMouseEnter:F,onMouseOver:F,onMouseLeave:L,onMouseOut:L}),l.jsx(Hr,{draggable:!0,fillEnabled:!1,height:i.height,hitStrokeWidth:g,listening:!s&&p==="move",onDragStart:D,onDragEnd:_,onDragMove:j,onMouseDown:D,onMouseOut:V,onMouseOver:z,onMouseEnter:z,onMouseUp:_,onTransform:M,onTransformEnd:T,ref:S,stroke:C?"rgba(255,255,255,0.7)":"white",strokeWidth:(C?8:1)/f,width:i.width,x:r.x,y:r.y}),l.jsx(JM,{anchorCornerRadius:3,anchorDragBoundFunc:P,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:p==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&p==="move",onDragStart:D,onDragEnd:_,onMouseDown:I,onMouseUp:T,onTransformEnd:T,ref:y,rotateEnabled:!1})]})},FT=be(tt,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:i,brushColor:s,tool:c,layer:u,shouldShowBrush:f,isMovingBoundingBox:h,isTransformingBoundingBox:p,stageScale:g,stageDimensions:y,boundingBoxCoordinates:S,boundingBoxDimensions:C,shouldRestrictStrokesToBox:w}=e,k=w?{clipX:S.x,clipY:S.y,clipWidth:C.width,clipHeight:C.height}:{};return{cursorPosition:t,brushX:t?t.x:y.width/2,brushY:t?t.y:y.height/2,radius:n/2,colorPickerOuterRadius:Gv/g,colorPickerInnerRadius:(Gv-sf+1)/g,maskColorString:qi({...i,a:.5}),brushColorString:qi(s),colorPickerColorString:qi(r),tool:c,layer:u,shouldShowBrush:f,shouldDrawBrushPreview:!(h||p||!t)&&f,strokeWidth:1.5/g,dotRadius:1.5/g,clip:k}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),LT=e=>{const{...t}=e,{brushX:n,brushY:r,radius:i,maskColorString:s,tool:c,layer:u,shouldDrawBrushPreview:f,dotRadius:h,strokeWidth:p,brushColorString:g,colorPickerColorString:y,colorPickerInnerRadius:S,colorPickerOuterRadius:C,clip:w}=O(FT);return f?l.jsxs(Br,{listening:!1,...w,...t,children:[c==="colorPicker"?l.jsxs(l.Fragment,{children:[l.jsx(_i,{x:n,y:r,radius:C,stroke:g,strokeWidth:sf,strokeScaleEnabled:!1}),l.jsx(_i,{x:n,y:r,radius:S,stroke:y,strokeWidth:sf,strokeScaleEnabled:!1})]}):l.jsxs(l.Fragment,{children:[l.jsx(_i,{x:n,y:r,radius:i,fill:u==="mask"?s:g,globalCompositeOperation:c==="eraser"?"destination-out":"source-out"}),l.jsx(_i,{x:n,y:r,radius:i,stroke:"rgba(255,255,255,0.4)",strokeWidth:p*2,strokeEnabled:!0,listening:!1}),l.jsx(_i,{x:n,y:r,radius:i,stroke:"rgba(0,0,0,1)",strokeWidth:p,strokeEnabled:!0,listening:!1})]}),l.jsx(_i,{x:n,y:r,radius:h*2,fill:"rgba(255,255,255,0.4)",listening:!1}),l.jsx(_i,{x:n,y:r,radius:h,fill:"rgba(0,0,0,1)",listening:!1})]}):null},BT=be([tt,zt],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:i,isTransformingBoundingBox:s,isMouseOverBoundingBox:c,isMovingBoundingBox:u,stageDimensions:f,stageCoordinates:h,tool:p,isMovingStage:g,shouldShowIntermediates:y,shouldShowGrid:S,shouldRestrictStrokesToBox:C}=e;let w="none";return p==="move"||t?g?w="grabbing":w="grab":s?w=void 0:C&&!c&&(w="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||u,shouldShowBoundingBox:i,shouldShowGrid:S,stageCoordinates:h,stageCursor:w,stageDimensions:f,stageScale:r,tool:p,isStaging:t,shouldShowIntermediates:y}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),HT=re(eT,{shouldForwardProp:e=>!["sx"].includes(e)}),k4=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:i,stageCursor:s,stageDimensions:c,stageScale:u,tool:f,isStaging:h,shouldShowIntermediates:p}=O(BT);iT();const g=x.useRef(null),y=x.useRef(null),S=x.useCallback(V=>{GC(V),g.current=V},[]),C=x.useCallback(V=>{$C(V),y.current=V},[]),w=x.useRef({x:0,y:0}),k=x.useRef(!1),j=hT(g),M=aT(g),P=dT(g,k),I=lT(g,k,w),T=cT(),{handleDragStart:D,handleDragMove:_,handleDragEnd:z}=nT();return l.jsx(B,{sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:l.jsxs(We,{sx:{position:"relative"},children:[l.jsxs(HT,{tabIndex:-1,ref:S,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:i.x,y:i.y,width:c.width,height:c.height,scale:{x:u,y:u},onTouchStart:M,onTouchMove:I,onTouchEnd:P,onMouseDown:M,onMouseLeave:T,onMouseMove:I,onMouseUp:P,onDragStart:D,onDragMove:_,onDragEnd:z,onContextMenu:V=>V.evt.preventDefault(),onWheel:j,draggable:(f==="move"||h)&&!t,children:[l.jsx(za,{id:"grid",visible:r,children:l.jsx(xT,{})}),l.jsx(za,{id:"base",ref:C,listening:!1,imageSmoothingEnabled:!1,children:l.jsx(PT,{})}),l.jsxs(za,{id:"mask",visible:e,listening:!1,children:[l.jsx(kT,{visible:!0,listening:!1}),l.jsx(CT,{listening:!1})]}),l.jsx(za,{children:l.jsx(mT,{})}),l.jsxs(za,{id:"preview",imageSmoothingEnabled:!1,children:[!h&&l.jsx(LT,{visible:f!=="move",listening:!1}),l.jsx(MT,{visible:h}),p&&l.jsx(bT,{}),l.jsx(NT,{visible:n&&!h})]})]}),l.jsx(zT,{}),l.jsx(_T,{})]})})},WT=be(tt,Ny,Bt,(e,t,n)=>{const{doesCanvasNeedScaling:r,isCanvasInitialized:i}=e;return{doesCanvasNeedScaling:r,activeTabName:n,initialCanvasImage:t,isCanvasInitialized:i}}),j4=()=>{const e=Y(),{doesCanvasNeedScaling:t,activeTabName:n,initialCanvasImage:r,isCanvasInitialized:i}=O(WT),s=x.useRef(null);return x.useLayoutEffect(()=>{window.setTimeout(()=>{if(!s.current)return;const{clientWidth:c,clientHeight:u}=s.current;e(qC({width:c,height:u})),e(i?YC():Sc()),e(on(!1))},0)},[e,r,t,n,i]),l.jsx(B,{ref:s,sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:l.jsx(Qf,{thickness:"2px",speed:"1s",size:"xl"})})},VT=be([tt,Bt,Pt],(e,t,n)=>{const{futureLayerStates:r}=e;return{canRedo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function E4(){const e=Y(),{canRedo:t,activeTabName:n}=O(VT),{t:r}=Z(),i=()=>{e(XC())};return fe(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{i()},{enabled:()=>t,preventDefault:!0},[n,t]),l.jsx(le,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:l.jsx(Y8,{}),onClick:i,isDisabled:!t})}const UT=be([tt,Bt,Pt],(e,t,n)=>{const{pastLayerStates:r}=e;return{canUndo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function P4(){const e=Y(),{t}=Z(),{canUndo:n,activeTabName:r}=O(UT),i=()=>{e(KC())};return fe(["meta+z","ctrl+z"],()=>{i()},{enabled:()=>n,preventDefault:!0},[r,n]),l.jsx(le,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:l.jsx(J8,{}),onClick:i,isDisabled:!n})}const $T=(e,t,n)=>{const r=document.createElement("img");r.addEventListener("load",()=>{const i=document.createElement("canvas");i.width=t,i.height=n;const s=i.getContext("2d");s&&(s.drawImage(r,0,0),i.toBlob(c=>{c&&navigator.clipboard.write([new ClipboardItem({[c.type]:c})])}),i.remove(),r.remove())}),r.src=e},GT=e=>{const t=document.createElement("a");t.href=e,t.download="",document.body.appendChild(t),t.click(),document.body.removeChild(t),t.remove()},qT=(e,t,n,r)=>{const i=e.scale(),s=e.getClientRect({relativeTo:e.getParent()});e.scale({x:1/t,y:1/t});const{x:c,y:u,width:f,height:h}=e.getClientRect(),p=r?{x:r.x+n.x,y:r.y+n.y,width:r.width,height:r.height}:{x:c,y:u,width:f,height:h},g=e.toDataURL(p);return e.scale(i),{dataURL:g,boundingBox:{x:s.x,y:s.y,width:f,height:h}}},YT={cropVisible:!1,cropToBoundingBox:!1,shouldSaveToGallery:!1,shouldDownload:!1,shouldCopy:!1,shouldSetAsInitialImage:!0},ai=(e=YT)=>async(t,n)=>{const{cropVisible:r,cropToBoundingBox:i,shouldSaveToGallery:s,shouldDownload:c,shouldCopy:u,shouldSetAsInitialImage:f}=e;t(QC("Exporting Image")),t(bl(!1));const h=n(),{stageScale:p,boundingBoxCoordinates:g,boundingBoxDimensions:y,stageCoordinates:S}=h.canvas,C=Sr();if(!C){t(md(!1)),t(bl(!0));return}const{dataURL:w,boundingBox:k}=qT(C,p,S,i?{...g,...y}:void 0);if(!w){t(md(!1)),t(bl(!0));return}const j=new FormData;j.append("data",JSON.stringify({dataURL:w,filename:"merged_canvas.png",kind:s?"result":"temp",cropVisible:r}));const P=await(await fetch(`${window.location.origin}/upload`,{method:"POST",body:j})).json(),{url:I,width:T,height:D}=P,_={uuid:P1(),category:s?"result":"user",...P};c&&(GT(I),t(Sl({title:nr.t("toast.downloadImageStarted"),status:"success",duration:2500,isClosable:!0}))),u&&($T(I,T,D),t(Sl({title:nr.t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0}))),s&&(t(I1({image:_,category:"result"})),t(Sl({title:nr.t("toast.imageSavedToGallery"),status:"success",duration:2500,isClosable:!0}))),f&&(t(ZC({kind:"image",layer:"base",...k,image:_})),t(Sl({title:nr.t("toast.canvasMerged"),status:"success",duration:2500,isClosable:!0}))),t(md(!1)),t(JC(nr.t("common.statusConnected"))),t(bl(!0))};function XT(){const e=O(zt),t=Sr(),n=O(u=>u.system.isProcessing),r=O(u=>u.canvas.shouldCropToBoundingBoxOnSave),i=Y(),{t:s}=Z();fe(["meta+c","ctrl+c"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{i(ai({cropVisible:!r,cropToBoundingBox:r,shouldCopy:!0}))};return l.jsx(le,{"aria-label":`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:l.jsx(Jo,{}),onClick:c,isDisabled:e})}function KT(){const e=Y(),{t}=Z(),n=Sr(),r=O(zt),i=O(u=>u.system.isProcessing),s=O(u=>u.canvas.shouldCropToBoundingBoxOnSave);fe(["shift+d"],()=>{c()},{enabled:()=>!r,preventDefault:!0},[n,i]);const c=()=>{e(ai({cropVisible:!s,cropToBoundingBox:s,shouldDownload:!0}))};return l.jsx(le,{"aria-label":`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:l.jsx(ip,{}),onClick:c,isDisabled:r})}function QT(){const e=O(zt),{openUploader:t}=Zh(),{t:n}=Z();return l.jsx(le,{"aria-label":n("common.upload"),tooltip:n("common.upload"),icon:l.jsx(Rc,{}),onClick:t,isDisabled:e})}const ZT=be([tt,zt],(e,t)=>{const{layer:n,isMaskEnabled:r}=e;return{layer:n,isMaskEnabled:r,isStaging:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function JT(){const e=Y(),{t}=Z(),{layer:n,isMaskEnabled:r,isStaging:i}=O(ZT),s=()=>{e(tc(n==="mask"?"base":"mask"))};fe(["q"],()=>{s()},{enabled:()=>!i,preventDefault:!0},[n]);const c=u=>{const f=u.target.value;e(tc(f)),f==="mask"&&!r&&e(ss(!0))};return l.jsx(Mn,{tooltip:`${t("unifiedCanvas.layer")} (Q)`,"aria-label":`${t("unifiedCanvas.layer")} (Q)`,tooltipProps:{hasArrow:!0,placement:"top"},value:n,validValues:Z1,onChange:c,isDisabled:i})}function e_(){const e=Y(),{t}=Z(),n=Sr(),r=O(zt),i=O(c=>c.system.isProcessing);fe(["shift+m"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n,i]);const s=()=>{e(ai({cropVisible:!1,shouldSetAsInitialImage:!0}))};return l.jsx(le,{"aria-label":`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:l.jsx(zy,{}),onClick:s,isDisabled:r})}function t_(){const e=O(s=>s.canvas.tool),t=O(zt),n=Y(),{t:r}=Z();fe(["v"],()=>{i()},{enabled:()=>!t,preventDefault:!0},[]);const i=()=>n(xr("move"));return l.jsx(le,{"aria-label":`${r("unifiedCanvas.move")} (V)`,tooltip:`${r("unifiedCanvas.move")} (V)`,icon:l.jsx(My,{}),isChecked:e==="move"||t,onClick:i})}function n_(){const e=O(i=>i.ui.shouldPinParametersPanel),t=Y(),{t:n}=Z(),r=()=>{t(Hi(!0)),e&&setTimeout(()=>t(on(!0)),400)};return l.jsxs(B,{flexDirection:"column",gap:2,children:[l.jsx(le,{tooltip:`${n("parameters.showOptionsPanel")} (O)`,tooltipProps:{placement:"top"},"aria-label":n("parameters.showOptionsPanel"),onClick:r,children:l.jsx(ap,{})}),l.jsx(B,{children:l.jsx(xp,{iconButton:!0})}),l.jsx(B,{children:l.jsx(vp,{width:"100%",height:"40px",btnGroupWidth:"100%"})})]})}function r_(){const e=Y(),{t}=Z(),n=O(zt),r=()=>{e(Jf()),e(Sc())};return l.jsx(le,{"aria-label":t("unifiedCanvas.clearCanvas"),tooltip:t("unifiedCanvas.clearCanvas"),icon:l.jsx(io,{}),onClick:r,isDisabled:n,colorScheme:"error"})}function I4(e,t,n=250){const[r,i]=x.useState(0);return x.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),i(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>i(s=>s+1)}function i_(){const e=Sr(),t=Y(),{t:n}=Z();fe(["r"],()=>{i()},{enabled:()=>!0,preventDefault:!0},[e]);const r=I4(()=>i(!1),()=>i(!0)),i=(s=!1)=>{const c=Sr();if(!c)return;const u=c.getClientRect({skipTransform:!0});t(J1({contentRect:u,shouldScaleTo1:s}))};return l.jsx(le,{"aria-label":`${n("unifiedCanvas.resetView")} (R)`,tooltip:`${n("unifiedCanvas.resetView")} (R)`,icon:l.jsx(_y,{}),onClick:r})}function o_(){const e=O(zt),t=Sr(),n=O(u=>u.system.isProcessing),r=O(u=>u.canvas.shouldCropToBoundingBoxOnSave),i=Y(),{t:s}=Z();fe(["shift+s"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{i(ai({cropVisible:!r,cropToBoundingBox:r,shouldSaveToGallery:!0}))};return l.jsx(le,{"aria-label":`${s("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${s("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:l.jsx(op,{}),onClick:c,isDisabled:e})}const a_=be([tt,zt,Pt],(e,t,n)=>{const{isProcessing:r}=n,{tool:i}=e;return{tool:i,isStaging:t,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),s_=()=>{const e=Y(),{t}=Z(),{tool:n,isStaging:r}=O(a_);fe(["b"],()=>{i()},{enabled:()=>!r,preventDefault:!0},[]),fe(["e"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n]),fe(["c"],()=>{c()},{enabled:()=>!r,preventDefault:!0},[n]),fe(["shift+f"],()=>{u()},{enabled:()=>!r,preventDefault:!0}),fe(["delete","backspace"],()=>{f()},{enabled:()=>!r,preventDefault:!0});const i=()=>e(xr("brush")),s=()=>e(xr("eraser")),c=()=>e(xr("colorPicker")),u=()=>e(e2()),f=()=>e(t2());return l.jsxs(B,{flexDirection:"column",gap:2,children:[l.jsxs(en,{children:[l.jsx(le,{"aria-label":`${t("unifiedCanvas.brush")} (B)`,tooltip:`${t("unifiedCanvas.brush")} (B)`,icon:l.jsx(Ry,{}),isChecked:n==="brush"&&!r,onClick:i,isDisabled:r}),l.jsx(le,{"aria-label":`${t("unifiedCanvas.eraser")} (E)`,tooltip:`${t("unifiedCanvas.eraser")} (B)`,icon:l.jsx(Dy,{}),isChecked:n==="eraser"&&!r,isDisabled:r,onClick:s})]}),l.jsxs(en,{children:[l.jsx(le,{"aria-label":`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:l.jsx(Ay,{}),isDisabled:r,onClick:u}),l.jsx(le,{"aria-label":`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),isDisabled:r,onClick:f})]}),l.jsx(le,{"aria-label":`${t("unifiedCanvas.colorPicker")} (C)`,tooltip:`${t("unifiedCanvas.colorPicker")} (C)`,icon:l.jsx(Oy,{}),isChecked:n==="colorPicker"&&!r,isDisabled:r,onClick:c,width:"max-content"})]})},Wc=he((e,t)=>{const{acceptButtonText:n="Accept",acceptCallback:r,cancelButtonText:i="Cancel",cancelCallback:s,children:c,title:u,triggerComponent:f}=e,{isOpen:h,onOpen:p,onClose:g}=ui(),y=x.useRef(null),S=()=>{r(),g()},C=()=>{s&&s(),g()};return l.jsxs(l.Fragment,{children:[x.cloneElement(f,{onClick:p,ref:t}),l.jsx(Xx,{isOpen:h,leastDestructiveRef:y,onClose:g,children:l.jsx(Nr,{children:l.jsxs(Kx,{children:[l.jsx(Rr,{fontSize:"lg",fontWeight:"bold",children:u}),l.jsx(Fr,{children:c}),l.jsxs(zr,{children:[l.jsx(Je,{ref:y,onClick:C,children:i}),l.jsx(Je,{colorScheme:"error",onClick:S,ml:3,children:n})]})]})})})]})}),M4=()=>{const e=O(zt),t=Y(),{t:n}=Z(),r=()=>{t(e3()),t(Jf()),t(n2())};return l.jsxs(Wc,{title:n("unifiedCanvas.emptyTempImageFolder"),acceptCallback:r,acceptButtonText:n("unifiedCanvas.emptyFolder"),triggerComponent:l.jsx(Je,{leftIcon:l.jsx(io,{}),size:"sm",isDisabled:e,children:n("unifiedCanvas.emptyTempImageFolder")}),children:[l.jsx("p",{children:n("unifiedCanvas.emptyTempImagesFolderMessage")}),l.jsx("br",{}),l.jsx("p",{children:n("unifiedCanvas.emptyTempImagesFolderConfirm")})]})},T4=()=>{const e=O(zt),t=Y(),{t:n}=Z();return l.jsxs(Wc,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(n2()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:l.jsx(Je,{size:"sm",leftIcon:l.jsx(io,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),l.jsx("br",{}),l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},l_=be([tt],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:i}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:i}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),c_=()=>{const e=Y(),{t}=Z(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldShowCanvasDebugInfo:i,shouldShowIntermediates:s}=O(l_);return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{tooltip:t("unifiedCanvas.canvasSettings"),tooltipProps:{placement:"bottom"},"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(sp,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:t("unifiedCanvas.showIntermediates"),isChecked:s,onChange:c=>e(r2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:c=>e(i2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:c=>e(o2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:i,onChange:c=>e(a2(c.target.checked))}),l.jsx(T4,{}),l.jsx(M4,{})]})})},u_=()=>{const e=O(t=>t.ui.shouldShowParametersPanel);return l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(JT,{}),l.jsx(s_,{}),l.jsxs(B,{gap:2,children:[l.jsx(t_,{}),l.jsx(i_,{})]}),l.jsxs(B,{columnGap:2,children:[l.jsx(e_,{}),l.jsx(o_,{})]}),l.jsxs(B,{columnGap:2,children:[l.jsx(XT,{}),l.jsx(KT,{})]}),l.jsxs(B,{gap:2,children:[l.jsx(P4,{}),l.jsx(E4,{})]}),l.jsxs(B,{gap:2,children:[l.jsx(QT,{}),l.jsx(r_,{})]}),l.jsx(c_,{}),!e&&l.jsx(n_,{})]})};function d_(){const e=Y(),t=O(i=>i.canvas.brushSize),{t:n}=Z(),r=O(zt);return fe(["BracketLeft"],()=>{e(Wo(Math.max(t-5,5)))},{enabled:()=>!r,preventDefault:!0},[t]),fe(["BracketRight"],()=>{e(Wo(Math.min(t+5,500)))},{enabled:()=>!r,preventDefault:!0},[t]),l.jsx(ut,{label:n("unifiedCanvas.brushSize"),value:t,withInput:!0,onChange:i=>e(Wo(i)),sliderNumberInputProps:{max:500},inputReadOnly:!1,isCompact:!0})}function Vc(){return(Vc=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}function Rf(e){var t=x.useRef(e),n=x.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var ta=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:k.buttons>0)&&i.current?s(T0(i.current,k,u.current)):w(!1)},C=function(){return w(!1)};function w(k){var j=f.current,M=Nf(i.current),P=k?M.addEventListener:M.removeEventListener;P(j?"touchmove":"mousemove",S),P(j?"touchend":"mouseup",C)}return[function(k){var j=k.nativeEvent,M=i.current;if(M&&(_0(j),!function(I,T){return T&&!Ua(I)}(j,f.current)&&M)){if(Ua(j)){f.current=!0;var P=j.changedTouches||[];P.length&&(u.current=P[0].identifier)}M.focus(),s(T0(M,j,u.current)),w(!0)}},function(k){var j=k.which||k.keyCode;j<37||j>40||(k.preventDefault(),c({left:j===39?.05:j===37?-.05:0,top:j===40?.05:j===38?-.05:0}))},w]},[c,s]),p=h[0],g=h[1],y=h[2];return x.useEffect(function(){return y},[y]),ke.createElement("div",Vc({},r,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:i,onKeyDown:g,tabIndex:0,role:"slider"}))}),Uc=function(e){return e.filter(Boolean).join(" ")},Rp=function(e){var t=e.color,n=e.left,r=e.top,i=r===void 0?.5:r,s=Uc(["react-colorful__pointer",e.className]);return ke.createElement("div",{className:s,style:{top:100*i+"%",left:100*n+"%"}},ke.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},gn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},D4=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:gn(e.h),s:gn(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:gn(i/2),a:gn(r,2)}},Ff=function(e){var t=D4(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Bd=function(e){var t=D4(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},f_=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),c=r*(1-n),u=r*(1-(t-s)*n),f=r*(1-(1-t+s)*n),h=s%6;return{r:gn(255*[r,u,c,c,f,r][h]),g:gn(255*[f,r,r,u,c,c][h]),b:gn(255*[c,c,f,r,r,u][h]),a:gn(i,2)}},h_=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,s=Math.max(t,n,r),c=s-Math.min(t,n,r),u=c?s===t?(n-r)/c:s===n?2+(r-t)/c:4+(t-n)/c:0;return{h:gn(60*(u<0?u+6:u)),s:gn(s?c/s*100:0),v:gn(s/255*100),a:i}},p_=ke.memo(function(e){var t=e.hue,n=e.onChange,r=Uc(["react-colorful__hue",e.className]);return ke.createElement("div",{className:r},ke.createElement(zp,{onMove:function(i){n({h:360*i.left})},onKey:function(i){n({h:ta(t+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":gn(t),"aria-valuemax":"360","aria-valuemin":"0"},ke.createElement(Rp,{className:"react-colorful__hue-pointer",left:t/360,color:Ff({h:t,s:100,v:100,a:1})})))}),m_=ke.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Ff({h:t.h,s:100,v:100,a:1})};return ke.createElement("div",{className:"react-colorful__saturation",style:r},ke.createElement(zp,{onMove:function(i){n({s:100*i.left,v:100-100*i.top})},onKey:function(i){n({s:ta(t.s+100*i.left,0,100),v:ta(t.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+gn(t.s)+"%, Brightness "+gn(t.v)+"%"},ke.createElement(Rp,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Ff(t)})))}),O4=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function v_(e,t,n){var r=Rf(n),i=x.useState(function(){return e.toHsva(t)}),s=i[0],c=i[1],u=x.useRef({color:t,hsva:s});x.useEffect(function(){if(!e.equal(t,u.current.color)){var h=e.toHsva(t);u.current={hsva:h,color:t},c(h)}},[t,e]),x.useEffect(function(){var h;O4(s,u.current.hsva)||e.equal(h=e.fromHsva(s),u.current.color)||(u.current={hsva:s,color:h},r(h))},[s,e,r]);var f=x.useCallback(function(h){c(function(p){return Object.assign({},p,h)})},[]);return[s,f]}var g_=typeof window<"u"?x.useLayoutEffect:x.useEffect,x_=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},D0=new Map,y_=function(e){g_(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!D0.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}`,D0.set(t,n);var r=x_();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},b_=function(e){var t=e.className,n=e.hsva,r=e.onChange,i={backgroundImage:"linear-gradient(90deg, "+Bd(Object.assign({},n,{a:0}))+", "+Bd(Object.assign({},n,{a:1}))+")"},s=Uc(["react-colorful__alpha",t]),c=gn(100*n.a);return ke.createElement("div",{className:s},ke.createElement("div",{className:"react-colorful__alpha-gradient",style:i}),ke.createElement(zp,{onMove:function(u){r({a:u.left})},onKey:function(u){r({a:ta(n.a+u.left)})},"aria-label":"Alpha","aria-valuetext":c+"%","aria-valuenow":c,"aria-valuemin":"0","aria-valuemax":"100"},ke.createElement(Rp,{className:"react-colorful__alpha-pointer",left:n.a,color:Bd(n)})))},S_=function(e){var t=e.className,n=e.colorModel,r=e.color,i=r===void 0?n.defaultColor:r,s=e.onChange,c=_4(e,["className","colorModel","color","onChange"]),u=x.useRef(null);y_(u);var f=v_(n,i,s),h=f[0],p=f[1],g=Uc(["react-colorful",t]);return ke.createElement("div",Vc({},c,{ref:u,className:g}),ke.createElement(m_,{hsva:h,onChange:p}),ke.createElement(p_,{hue:h.h,onChange:p}),ke.createElement(b_,{hsva:h,onChange:p,className:"react-colorful__last-control"}))},C_={defaultColor:{r:0,g:0,b:0,a:1},toHsva:h_,fromHsva:f_,equal:O4},w_=function(e){return ke.createElement(S_,Vc({},e,{colorModel:C_}))};const k_=re(w_,{baseStyle:{paddingInline:4},shouldForwardProp:e=>!["pickerColor"].includes(e)}),Hd={width:6,height:6,borderColor:"base.100"},pc=e=>{const{styleClass:t="",...n}=e;return l.jsx(k_,{sx:{".react-colorful__hue-pointer":Hd,".react-colorful__saturation-pointer":Hd,".react-colorful__alpha-pointer":Hd},className:t,...n})},j_=be([tt,zt],(e,t)=>{const{brushColor:n,maskColor:r,layer:i}=e;return{brushColor:n,maskColor:r,layer:i,isStaging:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function E_(){const e=Y(),{brushColor:t,maskColor:n,layer:r,isStaging:i}=O(j_),s=()=>{if(r==="base")return`rgba(${t.r},${t.g},${t.b},${t.a})`;if(r==="mask")return`rgba(${n.r},${n.g},${n.b},${n.a})`};return fe(["shift+BracketLeft"],()=>{e(Vo({...t,a:te.clamp(t.a-.05,.05,1)}))},{enabled:()=>!i,preventDefault:!0},[t]),fe(["shift+BracketRight"],()=>{e(Vo({...t,a:te.clamp(t.a+.05,.05,1)}))},{enabled:()=>!i,preventDefault:!0},[t]),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(We,{sx:{width:7,height:7,minWidth:7,minHeight:7,borderRadius:"full",bg:s(),cursor:"pointer"}}),children:l.jsxs(B,{minWidth:60,direction:"column",gap:4,width:"100%",children:[r==="base"&&l.jsx(pc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:t,onChange:c=>e(Vo(c))}),r==="mask"&&l.jsx(pc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:c=>e(s2(c))})]})})}function A4(){return l.jsxs(B,{columnGap:4,alignItems:"center",children:[l.jsx(d_,{}),l.jsx(E_,{})]})}function P_(){const e=Y(),t=O(r=>r.canvas.shouldRestrictStrokesToBox),{t:n}=Z();return l.jsx(pt,{label:n("unifiedCanvas.betaLimitToBox"),isChecked:t,onChange:r=>e(l2(r.target.checked))})}function I_(){return l.jsxs(B,{gap:4,alignItems:"center",children:[l.jsx(A4,{}),l.jsx(P_,{})]})}function M_(){const e=Y(),{t}=Z(),n=()=>e(Zf());return l.jsx(Je,{size:"sm",leftIcon:l.jsx(io,{}),onClick:n,tooltip:`${t("unifiedCanvas.clearMask")} (Shift+C)`,children:t("unifiedCanvas.betaClear")})}function T_(){const e=O(i=>i.canvas.isMaskEnabled),t=Y(),{t:n}=Z(),r=()=>t(ss(!e));return l.jsx(pt,{label:`${n("unifiedCanvas.enableMask")} (H)`,isChecked:e,onChange:r})}function __(){const e=Y(),{t}=Z(),n=O(r=>r.canvas.shouldPreserveMaskedArea);return l.jsx(pt,{label:t("unifiedCanvas.betaPreserveMasked"),isChecked:n,onChange:r=>e(c2(r.target.checked))})}function D_(){return l.jsxs(B,{gap:4,alignItems:"center",children:[l.jsx(A4,{}),l.jsx(T_,{}),l.jsx(__,{}),l.jsx(M_,{})]})}function O_(){const e=O(r=>r.canvas.shouldDarkenOutsideBoundingBox),t=Y(),{t:n}=Z();return l.jsx(pt,{label:n("unifiedCanvas.betaDarkenOutside"),isChecked:e,onChange:r=>t(u2(r.target.checked))})}function A_(){const e=O(r=>r.canvas.shouldShowGrid),t=Y(),{t:n}=Z();return l.jsx(pt,{label:n("unifiedCanvas.showGrid"),isChecked:e,onChange:r=>t(d2(r.target.checked))})}function z_(){const e=O(i=>i.canvas.shouldSnapToGrid),t=Y(),{t:n}=Z(),r=i=>t(ec(i.target.checked));return l.jsx(pt,{label:`${n("unifiedCanvas.snapToGrid")} (N)`,isChecked:e,onChange:r})}function R_(){return l.jsxs(B,{alignItems:"center",gap:4,children:[l.jsx(A_,{}),l.jsx(z_,{}),l.jsx(O_,{})]})}const N_=be([tt],e=>{const{tool:t,layer:n}=e;return{tool:t,layer:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function F_(){const{tool:e,layer:t}=O(N_);return l.jsxs(B,{height:8,minHeight:8,maxHeight:8,alignItems:"center",children:[t=="base"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx(I_,{}),t=="mask"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx(D_,{}),e=="move"&&l.jsx(R_,{})]})}const L_=be([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),B_=()=>{const e=Y(),{doesCanvasNeedScaling:t}=O(L_);return x.useLayoutEffect(()=>{e(on(!0));const n=te.debounce(()=>{e(on(!0))},250);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),l.jsx(We,{sx:{width:"100%",height:"100%",borderRadius:"base",bg:"base.850"},children:l.jsxs(B,{flexDirection:"row",width:"100%",height:"100%",columnGap:4,padding:4,children:[l.jsx(u_,{}),l.jsxs(B,{width:"100%",height:"100%",flexDirection:"column",rowGap:4,children:[l.jsx(F_,{}),t?l.jsx(j4,{}):l.jsx(k4,{})]})]})})},H_=be([tt,zt],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:i,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:qi(n),isMaskEnabled:i,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),W_=()=>{const e=Y(),{t}=Z(),{layer:n,maskColor:r,isMaskEnabled:i,shouldPreserveMaskedArea:s,isStaging:c}=O(H_);fe(["q"],()=>{u()},{enabled:()=>!c,preventDefault:!0},[n]),fe(["shift+c"],()=>{f()},{enabled:()=>!c,preventDefault:!0},[]),fe(["h"],()=>{h()},{enabled:()=>!c,preventDefault:!0},[i]);const u=()=>{e(tc(n==="mask"?"base":"mask"))},f=()=>e(Zf()),h=()=>e(ss(!i));return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(en,{children:l.jsx(le,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:l.jsx(W8,{}),isChecked:n==="mask",isDisabled:c})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:i,onChange:h}),l.jsx(pt,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:p=>e(c2(p.target.checked))}),l.jsx(pc,{sx:{paddingTop:2,paddingBottom:2},pickerColor:r,onChange:p=>e(s2(p))}),l.jsxs(Je,{size:"sm",leftIcon:l.jsx(io,{}),onClick:f,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},V_=be([tt],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:i,shouldShowGrid:s,shouldShowIntermediates:c,shouldSnapToGrid:u,shouldRestrictStrokesToBox:f}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:i,shouldShowGrid:s,shouldShowIntermediates:c,shouldSnapToGrid:u,shouldRestrictStrokesToBox:f}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),U_=()=>{const e=Y(),{t}=Z(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:i,shouldShowCanvasDebugInfo:s,shouldShowGrid:c,shouldShowIntermediates:u,shouldSnapToGrid:f,shouldRestrictStrokesToBox:h}=O(V_);fe(["n"],()=>{e(ec(!f))},{enabled:!0,preventDefault:!0},[f]);const p=g=>e(ec(g.target.checked));return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(sp,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:t("unifiedCanvas.showIntermediates"),isChecked:u,onChange:g=>e(r2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showGrid"),isChecked:c,onChange:g=>e(d2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.snapToGrid"),isChecked:f,onChange:p}),l.jsx(pt,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:i,onChange:g=>e(u2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:g=>e(i2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:g=>e(o2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:h,onChange:g=>e(l2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:g=>e(a2(g.target.checked))}),l.jsx(T4,{}),l.jsx(M4,{})]})})},$_=be([tt,zt,Pt],(e,t,n)=>{const{isProcessing:r}=n,{tool:i,brushColor:s,brushSize:c}=e;return{tool:i,isStaging:t,isProcessing:r,brushColor:s,brushSize:c}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),G_=()=>{const e=Y(),{tool:t,brushColor:n,brushSize:r,isStaging:i}=O($_),{t:s}=Z();fe(["b"],()=>{c()},{enabled:()=>!i,preventDefault:!0},[]),fe(["e"],()=>{u()},{enabled:()=>!i,preventDefault:!0},[t]),fe(["c"],()=>{f()},{enabled:()=>!i,preventDefault:!0},[t]),fe(["shift+f"],()=>{h()},{enabled:()=>!i,preventDefault:!0}),fe(["delete","backspace"],()=>{p()},{enabled:()=>!i,preventDefault:!0}),fe(["BracketLeft"],()=>{e(Wo(Math.max(r-5,5)))},{enabled:()=>!i,preventDefault:!0},[r]),fe(["BracketRight"],()=>{e(Wo(Math.min(r+5,500)))},{enabled:()=>!i,preventDefault:!0},[r]),fe(["shift+BracketLeft"],()=>{e(Vo({...n,a:te.clamp(n.a-.05,.05,1)}))},{enabled:()=>!i,preventDefault:!0},[n]),fe(["shift+BracketRight"],()=>{e(Vo({...n,a:te.clamp(n.a+.05,.05,1)}))},{enabled:()=>!i,preventDefault:!0},[n]);const c=()=>e(xr("brush")),u=()=>e(xr("eraser")),f=()=>e(xr("colorPicker")),h=()=>e(e2()),p=()=>e(t2());return l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:l.jsx(Ry,{}),isChecked:t==="brush"&&!i,onClick:c,isDisabled:i}),l.jsx(le,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:l.jsx(Dy,{}),isChecked:t==="eraser"&&!i,isDisabled:i,onClick:u}),l.jsx(le,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:l.jsx(Ay,{}),isDisabled:i,onClick:h}),l.jsx(le,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),isDisabled:i,onClick:p}),l.jsx(le,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:l.jsx(Oy,{}),isChecked:t==="colorPicker"&&!i,isDisabled:i,onClick:f}),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:l.jsx(ap,{})}),children:l.jsxs(B,{minWidth:60,direction:"column",gap:4,width:"100%",children:[l.jsx(B,{gap:4,justifyContent:"space-between",children:l.jsx(ut,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:g=>e(Wo(g)),sliderNumberInputProps:{max:500},inputReadOnly:!1})}),l.jsx(pc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:g=>e(Vo(g))})]})})]})},q_=be([Pt,tt,zt],(e,t,n)=>{const{isProcessing:r}=e,{tool:i,shouldCropToBoundingBoxOnSave:s,layer:c,isMaskEnabled:u}=t;return{isProcessing:r,isStaging:n,isMaskEnabled:u,tool:i,layer:c,shouldCropToBoundingBoxOnSave:s}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Y_=()=>{const e=Y(),{isProcessing:t,isStaging:n,isMaskEnabled:r,layer:i,tool:s,shouldCropToBoundingBoxOnSave:c}=O(q_),u=Sr(),{t:f}=Z(),{openUploader:h}=Zh();fe(["v"],()=>{p()},{enabled:()=>!n,preventDefault:!0},[]),fe(["r"],()=>{y()},{enabled:()=>!0,preventDefault:!0},[u]),fe(["shift+m"],()=>{C()},{enabled:()=>!n,preventDefault:!0},[u,t]),fe(["shift+s"],()=>{w()},{enabled:()=>!n,preventDefault:!0},[u,t]),fe(["meta+c","ctrl+c"],()=>{k()},{enabled:()=>!n,preventDefault:!0},[u,t]),fe(["shift+d"],()=>{j()},{enabled:()=>!n,preventDefault:!0},[u,t]);const p=()=>e(xr("move")),g=I4(()=>y(!1),()=>y(!0)),y=(P=!1)=>{const I=Sr();if(!I)return;const T=I.getClientRect({skipTransform:!0});e(J1({contentRect:T,shouldScaleTo1:P}))},S=()=>{e(Jf()),e(Sc())},C=()=>{e(ai({cropVisible:!1,shouldSetAsInitialImage:!0}))},w=()=>{e(ai({cropVisible:!c,cropToBoundingBox:c,shouldSaveToGallery:!0}))},k=()=>{e(ai({cropVisible:!c,cropToBoundingBox:c,shouldCopy:!0}))},j=()=>{e(ai({cropVisible:!c,cropToBoundingBox:c,shouldDownload:!0}))},M=P=>{const I=P.target.value;e(tc(I)),I==="mask"&&!r&&e(ss(!0))};return l.jsxs(B,{sx:{alignItems:"center",gap:2},children:[l.jsx(Mn,{tooltip:`${f("unifiedCanvas.layer")} (Q)`,tooltipProps:{hasArrow:!0,placement:"top"},value:i,validValues:Z1,onChange:M,isDisabled:n}),l.jsx(W_,{}),l.jsx(G_,{}),l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{"aria-label":`${f("unifiedCanvas.move")} (V)`,tooltip:`${f("unifiedCanvas.move")} (V)`,icon:l.jsx(My,{}),isChecked:s==="move"||n,onClick:p}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.resetView")} (R)`,tooltip:`${f("unifiedCanvas.resetView")} (R)`,icon:l.jsx(_y,{}),onClick:g})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{"aria-label":`${f("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${f("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:l.jsx(zy,{}),onClick:C,isDisabled:n}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:l.jsx(op,{}),onClick:w,isDisabled:n}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:l.jsx(Jo,{}),onClick:k,isDisabled:n}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:l.jsx(ip,{}),onClick:j,isDisabled:n})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(P4,{}),l.jsx(E4,{})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{"aria-label":`${f("common.upload")}`,tooltip:`${f("common.upload")}`,icon:l.jsx(Rc,{}),onClick:h,isDisabled:n}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.clearCanvas")}`,tooltip:`${f("unifiedCanvas.clearCanvas")}`,icon:l.jsx(io,{}),onClick:S,colorScheme:"error",isDisabled:n})]}),l.jsx(en,{isAttached:!0,children:l.jsx(U_,{})})]})},X_=be([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),K_=()=>{const e=Y(),{doesCanvasNeedScaling:t}=O(X_);return x.useLayoutEffect(()=>{e(on(!0));const n=te.debounce(()=>{e(on(!0))},250);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),l.jsx(We,{sx:{width:"100%",height:"100%",padding:4,borderRadius:"base",bg:"base.850"},children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",gap:4,width:"100%",height:"100%"},children:[l.jsx(Y_,{}),l.jsx(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:t?l.jsx(j4,{}):l.jsx(k4,{})})]})})},Q_=be(tt,e=>{const{boundingBoxDimensions:t,boundingBoxScaleMethod:n}=e;return{boundingBoxDimensions:t,boundingBoxScale:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Z_=()=>{const e=Y(),{boundingBoxDimensions:t}=O(Q_),{t:n}=Z(),r=u=>{e(Na({...t,width:Math.floor(u)}))},i=u=>{e(Na({...t,height:Math.floor(u)}))},s=()=>{e(Na({...t,width:Math.floor(512)}))},c=()=>{e(Na({...t,height:Math.floor(512)}))};return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(ut,{label:n("parameters.width"),min:64,max:1024,step:64,value:t.width,onChange:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:s}),l.jsx(ut,{label:n("parameters.height"),min:64,max:1024,step:64,value:t.height,onChange:i,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:c})]})},J_=be([gp,Pt,tt],(e,t,n)=>{const{tileSize:r,infillMethod:i}=e,{infill_methods:s}=t,{boundingBoxScaleMethod:c,scaledBoundingBoxDimensions:u}=n;return{boundingBoxScale:c,scaledBoundingBoxDimensions:u,tileSize:r,infillMethod:i,availableInfillMethods:s,isManual:c==="manual"}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),eD=()=>{const e=Y(),{tileSize:t,infillMethod:n,availableInfillMethods:r,boundingBoxScale:i,isManual:s,scaledBoundingBoxDimensions:c}=O(J_),{t:u}=Z(),f=S=>{e(Cl({...c,width:Math.floor(S)}))},h=S=>{e(Cl({...c,height:Math.floor(S)}))},p=()=>{e(Cl({...c,width:Math.floor(512)}))},g=()=>{e(Cl({...c,height:Math.floor(512)}))},y=S=>{e(r3(S.target.value))};return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(Mn,{label:u("parameters.scaleBeforeProcessing"),validValues:t3,value:i,onChange:y}),l.jsx(ut,{isInputDisabled:!s,isResetDisabled:!s,isSliderDisabled:!s,label:u("parameters.scaledWidth"),min:64,max:1024,step:64,value:c.width,onChange:f,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:p}),l.jsx(ut,{isInputDisabled:!s,isResetDisabled:!s,isSliderDisabled:!s,label:u("parameters.scaledHeight"),min:64,max:1024,step:64,value:c.height,onChange:h,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:g}),l.jsx(Mn,{label:u("parameters.infillMethod"),value:n,validValues:r,onChange:S=>e(n3(S.target.value))}),l.jsx(ut,{isInputDisabled:n!=="tile",isResetDisabled:n!=="tile",isSliderDisabled:n!=="tile",label:u("parameters.tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:S=>{e(qv(S))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(qv(32))}})]})};function tD(){const e=Y(),t=O(r=>r.generation.seamBlur),{t:n}=Z();return l.jsx(ut,{label:n("parameters.seamBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(Yv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Yv(16))}})}function nD(){const e=Y(),{t}=Z(),n=O(r=>r.generation.seamSize);return l.jsx(ut,{label:t("parameters.seamSize"),min:1,max:256,sliderNumberInputProps:{max:512},value:n,onChange:r=>{e(Xv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>e(Xv(96))})}function rD(){const{t:e}=Z(),t=O(r=>r.generation.seamSteps),n=Y();return l.jsx(ut,{label:e("parameters.seamSteps"),min:1,max:100,sliderNumberInputProps:{max:999},value:t,onChange:r=>{n(Kv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{n(Kv(30))}})}function iD(){const e=Y(),{t}=Z(),n=O(r=>r.generation.seamStrength);return l.jsx(ut,{label:t("parameters.seamStrength"),min:.01,max:.99,step:.01,value:n,onChange:r=>{e(Qv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Qv(.7))}})}const oD=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(nD,{}),l.jsx(tD,{}),l.jsx(iD,{}),l.jsx(rD,{})]});function aD(){const{t:e}=Z(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(Ep,{})},unifiedCanvasImg2Img:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(m4,{label:e("parameters.img2imgStrength")})},seed:{header:`${e("parameters.seed")}`,feature:dn.SEED,content:l.jsx(wp,{})},boundingBox:{header:`${e("parameters.boundingBoxHeader")}`,feature:dn.BOUNDING_BOX,content:l.jsx(Z_,{})},seamCorrection:{header:`${e("parameters.seamCorrectionHeader")}`,feature:dn.SEAM_CORRECTION,content:l.jsx(oD,{})},infillAndScaling:{header:`${e("parameters.infillScalingHeader")}`,feature:dn.INFILL_AND_SCALING,content:l.jsx(eD,{})},variations:{header:`${e("parameters.variations")}`,feature:dn.VARIATIONS,content:l.jsx(jp,{}),additionalHeaderComponents:l.jsx(kp,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(Sp,{}),additionalHeaderComponents:l.jsx(Cp,{})}};return l.jsxs(_p,{children:[l.jsxs(B,{flexDir:"column",rowGap:2,children:[l.jsx(Tp,{}),l.jsx(Mp,{})]}),l.jsx(Ip,{}),l.jsx(Pp,{accordionInfo:t})]})}function sD(){const e=O(t=>t.ui.shouldUseCanvasBetaLayout);return l.jsx(bp,{optionsPanel:l.jsx(aD,{}),children:e?l.jsx(B_,{}):l.jsx(K_,{})})}const Dn={txt2img:{title:l.jsx(Jt,{as:v9,boxSize:6}),workarea:l.jsx(KI,{}),tooltip:"Text To Image"},img2img:{title:l.jsx(Jt,{as:cp,boxSize:6}),workarea:l.jsx(VI,{}),tooltip:"Image To Image"},unifiedCanvas:{title:l.jsx(Jt,{as:y9,boxSize:6}),workarea:l.jsx(sD,{}),tooltip:"Unified Canvas"},nodes:{title:l.jsx(Jt,{as:g9,boxSize:6}),workarea:l.jsx($7,{}),tooltip:"Nodes"},postprocess:{title:l.jsx(Jt,{as:b9,boxSize:6}),workarea:l.jsx(G7,{}),tooltip:"Post Processing"},training:{title:l.jsx(Jt,{as:x9,boxSize:6}),workarea:l.jsx(q7,{}),tooltip:"Training"}};function lD(){Dn.txt2img.tooltip=nr.t("common.text2img"),Dn.img2img.tooltip=nr.t("common.img2img"),Dn.unifiedCanvas.tooltip=nr.t("common.unifiedCanvas"),Dn.nodes.tooltip=nr.t("common.nodes"),Dn.postprocess.tooltip=nr.t("common.postProcessing"),Dn.training.tooltip=nr.t("common.training")}function cD(){const e=O(U7),t=O(h=>h.lightbox.isLightboxOpen),{shouldShowGallery:n,shouldShowParametersPanel:r,shouldPinGallery:i,shouldPinParametersPanel:s}=O(yp);Y7(lD);const c=Y();fe("1",()=>{c(jn(0))}),fe("2",()=>{c(jn(1))}),fe("3",()=>{c(jn(2))}),fe("4",()=>{c(jn(3))}),fe("5",()=>{c(jn(4))}),fe("6",()=>{c(jn(5))}),fe("z",()=>{c(Bi(!t))},[t]),fe("f",()=>{n||r?(c(Hi(!1)),c(Fi(!1))):(c(Hi(!0)),c(Fi(!0))),(i||s)&&setTimeout(()=>c(on(!0)),400)},[n,r]);const u=()=>{const h=[];return Object.keys(Dn).forEach(p=>{h.push(l.jsx(Yt,{hasArrow:!0,label:Dn[p].tooltip,placement:"end",children:l.jsxs(yy,{children:[l.jsx(k2,{children:Dn[p].tooltip}),Dn[p].title]})},p))}),h},f=()=>{const h=[];return Object.keys(Dn).forEach(p=>{h.push(l.jsx(gy,{children:Dn[p].workarea},p))}),h};return l.jsxs(my,{isLazy:!0,defaultIndex:e,index:e,onChange:h=>{c(jn(h))},children:[l.jsx(vy,{children:u()}),l.jsx(xy,{children:t?l.jsx(sI,{}):f()})]})}var uD=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 bs(e,t){var n=dD(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 dD(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),i=uD.get(r);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}var fD=[".DS_Store","Thumbs.db"];function hD(e){return oa(this,void 0,void 0,function(){return aa(this,function(t){return mc(e)&&pD(e.dataTransfer)?[2,xD(e.dataTransfer,e.type)]:mD(e)?[2,vD(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,gD(e)]:[2,[]]})})}function pD(e){return mc(e)}function mD(e){return mc(e)&&mc(e.target)}function mc(e){return typeof e=="object"&&e!==null}function vD(e){return Lf(e.target.files).map(function(t){return bs(t)})}function gD(e){return oa(this,void 0,void 0,function(){var t;return aa(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 bs(r)})]}})})}function xD(e,t){return oa(this,void 0,void 0,function(){var n,r;return aa(this,function(i){switch(i.label){case 0:return e.items?(n=Lf(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(yD))]):[3,2];case 1:return r=i.sent(),[2,O0(z4(r))];case 2:return[2,O0(Lf(e.files).map(function(s){return bs(s)}))]}})})}function O0(e){return e.filter(function(t){return fD.indexOf(t.name)===-1})}function Lf(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,F0(n)];if(e.sizen)return[!1,F0(n)]}return[!0,null]}function Ni(e){return e!=null}function zD(e){var t=e.files,n=e.accept,r=e.minSize,i=e.maxSize,s=e.multiple,c=e.maxFiles,u=e.validator;return!s&&t.length>1||s&&c>=1&&t.length>c?!1:t.every(function(f){var h=L4(f,n),p=es(h,1),g=p[0],y=B4(f,r,i),S=es(y,1),C=S[0],w=u?u(f):null;return g&&C&&!w})}function vc(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Nl(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 B0(e){e.preventDefault()}function RD(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function ND(e){return e.indexOf("Edge/")!==-1}function FD(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return RD(e)||ND(e)}function hr(){for(var e=arguments.length,t=new Array(e),n=0;n1?i-1:0),c=1;ce.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 tO(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,s;for(s=0;s=0)&&(n[i]=e[i]);return n}var Np=x.forwardRef(function(e,t){var n=e.children,r=gc(e,UD),i=$4(r),s=i.open,c=gc(i,$D);return x.useImperativeHandle(t,function(){return{open:s}},[s]),ke.createElement(x.Fragment,null,n(Ot(Ot({},c),{},{open:s})))});Np.displayName="Dropzone";var U4={disabled:!1,getFilesFromEvent:hD,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};Np.defaultProps=U4;Np.propTypes={children:lt.func,accept:lt.objectOf(lt.arrayOf(lt.string)),multiple:lt.bool,preventDropOnDocument:lt.bool,noClick:lt.bool,noKeyboard:lt.bool,noDrag:lt.bool,noDragEventsBubbling:lt.bool,minSize:lt.number,maxSize:lt.number,maxFiles:lt.number,disabled:lt.bool,getFilesFromEvent:lt.func,onFileDialogCancel:lt.func,onFileDialogOpen:lt.func,useFsAccessApi:lt.bool,autoFocus:lt.bool,onDragEnter:lt.func,onDragLeave:lt.func,onDragOver:lt.func,onDrop:lt.func,onDropAccepted:lt.func,onDropRejected:lt.func,onError:lt.func,validator:lt.func};var Vf={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function $4(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Ot(Ot({},U4),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,s=t.maxSize,c=t.minSize,u=t.multiple,f=t.maxFiles,h=t.onDragEnter,p=t.onDragLeave,g=t.onDragOver,y=t.onDrop,S=t.onDropAccepted,C=t.onDropRejected,w=t.onFileDialogCancel,k=t.onFileDialogOpen,j=t.useFsAccessApi,M=t.autoFocus,P=t.preventDropOnDocument,I=t.noClick,T=t.noKeyboard,D=t.noDrag,_=t.noDragEventsBubbling,z=t.onError,V=t.validator,F=x.useMemo(function(){return HD(n)},[n]),L=x.useMemo(function(){return BD(n)},[n]),X=x.useMemo(function(){return typeof k=="function"?k:W0},[k]),$=x.useMemo(function(){return typeof w=="function"?w:W0},[w]),Q=x.useRef(null),ie=x.useRef(null),oe=x.useReducer(nO,Vf),U=Wd(oe,2),K=U[0],ne=U[1],ce=K.isFocused,Re=K.isFileDialogActive,ze=x.useRef(typeof window<"u"&&window.isSecureContext&&j&&LD()),Me=function(){!ze.current&&Re&&setTimeout(function(){if(ie.current){var se=ie.current.files;se.length||(ne({type:"closeDialog"}),$())}},300)};x.useEffect(function(){return window.addEventListener("focus",Me,!1),function(){window.removeEventListener("focus",Me,!1)}},[ie,Re,$,ze]);var J=x.useRef([]),ue=function(se){Q.current&&Q.current.contains(se.target)||(se.preventDefault(),J.current=[])};x.useEffect(function(){return P&&(document.addEventListener("dragover",B0,!1),document.addEventListener("drop",ue,!1)),function(){P&&(document.removeEventListener("dragover",B0),document.removeEventListener("drop",ue))}},[Q,P]),x.useEffect(function(){return!r&&M&&Q.current&&Q.current.focus(),function(){}},[Q,M,r]);var Ie=x.useCallback(function(q){z?z(q):console.error(q)},[z]),Be=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q),J.current=[].concat(YD(J.current),[q.target]),Nl(q)&&Promise.resolve(i(q)).then(function(se){if(!(vc(q)&&!_)){var Fe=se.length,Ze=Fe>0&&zD({files:se,accept:F,minSize:c,maxSize:s,multiple:u,maxFiles:f,validator:V}),ee=Fe>0&&!Ze;ne({isDragAccept:Ze,isDragReject:ee,isDragActive:!0,type:"setDraggedFiles"}),h&&h(q)}}).catch(function(se){return Ie(se)})},[i,h,Ie,_,F,c,s,u,f,V]),Ne=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var se=Nl(q);if(se&&q.dataTransfer)try{q.dataTransfer.dropEffect="copy"}catch{}return se&&g&&g(q),!1},[g,_]),Ge=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var se=J.current.filter(function(Ze){return Q.current&&Q.current.contains(Ze)}),Fe=se.indexOf(q.target);Fe!==-1&&se.splice(Fe,1),J.current=se,!(se.length>0)&&(ne({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Nl(q)&&p&&p(q))},[Q,p,_]),Qe=x.useCallback(function(q,se){var Fe=[],Ze=[];q.forEach(function(ee){var He=L4(ee,F),nt=Wd(He,2),Ft=nt[0],pe=nt[1],De=B4(ee,c,s),hn=Wd(De,2),$t=hn[0],pn=hn[1],ir=V?V(ee):null;if(Ft&&$t&&!ir)Fe.push(ee);else{var yi=[pe,pn];ir&&(yi=yi.concat(ir)),Ze.push({file:ee,errors:yi.filter(function(da){return da})})}}),(!u&&Fe.length>1||u&&f>=1&&Fe.length>f)&&(Fe.forEach(function(ee){Ze.push({file:ee,errors:[AD]})}),Fe.splice(0)),ne({acceptedFiles:Fe,fileRejections:Ze,type:"setFiles"}),y&&y(Fe,Ze,se),Ze.length>0&&C&&C(Ze,se),Fe.length>0&&S&&S(Fe,se)},[ne,u,F,c,s,f,y,S,C,V]),ve=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q),J.current=[],Nl(q)&&Promise.resolve(i(q)).then(function(se){vc(q)&&!_||Qe(se,q)}).catch(function(se){return Ie(se)}),ne({type:"reset"})},[i,Qe,Ie,_]),_e=x.useCallback(function(){if(ze.current){ne({type:"openDialog"}),X();var q={multiple:u,types:L};window.showOpenFilePicker(q).then(function(se){return i(se)}).then(function(se){Qe(se,null),ne({type:"closeDialog"})}).catch(function(se){WD(se)?($(se),ne({type:"closeDialog"})):VD(se)?(ze.current=!1,ie.current?(ie.current.value=null,ie.current.click()):Ie(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."))):Ie(se)});return}ie.current&&(ne({type:"openDialog"}),X(),ie.current.value=null,ie.current.click())},[ne,X,$,j,Qe,Ie,L,u]),qe=x.useCallback(function(q){!Q.current||!Q.current.isEqualNode(q.target)||(q.key===" "||q.key==="Enter"||q.keyCode===32||q.keyCode===13)&&(q.preventDefault(),_e())},[Q,_e]),ge=x.useCallback(function(){ne({type:"focus"})},[]),Te=x.useCallback(function(){ne({type:"blur"})},[]),et=x.useCallback(function(){I||(FD()?setTimeout(_e,0):_e())},[I,_e]),Ve=function(se){return r?null:se},vt=function(se){return T?null:Ve(se)},Nt=function(se){return D?null:Ve(se)},N=function(se){_&&se.stopPropagation()},de=x.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},se=q.refKey,Fe=se===void 0?"ref":se,Ze=q.role,ee=q.onKeyDown,He=q.onFocus,nt=q.onBlur,Ft=q.onClick,pe=q.onDragEnter,De=q.onDragOver,hn=q.onDragLeave,$t=q.onDrop,pn=gc(q,GD);return Ot(Ot(Wf({onKeyDown:vt(hr(ee,qe)),onFocus:vt(hr(He,ge)),onBlur:vt(hr(nt,Te)),onClick:Ve(hr(Ft,et)),onDragEnter:Nt(hr(pe,Be)),onDragOver:Nt(hr(De,Ne)),onDragLeave:Nt(hr(hn,Ge)),onDrop:Nt(hr($t,ve)),role:typeof Ze=="string"&&Ze!==""?Ze:"presentation"},Fe,Q),!r&&!T?{tabIndex:0}:{}),pn)}},[Q,qe,ge,Te,et,Be,Ne,Ge,ve,T,D,r]),xe=x.useCallback(function(q){q.stopPropagation()},[]),je=x.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},se=q.refKey,Fe=se===void 0?"ref":se,Ze=q.onChange,ee=q.onClick,He=gc(q,qD),nt=Wf({accept:F,multiple:u,type:"file",style:{display:"none"},onChange:Ve(hr(Ze,ve)),onClick:Ve(hr(ee,xe)),tabIndex:-1},Fe,ie);return Ot(Ot({},nt),He)}},[ie,n,u,ve,r]);return Ot(Ot({},K),{},{isFocused:ce&&!r,getRootProps:de,getInputProps:je,rootRef:Q,inputRef:ie,open:Ve(_e)})}function nO(e,t){switch(t.type){case"focus":return Ot(Ot({},e),{},{isFocused:!0});case"blur":return Ot(Ot({},e),{},{isFocused:!1});case"openDialog":return Ot(Ot({},Vf),{},{isFileDialogActive:!0});case"closeDialog":return Ot(Ot({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return Ot(Ot({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Ot(Ot({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return Ot({},Vf);default:return e}}function W0(){}const rO=e=>{const{isDragAccept:t,isDragReject:n,overlaySecondaryText:r,setIsHandlingUpload:i}=e;return fe("esc",()=>{i(!1)}),l.jsx(We,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:l.jsx(B,{sx:{opacity:.4,width:"100%",height:"100%",flexDirection:"column",rowGap:4,alignItems:"center",justifyContent:"center",bg:"base.900",boxShadow:`inset 0 0 20rem 1rem var(--invokeai-colors-${t?"accent":"error"}-500)`},children:t?l.jsxs(Vn,{size:"lg",children:["Upload Image",r]}):l.jsxs(l.Fragment,{children:[l.jsx(Vn,{size:"lg",children:"Invalid Upload"}),l.jsx(Vn,{size:"md",children:"Must be single JPEG or PNG image"})]})})})},iO=e=>{const{children:t}=e,n=Y(),r=O(Bt),i=us({}),{t:s}=Z(),[c,u]=x.useState(!1),{setOpenUploader:f}=Zh(),h=x.useCallback(P=>{u(!0);const I=P.errors.reduce((T,D)=>`${T} -${D.message}`,"");i({title:s("toast.uploadFailed"),description:I,status:"error",isClosable:!0})},[s,i]),p=x.useCallback(async P=>{n(Ug({imageFile:P}))},[n]),g=x.useCallback((P,I)=>{I.forEach(T=>{h(T)}),P.forEach(T=>{p(T)})},[p,h]),{getRootProps:y,getInputProps:S,isDragAccept:C,isDragReject:w,isDragActive:k,open:j}=$4({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:g,onDragOver:()=>u(!0),maxFiles:1});f(j),x.useEffect(()=>{const P=I=>{var z;const T=(z=I.clipboardData)==null?void 0:z.items;if(!T)return;const D=[];for(const V of T)V.kind==="file"&&["image/png","image/jpg"].includes(V.type)&&D.push(V);if(!D.length)return;if(I.stopImmediatePropagation(),D.length>1){i({description:s("toast.uploadFailedMultipleImagesDesc"),status:"error",isClosable:!0});return}const _=D[0].getAsFile();if(!_){i({description:s("toast.uploadFailedUnableToLoadDesc"),status:"error",isClosable:!0});return}n(Ug({imageFile:_}))};return document.addEventListener("paste",P),()=>{document.removeEventListener("paste",P)}},[s,n,i,r]);const M=["img2img","unifiedCanvas"].includes(r)?` to ${Dn[r].tooltip}`:"";return l.jsx(Qh.Provider,{value:j,children:l.jsxs(We,{...y({style:{}}),onKeyDown:P=>{P.key},children:[l.jsx("input",{...S()}),t,k&&c&&l.jsx(rO,{isDragAccept:C,isDragReject:w,overlaySecondaryText:M,setIsHandlingUpload:u})]})})},oO=be(Pt,e=>e.log,{memoizeOptions:{resultEqualityCheck:(e,t)=>e.length===t.length}}),aO=be(Pt,e=>({shouldShowLogViewer:e.shouldShowLogViewer,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),sO=()=>{const e=Y(),t=O(oO),{shouldShowLogViewer:n,hasError:r,wasErrorSeen:i}=O(aO),[s,c]=x.useState(!0),u=x.useRef(null);x.useLayoutEffect(()=>{u.current!==null&&s&&(u.current.scrollTop=u.current.scrollHeight)},[s,t,n]);const f=()=>{e(f2()),e(vd(!n))};fe("`",()=>{e(vd(!n))},[n]),fe("esc",()=>{e(vd(!1))});const h=()=>{u.current&&s&&u.current.scrollTop{const{timestamp:y,message:S,level:C}=p,w=C==="info"?"base":C;return l.jsxs(B,{sx:{gap:2,color:`${w}.300`},children:[l.jsxs(Ce,{fontWeight:"600",children:[y,":"]}),l.jsx(Ce,{wordBreak:"break-all",children:S})]},g)})})}),n&&l.jsx(Yt,{hasArrow:!0,label:s?"Autoscroll On":"Autoscroll Off",children:l.jsx(le,{size:"sm","aria-label":"Toggle autoscroll",icon:l.jsx(E8,{}),onClick:()=>c(!s),isChecked:s,sx:{position:"fixed",insetInlineStart:2,bottom:12,zIndex:"10000"}})}),l.jsx(Yt,{hasArrow:!0,label:n?"Hide Console":"Show Console",children:l.jsx(le,{size:"sm","aria-label":"Toggle Log Viewer",icon:n?l.jsx(V8,{}):l.jsx(Ty,{}),onClick:f,sx:{position:"fixed",insetInlineStart:2,bottom:2,zIndex:"10000"},colorScheme:r||!i?"error":"base"})})]})},lO=be(Pt,e=>({isProcessing:e.isProcessing,currentStep:e.currentStep,totalSteps:e.totalSteps,currentStatusHasSteps:e.currentStatusHasSteps}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),cO=()=>{const{t:e}=Z(),{isProcessing:t,currentStep:n,totalSteps:r,currentStatusHasSteps:i}=O(lO),s=n?Math.round(n*100/r):0;return l.jsx(ey,{value:s,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:t&&!i,height:fp,zIndex:99})};function uO(e){const{title:t,hotkey:n,description:r}=e;return l.jsxs($n,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[l.jsxs($n,{children:[l.jsx(Ce,{fontWeight:600,children:t}),r&&l.jsx(Ce,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),l.jsx(We,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function dO({children:e}){const{isOpen:t,onOpen:n,onClose:r}=ui(),{t:i}=Z(),s=[{title:i("hotkeys.invoke.title"),desc:i("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:i("hotkeys.cancel.title"),desc:i("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:i("hotkeys.focusPrompt.title"),desc:i("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:i("hotkeys.toggleOptions.title"),desc:i("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:i("hotkeys.pinOptions.title"),desc:i("hotkeys.pinOptions.desc"),hotkey:"Shift+O"},{title:i("hotkeys.toggleViewer.title"),desc:i("hotkeys.toggleViewer.desc"),hotkey:"Z"},{title:i("hotkeys.toggleGallery.title"),desc:i("hotkeys.toggleGallery.desc"),hotkey:"G"},{title:i("hotkeys.maximizeWorkSpace.title"),desc:i("hotkeys.maximizeWorkSpace.desc"),hotkey:"F"},{title:i("hotkeys.changeTabs.title"),desc:i("hotkeys.changeTabs.desc"),hotkey:"1-5"},{title:i("hotkeys.consoleToggle.title"),desc:i("hotkeys.consoleToggle.desc"),hotkey:"`"}],c=[{title:i("hotkeys.setPrompt.title"),desc:i("hotkeys.setPrompt.desc"),hotkey:"P"},{title:i("hotkeys.setSeed.title"),desc:i("hotkeys.setSeed.desc"),hotkey:"S"},{title:i("hotkeys.setParameters.title"),desc:i("hotkeys.setParameters.desc"),hotkey:"A"},{title:i("hotkeys.restoreFaces.title"),desc:i("hotkeys.restoreFaces.desc"),hotkey:"Shift+R"},{title:i("hotkeys.upscale.title"),desc:i("hotkeys.upscale.desc"),hotkey:"Shift+U"},{title:i("hotkeys.showInfo.title"),desc:i("hotkeys.showInfo.desc"),hotkey:"I"},{title:i("hotkeys.sendToImageToImage.title"),desc:i("hotkeys.sendToImageToImage.desc"),hotkey:"Shift+I"},{title:i("hotkeys.deleteImage.title"),desc:i("hotkeys.deleteImage.desc"),hotkey:"Del"},{title:i("hotkeys.closePanels.title"),desc:i("hotkeys.closePanels.desc"),hotkey:"Esc"}],u=[{title:i("hotkeys.previousImage.title"),desc:i("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:i("hotkeys.nextImage.title"),desc:i("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:i("hotkeys.toggleGalleryPin.title"),desc:i("hotkeys.toggleGalleryPin.desc"),hotkey:"Shift+G"},{title:i("hotkeys.increaseGalleryThumbSize.title"),desc:i("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:i("hotkeys.decreaseGalleryThumbSize.title"),desc:i("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],f=[{title:i("hotkeys.selectBrush.title"),desc:i("hotkeys.selectBrush.desc"),hotkey:"B"},{title:i("hotkeys.selectEraser.title"),desc:i("hotkeys.selectEraser.desc"),hotkey:"E"},{title:i("hotkeys.decreaseBrushSize.title"),desc:i("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:i("hotkeys.increaseBrushSize.title"),desc:i("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:i("hotkeys.decreaseBrushOpacity.title"),desc:i("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:i("hotkeys.increaseBrushOpacity.title"),desc:i("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:i("hotkeys.moveTool.title"),desc:i("hotkeys.moveTool.desc"),hotkey:"V"},{title:i("hotkeys.fillBoundingBox.title"),desc:i("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:i("hotkeys.eraseBoundingBox.title"),desc:i("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:i("hotkeys.colorPicker.title"),desc:i("hotkeys.colorPicker.desc"),hotkey:"C"},{title:i("hotkeys.toggleSnap.title"),desc:i("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:i("hotkeys.quickToggleMove.title"),desc:i("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:i("hotkeys.toggleLayer.title"),desc:i("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:i("hotkeys.clearMask.title"),desc:i("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:i("hotkeys.hideMask.title"),desc:i("hotkeys.hideMask.desc"),hotkey:"H"},{title:i("hotkeys.showHideBoundingBox.title"),desc:i("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:i("hotkeys.mergeVisible.title"),desc:i("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:i("hotkeys.saveToGallery.title"),desc:i("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:i("hotkeys.copyToClipboard.title"),desc:i("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:i("hotkeys.downloadImage.title"),desc:i("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:i("hotkeys.undoStroke.title"),desc:i("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:i("hotkeys.redoStroke.title"),desc:i("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:i("hotkeys.resetView.title"),desc:i("hotkeys.resetView.desc"),hotkey:"R"},{title:i("hotkeys.previousStagingImage.title"),desc:i("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:i("hotkeys.nextStagingImage.title"),desc:i("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:i("hotkeys.acceptStagingImage.title"),desc:i("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],h=p=>l.jsx(B,{flexDir:"column",gap:4,children:p.map((g,y)=>l.jsxs(B,{flexDir:"column",px:2,gap:4,children:[l.jsx(uO,{title:g.title,description:g.desc,hotkey:g.hotkey}),y-1}function qO(e,t){var n=this.__data__,r=$c(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function $r(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=ez}var tz="[object Arguments]",nz="[object Array]",rz="[object Boolean]",iz="[object Date]",oz="[object Error]",az="[object Function]",sz="[object Map]",lz="[object Number]",cz="[object Object]",uz="[object RegExp]",dz="[object Set]",fz="[object String]",hz="[object WeakMap]",pz="[object ArrayBuffer]",mz="[object DataView]",vz="[object Float32Array]",gz="[object Float64Array]",xz="[object Int8Array]",yz="[object Int16Array]",bz="[object Int32Array]",Sz="[object Uint8Array]",Cz="[object Uint8ClampedArray]",wz="[object Uint16Array]",kz="[object Uint32Array]",Ct={};Ct[vz]=Ct[gz]=Ct[xz]=Ct[yz]=Ct[bz]=Ct[Sz]=Ct[Cz]=Ct[wz]=Ct[kz]=!0;Ct[tz]=Ct[nz]=Ct[pz]=Ct[rz]=Ct[mz]=Ct[iz]=Ct[oz]=Ct[az]=Ct[sz]=Ct[lz]=Ct[cz]=Ct[uz]=Ct[dz]=Ct[fz]=Ct[hz]=!1;function jz(e){return so(e)&&rb(e.length)&&!!Ct[ao(e)]}function Lp(e){return function(t){return e(t)}}var ib=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$a=ib&&typeof module=="object"&&module&&!module.nodeType&&module,Ez=$a&&$a.exports===ib,Ud=Ez&&G4.process,Pz=function(){try{var e=$a&&$a.require&&$a.require("util").types;return e||Ud&&Ud.binding&&Ud.binding("util")}catch{}}();const na=Pz;var Z0=na&&na.isTypedArray,Iz=Z0?Lp(Z0):jz;const Mz=Iz;var Tz=Object.prototype,_z=Tz.hasOwnProperty;function ob(e,t){var n=Cs(e),r=!n&&$A(e),i=!n&&!r&&nb(e),s=!n&&!r&&!i&&Mz(e),c=n||r||i||s,u=c?BA(e.length,String):[],f=u.length;for(var h in e)(t||_z.call(e,h))&&!(c&&(h=="length"||i&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||JA(h,f)))&&u.push(h);return u}var Dz=Object.prototype;function Bp(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Dz;return e===n}var Oz=Y4(Object.keys,Object);const Az=Oz;var zz=Object.prototype,Rz=zz.hasOwnProperty;function Nz(e){if(!Bp(e))return Az(e);var t=[];for(var n in Object(e))Rz.call(e,n)&&n!="constructor"&&t.push(n);return t}function ab(e){return e!=null&&rb(e.length)&&!Q4(e)}function Hp(e){return ab(e)?ob(e):Nz(e)}function Fz(e,t){return e&&qc(t,Hp(t),e)}function Lz(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Bz=Object.prototype,Hz=Bz.hasOwnProperty;function Wz(e){if(!Ss(e))return Lz(e);var t=Bp(e),n=[];for(var r in e)r=="constructor"&&(t||!Hz.call(e,r))||n.push(r);return n}function Wp(e){return ab(e)?ob(e,!0):Wz(e)}function Vz(e,t){return e&&qc(t,Wp(t),e)}var sb=typeof exports=="object"&&exports&&!exports.nodeType&&exports,J0=sb&&typeof module=="object"&&module&&!module.nodeType&&module,Uz=J0&&J0.exports===sb,e1=Uz?kr.Buffer:void 0,t1=e1?e1.allocUnsafe:void 0;function $z(e,t){if(t)return e.slice();var n=e.length,r=t1?t1(n):new e.constructor(n);return e.copy(r),r}function lb(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n=0)&&(n[i]=e[i]);return n}function g1(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var x1=function(t){return Array.isArray(t)&&t.length===0},kn=function(t){return typeof t=="function"},Yc=function(t){return t!==null&&typeof t=="object"},VN=function(t){return String(Math.floor(Number(t)))===t},$d=function(t){return Object.prototype.toString.call(t)==="[object String]"},yb=function(t){return x.Children.count(t)===0},Gd=function(t){return Yc(t)&&kn(t.then)};function rn(e,t,n,r){r===void 0&&(r=0);for(var i=xb(t);e&&r=0?[]:{}}}return(s===0?e:i)[c[s]]===n?e:(n===void 0?delete i[c[s]]:i[c[s]]=n,s===0&&n===void 0&&delete r[c[s]],r)}function bb(e,t,n,r){n===void 0&&(n=new WeakMap),r===void 0&&(r={});for(var i=0,s=Object.keys(e);i0?de.map(function(je){return z(je,rn(N,je))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(xe).then(function(je){return je.reduce(function(q,se,Fe){return se==="DO_NOT_DELETE_YOU_WILL_BE_FIRED"||se&&(q=br(q,de[Fe],se)),q},{})})},[z]),F=x.useCallback(function(N){return Promise.all([V(N),y.validationSchema?_(N):{},y.validate?D(N):{}]).then(function(de){var xe=de[0],je=de[1],q=de[2],se=$f.all([xe,je,q],{arrayMerge:XN});return se})},[y.validate,y.validationSchema,V,D,_]),L=Hn(function(N){return N===void 0&&(N=I.values),T({type:"SET_ISVALIDATING",payload:!0}),F(N).then(function(de){return j.current&&(T({type:"SET_ISVALIDATING",payload:!1}),T({type:"SET_ERRORS",payload:de})),de})});x.useEffect(function(){c&&j.current===!0&&ri(S.current,y.initialValues)&&L(S.current)},[c,L]);var X=x.useCallback(function(N){var de=N&&N.values?N.values:S.current,xe=N&&N.errors?N.errors:C.current?C.current:y.initialErrors||{},je=N&&N.touched?N.touched:w.current?w.current:y.initialTouched||{},q=N&&N.status?N.status:k.current?k.current:y.initialStatus;S.current=de,C.current=xe,w.current=je,k.current=q;var se=function(){T({type:"RESET_FORM",payload:{isSubmitting:!!N&&!!N.isSubmitting,errors:xe,touched:je,status:q,values:de,isValidating:!!N&&!!N.isValidating,submitCount:N&&N.submitCount&&typeof N.submitCount=="number"?N.submitCount:0}})};if(y.onReset){var Fe=y.onReset(I.values,ve);Gd(Fe)?Fe.then(se):se()}else se()},[y.initialErrors,y.initialStatus,y.initialTouched]);x.useEffect(function(){j.current===!0&&!ri(S.current,y.initialValues)&&(h&&(S.current=y.initialValues,X()),c&&L(S.current))},[h,y.initialValues,X,c,L]),x.useEffect(function(){h&&j.current===!0&&!ri(C.current,y.initialErrors)&&(C.current=y.initialErrors||Oi,T({type:"SET_ERRORS",payload:y.initialErrors||Oi}))},[h,y.initialErrors]),x.useEffect(function(){h&&j.current===!0&&!ri(w.current,y.initialTouched)&&(w.current=y.initialTouched||Fl,T({type:"SET_TOUCHED",payload:y.initialTouched||Fl}))},[h,y.initialTouched]),x.useEffect(function(){h&&j.current===!0&&!ri(k.current,y.initialStatus)&&(k.current=y.initialStatus,T({type:"SET_STATUS",payload:y.initialStatus}))},[h,y.initialStatus,y.initialTouched]);var $=Hn(function(N){if(M.current[N]&&kn(M.current[N].validate)){var de=rn(I.values,N),xe=M.current[N].validate(de);return Gd(xe)?(T({type:"SET_ISVALIDATING",payload:!0}),xe.then(function(je){return je}).then(function(je){T({type:"SET_FIELD_ERROR",payload:{field:N,value:je}}),T({type:"SET_ISVALIDATING",payload:!1})})):(T({type:"SET_FIELD_ERROR",payload:{field:N,value:xe}}),Promise.resolve(xe))}else if(y.validationSchema)return T({type:"SET_ISVALIDATING",payload:!0}),_(I.values,N).then(function(je){return je}).then(function(je){T({type:"SET_FIELD_ERROR",payload:{field:N,value:je[N]}}),T({type:"SET_ISVALIDATING",payload:!1})});return Promise.resolve()}),Q=x.useCallback(function(N,de){var xe=de.validate;M.current[N]={validate:xe}},[]),ie=x.useCallback(function(N){delete M.current[N]},[]),oe=Hn(function(N,de){T({type:"SET_TOUCHED",payload:N});var xe=de===void 0?i:de;return xe?L(I.values):Promise.resolve()}),U=x.useCallback(function(N){T({type:"SET_ERRORS",payload:N})},[]),K=Hn(function(N,de){var xe=kn(N)?N(I.values):N;T({type:"SET_VALUES",payload:xe});var je=de===void 0?n:de;return je?L(xe):Promise.resolve()}),ne=x.useCallback(function(N,de){T({type:"SET_FIELD_ERROR",payload:{field:N,value:de}})},[]),ce=Hn(function(N,de,xe){T({type:"SET_FIELD_VALUE",payload:{field:N,value:de}});var je=xe===void 0?n:xe;return je?L(br(I.values,N,de)):Promise.resolve()}),Re=x.useCallback(function(N,de){var xe=de,je=N,q;if(!$d(N)){N.persist&&N.persist();var se=N.target?N.target:N.currentTarget,Fe=se.type,Ze=se.name,ee=se.id,He=se.value,nt=se.checked,Ft=se.outerHTML,pe=se.options,De=se.multiple;xe=de||Ze||ee,je=/number|range/.test(Fe)?(q=parseFloat(He),isNaN(q)?"":q):/checkbox/.test(Fe)?QN(rn(I.values,xe),nt,He):pe&&De?KN(pe):He}xe&&ce(xe,je)},[ce,I.values]),ze=Hn(function(N){if($d(N))return function(de){return Re(de,N)};Re(N)}),Me=Hn(function(N,de,xe){de===void 0&&(de=!0),T({type:"SET_FIELD_TOUCHED",payload:{field:N,value:de}});var je=xe===void 0?i:xe;return je?L(I.values):Promise.resolve()}),J=x.useCallback(function(N,de){N.persist&&N.persist();var xe=N.target,je=xe.name,q=xe.id,se=xe.outerHTML,Fe=de||je||q;Me(Fe,!0)},[Me]),ue=Hn(function(N){if($d(N))return function(de){return J(de,N)};J(N)}),Ie=x.useCallback(function(N){kn(N)?T({type:"SET_FORMIK_STATE",payload:N}):T({type:"SET_FORMIK_STATE",payload:function(){return N}})},[]),Be=x.useCallback(function(N){T({type:"SET_STATUS",payload:N})},[]),Ne=x.useCallback(function(N){T({type:"SET_ISSUBMITTING",payload:N})},[]),Ge=Hn(function(){return T({type:"SUBMIT_ATTEMPT"}),L().then(function(N){var de=N instanceof Error,xe=!de&&Object.keys(N).length===0;if(xe){var je;try{if(je=_e(),je===void 0)return}catch(q){throw q}return Promise.resolve(je).then(function(q){return j.current&&T({type:"SUBMIT_SUCCESS"}),q}).catch(function(q){if(j.current)throw T({type:"SUBMIT_FAILURE"}),q})}else if(j.current&&(T({type:"SUBMIT_FAILURE"}),de))throw N})}),Qe=Hn(function(N){N&&N.preventDefault&&kn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&kn(N.stopPropagation)&&N.stopPropagation(),Ge().catch(function(de){console.warn("Warning: An unhandled error was caught from submitForm()",de)})}),ve={resetForm:X,validateForm:L,validateField:$,setErrors:U,setFieldError:ne,setFieldTouched:Me,setFieldValue:ce,setStatus:Be,setSubmitting:Ne,setTouched:oe,setValues:K,setFormikState:Ie,submitForm:Ge},_e=Hn(function(){return p(I.values,ve)}),qe=Hn(function(N){N&&N.preventDefault&&kn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&kn(N.stopPropagation)&&N.stopPropagation(),X()}),ge=x.useCallback(function(N){return{value:rn(I.values,N),error:rn(I.errors,N),touched:!!rn(I.touched,N),initialValue:rn(S.current,N),initialTouched:!!rn(w.current,N),initialError:rn(C.current,N)}},[I.errors,I.touched,I.values]),Te=x.useCallback(function(N){return{setValue:function(xe,je){return ce(N,xe,je)},setTouched:function(xe,je){return Me(N,xe,je)},setError:function(xe){return ne(N,xe)}}},[ce,Me,ne]),et=x.useCallback(function(N){var de=Yc(N),xe=de?N.name:N,je=rn(I.values,xe),q={name:xe,value:je,onChange:ze,onBlur:ue};if(de){var se=N.type,Fe=N.value,Ze=N.as,ee=N.multiple;se==="checkbox"?Fe===void 0?q.checked=!!je:(q.checked=!!(Array.isArray(je)&&~je.indexOf(Fe)),q.value=Fe):se==="radio"?(q.checked=je===Fe,q.value=Fe):Ze==="select"&&ee&&(q.value=q.value||[],q.multiple=!0)}return q},[ue,ze,I.values]),Ve=x.useMemo(function(){return!ri(S.current,I.values)},[S.current,I.values]),vt=x.useMemo(function(){return typeof u<"u"?Ve?I.errors&&Object.keys(I.errors).length===0:u!==!1&&kn(u)?u(y):u:I.errors&&Object.keys(I.errors).length===0},[u,Ve,I.errors,y]),Nt=ht({},I,{initialValues:S.current,initialErrors:C.current,initialTouched:w.current,initialStatus:k.current,handleBlur:ue,handleChange:ze,handleReset:qe,handleSubmit:Qe,resetForm:X,setErrors:U,setFormikState:Ie,setFieldTouched:Me,setFieldValue:ce,setFieldError:ne,setStatus:Be,setSubmitting:Ne,setTouched:oe,setValues:K,submitForm:Ge,validateForm:L,validateField:$,isValid:vt,dirty:Ve,unregisterField:ie,registerField:Q,getFieldProps:et,getFieldMeta:ge,getFieldHelpers:Te,validateOnBlur:i,validateOnChange:n,validateOnMount:c});return Nt}function ws(e){var t=GN(e),n=e.component,r=e.children,i=e.render,s=e.innerRef;return x.useImperativeHandle(s,function(){return t}),x.createElement(UN,{value:t},n?x.createElement(n,t):i?i(t):r?kn(r)?r(t):yb(r)?null:x.Children.only(r):null)}function qN(e){var t={};if(e.inner){if(e.inner.length===0)return br(t,e.path,e.message);for(var i=e.inner,n=Array.isArray(i),r=0,i=n?i:i[Symbol.iterator]();;){var s;if(n){if(r>=i.length)break;s=i[r++]}else{if(r=i.next(),r.done)break;s=r.value}var c=s;rn(t,c.path)||(t=br(t,c.path,c.message))}}return t}function YN(e,t,n,r){n===void 0&&(n=!1),r===void 0&&(r={});var i=Kf(e);return t[n?"validateSync":"validate"](i,{abortEarly:!1,context:r})}function Kf(e){var t=Array.isArray(e)?[]:{};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=String(n);Array.isArray(e[r])===!0?t[r]=e[r].map(function(i){return Array.isArray(i)===!0||G0(i)?Kf(i):i!==""?i:void 0}):G0(e[r])?t[r]=Kf(e[r]):t[r]=e[r]!==""?e[r]:void 0}return t}function XN(e,t,n){var r=e.slice();return t.forEach(function(s,c){if(typeof r[c]>"u"){var u=n.clone!==!1,f=u&&n.isMergeableObject(s);r[c]=f?$f(Array.isArray(s)?[]:{},s,n):s}else n.isMergeableObject(s)?r[c]=$f(e[c],s,n):e.indexOf(s)===-1&&r.push(s)}),r}function KN(e){return Array.from(e).filter(function(t){return t.selected}).map(function(t){return t.value})}function QN(e,t,n){if(typeof e=="boolean")return Boolean(t);var r=[],i=!1,s=-1;if(Array.isArray(e))r=e,s=e.indexOf(n),i=s>=0;else if(!n||n=="true"||n=="false")return Boolean(t);return t&&n&&!i?r.concat(n):i?r.slice(0,s).concat(r.slice(s+1)):r}var ZN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?x.useLayoutEffect:x.useEffect;function Hn(e){var t=x.useRef(e);return ZN(function(){t.current=e}),x.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;ir?i:r},0);return Array.from(ht({},t,{length:n+1}))}else return[]},rF=function(e){WN(t,e);function t(r){var i;return i=e.call(this,r)||this,i.updateArrayField=function(s,c,u){var f=i.props,h=f.name,p=f.formik.setFormikState;p(function(g){var y=typeof u=="function"?u:s,S=typeof c=="function"?c:s,C=br(g.values,h,s(rn(g.values,h))),w=u?y(rn(g.errors,h)):void 0,k=c?S(rn(g.touched,h)):void 0;return x1(w)&&(w=void 0),x1(k)&&(k=void 0),ht({},g,{values:C,errors:u?br(g.errors,h,w):g.errors,touched:c?br(g.touched,h,k):g.touched})})},i.push=function(s){return i.updateArrayField(function(c){return[].concat(ra(c),[HN(s)])},!1,!1)},i.handlePush=function(s){return function(){return i.push(s)}},i.swap=function(s,c){return i.updateArrayField(function(u){return tF(u,s,c)},!0,!0)},i.handleSwap=function(s,c){return function(){return i.swap(s,c)}},i.move=function(s,c){return i.updateArrayField(function(u){return eF(u,s,c)},!0,!0)},i.handleMove=function(s,c){return function(){return i.move(s,c)}},i.insert=function(s,c){return i.updateArrayField(function(u){return qd(u,s,c)},function(u){return qd(u,s,null)},function(u){return qd(u,s,null)})},i.handleInsert=function(s,c){return function(){return i.insert(s,c)}},i.replace=function(s,c){return i.updateArrayField(function(u){return nF(u,s,c)},!1,!1)},i.handleReplace=function(s,c){return function(){return i.replace(s,c)}},i.unshift=function(s){var c=-1;return i.updateArrayField(function(u){var f=u?[s].concat(u):[s];return c<0&&(c=f.length),f},function(u){var f=u?[null].concat(u):[null];return c<0&&(c=f.length),f},function(u){var f=u?[null].concat(u):[null];return c<0&&(c=f.length),f}),c},i.handleUnshift=function(s){return function(){return i.unshift(s)}},i.handleRemove=function(s){return function(){return i.remove(s)}},i.handlePop=function(){return function(){return i.pop()}},i.remove=i.remove.bind(g1(i)),i.pop=i.pop.bind(g1(i)),i}var n=t.prototype;return n.componentDidUpdate=function(i){this.props.validateOnChange&&this.props.formik.validateOnChange&&!ri(rn(i.formik.values,i.name),rn(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},n.remove=function(i){var s;return this.updateArrayField(function(c){var u=c?ra(c):[];return s||(s=u[i]),kn(u.splice)&&u.splice(i,1),u},!0,!0),s},n.pop=function(){var i;return this.updateArrayField(function(s){var c=s;return i||(i=c&&c.pop&&c.pop()),c},!0,!0),i},n.render=function(){var i={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},s=this.props,c=s.component,u=s.render,f=s.children,h=s.name,p=s.formik,g=Li(p,["validate","validationSchema"]),y=ht({},i,{form:g,name:h});return c?x.createElement(c,y):u?u(y):f?typeof f=="function"?f(y):yb(f)?null:x.Children.only(f):null},t}(x.Component);rF.defaultProps={validateOnChange:!0};function iF(e){const{model:t}=e,r=O(C=>C.system.model_list)[t],i=Y(),{t:s}=Z(),c=O(C=>C.system.isProcessing),u=O(C=>C.system.isConnected),[f,h]=x.useState("same"),[p,g]=x.useState("");x.useEffect(()=>{h("same")},[t]);const y=()=>{h("same")},S=()=>{i(i3({model_name:t,save_location:f,custom_location:f==="custom"&&p!==""?p:null}))};return l.jsxs(Wc,{title:`${s("modelManager.convert")} ${t}`,acceptCallback:S,cancelCallback:y,acceptButtonText:`${s("modelManager.convert")}`,triggerComponent:l.jsxs(Je,{size:"sm","aria-label":s("modelManager.convertToDiffusers"),isDisabled:r.status==="active"||c||!u,className:" modal-close-btn",marginInlineEnd:8,children:["🧨 ",s("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[l.jsxs(B,{flexDirection:"column",rowGap:4,children:[l.jsx(Ce,{children:s("modelManager.convertToDiffusersHelpText1")}),l.jsxs(gx,{children:[l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText2")}),l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText3")}),l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText4")}),l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText5")})]}),l.jsx(Ce,{children:s("modelManager.convertToDiffusersHelpText6")})]}),l.jsxs(B,{flexDir:"column",gap:4,children:[l.jsxs(B,{marginTop:4,flexDir:"column",gap:2,children:[l.jsx(Ce,{fontWeight:"600",children:s("modelManager.convertToDiffusersSaveLocation")}),l.jsx(Ja,{value:f,onChange:C=>h(C),children:l.jsxs(B,{gap:4,children:[l.jsx(vn,{value:"same",children:l.jsx(Yt,{label:"Save converted model in the same folder",children:s("modelManager.sameFolder")})}),l.jsx(vn,{value:"root",children:l.jsx(Yt,{label:"Save converted model in the InvokeAI root folder",children:s("modelManager.invokeRoot")})}),l.jsx(vn,{value:"custom",children:l.jsx(Yt,{label:"Save converted model in a custom folder",children:s("modelManager.custom")})})]})})]}),f==="custom"&&l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:s("modelManager.customSaveLocation")}),l.jsx(mt,{value:p,onChange:C=>{C.target.value!==""&&g(C.target.value)},width:"full"})]})]})]})}const oF=be([Pt],e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),y1=64,b1=2048;function aF(){const{openModel:e,model_list:t}=O(oF),n=O(f=>f.system.isProcessing),r=Y(),{t:i}=Z(),[s,c]=x.useState({name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,default:!1,format:"ckpt"});x.useEffect(()=>{var f,h,p,g,y,S,C;if(e){const w=te.pickBy(t,(k,j)=>te.isEqual(j,e));c({name:e,description:(f=w[e])==null?void 0:f.description,config:(h=w[e])==null?void 0:h.config,weights:(p=w[e])==null?void 0:p.weights,vae:(g=w[e])==null?void 0:g.vae,width:(y=w[e])==null?void 0:y.width,height:(S=w[e])==null?void 0:S.height,default:(C=w[e])==null?void 0:C.default,format:"ckpt"})}},[t,e]);const u=f=>{r(ls({...f,width:Number(f.width),height:Number(f.height)}))};return e?l.jsxs(B,{flexDirection:"column",rowGap:4,width:"100%",children:[l.jsxs(B,{alignItems:"center",gap:4,justifyContent:"space-between",children:[l.jsx(Ce,{fontSize:"lg",fontWeight:"bold",children:e}),l.jsx(iF,{model:e})]}),l.jsx(B,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",paddingInlineEnd:8,children:l.jsx(ws,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:h,touched:p})=>l.jsx("form",{onSubmit:f,children:l.jsxs(Le,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!h.description&&p.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:i("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),h.description&&p.description?l.jsx(kt,{children:h.description}):l.jsx(wt,{margin:0,children:i("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.config&&p.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:i("modelManager.config")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"config",name:"config",type:"text",width:"full"}),h.config&&p.config?l.jsx(kt,{children:h.config}):l.jsx(wt,{margin:0,children:i("modelManager.configValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.weights&&p.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:i("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"weights",name:"weights",type:"text",width:"full"}),h.weights&&p.weights?l.jsx(kt,{children:h.weights}):l.jsx(wt,{margin:0,children:i("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.vae&&p.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:i("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae",name:"vae",type:"text",width:"full"}),h.vae&&p.vae?l.jsx(kt,{children:h.vae}):l.jsx(wt,{margin:0,children:i("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(sa,{width:"100%",children:[l.jsxs(rt,{isInvalid:!!h.width&&p.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:i("modelManager.width")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"width",name:"width",children:({field:g,form:y})=>l.jsx(Lr,{id:"width",name:"width",min:y1,max:b1,step:64,value:y.values.width,onChange:S=>y.setFieldValue(g.name,Number(S))})}),h.width&&p.width?l.jsx(kt,{children:h.width}):l.jsx(wt,{margin:0,children:i("modelManager.widthValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.height&&p.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:i("modelManager.height")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"height",name:"height",children:({field:g,form:y})=>l.jsx(Lr,{id:"height",name:"height",min:y1,max:b1,step:64,value:y.values.height,onChange:S=>y.setFieldValue(g.name,Number(S))})}),h.height&&p.height?l.jsx(kt,{children:h.height}):l.jsx(wt,{margin:0,children:i("modelManager.heightValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:i("modelManager.updateModel")})]})})})})]}):l.jsx(B,{sx:{width:"100%",justifyContent:"center",alignItems:"center",borderRadius:"base",bg:"base.900"},children:l.jsx(Ce,{fontWeight:500,children:"Pick A Model To Edit"})})}const sF=be([Pt],e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function lF(){const{openModel:e,model_list:t}=O(sF),n=O(f=>f.system.isProcessing),r=Y(),{t:i}=Z(),[s,c]=x.useState({name:"",description:"",repo_id:"",path:"",vae:{repo_id:"",path:""},default:!1,format:"diffusers"});x.useEffect(()=>{var f,h,p,g,y,S,C,w,k,j,M,P,I,T,D,_;if(e){const z=te.pickBy(t,(V,F)=>te.isEqual(F,e));c({name:e,description:(f=z[e])==null?void 0:f.description,path:(h=z[e])!=null&&h.path&&((p=z[e])==null?void 0:p.path)!=="None"?(g=z[e])==null?void 0:g.path:"",repo_id:(y=z[e])!=null&&y.repo_id&&((S=z[e])==null?void 0:S.repo_id)!=="None"?(C=z[e])==null?void 0:C.repo_id:"",vae:{repo_id:(k=(w=z[e])==null?void 0:w.vae)!=null&&k.repo_id?(M=(j=z[e])==null?void 0:j.vae)==null?void 0:M.repo_id:"",path:(I=(P=z[e])==null?void 0:P.vae)!=null&&I.path?(D=(T=z[e])==null?void 0:T.vae)==null?void 0:D.path:""},default:(_=z[e])==null?void 0:_.default,format:"diffusers"})}},[t,e]);const u=f=>{const h=f;f.path===""&&delete h.path,f.repo_id===""&&delete h.repo_id,f.vae.path===""&&delete h.vae.path,f.vae.repo_id===""&&delete h.vae.repo_id,r(ls(f))};return e?l.jsxs(B,{flexDirection:"column",rowGap:4,width:"100%",children:[l.jsx(B,{alignItems:"center",children:l.jsx(Ce,{fontSize:"lg",fontWeight:"bold",children:e})}),l.jsx(B,{flexDirection:"column",overflowY:"scroll",paddingInlineEnd:8,children:l.jsx(ws,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:h,touched:p})=>{var g,y,S,C,w,k,j,M,P,I;return l.jsx("form",{onSubmit:f,children:l.jsxs(Le,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!h.description&&p.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:i("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),h.description&&p.description?l.jsx(kt,{children:h.description}):l.jsx(wt,{margin:0,children:i("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.path&&p.path,isRequired:!0,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:i("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"path",name:"path",type:"text",width:"full"}),h.path&&p.path?l.jsx(kt,{children:h.path}):l.jsx(wt,{margin:0,children:i("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.repo_id&&p.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:i("modelManager.repo_id")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"full"}),h.repo_id&&p.repo_id?l.jsx(kt,{children:h.repo_id}):l.jsx(wt,{margin:0,children:i("modelManager.repoIDValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((g=h.vae)!=null&&g.path)&&((y=p.vae)==null?void 0:y.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:i("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"full"}),(S=h.vae)!=null&&S.path&&((C=p.vae)!=null&&C.path)?l.jsx(kt,{children:(w=h.vae)==null?void 0:w.path}):l.jsx(wt,{margin:0,children:i("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((k=h.vae)!=null&&k.repo_id)&&((j=p.vae)==null?void 0:j.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:i("modelManager.vaeRepoID")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"full"}),(M=h.vae)!=null&&M.repo_id&&((P=p.vae)!=null&&P.repo_id)?l.jsx(kt,{children:(I=h.vae)==null?void 0:I.repo_id}):l.jsx(wt,{margin:0,children:i("modelManager.vaeRepoIDValidationMsg")})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:i("modelManager.updateModel")})]})})}})})]}):l.jsx(B,{sx:{width:"100%",justifyContent:"center",alignItems:"center",borderRadius:"base",bg:"base.900"},children:l.jsx(Ce,{fontWeight:"500",children:"Pick A Model To Edit"})})}const Cb=be([Pt],e=>{const{model_list:t}=e,n=[];return te.forEach(t,r=>{n.push(r.weights)}),n});function S1({model:e,modelsToAdd:t,setModelsToAdd:n}){const{t:r}=Z(),i=O(Cb),s=c=>{t.includes(c.target.value)?n(te.remove(t,u=>u!==c.target.value)):n([...t,c.target.value])};return l.jsx(Le,{children:l.jsxs(B,{flexDirection:"column",gap:2,backgroundColor:t.includes(e.name)?"accent.650":"base.800",paddingX:4,paddingY:2,borderRadius:4,children:[l.jsxs(B,{gap:4,children:[l.jsx(pt,{value:e.name,label:l.jsx(Ce,{fontWeight:500,children:e.name}),isChecked:t.includes(e.name),isDisabled:i.includes(e.location),onChange:s}),i.includes(e.location)&&l.jsx(Sx,{colorScheme:"accent",children:r("modelManager.modelExists")})]}),l.jsx(Ce,{fontStyle:"italic",variant:"subtext",children:e.location})]})})}function cF(){const e=Y(),{t}=Z(),n=O(P=>P.system.searchFolder),r=O(P=>P.system.foundModels),i=O(Cb),s=O(P=>P.ui.shouldShowExistingModelsInSearch),c=O(P=>P.system.isProcessing),[u,f]=ke.useState([]),[h,p]=ke.useState("v1"),[g,y]=ke.useState(""),S=()=>{e(a3(null)),e(s3(null)),f([])},C=P=>{e(Zv(P.checkpointFolder))},w=()=>{f([]),r&&r.forEach(P=>{i.includes(P.location)||f(I=>[...I,P.name])})},k=()=>{f([])},j=()=>{const P=r==null?void 0:r.filter(T=>u.includes(T.name)),I={v1:"configs/stable-diffusion/v1-inference.yaml",v2_base:"configs/stable-diffusion/v2-inference-v.yaml",v2_768:"configs/stable-diffusion/v2-inference-v.yaml",inpainting:"configs/stable-diffusion/v1-inpainting-inference.yaml",custom:g};P==null||P.forEach(T=>{const D={name:T.name,description:"",config:I[h],weights:T.location,vae:"",width:512,height:512,default:!1,format:"ckpt"};e(ls(D))}),f([])},M=()=>{const P=[],I=[];return r&&r.forEach((T,D)=>{i.includes(T.location)?I.push(l.jsx(S1,{model:T,modelsToAdd:u,setModelsToAdd:f},D)):P.push(l.jsx(S1,{model:T,modelsToAdd:u,setModelsToAdd:f},D))}),l.jsxs(l.Fragment,{children:[P,s&&I]})};return l.jsxs(l.Fragment,{children:[n?l.jsxs(B,{sx:{padding:4,gap:2,position:"relative",borderRadius:"base",alignItems:"center",w:"full",bg:"base.900"},children:[l.jsxs(B,{sx:{flexDir:"column",gap:2},children:[l.jsx(Ce,{sx:{fontWeight:500,fontSize:"sm"},variant:"subtext",children:t("modelManager.checkpointFolder")}),l.jsx(Ce,{sx:{fontWeight:500,fontSize:"sm"},children:n})]}),l.jsx(jc,{}),l.jsx(le,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:l.jsx(ep,{}),fontSize:18,disabled:c,onClick:()=>e(Zv(n))}),l.jsx(le,{"aria-label":t("modelManager.clearCheckpointFolder"),icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),onClick:S})]}):l.jsx(ws,{initialValues:{checkpointFolder:""},onSubmit:P=>{C(P)},children:({handleSubmit:P})=>l.jsx("form",{onSubmit:P,children:l.jsxs(sa,{columnGap:2,alignItems:"flex-end",width:"100%",children:[l.jsx(rt,{isRequired:!0,width:"lg",children:l.jsx(jt,{as:mt,id:"checkpointFolder",name:"checkpointFolder",type:"text",size:"md",label:t("modelManager.checkpointFolder")})}),l.jsx(Je,{leftIcon:l.jsx(X8,{}),"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),type:"submit",disabled:c,paddingX:10,children:t("modelManager.findModels")})]})})}),r&&l.jsxs(B,{flexDirection:"column",rowGap:4,width:"full",children:[l.jsxs(B,{justifyContent:"space-between",alignItems:"center",children:[l.jsxs("p",{children:[t("modelManager.modelsFound"),": ",r.length]}),l.jsxs("p",{children:[t("modelManager.selected"),": ",u.length]})]}),l.jsxs(B,{columnGap:2,justifyContent:"space-between",children:[l.jsxs(B,{columnGap:2,children:[l.jsx(Je,{isDisabled:u.length===r.length,onClick:w,children:t("modelManager.selectAll")}),l.jsx(Je,{isDisabled:u.length===0,onClick:k,children:t("modelManager.deselectAll")}),l.jsx(pt,{label:t("modelManager.showExisting"),isChecked:s,onChange:()=>e(o3(!s))})]}),l.jsx(Je,{isDisabled:u.length===0,onClick:j,colorScheme:"accent",children:t("modelManager.addSelected")})]}),l.jsxs(B,{sx:{flexDirection:"column",padding:4,rowGap:4,borderRadius:"base",width:"full",bg:"base.900"},children:[l.jsxs(B,{gap:4,children:[l.jsx(Ce,{fontWeight:500,variant:"subtext",children:t("modelManager.pickModelType")}),l.jsx(Ja,{value:h,onChange:P=>p(P),defaultValue:"v1",name:"model_type",children:l.jsxs(B,{gap:4,children:[l.jsx(vn,{value:"v1",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v1")})}),l.jsx(vn,{value:"v2_base",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v2_base")})}),l.jsx(vn,{value:"v2_768",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v2_768")})}),l.jsx(vn,{value:"inpainting",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.inpainting")})}),l.jsx(vn,{value:"custom",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.customConfig")})})]})})]}),h==="custom"&&l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:t("modelManager.pathToCustomConfig")}),l.jsx(mt,{value:g,onChange:P=>{P.target.value!==""&&y(P.target.value)},width:"full"})]})]}),l.jsx(B,{flexDirection:"column",maxHeight:72,overflowY:"scroll",borderRadius:"sm",paddingInlineEnd:4,gap:2,children:r.length>0?M():l.jsx(Ce,{fontWeight:"500",padding:2,borderRadius:"sm",textAlign:"center",variant:"subtext",children:t("modelManager.noModelsFound")})})]})]})}const C1=64,w1=2048;function uF(){const e=Y(),{t}=Z(),n=O(h=>h.system.isProcessing);function r(h){return/\s/.test(h)}function i(h){let p;return r(h)&&(p=t("modelManager.cannotUseSpaces")),p}const s={name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,format:"ckpt",default:!1},c=h=>{e(ls(h)),e(Wi(null))},[u,f]=ke.useState(!1);return l.jsxs(Le,{gap:2,alignItems:"flex-start",children:[l.jsx(le,{"aria-label":t("common.back"),tooltip:t("common.back"),onClick:()=>e(Wi(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",insetInlineEnd:12,top:3,icon:l.jsx(Cy,{})}),l.jsx(cF,{}),l.jsx(pt,{label:t("modelManager.addManually"),isChecked:u,onChange:()=>f(!u)}),u&&l.jsx(ws,{initialValues:s,onSubmit:c,children:({handleSubmit:h,errors:p,touched:g})=>l.jsx("form",{onSubmit:h,children:l.jsxs(Le,{rowGap:2,children:[l.jsx(Ce,{fontSize:20,fontWeight:"bold",alignSelf:"start",children:t("modelManager.manual")}),l.jsxs(rt,{isInvalid:!!p.name&&g.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"name",name:"name",type:"text",validate:i,width:"2xl"}),p.name&&g.name?l.jsx(kt,{children:p.name}):l.jsx(wt,{margin:0,children:t("modelManager.nameValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.description&&g.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"2xl"}),p.description&&g.description?l.jsx(kt,{children:p.description}):l.jsx(wt,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.config&&g.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.config")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"config",name:"config",type:"text",width:"2xl"}),p.config&&g.config?l.jsx(kt,{children:p.config}):l.jsx(wt,{margin:0,children:t("modelManager.configValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.weights&&g.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"weights",name:"weights",type:"text",width:"2xl"}),p.weights&&g.weights?l.jsx(kt,{children:p.weights}):l.jsx(wt,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.vae&&g.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae",name:"vae",type:"text",width:"2xl"}),p.vae&&g.vae?l.jsx(kt,{children:p.vae}):l.jsx(wt,{margin:0,children:t("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(sa,{width:"100%",children:[l.jsxs(rt,{isInvalid:!!p.width&&g.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:t("modelManager.width")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"width",name:"width",children:({field:y,form:S})=>l.jsx(Lr,{id:"width",name:"width",min:C1,max:w1,step:64,width:"90%",value:S.values.width,onChange:C=>S.setFieldValue(y.name,Number(C))})}),p.width&&g.width?l.jsx(kt,{children:p.width}):l.jsx(wt,{margin:0,children:t("modelManager.widthValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.height&&g.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:t("modelManager.height")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"height",name:"height",children:({field:y,form:S})=>l.jsx(Lr,{id:"height",name:"height",min:C1,max:w1,width:"90%",step:64,value:S.values.height,onChange:C=>S.setFieldValue(y.name,Number(C))})}),p.height&&g.height?l.jsx(kt,{children:p.height}):l.jsx(wt,{margin:0,children:t("modelManager.heightValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:t("modelManager.addModel")})]})})})]})}function Ll({children:e}){return l.jsx(B,{sx:{flexDirection:"column",padding:4,rowGap:4,borderRadius:"base",width:"full",bg:"base.900"},children:e})}function dF(){const e=Y(),{t}=Z(),n=O(u=>u.system.isProcessing);function r(u){return/\s/.test(u)}function i(u){let f;return r(u)&&(f=t("modelManager.cannotUseSpaces")),f}const s={name:"",description:"",repo_id:"",path:"",format:"diffusers",default:!1,vae:{repo_id:"",path:""}},c=u=>{const f=u;u.path===""&&delete f.path,u.repo_id===""&&delete f.repo_id,u.vae.path===""&&delete f.vae.path,u.vae.repo_id===""&&delete f.vae.repo_id,e(ls(f)),e(Wi(null))};return l.jsxs(B,{children:[l.jsx(le,{"aria-label":t("common.back"),tooltip:t("common.back"),onClick:()=>e(Wi(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",insetInlineEnd:12,top:3,icon:l.jsx(Cy,{})}),l.jsx(ws,{initialValues:s,onSubmit:c,children:({handleSubmit:u,errors:f,touched:h})=>{var p,g,y,S,C,w,k,j,M,P;return l.jsx("form",{onSubmit:u,children:l.jsxs(Le,{rowGap:2,children:[l.jsx(Ll,{children:l.jsxs(rt,{isInvalid:!!f.name&&h.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"name",name:"name",type:"text",validate:i,width:"2xl",isRequired:!0}),f.name&&h.name?l.jsx(kt,{children:f.name}):l.jsx(wt,{margin:0,children:t("modelManager.nameValidationMsg")})]})]})}),l.jsx(Ll,{children:l.jsxs(rt,{isInvalid:!!f.description&&h.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"2xl",isRequired:!0}),f.description&&h.description?l.jsx(kt,{children:f.description}):l.jsx(wt,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]})}),l.jsxs(Ll,{children:[l.jsx(Ce,{fontWeight:"bold",fontSize:"sm",children:t("modelManager.formMessageDiffusersModelLocation")}),l.jsx(Ce,{sx:{fontSize:"sm",fontStyle:"italic"},variant:"subtext",children:t("modelManager.formMessageDiffusersModelLocationDesc")}),l.jsxs(rt,{isInvalid:!!f.path&&h.path,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"path",name:"path",type:"text",width:"2xl"}),f.path&&h.path?l.jsx(kt,{children:f.path}):l.jsx(wt,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!f.repo_id&&h.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:t("modelManager.repo_id")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"2xl"}),f.repo_id&&h.repo_id?l.jsx(kt,{children:f.repo_id}):l.jsx(wt,{margin:0,children:t("modelManager.repoIDValidationMsg")})]})]})]}),l.jsxs(Ll,{children:[l.jsx(Ce,{fontWeight:"bold",children:t("modelManager.formMessageDiffusersVAELocation")}),l.jsx(Ce,{sx:{fontSize:"sm",fontStyle:"italic"},variant:"subtext",children:t("modelManager.formMessageDiffusersVAELocationDesc")}),l.jsxs(rt,{isInvalid:!!((p=f.vae)!=null&&p.path)&&((g=h.vae)==null?void 0:g.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"2xl"}),(y=f.vae)!=null&&y.path&&((S=h.vae)!=null&&S.path)?l.jsx(kt,{children:(C=f.vae)==null?void 0:C.path}):l.jsx(wt,{margin:0,children:t("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((w=f.vae)!=null&&w.repo_id)&&((k=h.vae)==null?void 0:k.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:t("modelManager.vaeRepoID")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"2xl"}),(j=f.vae)!=null&&j.repo_id&&((M=h.vae)!=null&&M.repo_id)?l.jsx(kt,{children:(P=f.vae)==null?void 0:P.repo_id}):l.jsx(wt,{margin:0,children:t("modelManager.vaeRepoIDValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",isLoading:n,children:t("modelManager.addModel")})]})})}})]})}function k1({text:e,onClick:t}){return l.jsx(B,{position:"relative",width:"50%",height:40,justifyContent:"center",alignItems:"center",onClick:t,as:to,children:l.jsx(Ce,{fontWeight:"bold",children:e})})}function fF(){const{isOpen:e,onOpen:t,onClose:n}=ui(),r=O(u=>u.ui.addNewModelUIOption),i=Y(),{t:s}=Z(),c=()=>{n(),i(Wi(null))};return l.jsxs(l.Fragment,{children:[l.jsx(Je,{"aria-label":s("modelManager.addNewModel"),tooltip:s("modelManager.addNewModel"),onClick:t,size:"sm",children:l.jsxs(B,{columnGap:2,alignItems:"center",children:[l.jsx(xs,{}),s("modelManager.addNew")]})}),l.jsxs(di,{isOpen:e,onClose:c,size:"3xl",closeOnOverlayClick:!1,children:[l.jsx(Nr,{}),l.jsxs(fi,{margin:"auto",paddingInlineEnd:4,children:[l.jsx(Rr,{children:s("modelManager.addNewModel")}),l.jsx(ca,{}),l.jsxs(Fr,{children:[r==null&&l.jsxs(B,{columnGap:4,children:[l.jsx(k1,{text:s("modelManager.addCheckpointModel"),onClick:()=>i(Wi("ckpt"))}),l.jsx(k1,{text:s("modelManager.addDiffuserModel"),onClick:()=>i(Wi("diffusers"))})]}),r=="ckpt"&&l.jsx(uF,{}),r=="diffusers"&&l.jsx(dF,{})]}),l.jsx(zr,{})]})]})]})}function Bl(e){const{isProcessing:t,isConnected:n}=O(S=>S.system),r=O(S=>S.system.openModel),{t:i}=Z(),s=Y(),{name:c,status:u,description:f}=e,h=()=>{s(h2(c))},p=()=>{s(Jv(c))},g=()=>{s(l3(c)),s(Jv(null))},y=()=>{switch(u){case"active":return"ok.500";case"cached":return"warning.500";case"not loaded":return"inherit"}};return l.jsxs(B,{alignItems:"center",p:2,borderRadius:"base",sx:c===r?{bg:"accent.750",_hover:{bg:"accent.750"}}:{_hover:{bg:"base.750"}},children:[l.jsx(We,{onClick:p,cursor:"pointer",children:l.jsx(Yt,{label:f,hasArrow:!0,placement:"bottom",children:l.jsx(Ce,{fontWeight:"600",children:c})})}),l.jsx(jc,{onClick:p,cursor:"pointer"}),l.jsxs(B,{gap:2,alignItems:"center",children:[l.jsx(Ce,{color:y(),children:u}),l.jsx(to,{size:"sm",onClick:h,isDisabled:u==="active"||t||!n,children:i("modelManager.load")}),l.jsx(le,{icon:l.jsx(B9,{}),size:"sm",onClick:p,"aria-label":"Modify Config",isDisabled:u==="active"||t||!n}),l.jsx(Wc,{title:i("modelManager.deleteModel"),acceptCallback:g,acceptButtonText:i("modelManager.delete"),triggerComponent:l.jsx(le,{icon:l.jsx(H9,{}),size:"sm","aria-label":i("modelManager.deleteConfig"),isDisabled:u==="active"||t||!n,colorScheme:"error"}),children:l.jsxs(B,{rowGap:4,flexDirection:"column",children:[l.jsx("p",{style:{fontWeight:"bold"},children:i("modelManager.deleteMsg1")}),l.jsx("p",{children:i("modelManager.deleteMsg2")})]})})]})]})}function hF(){const e=Y(),{isOpen:t,onOpen:n,onClose:r}=ui(),i=O(c8),{t:s}=Z(),[c,u]=x.useState(Object.keys(i)[0]),[f,h]=x.useState(Object.keys(i)[1]),[p,g]=x.useState("none"),[y,S]=x.useState(""),[C,w]=x.useState(.5),[k,j]=x.useState("weighted_sum"),[M,P]=x.useState("root"),[I,T]=x.useState(""),[D,_]=x.useState(!1),z=Object.keys(i).filter($=>$!==f&&$!==p),V=Object.keys(i).filter($=>$!==c&&$!==p),F=[{key:s("modelManager.none"),value:"none"},...Object.keys(i).filter($=>$!==c&&$!==f).map($=>({key:$,value:$}))],L=O($=>$.system.isProcessing),X=()=>{let $=[c,f,p];$=$.filter(ie=>ie!=="none");const Q={models_to_merge:$,merged_model_name:y!==""?y:$.join("-"),alpha:C,interp:k,model_merge_save_path:M==="root"?null:I,force:D};e(c3(Q))};return l.jsxs(l.Fragment,{children:[l.jsx(Je,{onClick:n,size:"sm",children:l.jsx(B,{columnGap:2,alignItems:"center",children:s("modelManager.mergeModels")})}),l.jsxs(di,{isOpen:t,onClose:r,size:"4xl",closeOnOverlayClick:!1,children:[l.jsx(Nr,{}),l.jsxs(fi,{fontFamily:"Inter",margin:"auto",paddingInlineEnd:4,children:[l.jsx(Rr,{children:s("modelManager.mergeModels")}),l.jsx(ca,{}),l.jsx(Fr,{children:l.jsxs(B,{flexDirection:"column",rowGap:4,children:[l.jsxs(B,{sx:{flexDirection:"column",marginBottom:4,padding:4,borderRadius:"base",rowGap:1,bg:"base.900"},children:[l.jsx(Ce,{children:s("modelManager.modelMergeHeaderHelp1")}),l.jsx(Ce,{fontSize:"sm",variant:"subtext",children:s("modelManager.modelMergeHeaderHelp2")})]}),l.jsxs(B,{columnGap:4,children:[l.jsx(Mn,{label:s("modelManager.modelOne"),validValues:z,onChange:$=>u($.target.value)}),l.jsx(Mn,{label:s("modelManager.modelTwo"),validValues:V,onChange:$=>h($.target.value)}),l.jsx(Mn,{label:s("modelManager.modelThree"),validValues:F,onChange:$=>{$.target.value!=="none"?(g($.target.value),j("add_difference")):(g("none"),j("weighted_sum"))}})]}),l.jsx(mt,{label:s("modelManager.mergedModelName"),value:y,onChange:$=>S($.target.value)}),l.jsxs(B,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsx(ut,{label:s("modelManager.alpha"),min:.01,max:.99,step:.01,value:C,onChange:$=>w($),withInput:!0,withReset:!0,handleReset:()=>w(.5),withSliderMarks:!0}),l.jsx(Ce,{variant:"subtext",fontSize:"sm",children:s("modelManager.modelMergeAlphaHelp")})]}),l.jsxs(B,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsx(Ce,{fontWeight:500,fontSize:"sm",variant:"subtext",children:s("modelManager.interpolationType")}),l.jsx(Ja,{value:k,onChange:$=>j($),children:l.jsx(B,{columnGap:4,children:p==="none"?l.jsxs(l.Fragment,{children:[l.jsx(vn,{value:"weighted_sum",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.weightedSum")})}),l.jsx(vn,{value:"sigmoid",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.sigmoid")})}),l.jsx(vn,{value:"inv_sigmoid",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.inverseSigmoid")})})]}):l.jsx(vn,{value:"add_difference",children:l.jsx(Yt,{label:s("modelManager.modelMergeInterpAddDifferenceHelp"),children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.addDifference")})})})})})]}),l.jsxs(B,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsxs(B,{columnGap:4,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:s("modelManager.mergedModelSaveLocation")}),l.jsx(Ja,{value:M,onChange:$=>P($),children:l.jsxs(B,{columnGap:4,children:[l.jsx(vn,{value:"root",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.invokeAIFolder")})}),l.jsx(vn,{value:"custom",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.custom")})})]})})]}),M==="custom"&&l.jsx(mt,{label:s("modelManager.mergedModelCustomSaveLocation"),value:I,onChange:$=>T($.target.value)})]}),l.jsx(pt,{label:s("modelManager.ignoreMismatch"),isChecked:D,onChange:$=>_($.target.checked),fontWeight:"500"}),l.jsx(Je,{onClick:X,isLoading:L,isDisabled:M==="custom"&&I==="",children:s("modelManager.merge")})]})}),l.jsx(zr,{})]})]})]})}const pF=be(Pt,e=>te.map(e.model_list,(n,r)=>({name:r,...n})),{memoizeOptions:{resultEqualityCheck:te.isEqual}});function Yd({label:e,isActive:t,onClick:n}){return l.jsx(Je,{onClick:n,isActive:t,sx:{_active:{bg:"accent.750"}},size:"sm",children:e})}const mF=()=>{const e=O(pF),[t,n]=ke.useState(!1);ke.useEffect(()=>{const y=setTimeout(()=>{n(!0)},200);return()=>clearTimeout(y)},[]);const[r,i]=x.useState(""),[s,c]=x.useState("all"),[u,f]=x.useTransition(),{t:h}=Z(),p=y=>{f(()=>{i(y.target.value)})},g=x.useMemo(()=>{const y=[],S=[],C=[],w=[];return e.forEach((k,j)=>{k.name.toLowerCase().includes(r.toLowerCase())&&(C.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j)),k.format===s&&w.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j))),k.format!=="diffusers"?y.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j)):S.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j))}),r!==""?s==="all"?l.jsx(We,{marginTop:4,children:C}):l.jsx(We,{marginTop:4,children:w}):l.jsxs(B,{flexDirection:"column",rowGap:6,children:[s==="all"&&l.jsxs(l.Fragment,{children:[l.jsxs(We,{children:[l.jsx(Ce,{sx:{fontWeight:"500",py:2,px:4,my:4,mx:0,borderRadius:"base",width:"max-content",fontSize:"sm",bg:"base.750"},children:h("modelManager.checkpointModels")}),y]}),l.jsxs(We,{children:[l.jsx(Ce,{sx:{fontWeight:"500",py:2,px:4,mb:4,borderRadius:"base",width:"max-content",fontSize:"sm",bg:"base.750"},children:h("modelManager.diffusersModels")}),S]})]}),s==="ckpt"&&l.jsx(B,{flexDirection:"column",marginTop:4,children:y}),s==="diffusers"&&l.jsx(B,{flexDirection:"column",marginTop:4,children:S})]})},[e,r,h,s]);return l.jsxs(B,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:[l.jsxs(B,{justifyContent:"space-between",alignItems:"center",gap:2,children:[l.jsx(Vn,{size:"md",children:h("modelManager.availableModels")}),l.jsx(jc,{}),l.jsx(fF,{}),l.jsx(hF,{})]}),l.jsx(mt,{onChange:p,label:h("modelManager.search")}),l.jsxs(B,{flexDirection:"column",gap:1,maxHeight:window.innerHeight-240,overflow:"scroll",paddingInlineEnd:4,children:[l.jsxs(B,{columnGap:2,children:[l.jsx(Yd,{label:h("modelManager.allModels"),onClick:()=>c("all"),isActive:s==="all"}),l.jsx(Yd,{label:h("modelManager.checkpointModels"),onClick:()=>c("ckpt"),isActive:s==="ckpt"}),l.jsx(Yd,{label:h("modelManager.diffusersModels"),onClick:()=>c("diffusers"),isActive:s==="diffusers"})]}),t?g:l.jsx(B,{width:"100%",minHeight:96,justifyContent:"center",alignItems:"center",children:l.jsx(Qf,{})})]})]})};function vF({children:e}){const{isOpen:t,onOpen:n,onClose:r}=ui(),i=O(u=>u.system.model_list),s=O(u=>u.system.openModel),{t:c}=Z();return l.jsxs(l.Fragment,{children:[x.cloneElement(e,{onClick:n}),l.jsxs(di,{isOpen:t,onClose:r,size:"full",children:[l.jsx(Nr,{}),l.jsxs(fi,{children:[l.jsx(ca,{}),l.jsx(Rr,{children:c("modelManager.modelManager")}),l.jsx(Fr,{children:l.jsxs(B,{width:"100%",columnGap:8,children:[l.jsx(mF,{}),s&&i[s].format==="diffusers"?l.jsx(lF,{}):l.jsx(aF,{})]})}),l.jsx(zr,{})]})]})]})}const gF=be([Pt],e=>{const{isProcessing:t,model_list:n}=e;return{models:te.map(n,(i,s)=>s),isProcessing:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),xF=()=>{const e=Y(),{t}=Z(),{models:n,isProcessing:r}=O(gF),i=O(wy),s=c=>{e(h2(c.target.value))};return l.jsx(B,{style:{paddingInlineStart:1.5},children:l.jsx(Mn,{style:{fontSize:"sm"},"aria-label":t("accessibility.modelSelect"),tooltip:i.description,isDisabled:r,value:i.name,validValues:n,onChange:s})})},yF=be([Pt,ro],(e,t)=>{const{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:i,model_list:s,saveIntermediatesInterval:c,enableImageDebugging:u}=e,{shouldUseCanvasBetaLayout:f,shouldUseSliders:h}=t;return{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:i,models:te.map(s,(p,g)=>g),saveIntermediatesInterval:c,enableImageDebugging:u,shouldUseCanvasBetaLayout:f,shouldUseSliders:h}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Xd={flexDirection:"column",gap:2,p:4,bg:"base.900"},bF=({children:e})=>{const t=Y(),{t:n}=Z(),r=O(P=>P.generation.steps),{isOpen:i,onOpen:s,onClose:c}=ui(),{isOpen:u,onOpen:f,onClose:h}=ui(),{shouldDisplayInProgressType:p,shouldConfirmOnDelete:g,shouldDisplayGuides:y,saveIntermediatesInterval:S,enableImageDebugging:C,shouldUseCanvasBetaLayout:w,shouldUseSliders:k}=O(yF),j=()=>{v3.purge().then(()=>{c(),f()})},M=P=>{P>r&&(P=r),P<1&&(P=1),t(g3(P))};return l.jsxs(l.Fragment,{children:[x.cloneElement(e,{onClick:s}),l.jsxs(di,{isOpen:i,onClose:c,size:"xl",children:[l.jsx(Nr,{}),l.jsxs(fi,{paddingInlineEnd:4,children:[l.jsx(Rr,{children:n("common.settingsLabel")}),l.jsx(ca,{}),l.jsx(Fr,{children:l.jsxs($n,{gap:4,children:[l.jsxs(B,{sx:Xd,children:[l.jsx(Mn,{label:n("settings.displayInProgress"),validValues:u3,value:p,onChange:P=>t(d3(P.target.value))}),p==="full-res"&&l.jsx(Lr,{label:n("settings.saveSteps"),min:1,max:r,step:1,onChange:M,value:S,width:"auto",textAlign:"center"}),l.jsx(En,{label:n("settings.confirmOnDelete"),isChecked:g,onChange:P=>t(_1(P.target.checked))}),l.jsx(En,{label:n("settings.displayHelpIcons"),isChecked:y,onChange:P=>t(f3(P.target.checked))}),l.jsx(En,{label:n("settings.useCanvasBeta"),isChecked:w,onChange:P=>t(h3(P.target.checked))}),l.jsx(En,{label:n("settings.useSlidersForAll"),isChecked:k,onChange:P=>t(p3(P.target.checked))})]}),l.jsxs(B,{sx:Xd,children:[l.jsx(Vn,{size:"sm",style:{fontWeight:"bold"},children:"Developer"}),l.jsx(En,{label:n("settings.enableImageDebugging"),isChecked:C,onChange:P=>t(m3(P.target.checked))})]}),l.jsxs(B,{sx:Xd,children:[l.jsx(Vn,{size:"sm",children:n("settings.resetWebUI")}),l.jsx(Je,{colorScheme:"error",onClick:j,children:n("settings.resetWebUI")}),l.jsx(Ce,{children:n("settings.resetWebUIDesc1")}),l.jsx(Ce,{children:n("settings.resetWebUIDesc2")})]})]})}),l.jsx(zr,{children:l.jsx(Je,{onClick:c,children:n("common.close")})})]})]}),l.jsxs(di,{closeOnOverlayClick:!1,isOpen:u,onClose:h,isCentered:!0,children:[l.jsx(Nr,{backdropFilter:"blur(40px)"}),l.jsxs(fi,{children:[l.jsx(Rr,{}),l.jsx(Fr,{children:l.jsx(B,{justifyContent:"center",children:l.jsx(Ce,{fontSize:"lg",children:l.jsx(Ce,{children:n("settings.resetComplete")})})})}),l.jsx(zr,{})]})]})]})},SF=be(Pt,e=>({isConnected:e.isConnected,isProcessing:e.isProcessing,currentIteration:e.currentIteration,totalIterations:e.totalIterations,currentStatus:e.currentStatus,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),CF=()=>{const{isConnected:e,isProcessing:t,currentIteration:n,totalIterations:r,currentStatus:i,hasError:s,wasErrorSeen:c}=O(SF),u=Y(),{t:f}=Z();let h;e&&!s?h="ok":h="error";let p=i;t&&(h="working"),p&&t&&r>1&&(p=`${f(p)} (${n}/${r})`);const g=s&&!c?"Click to clear, check logs for details":void 0,y=s&&!c?"pointer":"initial",S=()=>{(s||!c)&&u(f2())};return l.jsx(Yt,{label:g,children:l.jsx(Ce,{cursor:y,onClick:S,sx:{fontSize:"xs",fontWeight:"600",color:`${h}.400`},children:f(p)})})};function wF(){const{t:e}=Z(),t=Y(),n=O(c=>c.ui.currentTheme),r={dark:e("common.darkTheme"),light:e("common.lightTheme"),green:e("common.greenTheme"),ocean:e("common.oceanTheme")},i=c=>{t(x3(c))},s=()=>{const c=[];return Object.keys(r).forEach(u=>{c.push(l.jsx(Je,{sx:{width:24},isChecked:n===u,leftIcon:n===u?l.jsx(zc,{}):void 0,size:"sm",onClick:()=>i(u),children:r[u]},u))}),c};return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{"aria-label":e("common.themeLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(U8,{})}),children:l.jsx(Le,{align:"stretch",children:s()})})}function kF(){const{t:e,i18n:t}=Z(),n={ar:e("common.langArabic",{lng:"ar"}),nl:e("common.langDutch",{lng:"nl"}),en:e("common.langEnglish",{lng:"en"}),fr:e("common.langFrench",{lng:"fr"}),de:e("common.langGerman",{lng:"de"}),he:e("common.langHebrew",{lng:"he"}),it:e("common.langItalian",{lng:"it"}),ja:e("common.langJapanese",{lng:"ja"}),ko:e("common.langKorean",{lng:"ko"}),pl:e("common.langPolish",{lng:"pl"}),pt_BR:e("common.langBrPortuguese",{lng:"pt_BR"}),pt:e("common.langPortuguese",{lng:"pt"}),ru:e("common.langRussian",{lng:"ru"}),zh_CN:e("common.langSimplifiedChinese",{lng:"zh_CN"}),es:e("common.langSpanish",{lng:"es"}),uk:e("common.langUkranian",{lng:"ua"})},r=()=>{const i=[];return Object.keys(n).forEach(s=>{i.push(l.jsx(Je,{isChecked:localStorage.getItem("i18nextLng")===s,leftIcon:localStorage.getItem("i18nextLng")===s?l.jsx(zc,{}):void 0,onClick:()=>t.changeLanguage(s),"aria-label":n[s],size:"sm",minWidth:"200px",children:n[s]},s))}),i};return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{"aria-label":e("common.languagePickerLabel"),tooltip:e("common.languagePickerLabel"),icon:l.jsx(H8,{}),size:"sm",variant:"link","data-variant":"link",fontSize:26}),children:l.jsx(Le,{children:r()})})}const jF=()=>{const{t:e}=Z();return l.jsxs($n,{gridTemplateColumns:"auto max-content",children:[l.jsx(p4,{}),l.jsxs(B,{alignItems:"center",gap:2,children:[l.jsx(CF,{}),l.jsx(xF,{}),l.jsx(vF,{children:l.jsx(le,{"aria-label":e("modelManager.modelManager"),tooltip:e("modelManager.modelManager"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(O8,{})})}),l.jsx(dO,{children:l.jsx(le,{"aria-label":e("common.hotkeysLabel"),tooltip:e("common.hotkeysLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(B8,{})})}),l.jsx(wF,{}),l.jsx(kF,{}),l.jsx(le,{"aria-label":e("common.reportBugLabel"),tooltip:e("common.reportBugLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx($i,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI/issues",children:l.jsx(D8,{})})}),l.jsx(le,{"aria-label":e("common.githubLabel"),tooltip:e("common.githubLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx($i,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI",children:l.jsx(j8,{})})}),l.jsx(le,{"aria-label":e("common.discordLabel"),tooltip:e("common.discordLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx($i,{isExternal:!0,href:"https://discord.gg/ZmtBAhwWhy",children:l.jsx(k8,{})})}),l.jsx(bF,{children:l.jsx(le,{"aria-label":e("common.settingsLabel"),tooltip:e("common.settingsLabel"),variant:"link","data-variant":"link",fontSize:22,size:"sm",icon:l.jsx(m9,{})})})]})]})};function EF(){async function e(n=""){return await fetch(n,{method:"GET",cache:"no-cache"})}const t=()=>{const n=document.location;e(n+"/flaskwebgui-keep-server-alive").then(i=>i)};(!{}.NODE_ENV||{}.NODE_ENV==="production")&&document.addEventListener("DOMContentLoaded",()=>{t(),setInterval(t,3e3)})}const PF=()=>{const e=Y(),t=O(l8),n=us();x.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(y3())},[e,n,t])},IF=()=>{const e=Y(),{shouldShowGalleryButton:t,shouldPinGallery:n}=O(yp),r=()=>{e(Fi(!0)),n&&e(on(!0))};return t?l.jsx(le,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":"Show Gallery",onClick:r,sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",zIndex:31,p:0,insetInlineEnd:0,px:3,h:48,w:8,borderStartEndRadius:0,borderEndEndRadius:0},children:l.jsx(cp,{})}):null};EF();const OF=()=>(PF(),l.jsxs($n,{w:"100vw",h:"100vh",children:[l.jsxs(iO,{children:[l.jsx(cO,{}),l.jsxs($n,{gap:4,p:O9,gridAutoRows:"min-content auto",w:A9,h:z9,children:[l.jsx(jF,{}),l.jsx(cD,{})]}),l.jsx(We,{children:l.jsx(sO,{})})]}),l.jsx(uI,{}),l.jsx(IF,{})]}));export{OF as default}; diff --git a/invokeai/frontend/web/dist/assets/App-982926da.js b/invokeai/frontend/web/dist/assets/App-982926da.js new file mode 100644 index 0000000000..339056de8d --- /dev/null +++ b/invokeai/frontend/web/dist/assets/App-982926da.js @@ -0,0 +1,188 @@ +import{r as g,f as fe,j as l,u as zS,c as re,a as Ae,b as Ee,w as ts,d as un,o as At,S as Xf,e as go,g as qe,h as Rr,k as Jo,i as yc,_ as Yd,l as RS,m as NS,R as Me,n as Ev,p as FS,q as Kd,s as ea,t as y1,v as x1,x as LS,y as BS,z as ee,A as b1,B as S1,C as xc,D as ns,F as B,E as X,G as HS,H as cd,T as Ce,I as C1,J as WS,K as rs,L as Pv,M as VS,N as US,O as $S,P as Wo,Q as w1,U as Iv,V as GS,W as k1,X as qS,Y as YS,Z as KS,$ as j1,a0 as XS,a1 as QS,a2 as ZS,a3 as JS,a4 as e3,a5 as t3,a6 as n3,a7 as E1,a8 as r3,a9 as o3,aa as ql,ab as i3,ac as a3,ad as Nl,ae as Yl,af as Xd,ag as Qd,ah as Zd,ai as s3,aj as P1,ak as l3,al as I1,am as c3,an as M1,ao as T1,ap as Vo,aq as jn,ar as _1,as as os,at as u3,au as d3,av as D1,aw as Jd,ax as ef,ay as A1,az as tf,aA as nf,aB as Mv,aC as O1,aD as z1,aE as R1,aF as Fl,aG as Ll,aH as f3,aI as rf,aJ as N1,aK as F1,aL as L1,aM as h3,aN as p3,aO as Tv,aP as _v,aQ as m3,aR as v3,aS as g3,aT as B1,aU as H1,aV as y3,aW as x3,aX as W1,aY as Dv,aZ as b3,a_ as Av,a$ as S3,b0 as C3,b1 as V1,b2 as w3,b3 as k3,b4 as j3,b5 as ud,b6 as Ov,b7 as U1,b8 as of,b9 as E3,ba as zv,bb as Bl,bc as P3,bd as I3,be as Va,bf as Kl,bg as $1,bh as Xl,bi as M3,bj as T3,bk as br,bl as G1,bm as Qf,bn as is,bo as _3,bp as D3,bq as A3,br as wr,bs as q1,bt as O3,bu as z3,bv as Y1,bw as R3,bx as N3,by as F3,bz as L3,bA as B3,bB as H3,bC as W3,bD as V3,bE as U3,bF as Rv,bG as $3,bH as G3,bI as q3,bJ as Y3,bK as K3,bL as X3,bM as dd,bN as Oa,bO as pl,bP as Nv,bQ as fd,bR as hd,bS as ml,bT as Fv,bU as af,bV as Q3,bW as Z3,bX as J3,bY as bc,bZ as eC,b_ as tC,b$ as nC,c0 as rC,c1 as vl,c2 as pd,c3 as gl,c4 as Ia,c5 as oC,c6 as iC,c7 as K1,c8 as Ql,c9 as Zf,ca as X1,cb as Q1,cc as Z1,cd as aC,ce as J1,cf as e2,cg as t2,ch as n2,ci as r2,cj as Fi,ck as Li,cl as o2,cm as i2,cn as a2,co as s2,cp as l2,cq as sC,cr as lC,cs as Lv,ct as yl,cu as cC,cv as Bv,cw as Hv,cx as Wv,cy as Vv,cz as uC,cA as dC,cB as sf,cC as fC,cD as Uv,cE as xl,cF as Zl,cG as hC,cH as pC,cI as mC,cJ as vC,cK as c2,cL as gC,cM as yC}from"./index-2ad84bef.js";import{I as tn,u as xC,c as bC,a as jt,b as Wt,A as yo,m as ir,d as Bi,e as ei,P as Ua,f as SC,C as CC,g as Y,h as A}from"./storeHooks-e63a2dc4.js";function wC(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 Jl="NOT_FOUND";function kC(e){var t;return{get:function(r){return t&&e(t.key,r)?t.value:Jl},put:function(r,o){t={key:r,value:o}},getEntries:function(){return t?[t]:[]},clear:function(){t=void 0}}}function jC(e,t){var n=[];function r(u){var f=n.findIndex(function(h){return t(u,h.key)});if(f>-1){var p=n[f];return f>0&&(n.splice(f,1),n.unshift(p)),p.value}return Jl}function o(u,f){r(u)===Jl&&(n.unshift({key:u,value:f}),n.length>e&&n.pop())}function s(){return n}function c(){n=[]}return{get:r,put:o,getEntries:s,clear:c}}var EC=function(t,n){return t===n};function PC(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var o=n.length,s=0;s1?t-1:0),r=1;rperformance.now():()=>Date.now(),f2=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(OC()),d2);function zC(e){let t=[],n=[],r=0,o=!1,s=!1;const c=new WeakSet,u={schedule:(f,p=!1,h=!1)=>{const y=h&&o,x=y?t:n;return p&&c.add(f),x.indexOf(f)===-1&&(x.push(f),y&&o&&(r=t.length)),f},cancel:f=>{const p=n.indexOf(f);p!==-1&&n.splice(p,1),c.delete(f)},process:f=>{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]=zC(()=>$a=!0),e),{}),NC=as.reduce((e,t)=>{const n=Sc[t];return e[t]=(r,o=!1,s=!1)=>($a||BC(),n.schedule(r,o,s)),e},{}),FC=as.reduce((e,t)=>(e[t]=Sc[t].cancel,e),{});as.reduce((e,t)=>(e[t]=()=>Sc[t].process(Hi),e),{});const LC=e=>Sc[e].process(Hi),h2=e=>{$a=!1,Hi.delta=lf?d2:Math.max(Math.min(e-Hi.timestamp,RC),1),Hi.timestamp=e,cf=!0,as.forEach(LC),cf=!1,$a&&(lf=!1,f2(h2))},BC=()=>{$a=!0,lf=!0,cf||f2(h2)},$v=()=>Hi;function Jf(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=g.Children.toArray(e.path),c=fe((u,f)=>l.jsx(tn,{ref:f,viewBox:t,...o,...u,children:s.length?s:l.jsx("path",{fill:"currentColor",d:n})}));return c.displayName=r,c}function ss(e){const{theme:t}=zS(),n=xC();return g.useMemo(()=>bC(t.direction,{...n,...e}),[e,t.direction,n])}var HC=Object.defineProperty,WC=(e,t,n)=>t in e?HC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zt=(e,t,n)=>(WC(e,typeof t!="symbol"?t+"":t,n),n);function Gv(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 VC=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function qv(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function Yv(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var uf=typeof window<"u"?g.useLayoutEffect:g.useEffect,ec=e=>e,UC=class{constructor(){zt(this,"descendants",new Map),zt(this,"register",e=>{if(e!=null)return VC(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),zt(this,"unregister",e=>{this.descendants.delete(e);const t=Gv(Array.from(this.descendants.keys()));this.assignIndex(t)}),zt(this,"destroy",()=>{this.descendants.clear()}),zt(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),zt(this,"count",()=>this.descendants.size),zt(this,"enabledCount",()=>this.enabledValues().length),zt(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),zt(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),zt(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),zt(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),zt(this,"first",()=>this.item(0)),zt(this,"firstEnabled",()=>this.enabledItem(0)),zt(this,"last",()=>this.item(this.descendants.size-1)),zt(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),zt(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),zt(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),zt(this,"next",(e,t=!0)=>{const n=qv(e,this.count(),t);return this.item(n)}),zt(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=qv(r,this.enabledCount(),t);return this.enabledItem(o)}),zt(this,"prev",(e,t=!0)=>{const n=Yv(e,this.count()-1,t);return this.item(n)}),zt(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=Yv(r,this.enabledCount()-1,t);return this.enabledItem(o)}),zt(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=Gv(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 $C(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 ct(...e){return t=>{e.forEach(n=>{$C(n,t)})}}function GC(...e){return g.useMemo(()=>ct(...e),e)}function qC(){const e=g.useRef(new UC);return uf(()=>()=>e.current.destroy()),e.current}var[YC,p2]=jt({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function KC(e){const t=p2(),[n,r]=g.useState(-1),o=g.useRef(null);uf(()=>()=>{o.current&&t.unregister(o.current)},[]),uf(()=>{if(!o.current)return;const c=Number(o.current.dataset.index);n!=c&&!Number.isNaN(c)&&r(c)});const s=ec(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:ct(s,o)}}function eh(){return[ec(YC),()=>ec(p2()),()=>qC(),o=>KC(o)]}var[XC,Cc]=jt({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[QC,th]=jt({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[ZC,tL,JC,ew]=eh(),Di=fe(function(t,n){const{getButtonProps:r}=th(),o=r(t,n),c={display:"flex",alignItems:"center",width:"100%",outline:0,...Cc().button};return l.jsx(re.button,{...o,className:Ae("chakra-accordion__button",t.className),__css:c})});Di.displayName="AccordionButton";function nh(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(x,S)=>x!==S}=e,s=Wt(r),c=Wt(o),[u,f]=g.useState(n),p=t!==void 0,h=p?t:u,y=Wt(x=>{const C=typeof x=="function"?x(h):x;c(h,C)&&(p||f(C),s(C))},[p,s,h,c]);return[h,y]}function tw(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...c}=e;ow(e),iw(e);const u=JC(),[f,p]=g.useState(-1);g.useEffect(()=>()=>{p(-1)},[]);const[h,y]=nh({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:h,setIndex:y,htmlProps:c,getAccordionItemProps:S=>{let C=!1;return S!==null&&(C=Array.isArray(h)?h.includes(S):h===S),{isOpen:C,onChange:w=>{if(S!==null)if(o&&Array.isArray(h)){const j=w?h.concat(S):h.filter(I=>I!==S);y(j)}else w?y(S):s&&y(-1)}}},focusedIndex:f,setFocusedIndex:p,descendants:u}}var[nw,rh]=jt({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function rw(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:c}=rh(),u=g.useRef(null),f=g.useId(),p=r??f,h=`accordion-button-${p}`,y=`accordion-panel-${p}`;aw(e);const{register:x,index:S,descendants:C}=ew({disabled:t&&!n}),{isOpen:k,onChange:w}=s(S===-1?null:S);sw({isOpen:k,isDisabled:t});const j=()=>{w==null||w(!0)},I=()=>{w==null||w(!1)},P=g.useCallback(()=>{w==null||w(!k),c(S)},[S,c,k,w]),M=g.useCallback(R=>{const F={ArrowDown:()=>{const L=C.nextEnabled(S);L==null||L.node.focus()},ArrowUp:()=>{const L=C.prevEnabled(S);L==null||L.node.focus()},Home:()=>{const L=C.firstEnabled();L==null||L.node.focus()},End:()=>{const L=C.lastEnabled();L==null||L.node.focus()}}[R.key];F&&(R.preventDefault(),F(R))},[C,S]),T=g.useCallback(()=>{c(S)},[c,S]),D=g.useCallback(function(V={},F=null){return{...V,type:"button",ref:ct(x,u,F),id:h,disabled:!!t,"aria-expanded":!!k,"aria-controls":y,onClick:Ee(V.onClick,P),onFocus:Ee(V.onFocus,T),onKeyDown:Ee(V.onKeyDown,M)}},[h,t,k,P,T,M,y,x]),_=g.useCallback(function(V={},F=null){return{...V,ref:F,role:"region",id:y,"aria-labelledby":h,hidden:!k}},[h,k,y]);return{isOpen:k,isDisabled:t,isFocusable:n,onOpen:j,onClose:I,getButtonProps:D,getPanelProps:_,htmlProps:o}}function ow(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;ts({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function iw(e){ts({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 aw(e){ts({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 sw(e){ts({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Ai(e){const{isOpen:t,isDisabled:n}=th(),{reduceMotion:r}=rh(),o=Ae("chakra-accordion__icon",e.className),s=Cc(),c={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return l.jsx(tn,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:c,...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Ai.displayName="AccordionIcon";var Oi=fe(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...c}=rw(t),f={...Cc().container,overflowAnchor:"none"},p=g.useMemo(()=>c,[c]);return l.jsx(QC,{value:p,children:l.jsx(re.div,{ref:n,...s,className:Ae("chakra-accordion__item",o),__css:f,children:typeof r=="function"?r({isExpanded:!!c.isOpen,isDisabled:!!c.isDisabled}):r})})});Oi.displayName="AccordionItem";var Bo={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Ma={scale:{enter:{scale:1},exit:{scale:.95}},fade:{enter:{opacity:1},exit:{opacity:0}},pushLeft:{enter:{x:"100%"},exit:{x:"-30%"}},pushRight:{enter:{x:"-100%"},exit:{x:"30%"}},pushUp:{enter:{y:"100%"},exit:{y:"-30%"}},pushDown:{enter:{y:"-100%"},exit:{y:"30%"}},slideLeft:{position:{left:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"-100%",y:0}},slideRight:{position:{right:0,top:0,bottom:0,width:"100%"},enter:{x:0,y:0},exit:{x:"100%",y:0}},slideUp:{position:{top:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"-100%"}},slideDown:{position:{bottom:0,left:0,right:0,maxWidth:"100vw"},enter:{x:0,y:0},exit:{x:0,y:"100%"}}};function df(e){var t;switch((t=e==null?void 0:e.direction)!=null?t:"right"){case"right":return Ma.slideRight;case"left":return Ma.slideLeft;case"bottom":return Ma.slideDown;case"top":return Ma.slideUp;default:return Ma.slideRight}}var Uo={enter:{duration:.2,ease:Bo.easeOut},exit:{duration:.1,ease:Bo.easeIn}},nr={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})},lw=e=>e!=null&&parseInt(e.toString(),10)>0,Kv={exit:{height:{duration:.2,ease:Bo.ease},opacity:{duration:.3,ease:Bo.ease}},enter:{height:{duration:.3,ease:Bo.ease},opacity:{duration:.4,ease:Bo.ease}}},cw={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:lw(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:nr.exit(Kv.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:nr.enter(Kv.enter,o)}}},m2=g.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:c="auto",style:u,className:f,transition:p,transitionEnd:h,...y}=e,[x,S]=g.useState(!1);g.useEffect(()=>{const I=setTimeout(()=>{S(!0)});return()=>clearTimeout(I)},[]),ts({condition:Boolean(s>0&&r),message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const C=parseFloat(s.toString())>0,k={startingHeight:s,endingHeight:c,animateOpacity:o,transition:x?p:{enter:{duration:0}},transitionEnd:{enter:h==null?void 0:h.enter,exit:r?h==null?void 0:h.exit:{...h==null?void 0:h.exit,display:C?"block":"none"}}},w=r?n:!0,j=n||r?"enter":"exit";return l.jsx(yo,{initial:!1,custom:k,children:w&&l.jsx(ir.div,{ref:t,...y,className:Ae("chakra-collapse",f),style:{overflow:"hidden",display:"block",...u},custom:k,variants:cw,initial:r?"exit":!1,animate:j,exit:"exit"})})});m2.displayName="Collapse";var uw={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:nr.enter(Uo.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:nr.exit(Uo.exit,n),transitionEnd:t==null?void 0:t.exit}}},v2={initial:"exit",animate:"enter",exit:"exit",variants:uw},dw=g.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:c,transitionEnd:u,delay:f,...p}=t,h=o||r?"enter":"exit",y=r?o&&r:!0,x={transition:c,transitionEnd:u,delay:f};return l.jsx(yo,{custom:x,children:y&&l.jsx(ir.div,{ref:n,className:Ae("chakra-fade",s),custom:x,...v2,animate:h,...p})})});dw.displayName="Fade";var fw={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:nr.exit(Uo.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:nr.enter(Uo.enter,n),transitionEnd:e==null?void 0:e.enter}}},g2={initial:"exit",animate:"enter",exit:"exit",variants:fw},hw=g.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:c=.95,className:u,transition:f,transitionEnd:p,delay:h,...y}=t,x=r?o&&r:!0,S=o||r?"enter":"exit",C={initialScale:c,reverse:s,transition:f,transitionEnd:p,delay:h};return l.jsx(yo,{custom:C,children:x&&l.jsx(ir.div,{ref:n,className:Ae("chakra-offset-slide",u),...g2,animate:S,custom:C,...y})})});hw.displayName="ScaleFade";var pw={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:nr.exit(Uo.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:nr.enter(Uo.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var c;const u={x:t,y:e};return{opacity:0,transition:(c=n==null?void 0:n.exit)!=null?c:nr.exit(Uo.exit,s),...o?{...u,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...u,...r==null?void 0:r.exit}}}}},ff={initial:"initial",animate:"enter",exit:"exit",variants:pw},mw=g.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:c,offsetX:u=0,offsetY:f=8,transition:p,transitionEnd:h,delay:y,...x}=t,S=r?o&&r:!0,C=o||r?"enter":"exit",k={offsetX:u,offsetY:f,reverse:s,transition:p,transitionEnd:h,delay:y};return l.jsx(yo,{custom:k,children:S&&l.jsx(ir.div,{ref:n,className:Ae("chakra-offset-slide",c),custom:k,...ff,animate:C,...x})})});mw.displayName="SlideFade";var Xv={exit:{duration:.15,ease:Bo.easeInOut},enter:{type:"spring",damping:25,stiffness:180}},vw={exit:({direction:e,transition:t,transitionEnd:n,delay:r})=>{var o;const{exit:s}=df({direction:e});return{...s,transition:(o=t==null?void 0:t.exit)!=null?o:nr.exit(Xv.exit,r),transitionEnd:n==null?void 0:n.exit}},enter:({direction:e,transitionEnd:t,transition:n,delay:r})=>{var o;const{enter:s}=df({direction:e});return{...s,transition:(o=n==null?void 0:n.enter)!=null?o:nr.enter(Xv.enter,r),transitionEnd:t==null?void 0:t.enter}}},y2=g.forwardRef(function(t,n){const{direction:r="right",style:o,unmountOnExit:s,in:c,className:u,transition:f,transitionEnd:p,delay:h,motionProps:y,...x}=t,S=df({direction:r}),C=Object.assign({position:"fixed"},S.position,o),k=s?c&&s:!0,w=c||s?"enter":"exit",j={transitionEnd:p,transition:f,direction:r,delay:h};return l.jsx(yo,{custom:j,children:k&&l.jsx(ir.div,{...x,ref:n,initial:"exit",className:Ae("chakra-slide",u),animate:w,exit:"exit",custom:j,variants:vw,style:C,...y})})});y2.displayName="Slide";var zi=fe(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:c}=rh(),{getPanelProps:u,isOpen:f}=th(),p=u(s,n),h=Ae("chakra-accordion__panel",r),y=Cc();c||delete p.hidden;const x=l.jsx(re.div,{...p,__css:y.panel,className:h});return c?x:l.jsx(m2,{in:f,...o,children:x})});zi.displayName="AccordionPanel";var oh=fe(function({children:t,reduceMotion:n,...r},o){const s=un("Accordion",r),c=At(r),{htmlProps:u,descendants:f,...p}=tw(c),h=g.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return l.jsx(ZC,{value:f,children:l.jsx(nw,{value:h,children:l.jsx(XC,{value:s,children:l.jsx(re.div,{ref:o,...u,className:Ae("chakra-accordion",r.className),__css:s.root,children:t})})})})});oh.displayName="Accordion";var hf=fe(function(t,n){const{htmlWidth:r,htmlHeight:o,alt:s,...c}=t;return l.jsx("img",{width:r,height:o,ref:n,alt:s,...c})});hf.displayName="NativeImage";function gw(e){const{loading:t,src:n,srcSet:r,onLoad:o,onError:s,crossOrigin:c,sizes:u,ignoreFallback:f}=e,[p,h]=g.useState("pending");g.useEffect(()=>{h(n?"loading":"pending")},[n]);const y=g.useRef(),x=g.useCallback(()=>{if(!n)return;S();const C=new Image;C.src=n,c&&(C.crossOrigin=c),r&&(C.srcset=r),u&&(C.sizes=u),t&&(C.loading=t),C.onload=k=>{S(),h("loaded"),o==null||o(k)},C.onerror=k=>{S(),h("failed"),s==null||s(k)},y.current=C},[n,c,r,u,o,s,t]),S=()=>{y.current&&(y.current.onload=null,y.current.onerror=null,y.current=null)};return Bi(()=>{if(!f)return p==="loading"&&x(),()=>{S()}},[p,x,f]),f?"loaded":p}var yw=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function xw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var ls=fe(function(t,n){const{fallbackSrc:r,fallback:o,src:s,srcSet:c,align:u,fit:f,loading:p,ignoreFallback:h,crossOrigin:y,fallbackStrategy:x="beforeLoadOrError",referrerPolicy:S,...C}=t,k=r!==void 0||o!==void 0,w=p!=null||h||!k,j=gw({...t,ignoreFallback:w}),I=yw(j,x),P={ref:n,objectFit:f,objectPosition:u,...w?C:xw(C,["onError","onLoad"])};return I?o||l.jsx(re.img,{as:hf,className:"chakra-image__placeholder",src:r,...P}):l.jsx(re.img,{as:hf,src:s,srcSet:c,crossOrigin:y,loading:p,referrerPolicy:S,className:"chakra-image",...P})});ls.displayName="Image";function ih(e){return g.Children.toArray(e).filter(t=>g.isValidElement(t))}var[bw,Sw]=jt({strict:!1,name:"ButtonGroupContext"}),Cw={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}}},ww={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},Qt=fe(function(t,n){const{size:r,colorScheme:o,variant:s,className:c,spacing:u="0.5rem",isAttached:f,isDisabled:p,orientation:h="horizontal",...y}=t,x=Ae("chakra-button__group",c),S=g.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let C={display:"inline-flex",...f?Cw[h]:ww[h](u)};const k=h==="vertical";return l.jsx(bw,{value:S,children:l.jsx(re.div,{ref:n,role:"group",__css:C,className:x,"data-attached":f?"":void 0,"data-orientation":h,flexDir:k?"column":void 0,...y})})});Qt.displayName="ButtonGroup";function kw(e){const[t,n]=g.useState(!e);return{ref:g.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function pf(e){const{children:t,className:n,...r}=e,o=g.isValidElement(t)?g.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ae("chakra-button__icon",n);return l.jsx(re.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}pf.displayName="ButtonIcon";function tc(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=l.jsx(Xf,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:c,...u}=e,f=Ae("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",h=g.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...c}),[c,t,p,r]);return l.jsx(re.div,{className:f,...u,__css:h,children:o})}tc.displayName="ButtonSpinner";var ti=fe((e,t)=>{const n=Sw(),r=go("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:c,children:u,leftIcon:f,rightIcon:p,loadingText:h,iconSpacing:y="0.5rem",type:x,spinner:S,spinnerPlacement:C="start",className:k,as:w,...j}=At(e),I=g.useMemo(()=>{const D={...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:D}}},[r,n]),{ref:P,type:M}=kw(w),T={rightIcon:p,leftIcon:f,iconSpacing:y,children:u};return l.jsxs(re.button,{ref:GC(t,P),as:w,type:x??M,"data-active":qe(c),"data-loading":qe(s),__css:I,className:Ae("chakra-button",k),...j,disabled:o||s,children:[s&&C==="start"&&l.jsx(tc,{className:"chakra-button__spinner--start",label:h,placement:"start",spacing:y,children:S}),s?h||l.jsx(re.span,{opacity:0,children:l.jsx(Qv,{...T})}):l.jsx(Qv,{...T}),s&&C==="end"&&l.jsx(tc,{className:"chakra-button__spinner--end",label:h,placement:"end",spacing:y,children:S})]})});ti.displayName="Button";function Qv(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return l.jsxs(l.Fragment,{children:[t&&l.jsx(pf,{marginEnd:o,children:t}),r,n&&l.jsx(pf,{marginStart:o,children:n})]})}var fo=fe((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...c}=e,u=n||r,f=g.isValidElement(u)?g.cloneElement(u,{"aria-hidden":!0,focusable:!1}):null;return l.jsx(ti,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...c,children:f})});fo.displayName="IconButton";var[nL,jw]=jt({name:"CheckboxGroupContext",strict:!1});function Ew(e){return l.jsx(re.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:l.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function Pw(e){return l.jsx(re.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:l.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function Iw(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?Pw:Ew;return n||t?l.jsx(re.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:l.jsx(o,{...r})}):null}var[Mw,x2]=jt({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Tw,ni]=jt({strict:!1,name:"FormControlContext"});function _w(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...c}=e,u=g.useId(),f=t||`field-${u}`,p=`${f}-label`,h=`${f}-feedback`,y=`${f}-helptext`,[x,S]=g.useState(!1),[C,k]=g.useState(!1),[w,j]=g.useState(!1),I=g.useCallback((_={},R=null)=>({id:y,..._,ref:ct(R,V=>{V&&k(!0)})}),[y]),P=g.useCallback((_={},R=null)=>{var V,F;return{..._,ref:R,"data-focus":qe(w),"data-disabled":qe(o),"data-invalid":qe(r),"data-readonly":qe(s),id:(V=_.id)!=null?V:p,htmlFor:(F=_.htmlFor)!=null?F:f}},[f,o,w,r,s,p]),M=g.useCallback((_={},R=null)=>({id:h,..._,ref:ct(R,V=>{V&&S(!0)}),"aria-live":"polite"}),[h]),T=g.useCallback((_={},R=null)=>({..._,...c,ref:R,role:"group"}),[c]),D=g.useCallback((_={},R=null)=>({..._,ref:R,role:"presentation","aria-hidden":!0,children:_.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!w,onFocus:()=>j(!0),onBlur:()=>j(!1),hasFeedbackText:x,setHasFeedbackText:S,hasHelpText:C,setHasHelpText:k,id:f,labelId:p,feedbackId:h,helpTextId:y,htmlProps:c,getHelpTextProps:I,getErrorMessageProps:M,getRootProps:T,getLabelProps:P,getRequiredIndicatorProps:D}}var rt=fe(function(t,n){const r=un("Form",t),o=At(t),{getRootProps:s,htmlProps:c,...u}=_w(o),f=Ae("chakra-form-control",t.className);return l.jsx(Tw,{value:u,children:l.jsx(Mw,{value:r,children:l.jsx(re.div,{...s({},n),className:f,__css:r.container})})})});rt.displayName="FormControl";var pn=fe(function(t,n){const r=ni(),o=x2(),s=Ae("chakra-form__helper-text",t.className);return l.jsx(re.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});pn.displayName="FormHelperText";var[Dw,Aw]=jt({name:"FormErrorStylesContext",errorMessage:`useFormErrorStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),mn=fe((e,t)=>{const n=un("FormError",e),r=At(e),o=ni();return o!=null&&o.isInvalid?l.jsx(Dw,{value:n,children:l.jsx(re.div,{...o==null?void 0:o.getErrorMessageProps(r,t),className:Ae("chakra-form__error-message",e.className),__css:{display:"flex",alignItems:"center",...n.text}})}):null});mn.displayName="FormErrorMessage";var Ow=fe((e,t)=>{const n=Aw(),r=ni();if(!(r!=null&&r.isInvalid))return null;const o=Ae("chakra-form__error-icon",e.className);return l.jsx(tn,{ref:t,"aria-hidden":!0,...e,__css:n.icon,className:o,children:l.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"})})});Ow.displayName="FormErrorIcon";var st=fe(function(t,n){var r;const o=go("FormLabel",t),s=At(t),{className:c,children:u,requiredIndicator:f=l.jsx(b2,{}),optionalIndicator:p=null,...h}=s,y=ni(),x=(r=y==null?void 0:y.getLabelProps(h,n))!=null?r:{ref:n,...h};return l.jsxs(re.label,{...x,className:Ae("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[u,y!=null&&y.isRequired?f:p]})});st.displayName="FormLabel";var b2=fe(function(t,n){const r=ni(),o=x2();if(!(r!=null&&r.isRequired))return null;const s=Ae("chakra-form__required-indicator",t.className);return l.jsx(re.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});b2.displayName="RequiredIndicator";function ah(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=sh(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":Rr(n),"aria-required":Rr(o),"aria-readonly":Rr(r)}}function sh(e){var t,n,r;const o=ni(),{id:s,disabled:c,readOnly:u,required:f,isRequired:p,isInvalid:h,isReadOnly:y,isDisabled:x,onFocus:S,onBlur:C,...k}=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),{...k,"aria-describedby":w.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=c??x)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=u??y)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=f??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:h??(o==null?void 0:o.isInvalid),onFocus:Ee(o==null?void 0:o.onFocus,S),onBlur:Ee(o==null?void 0:o.onBlur,C)}}var lh={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},S2=re("span",{baseStyle:lh});S2.displayName="VisuallyHidden";var zw=re("input",{baseStyle:lh});zw.displayName="VisuallyHiddenInput";var Zv=!1,cs=null,Ko=!1,mf=!1,vf=new Set;function ch(e,t){vf.forEach(n=>n(e,t))}var Rw=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function Nw(e){return!(e.metaKey||!Rw&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Jv(e){Ko=!0,Nw(e)&&(cs="keyboard",ch("keyboard",e))}function wi(e){if(cs="pointer",e.type==="mousedown"||e.type==="pointerdown"){Ko=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;ch("pointer",e)}}function Fw(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function Lw(e){Fw(e)&&(Ko=!0,cs="virtual")}function Bw(e){e.target===window||e.target===document||(!Ko&&!mf&&(cs="virtual",ch("virtual",e)),Ko=!1,mf=!1)}function Hw(){Ko=!1,mf=!0}function eg(){return cs!=="pointer"}function Ww(){if(typeof window>"u"||Zv)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Ko=!0,e.apply(this,n)},document.addEventListener("keydown",Jv,!0),document.addEventListener("keyup",Jv,!0),document.addEventListener("click",Lw,!0),window.addEventListener("focus",Bw,!0),window.addEventListener("blur",Hw,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",wi,!0),document.addEventListener("pointermove",wi,!0),document.addEventListener("pointerup",wi,!0)):(document.addEventListener("mousedown",wi,!0),document.addEventListener("mousemove",wi,!0),document.addEventListener("mouseup",wi,!0)),Zv=!0}function C2(e){Ww(),e(eg());const t=()=>e(eg());return vf.add(t),()=>{vf.delete(t)}}function Vw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function w2(e={}){const t=sh(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:c,onBlur:u,onFocus:f,"aria-describedby":p}=t,{defaultChecked:h,isChecked:y,isFocusable:x,onChange:S,isIndeterminate:C,name:k,value:w,tabIndex:j=void 0,"aria-label":I,"aria-labelledby":P,"aria-invalid":M,...T}=e,D=Vw(T,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),_=Wt(S),R=Wt(u),V=Wt(f),[F,L]=g.useState(!1),[Q,U]=g.useState(!1),[K,te]=g.useState(!1),[ne,$]=g.useState(!1);g.useEffect(()=>C2(L),[]);const Z=g.useRef(null),[oe,le]=g.useState(!0),[Re,Ne]=g.useState(!!h),Ie=y!==void 0,pe=Ie?y:Re,ce=g.useCallback(ye=>{if(r||n){ye.preventDefault();return}Ie||Ne(pe?ye.target.checked:C?!0:ye.target.checked),_==null||_(ye)},[r,n,pe,Ie,C,_]);Bi(()=>{Z.current&&(Z.current.indeterminate=Boolean(C))},[C]),ei(()=>{n&&U(!1)},[n,U]),Bi(()=>{const ye=Z.current;ye!=null&&ye.form&&(ye.form.onreset=()=>{Ne(!!h)})},[]);const Fe=n&&!x,Ve=g.useCallback(ye=>{ye.key===" "&&$(!0)},[$]),Ue=g.useCallback(ye=>{ye.key===" "&&$(!1)},[$]);Bi(()=>{if(!Z.current)return;Z.current.checked!==pe&&Ne(Z.current.checked)},[Z.current]);const $e=g.useCallback((ye={},Pe=null)=>{const et=Be=>{Q&&Be.preventDefault(),$(!0)};return{...ye,ref:Pe,"data-active":qe(ne),"data-hover":qe(K),"data-checked":qe(pe),"data-focus":qe(Q),"data-focus-visible":qe(Q&&F),"data-indeterminate":qe(C),"data-disabled":qe(n),"data-invalid":qe(s),"data-readonly":qe(r),"aria-hidden":!0,onMouseDown:Ee(ye.onMouseDown,et),onMouseUp:Ee(ye.onMouseUp,()=>$(!1)),onMouseEnter:Ee(ye.onMouseEnter,()=>te(!0)),onMouseLeave:Ee(ye.onMouseLeave,()=>te(!1))}},[ne,pe,n,Q,F,K,C,s,r]),Qe=g.useCallback((ye={},Pe=null)=>({...D,...ye,ref:ct(Pe,et=>{et&&le(et.tagName==="LABEL")}),onClick:Ee(ye.onClick,()=>{var et;oe||((et=Z.current)==null||et.click(),requestAnimationFrame(()=>{var Be;(Be=Z.current)==null||Be.focus()}))}),"data-disabled":qe(n),"data-checked":qe(pe),"data-invalid":qe(s)}),[D,n,pe,s,oe]),ge=g.useCallback((ye={},Pe=null)=>({...ye,ref:ct(Z,Pe),type:"checkbox",name:k,value:w,id:c,tabIndex:j,onChange:Ee(ye.onChange,ce),onBlur:Ee(ye.onBlur,R,()=>U(!1)),onFocus:Ee(ye.onFocus,V,()=>U(!0)),onKeyDown:Ee(ye.onKeyDown,Ve),onKeyUp:Ee(ye.onKeyUp,Ue),required:o,checked:pe,disabled:Fe,readOnly:r,"aria-label":I,"aria-labelledby":P,"aria-invalid":M?Boolean(M):s,"aria-describedby":p,"aria-disabled":n,style:lh}),[k,w,c,ce,R,V,Ve,Ue,o,pe,Fe,r,I,P,M,s,p,n,j]),Te=g.useCallback((ye={},Pe=null)=>({...ye,ref:Pe,onMouseDown:Ee(ye.onMouseDown,tg),onTouchStart:Ee(ye.onTouchStart,tg),"data-disabled":qe(n),"data-checked":qe(pe),"data-invalid":qe(s)}),[pe,n,s]);return{state:{isInvalid:s,isFocused:Q,isChecked:pe,isActive:ne,isHovered:K,isIndeterminate:C,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:Qe,getCheckboxProps:$e,getInputProps:ge,getLabelProps:Te,htmlProps:D}}function tg(e){e.preventDefault(),e.stopPropagation()}var Uw={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},$w={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},Gw=Jo({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),qw=Jo({from:{opacity:0},to:{opacity:1}}),Yw=Jo({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),k2=fe(function(t,n){const r=jw(),o={...r,...t},s=un("Checkbox",o),c=At(t),{spacing:u="0.5rem",className:f,children:p,iconColor:h,iconSize:y,icon:x=l.jsx(Iw,{}),isChecked:S,isDisabled:C=r==null?void 0:r.isDisabled,onChange:k,inputProps:w,...j}=c;let I=S;r!=null&&r.value&&c.value&&(I=r.value.includes(c.value));let P=k;r!=null&&r.onChange&&c.value&&(P=yc(r.onChange,k));const{state:M,getInputProps:T,getCheckboxProps:D,getLabelProps:_,getRootProps:R}=w2({...j,isDisabled:C,isChecked:I,onChange:P}),V=g.useMemo(()=>({animation:M.isIndeterminate?`${qw} 20ms linear, ${Yw} 200ms linear`:`${Gw} 200ms linear`,fontSize:y,color:h,...s.icon}),[h,y,,M.isIndeterminate,s.icon]),F=g.cloneElement(x,{__css:V,isIndeterminate:M.isIndeterminate,isChecked:M.isChecked});return l.jsxs(re.label,{__css:{...$w,...s.container},className:Ae("chakra-checkbox",f),...R(),children:[l.jsx("input",{className:"chakra-checkbox__input",...T(w,n)}),l.jsx(re.span,{__css:{...Uw,...s.control},className:"chakra-checkbox__control",...D(),children:F}),p&&l.jsx(re.span,{className:"chakra-checkbox__label",..._(),__css:{marginStart:u,...s.label},children:p})]})});k2.displayName="Checkbox";function Kw(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function uh(e,t){let n=Kw(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function gf(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 ng(e,t,n){return(e-t)*100/(n-t)}function Xw(e,t,n){return(n-t)*e+t}function rg(e,t,n){const r=Math.round((e-t)/n)*n+t,o=gf(n);return uh(r,o)}function Hl(e,t,n){return e==null?e:(n{var F;return r==null?"":(F=md(r,s,n))!=null?F:""}),x=typeof o<"u",S=x?o:h,C=j2(oo(S),s),k=n??C,w=g.useCallback(F=>{F!==S&&(x||y(F.toString()),p==null||p(F.toString(),oo(F)))},[p,x,S]),j=g.useCallback(F=>{let L=F;return f&&(L=Hl(L,c,u)),uh(L,k)},[k,f,u,c]),I=g.useCallback((F=s)=>{let L;S===""?L=oo(F):L=oo(S)+F,L=j(L),w(L)},[j,s,w,S]),P=g.useCallback((F=s)=>{let L;S===""?L=oo(-F):L=oo(S)-F,L=j(L),w(L)},[j,s,w,S]),M=g.useCallback(()=>{var F;let L;r==null?L="":L=(F=md(r,s,n))!=null?F:c,w(L)},[r,n,s,w,c]),T=g.useCallback(F=>{var L;const Q=(L=md(F,s,k))!=null?L:c;w(Q)},[k,s,w,c]),D=oo(S);return{isOutOfRange:D>u||D{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 Zw(e){return"current"in e}var E2=()=>typeof window<"u";function Jw(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var e5=e=>E2()&&e.test(navigator.vendor),t5=e=>E2()&&e.test(Jw()),n5=()=>t5(/mac|iphone|ipad|ipod/i),r5=()=>n5()&&e5(/apple/i);function o5(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,c;return(c=(s=t.current)==null?void 0:s.ownerDocument)!=null?c:document};$o(o,"pointerdown",s=>{if(!r5()||!r)return;const c=s.target,f=(n??[t]).some(p=>{const h=Zw(p)?p.current:p;return(h==null?void 0:h.contains(c))||h===c});o().activeElement!==c&&f&&(s.preventDefault(),c.focus())})}var lt={},i5={get exports(){return lt},set exports(e){lt=e}},a5="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",s5=a5,l5=s5;function P2(){}function I2(){}I2.resetWarningCache=P2;var c5=function(){function e(r,o,s,c,u,f){if(f!==l5){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:I2,resetWarningCache:P2};return n.PropTypes=n,n};i5.exports=c5();var yf="data-focus-lock",M2="data-focus-lock-disabled",u5="data-no-focus-lock",d5="data-autofocus-inside",f5="data-no-autofocus";function h5(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function p5(e,t){var n=g.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 T2(e,t){return p5(t||null,function(n){return e.forEach(function(r){return h5(r,n)})})}var vd={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},yr=function(){return yr=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(u){c={error:u}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(c)throw c.error}}return s}function xf(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(I5)},M5=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],ph=M5.join(","),T5="".concat(ph,", [data-focus-guard]"),Y2=function(e,t){return jr((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?T5:ph)?[r]:[],Y2(r))},[])},_5=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?wc([e.contentDocument.body],t):[e]},wc=function(e,t){return e.reduce(function(n,r){var o,s=Y2(r,t),c=(o=[]).concat.apply(o,s.map(function(u){return _5(u,t)}));return n.concat(c,r.parentNode?jr(r.parentNode.querySelectorAll(ph)).filter(function(u){return u===r}):[])},[])},D5=function(e){var t=e.querySelectorAll("[".concat(d5,"]"));return jr(t).map(function(n){return wc([n])}).reduce(function(n,r){return n.concat(r)},[])},mh=function(e,t){return jr(e).filter(function(n){return W2(t,n)}).filter(function(n){return j5(n)})},ig=function(e,t){return t===void 0&&(t=new Map),jr(e).filter(function(n){return V2(t,n)})},bf=function(e,t,n){return q2(mh(wc(e,n),t),!0,n)},ag=function(e,t){return q2(mh(wc(e),t),!1)},A5=function(e,t){return mh(D5(e),t)},Wi=function(e,t){return e.shadowRoot?Wi(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:jr(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?Wi(o,t):!1}return Wi(n,t)})},O5=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(c,u){return!t.has(u)})},K2=function(e){return e.parentNode?K2(e.parentNode):e},vh=function(e){var t=nc(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(yf);return n.push.apply(n,o?O5(jr(K2(r).querySelectorAll("[".concat(yf,'="').concat(o,'"]:not([').concat(M2,'="disabled"])')))):[r]),n},[])},z5=function(e){try{return e()}catch{return}},Ga=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Ga(t.shadowRoot):t instanceof HTMLIFrameElement&&z5(function(){return t.contentWindow.document})?Ga(t.contentWindow.document):t}},R5=function(e,t){return e===t},N5=function(e,t){return Boolean(jr(e.querySelectorAll("iframe")).some(function(n){return R5(n,t)}))},X2=function(e,t){return t===void 0&&(t=Ga(L2(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:vh(e).some(function(n){return Wi(n,t)||N5(n,t)})},F5=function(e){e===void 0&&(e=document);var t=Ga(e);return t?jr(e.querySelectorAll("[".concat(u5,"]"))).some(function(n){return Wi(n,t)}):!1},L5=function(e,t){return t.filter(G2).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},gh=function(e,t){return G2(e)&&e.name?L5(e,t):e},B5=function(e){var t=new Set;return e.forEach(function(n){return t.add(gh(n,e))}),e.filter(function(n){return t.has(n)})},sg=function(e){return e[0]&&e.length>1?gh(e[0],e):e[0]},lg=function(e,t){return e.length>1?e.indexOf(gh(e[t],e)):t},Q2="NEW_FOCUS",H5=function(e,t,n,r){var o=e.length,s=e[0],c=e[o-1],u=hh(n);if(!(n&&e.indexOf(n)>=0)){var f=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):f,h=r?e.indexOf(r):-1,y=f-p,x=t.indexOf(s),S=t.indexOf(c),C=B5(t),k=n!==void 0?C.indexOf(n):-1,w=k-(r?C.indexOf(r):f),j=lg(e,0),I=lg(e,o-1);if(f===-1||h===-1)return Q2;if(!y&&h>=0)return h;if(f<=x&&u&&Math.abs(y)>1)return I;if(f>=S&&u&&Math.abs(y)>1)return j;if(y&&Math.abs(w)>1)return h;if(f<=x)return I;if(f>S)return j;if(y)return Math.abs(y)>1?h:(o+h+y)%o}},W5=function(e){return function(t){var n,r=(n=U2(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},V5=function(e,t,n){var r=e.map(function(s){var c=s.node;return c}),o=ig(r.filter(W5(n)));return o&&o.length?sg(o):sg(ig(t))},Sf=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&Sf(e.parentNode.host||e.parentNode,t),t},gd=function(e,t){for(var n=Sf(e),r=Sf(t),o=0;o=0)return s}return!1},Z2=function(e,t,n){var r=nc(e),o=nc(t),s=r[0],c=!1;return o.filter(Boolean).forEach(function(u){c=gd(c||u,u)||c,n.filter(Boolean).forEach(function(f){var p=gd(s,f);p&&(!c||Wi(p,c)?c=p:c=gd(p,c))})}),c},U5=function(e,t){return e.reduce(function(n,r){return n.concat(A5(r,t))},[])},$5=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(P5)},G5=function(e,t){var n=Ga(nc(e).length>0?document:L2(e).ownerDocument),r=vh(e).filter(rc),o=Z2(n||e,e,r),s=new Map,c=ag(r,s),u=bf(r,s).filter(function(S){var C=S.node;return rc(C)});if(!(!u[0]&&(u=c,!u[0]))){var f=ag([o],s).map(function(S){var C=S.node;return C}),p=$5(f,u),h=p.map(function(S){var C=S.node;return C}),y=H5(h,f,n,t);if(y===Q2){var x=V5(c,h,U5(r,s));if(x)return{node:x};console.warn("focus-lock: cannot find any node to move focus into");return}return y===void 0?y:p[y]}},q5=function(e){var t=vh(e).filter(rc),n=Z2(e,e,t),r=new Map,o=bf([n],r,!0),s=bf(t,r).filter(function(c){var u=c.node;return rc(u)}).map(function(c){var u=c.node;return u});return o.map(function(c){var u=c.node,f=c.index;return{node:u,index:f,lockItem:s.indexOf(u)>=0,guard:hh(u)}})},Y5=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},yd=0,xd=!1,J2=function(e,t,n){n===void 0&&(n={});var r=G5(e,t);if(!xd&&r){if(yd>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),xd=!0,setTimeout(function(){xd=!1},1);return}yd++,Y5(r.node,n.focusOptions),yd--}};function ey(e){var t=window,n=t.setImmediate;typeof n<"u"?n(e):setTimeout(e,1)}var K5=function(){return document&&document.activeElement===document.body},X5=function(){return K5()||F5()},Vi=null,Ri=null,Ui=null,qa=!1,Q5=function(){return!0},Z5=function(t){return(Vi.whiteList||Q5)(t)},J5=function(t,n){Ui={observerNode:t,portaledElement:n}},e6=function(t){return Ui&&Ui.portaledElement===t};function cg(e,t,n,r){var o=null,s=e;do{var c=r[s];if(c.guard)c.node.dataset.focusAutoGuard&&(o=c);else if(c.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var t6=function(t){return t&&"current"in t?t.current:t},n6=function(t){return t?Boolean(qa):qa==="meanwhile"},r6=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},o6=function(t,n){return n.some(function(r){return r6(t,r,r)})},oc=function(){var t=!1;if(Vi){var n=Vi,r=n.observed,o=n.persistentFocus,s=n.autoFocus,c=n.shards,u=n.crossFrame,f=n.focusOptions,p=r||Ui&&Ui.portaledElement,h=document&&document.activeElement;if(p){var y=[p].concat(c.map(t6).filter(Boolean));if((!h||Z5(h))&&(o||n6(u)||!X5()||!Ri&&s)&&(p&&!(X2(y)||h&&o6(h,y)||e6(h))&&(document&&!Ri&&h&&!s?(h.blur&&h.blur(),document.body.focus()):(t=J2(y,Ri,{focusOptions:f}),Ui={})),qa=!1,Ri=document&&document.activeElement),document){var x=document&&document.activeElement,S=q5(y),C=S.map(function(k){var w=k.node;return w}).indexOf(x);C>-1&&(S.filter(function(k){var w=k.guard,j=k.node;return w&&j.dataset.focusAutoGuard}).forEach(function(k){var w=k.node;return w.removeAttribute("tabIndex")}),cg(C,S.length,1,S),cg(C,-1,-1,S))}}}return t},ty=function(t){oc()&&t&&(t.stopPropagation(),t.preventDefault())},yh=function(){return ey(oc)},i6=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||J5(r,n)},a6=function(){return null},ny=function(){qa="just",setTimeout(function(){qa="meanwhile"},0)},s6=function(){document.addEventListener("focusin",ty),document.addEventListener("focusout",yh),window.addEventListener("blur",ny)},l6=function(){document.removeEventListener("focusin",ty),document.removeEventListener("focusout",yh),window.removeEventListener("blur",ny)};function c6(e){return e.filter(function(t){var n=t.disabled;return!n})}function u6(e){var t=e.slice(-1)[0];t&&!Vi&&s6();var n=Vi,r=n&&t&&t.id===n.id;Vi=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Ri=null,(!r||n.observed!==t.observed)&&t.onActivation(),oc(),ey(oc)):(l6(),Ri=null)}R2.assignSyncMedium(i6);N2.assignMedium(yh);v5.assignMedium(function(e){return e({moveFocusInside:J2,focusInside:X2})});const d6=b5(c6,u6)(a6);var ry=g.forwardRef(function(t,n){return g.createElement(F2,Yd({sideCar:d6,ref:n},t))}),oy=F2.propTypes||{};oy.sideCar;wC(oy,["sideCar"]);ry.propTypes={};const ug=ry;function iy(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function ay(e){var t;if(!iy(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function f6(e){var t,n;return(n=(t=sy(e))==null?void 0:t.defaultView)!=null?n:window}function sy(e){return iy(e)?e.ownerDocument:document}function h6(e){return sy(e).activeElement}var ly=e=>e.hasAttribute("tabindex"),p6=e=>ly(e)&&e.tabIndex===-1;function m6(e){return Boolean(e.getAttribute("disabled"))===!0||Boolean(e.getAttribute("aria-disabled"))===!0}function cy(e){return e.parentElement&&cy(e.parentElement)?!0:e.hidden}function v6(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function uy(e){if(!ay(e)||cy(e)||m6(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]():v6(e)?!0:ly(e)}function g6(e){return e?ay(e)&&uy(e)&&!p6(e):!1}var y6=["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]"],x6=y6.join(),b6=e=>e.offsetWidth>0&&e.offsetHeight>0;function dy(e){const t=Array.from(e.querySelectorAll(x6));return t.unshift(e),t.filter(n=>uy(n)&&b6(n))}var dg,S6=(dg=ug.default)!=null?dg:ug,fy=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:c,autoFocus:u,persistentFocus:f,lockFocusAcrossFrames:p}=e,h=g.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&dy(r.current).length===0&&requestAnimationFrame(()=>{var C;(C=r.current)==null||C.focus()})},[t,r]),y=g.useCallback(()=>{var S;(S=n==null?void 0:n.current)==null||S.focus()},[n]),x=o&&!n;return l.jsx(S6,{crossFrame:p,persistentFocus:f,autoFocus:u,disabled:c,onActivation:h,onDeactivation:y,returnFocus:x,children:s})};fy.displayName="FocusLock";var C6=AC?g.useLayoutEffect:g.useEffect;function ic(e,t=[]){const n=g.useRef(e);return C6(()=>{n.current=e}),g.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function w6(e,t,n,r){const o=ic(t);return g.useEffect(()=>{var s;const c=(s=Ev(n))!=null?s:document;if(t)return c.addEventListener(e,o,r),()=>{c.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=Ev(n))!=null?s:document).removeEventListener(e,o,r)}}function k6(e){const{ref:t,handler:n,enabled:r=!0}=e,o=ic(n),c=g.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;g.useEffect(()=>{if(!r)return;const u=y=>{bd(y,t)&&(c.isPointerDown=!0)},f=y=>{if(c.ignoreEmulatedMouseEvents){c.ignoreEmulatedMouseEvents=!1;return}c.isPointerDown&&n&&bd(y,t)&&(c.isPointerDown=!1,o(y))},p=y=>{c.ignoreEmulatedMouseEvents=!0,n&&c.isPointerDown&&bd(y,t)&&(c.isPointerDown=!1,o(y))},h=u2(t.current);return h.addEventListener("mousedown",u,!0),h.addEventListener("mouseup",f,!0),h.addEventListener("touchstart",u,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",u,!0),h.removeEventListener("mouseup",f,!0),h.removeEventListener("touchstart",u,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,c,r])}function bd(e,t){var n;const r=e.target;return e.button>0||r&&!u2(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function j6(e,t){const n=g.useId();return g.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function E6(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function ho(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=ic(n),c=ic(t),[u,f]=g.useState(e.defaultIsOpen||!1),[p,h]=E6(r,u),y=j6(o,"disclosure"),x=g.useCallback(()=>{p||f(!1),c==null||c()},[p,c]),S=g.useCallback(()=>{p||f(!0),s==null||s()},[p,s]),C=g.useCallback(()=>{(h?x:S)()},[h,S,x]);return{isOpen:!!h,onOpen:S,onClose:x,onToggle:C,isControlled:p,getButtonProps:(k={})=>({...k,"aria-expanded":h,"aria-controls":y,onClick:FS(k.onClick,C)}),getDisclosureProps:(k={})=>({...k,hidden:!h,id:y})}}var xh=fe(function(t,n){const{htmlSize:r,...o}=t,s=un("Input",o),c=At(o),u=ah(c),f=Ae("chakra-input",t.className);return l.jsx(re.input,{size:r,...u,__css:s.field,ref:n,className:f})});xh.displayName="Input";xh.id="Input";var[P6,hy]=jt({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),bh=fe(function(t,n){const r=un("List",t),{children:o,styleType:s="none",stylePosition:c,spacing:u,...f}=At(t),p=ih(o),y=u?{["& > *:not(style) ~ *:not(style)"]:{mt:u}}:{};return l.jsx(P6,{value:r,children:l.jsx(re.ul,{ref:n,listStyleType:s,listStylePosition:c,role:"list",__css:{...r.container,...y},...f,children:p})})});bh.displayName="List";var I6=fe((e,t)=>{const{as:n,...r}=e;return l.jsx(bh,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});I6.displayName="OrderedList";var py=fe(function(t,n){const{as:r,...o}=t;return l.jsx(bh,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});py.displayName="UnorderedList";var za=fe(function(t,n){const r=hy();return l.jsx(re.li,{ref:n,...t,__css:r.item})});za.displayName="ListItem";var M6=fe(function(t,n){const r=hy();return l.jsx(tn,{ref:n,role:"presentation",...t,__css:r.icon})});M6.displayName="ListIcon";var or=fe(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:c,column:u,row:f,autoFlow:p,autoRows:h,templateRows:y,autoColumns:x,templateColumns:S,...C}=t,k={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:c,gridAutoColumns:x,gridColumn:u,gridRow:f,gridAutoFlow:p,gridAutoRows:h,gridTemplateRows:y,gridTemplateColumns:S};return l.jsx(re.div,{ref:n,__css:k,...C})});or.displayName="Grid";function my(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):Kd(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var kc=re("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});kc.displayName="Spacer";var vy=e=>l.jsx(re.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});vy.displayName="StackItem";var Cf="& > *:not(style) ~ *:not(style)";function T6(e){const{spacing:t,direction:n}=e,r={column:{marginTop:t,marginEnd:0,marginBottom:0,marginStart:0},row:{marginTop:0,marginEnd:0,marginBottom:0,marginStart:t},"column-reverse":{marginTop:0,marginEnd:0,marginBottom:t,marginStart:0},"row-reverse":{marginTop:0,marginEnd:t,marginBottom:0,marginStart:0}};return{flexDirection:n,[Cf]:my(n,o=>r[o])}}function _6(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{"&":my(n,o=>r[o])}}var Sh=fe((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:c="0.5rem",wrap:u,children:f,divider:p,className:h,shouldWrapChildren:y,...x}=e,S=n?"row":r??"column",C=g.useMemo(()=>T6({direction:S,spacing:c}),[S,c]),k=g.useMemo(()=>_6({spacing:c,direction:S}),[c,S]),w=!!p,j=!y&&!w,I=g.useMemo(()=>{const M=ih(f);return j?M:M.map((T,D)=>{const _=typeof T.key<"u"?T.key:D,R=D+1===M.length,F=y?l.jsx(vy,{children:T},_):T;if(!w)return F;const L=g.cloneElement(p,{__css:k}),Q=R?null:L;return l.jsxs(g.Fragment,{children:[F,Q]},_)})},[p,k,w,j,y,f]),P=Ae("chakra-stack",h);return l.jsx(re.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:C.flexDirection,flexWrap:u,className:P,__css:w?{}:{[Cf]:C[Cf]},...x,children:I})});Sh.displayName="Stack";var ze=fe((e,t)=>l.jsx(Sh,{align:"center",...e,direction:"column",ref:t}));ze.displayName="VStack";var ra=fe((e,t)=>l.jsx(Sh,{align:"center",...e,direction:"row",ref:t}));ra.displayName="HStack";var Wn=fe(function(t,n){const r=go("Heading",t),{className:o,...s}=At(t);return l.jsx(re.h2,{ref:n,className:Ae("chakra-heading",t.className),...s,__css:r})});Wn.displayName="Heading";var Ye=re("div");Ye.displayName="Box";var gy=fe(function(t,n){const{size:r,centerContent:o=!0,...s}=t,c=o?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return l.jsx(Ye,{ref:n,boxSize:r,__css:{...c,flexShrink:0,flexGrow:0},...s})});gy.displayName="Square";var D6=fe(function(t,n){const{size:r,...o}=t;return l.jsx(gy,{size:r,ref:n,borderRadius:"9999px",...o})});D6.displayName="Circle";var Go=fe(function(t,n){const r=go("Link",t),{className:o,isExternal:s,...c}=At(t);return l.jsx(re.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ae("chakra-link",o),...c,__css:r})});Go.displayName="Link";var yy=fe(function(t,n){const r=go("Badge",t),{className:o,...s}=At(t);return l.jsx(re.span,{ref:n,className:Ae("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});yy.displayName="Badge";var xy=re("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center"}});xy.displayName="Center";var A6={horizontal:{insetStart:"50%",transform:"translateX(-50%)"},vertical:{top:"50%",transform:"translateY(-50%)"},both:{insetStart:"50%",top:"50%",transform:"translate(-50%, -50%)"}};fe(function(t,n){const{axis:r="both",...o}=t;return l.jsx(re.div,{ref:n,__css:A6[r],...o,position:"absolute"})});var by=fe(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:c,borderWidth:u,borderStyle:f,borderColor:p,...h}=go("Divider",t),{className:y,orientation:x="horizontal",__css:S,...C}=At(t),k={vertical:{borderLeftWidth:r||c||u||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||u||"1px",width:"100%"}};return l.jsx(re.hr,{ref:n,"aria-orientation":x,...C,__css:{...h,border:"0",borderColor:p,borderStyle:f,...k[x],...S},className:Ae("chakra-divider",y)})});by.displayName="Divider";function O6(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function z6(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=g.useState([]),s=g.useRef(),c=()=>{s.current&&(clearTimeout(s.current),s.current=null)},u=()=>{c(),s.current=setTimeout(()=>{o([]),s.current=null},t)};g.useEffect(()=>c,[]);function f(p){return h=>{if(h.key==="Backspace"){const y=[...r];y.pop(),o(y);return}if(O6(h)){const y=r.concat(h.key);n(h)&&(h.preventDefault(),h.stopPropagation()),o(y),p(y.join("")),u()}}}return f}function R6(e,t,n,r){if(t==null)return r;if(!r)return e.find(c=>n(c).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 N6(){const e=g.useRef(new Map),t=e.current,n=g.useCallback((o,s,c,u)=>{e.current.set(c,{type:s,el:o,options:u}),o.addEventListener(s,c,u)},[]),r=g.useCallback((o,s,c,u)=>{o.removeEventListener(s,c,u),e.current.delete(c)},[]);return g.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function Sd(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function Sy(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:c,onMouseUp:u,onClick:f,onKeyDown:p,onKeyUp:h,tabIndex:y,onMouseOver:x,onMouseLeave:S,...C}=e,[k,w]=g.useState(!0),[j,I]=g.useState(!1),P=N6(),M=$=>{$&&$.tagName!=="BUTTON"&&w(!1)},T=k?y:y||0,D=n&&!r,_=g.useCallback($=>{if(n){$.stopPropagation(),$.preventDefault();return}$.currentTarget.focus(),f==null||f($)},[n,f]),R=g.useCallback($=>{j&&Sd($)&&($.preventDefault(),$.stopPropagation(),I(!1),P.remove(document,"keyup",R,!1))},[j,P]),V=g.useCallback($=>{if(p==null||p($),n||$.defaultPrevented||$.metaKey||!Sd($.nativeEvent)||k)return;const Z=o&&$.key==="Enter";s&&$.key===" "&&($.preventDefault(),I(!0)),Z&&($.preventDefault(),$.currentTarget.click()),P.add(document,"keyup",R,!1)},[n,k,p,o,s,P,R]),F=g.useCallback($=>{if(h==null||h($),n||$.defaultPrevented||$.metaKey||!Sd($.nativeEvent)||k)return;s&&$.key===" "&&($.preventDefault(),I(!1),$.currentTarget.click())},[s,k,n,h]),L=g.useCallback($=>{$.button===0&&(I(!1),P.remove(document,"mouseup",L,!1))},[P]),Q=g.useCallback($=>{if($.button!==0)return;if(n){$.stopPropagation(),$.preventDefault();return}k||I(!0),$.currentTarget.focus({preventScroll:!0}),P.add(document,"mouseup",L,!1),c==null||c($)},[n,k,c,P,L]),U=g.useCallback($=>{$.button===0&&(k||I(!1),u==null||u($))},[u,k]),K=g.useCallback($=>{if(n){$.preventDefault();return}x==null||x($)},[n,x]),te=g.useCallback($=>{j&&($.preventDefault(),I(!1)),S==null||S($)},[j,S]),ne=ct(t,M);return k?{...C,ref:ne,type:"button","aria-disabled":D?void 0:n,disabled:D,onClick:_,onMouseDown:c,onMouseUp:u,onKeyUp:h,onKeyDown:p,onMouseOver:x,onMouseLeave:S}:{...C,ref:ne,role:"button","data-active":qe(j),"aria-disabled":n?"true":void 0,tabIndex:D?void 0:T,onClick:_,onMouseDown:Q,onMouseUp:U,onKeyUp:F,onKeyDown:V,onMouseOver:K,onMouseLeave:te}}function F6(e){const t=e.current;if(!t)return!1;const n=h6(t);return!n||t.contains(n)?!1:!!g6(n)}function Cy(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;ei(()=>{if(!s||F6(e))return;const c=(o==null?void 0:o.current)||e.current;c&&requestAnimationFrame(()=>{c.focus()})},[s,e,o])}var L6={preventScroll:!0,shouldFocus:!1};function B6(e,t=L6){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,c=H6(e)?e.current:e,u=o&&s,f=g.useRef(u),p=g.useRef(s);Bi(()=>{!p.current&&s&&(f.current=u),p.current=s},[s,u]);const h=g.useCallback(()=>{if(!(!s||!c||!f.current)&&(f.current=!1,!c.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var y;(y=n.current)==null||y.focus({preventScroll:r})});else{const y=dy(c);y.length>0&&requestAnimationFrame(()=>{y[0].focus({preventScroll:r})})}},[s,r,c,n]);ei(()=>{h()},[h]),$o(c,"transitionend",h)}function H6(e){return"current"in e}var ki=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Ht={arrowShadowColor:ki("--popper-arrow-shadow-color"),arrowSize:ki("--popper-arrow-size","8px"),arrowSizeHalf:ki("--popper-arrow-size-half"),arrowBg:ki("--popper-arrow-bg"),transformOrigin:ki("--popper-transform-origin"),arrowOffset:ki("--popper-arrow-offset")};function W6(e){if(e.includes("top"))return"1px 1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 1px 0 var(--popper-arrow-shadow-color)"}var V6={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"},U6=e=>V6[e],fg={scroll:!0,resize:!0};function $6(e){let t;return typeof e=="object"?t={enabled:!0,options:{...fg,...e}}:t={enabled:e,options:fg},t}var G6={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`}},q6={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{hg(e)},effect:({state:e})=>()=>{hg(e)}},hg=e=>{e.elements.popper.style.setProperty(Ht.transformOrigin.var,U6(e.placement))},Y6={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{K6(e)}},K6=e=>{var t;if(!e.placement)return;const n=X6(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:Ht.arrowSize.varRef,height:Ht.arrowSize.varRef,zIndex:-1});const r={[Ht.arrowSizeHalf.var]:`calc(${Ht.arrowSize.varRef} / 2)`,[Ht.arrowOffset.var]:`calc(${Ht.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},X6=e=>{if(e.startsWith("top"))return{property:"bottom",value:Ht.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:Ht.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:Ht.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:Ht.arrowOffset.varRef}},Q6={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{pg(e)},effect:({state:e})=>()=>{pg(e)}},pg=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=W6(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:Ht.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},Z6={"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"}},J6={"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 ek(e,t="ltr"){var n,r;const o=((n=Z6[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=J6[e])!=null?r:o}var Pn="top",Un="bottom",$n="right",In="left",Ch="auto",us=[Pn,Un,$n,In],$i="start",Ya="end",tk="clippingParents",wy="viewport",Ta="popper",nk="reference",mg=us.reduce(function(e,t){return e.concat([t+"-"+$i,t+"-"+Ya])},[]),ky=[].concat(us,[Ch]).reduce(function(e,t){return e.concat([t,t+"-"+$i,t+"-"+Ya])},[]),rk="beforeRead",ok="read",ik="afterRead",ak="beforeMain",sk="main",lk="afterMain",ck="beforeWrite",uk="write",dk="afterWrite",fk=[rk,ok,ik,ak,sk,lk,ck,uk,dk];function kr(e){return e?(e.nodeName||"").toLowerCase():null}function Gn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Xo(e){var t=Gn(e).Element;return e instanceof t||e instanceof Element}function Vn(e){var t=Gn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function wh(e){if(typeof ShadowRoot>"u")return!1;var t=Gn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function hk(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];!Vn(s)||!kr(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(c){var u=o[c];u===!1?s.removeAttribute(c):s.setAttribute(c,u===!0?"":u)}))})}function pk(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]||{},c=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),u=c.reduce(function(f,p){return f[p]="",f},{});!Vn(o)||!kr(o)||(Object.assign(o.style,u),Object.keys(s).forEach(function(f){o.removeAttribute(f)}))})}}const mk={name:"applyStyles",enabled:!0,phase:"write",fn:hk,effect:pk,requires:["computeStyles"]};function Sr(e){return e.split("-")[0]}var qo=Math.max,ac=Math.min,Gi=Math.round;function wf(){var e=navigator.userAgentData;return e!=null&&e.brands?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function jy(){return!/^((?!chrome|android).)*safari/i.test(wf())}function qi(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Vn(e)&&(o=e.offsetWidth>0&&Gi(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&Gi(r.height)/e.offsetHeight||1);var c=Xo(e)?Gn(e):window,u=c.visualViewport,f=!jy()&&n,p=(r.left+(f&&u?u.offsetLeft:0))/o,h=(r.top+(f&&u?u.offsetTop:0))/s,y=r.width/o,x=r.height/s;return{width:y,height:x,top:h,right:p+y,bottom:h+x,left:p,x:p,y:h}}function kh(e){var t=qi(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 Ey(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&wh(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Nr(e){return Gn(e).getComputedStyle(e)}function vk(e){return["table","td","th"].indexOf(kr(e))>=0}function xo(e){return((Xo(e)?e.ownerDocument:e.document)||window.document).documentElement}function jc(e){return kr(e)==="html"?e:e.assignedSlot||e.parentNode||(wh(e)?e.host:null)||xo(e)}function vg(e){return!Vn(e)||Nr(e).position==="fixed"?null:e.offsetParent}function gk(e){var t=/firefox/i.test(wf()),n=/Trident/i.test(wf());if(n&&Vn(e)){var r=Nr(e);if(r.position==="fixed")return null}var o=jc(e);for(wh(o)&&(o=o.host);Vn(o)&&["html","body"].indexOf(kr(o))<0;){var s=Nr(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 ds(e){for(var t=Gn(e),n=vg(e);n&&vk(n)&&Nr(n).position==="static";)n=vg(n);return n&&(kr(n)==="html"||kr(n)==="body"&&Nr(n).position==="static")?t:n||gk(e)||t}function jh(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Na(e,t,n){return qo(e,ac(t,n))}function yk(e,t,n){var r=Na(e,t,n);return r>n?n:r}function Py(){return{top:0,right:0,bottom:0,left:0}}function Iy(e){return Object.assign({},Py(),e)}function My(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var xk=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Iy(typeof t!="number"?t:My(t,us))};function bk(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,c=n.modifiersData.popperOffsets,u=Sr(n.placement),f=jh(u),p=[In,$n].indexOf(u)>=0,h=p?"height":"width";if(!(!s||!c)){var y=xk(o.padding,n),x=kh(s),S=f==="y"?Pn:In,C=f==="y"?Un:$n,k=n.rects.reference[h]+n.rects.reference[f]-c[f]-n.rects.popper[h],w=c[f]-n.rects.reference[f],j=ds(s),I=j?f==="y"?j.clientHeight||0:j.clientWidth||0:0,P=k/2-w/2,M=y[S],T=I-x[h]-y[C],D=I/2-x[h]/2+P,_=Na(M,D,T),R=f;n.modifiersData[r]=(t={},t[R]=_,t.centerOffset=_-D,t)}}function Sk(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)||Ey(t.elements.popper,o)&&(t.elements.arrow=o))}const Ck={name:"arrow",enabled:!0,phase:"main",fn:bk,effect:Sk,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Yi(e){return e.split("-")[1]}var wk={top:"auto",right:"auto",bottom:"auto",left:"auto"};function kk(e){var t=e.x,n=e.y,r=window,o=r.devicePixelRatio||1;return{x:Gi(t*o)/o||0,y:Gi(n*o)/o||0}}function gg(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,c=e.offsets,u=e.position,f=e.gpuAcceleration,p=e.adaptive,h=e.roundOffsets,y=e.isFixed,x=c.x,S=x===void 0?0:x,C=c.y,k=C===void 0?0:C,w=typeof h=="function"?h({x:S,y:k}):{x:S,y:k};S=w.x,k=w.y;var j=c.hasOwnProperty("x"),I=c.hasOwnProperty("y"),P=In,M=Pn,T=window;if(p){var D=ds(n),_="clientHeight",R="clientWidth";if(D===Gn(n)&&(D=xo(n),Nr(D).position!=="static"&&u==="absolute"&&(_="scrollHeight",R="scrollWidth")),D=D,o===Pn||(o===In||o===$n)&&s===Ya){M=Un;var V=y&&D===T&&T.visualViewport?T.visualViewport.height:D[_];k-=V-r.height,k*=f?1:-1}if(o===In||(o===Pn||o===Un)&&s===Ya){P=$n;var F=y&&D===T&&T.visualViewport?T.visualViewport.width:D[R];S-=F-r.width,S*=f?1:-1}}var L=Object.assign({position:u},p&&wk),Q=h===!0?kk({x:S,y:k}):{x:S,y:k};if(S=Q.x,k=Q.y,f){var U;return Object.assign({},L,(U={},U[M]=I?"0":"",U[P]=j?"0":"",U.transform=(T.devicePixelRatio||1)<=1?"translate("+S+"px, "+k+"px)":"translate3d("+S+"px, "+k+"px, 0)",U))}return Object.assign({},L,(t={},t[M]=I?k+"px":"",t[P]=j?S+"px":"",t.transform="",t))}function jk(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,c=s===void 0?!0:s,u=n.roundOffsets,f=u===void 0?!0:u,p={placement:Sr(t.placement),variation:Yi(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,gg(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:c,roundOffsets:f})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,gg(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const Ek={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:jk,data:{}};var bl={passive:!0};function Pk(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,c=r.resize,u=c===void 0?!0:c,f=Gn(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(h){h.addEventListener("scroll",n.update,bl)}),u&&f.addEventListener("resize",n.update,bl),function(){s&&p.forEach(function(h){h.removeEventListener("scroll",n.update,bl)}),u&&f.removeEventListener("resize",n.update,bl)}}const Ik={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Pk,data:{}};var Mk={left:"right",right:"left",bottom:"top",top:"bottom"};function Wl(e){return e.replace(/left|right|bottom|top/g,function(t){return Mk[t]})}var Tk={start:"end",end:"start"};function yg(e){return e.replace(/start|end/g,function(t){return Tk[t]})}function Eh(e){var t=Gn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Ph(e){return qi(xo(e)).left+Eh(e).scrollLeft}function _k(e,t){var n=Gn(e),r=xo(e),o=n.visualViewport,s=r.clientWidth,c=r.clientHeight,u=0,f=0;if(o){s=o.width,c=o.height;var p=jy();(p||!p&&t==="fixed")&&(u=o.offsetLeft,f=o.offsetTop)}return{width:s,height:c,x:u+Ph(e),y:f}}function Dk(e){var t,n=xo(e),r=Eh(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=qo(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),c=qo(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),u=-r.scrollLeft+Ph(e),f=-r.scrollTop;return Nr(o||n).direction==="rtl"&&(u+=qo(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:c,x:u,y:f}}function Ih(e){var t=Nr(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function Ty(e){return["html","body","#document"].indexOf(kr(e))>=0?e.ownerDocument.body:Vn(e)&&Ih(e)?e:Ty(jc(e))}function Fa(e,t){var n;t===void 0&&(t=[]);var r=Ty(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Gn(r),c=o?[s].concat(s.visualViewport||[],Ih(r)?r:[]):r,u=t.concat(c);return o?u:u.concat(Fa(jc(c)))}function kf(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Ak(e,t){var n=qi(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 xg(e,t,n){return t===wy?kf(_k(e,n)):Xo(t)?Ak(t,n):kf(Dk(xo(e)))}function Ok(e){var t=Fa(jc(e)),n=["absolute","fixed"].indexOf(Nr(e).position)>=0,r=n&&Vn(e)?ds(e):e;return Xo(r)?t.filter(function(o){return Xo(o)&&Ey(o,r)&&kr(o)!=="body"}):[]}function zk(e,t,n,r){var o=t==="clippingParents"?Ok(e):[].concat(t),s=[].concat(o,[n]),c=s[0],u=s.reduce(function(f,p){var h=xg(e,p,r);return f.top=qo(h.top,f.top),f.right=ac(h.right,f.right),f.bottom=ac(h.bottom,f.bottom),f.left=qo(h.left,f.left),f},xg(e,c,r));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function _y(e){var t=e.reference,n=e.element,r=e.placement,o=r?Sr(r):null,s=r?Yi(r):null,c=t.x+t.width/2-n.width/2,u=t.y+t.height/2-n.height/2,f;switch(o){case Pn:f={x:c,y:t.y-n.height};break;case Un:f={x:c,y:t.y+t.height};break;case $n:f={x:t.x+t.width,y:u};break;case In:f={x:t.x-n.width,y:u};break;default:f={x:t.x,y:t.y}}var p=o?jh(o):null;if(p!=null){var h=p==="y"?"height":"width";switch(s){case $i:f[p]=f[p]-(t[h]/2-n[h]/2);break;case Ya:f[p]=f[p]+(t[h]/2-n[h]/2);break}}return f}function Ka(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,c=s===void 0?e.strategy:s,u=n.boundary,f=u===void 0?tk:u,p=n.rootBoundary,h=p===void 0?wy:p,y=n.elementContext,x=y===void 0?Ta:y,S=n.altBoundary,C=S===void 0?!1:S,k=n.padding,w=k===void 0?0:k,j=Iy(typeof w!="number"?w:My(w,us)),I=x===Ta?nk:Ta,P=e.rects.popper,M=e.elements[C?I:x],T=zk(Xo(M)?M:M.contextElement||xo(e.elements.popper),f,h,c),D=qi(e.elements.reference),_=_y({reference:D,element:P,strategy:"absolute",placement:o}),R=kf(Object.assign({},P,_)),V=x===Ta?R:D,F={top:T.top-V.top+j.top,bottom:V.bottom-T.bottom+j.bottom,left:T.left-V.left+j.left,right:V.right-T.right+j.right},L=e.modifiersData.offset;if(x===Ta&&L){var Q=L[o];Object.keys(F).forEach(function(U){var K=[$n,Un].indexOf(U)>=0?1:-1,te=[Pn,Un].indexOf(U)>=0?"y":"x";F[U]+=Q[te]*K})}return F}function Rk(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,c=n.padding,u=n.flipVariations,f=n.allowedAutoPlacements,p=f===void 0?ky:f,h=Yi(r),y=h?u?mg:mg.filter(function(C){return Yi(C)===h}):us,x=y.filter(function(C){return p.indexOf(C)>=0});x.length===0&&(x=y);var S=x.reduce(function(C,k){return C[k]=Ka(e,{placement:k,boundary:o,rootBoundary:s,padding:c})[Sr(k)],C},{});return Object.keys(S).sort(function(C,k){return S[C]-S[k]})}function Nk(e){if(Sr(e)===Ch)return[];var t=Wl(e);return[yg(e),t,yg(t)]}function Fk(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,c=n.altAxis,u=c===void 0?!0:c,f=n.fallbackPlacements,p=n.padding,h=n.boundary,y=n.rootBoundary,x=n.altBoundary,S=n.flipVariations,C=S===void 0?!0:S,k=n.allowedAutoPlacements,w=t.options.placement,j=Sr(w),I=j===w,P=f||(I||!C?[Wl(w)]:Nk(w)),M=[w].concat(P).reduce(function(pe,ce){return pe.concat(Sr(ce)===Ch?Rk(t,{placement:ce,boundary:h,rootBoundary:y,padding:p,flipVariations:C,allowedAutoPlacements:k}):ce)},[]),T=t.rects.reference,D=t.rects.popper,_=new Map,R=!0,V=M[0],F=0;F=0,te=K?"width":"height",ne=Ka(t,{placement:L,boundary:h,rootBoundary:y,altBoundary:x,padding:p}),$=K?U?$n:In:U?Un:Pn;T[te]>D[te]&&($=Wl($));var Z=Wl($),oe=[];if(s&&oe.push(ne[Q]<=0),u&&oe.push(ne[$]<=0,ne[Z]<=0),oe.every(function(pe){return pe})){V=L,R=!1;break}_.set(L,oe)}if(R)for(var le=C?3:1,Re=function(ce){var Fe=M.find(function(Ve){var Ue=_.get(Ve);if(Ue)return Ue.slice(0,ce).every(function($e){return $e})});if(Fe)return V=Fe,"break"},Ne=le;Ne>0;Ne--){var Ie=Re(Ne);if(Ie==="break")break}t.placement!==V&&(t.modifiersData[r]._skip=!0,t.placement=V,t.reset=!0)}}const Lk={name:"flip",enabled:!0,phase:"main",fn:Fk,requiresIfExists:["offset"],data:{_skip:!1}};function bg(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 Sg(e){return[Pn,$n,Un,In].some(function(t){return e[t]>=0})}function Bk(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,c=Ka(t,{elementContext:"reference"}),u=Ka(t,{altBoundary:!0}),f=bg(c,r),p=bg(u,o,s),h=Sg(f),y=Sg(p);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:p,isReferenceHidden:h,hasPopperEscaped:y},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":y})}const Hk={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Bk};function Wk(e,t,n){var r=Sr(e),o=[In,Pn].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,c=s[0],u=s[1];return c=c||0,u=(u||0)*o,[In,$n].indexOf(r)>=0?{x:u,y:c}:{x:c,y:u}}function Vk(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,c=ky.reduce(function(h,y){return h[y]=Wk(y,t.rects,s),h},{}),u=c[t.placement],f=u.x,p=u.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=c}const Uk={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Vk};function $k(e){var t=e.state,n=e.name;t.modifiersData[n]=_y({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Gk={name:"popperOffsets",enabled:!0,phase:"read",fn:$k,data:{}};function qk(e){return e==="x"?"y":"x"}function Yk(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,c=n.altAxis,u=c===void 0?!1:c,f=n.boundary,p=n.rootBoundary,h=n.altBoundary,y=n.padding,x=n.tether,S=x===void 0?!0:x,C=n.tetherOffset,k=C===void 0?0:C,w=Ka(t,{boundary:f,rootBoundary:p,padding:y,altBoundary:h}),j=Sr(t.placement),I=Yi(t.placement),P=!I,M=jh(j),T=qk(M),D=t.modifiersData.popperOffsets,_=t.rects.reference,R=t.rects.popper,V=typeof k=="function"?k(Object.assign({},t.rects,{placement:t.placement})):k,F=typeof V=="number"?{mainAxis:V,altAxis:V}:Object.assign({mainAxis:0,altAxis:0},V),L=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Q={x:0,y:0};if(D){if(s){var U,K=M==="y"?Pn:In,te=M==="y"?Un:$n,ne=M==="y"?"height":"width",$=D[M],Z=$+w[K],oe=$-w[te],le=S?-R[ne]/2:0,Re=I===$i?_[ne]:R[ne],Ne=I===$i?-R[ne]:-_[ne],Ie=t.elements.arrow,pe=S&&Ie?kh(Ie):{width:0,height:0},ce=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Py(),Fe=ce[K],Ve=ce[te],Ue=Na(0,_[ne],pe[ne]),$e=P?_[ne]/2-le-Ue-Fe-F.mainAxis:Re-Ue-Fe-F.mainAxis,Qe=P?-_[ne]/2+le+Ue+Ve+F.mainAxis:Ne+Ue+Ve+F.mainAxis,ge=t.elements.arrow&&ds(t.elements.arrow),Te=ge?M==="y"?ge.clientTop||0:ge.clientLeft||0:0,Ge=(U=L==null?void 0:L[M])!=null?U:0,ye=$+$e-Ge-Te,Pe=$+Qe-Ge,et=Na(S?ac(Z,ye):Z,$,S?qo(oe,Pe):oe);D[M]=et,Q[M]=et-$}if(u){var Be,vt=M==="x"?Pn:In,Rt=M==="x"?Un:$n,N=D[T],ue=T==="y"?"height":"width",xe=N+w[vt],ke=N-w[Rt],q=[Pn,In].indexOf(j)!==-1,ae=(Be=L==null?void 0:L[T])!=null?Be:0,Oe=q?xe:N-_[ue]-R[ue]-ae+F.altAxis,Ze=q?N+_[ue]+R[ue]-ae-F.altAxis:ke,J=S&&q?yk(Oe,N,Ze):Na(S?Oe:xe,N,S?Ze:ke);D[T]=J,Q[T]=J-N}t.modifiersData[r]=Q}}const Kk={name:"preventOverflow",enabled:!0,phase:"main",fn:Yk,requiresIfExists:["offset"]};function Xk(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Qk(e){return e===Gn(e)||!Vn(e)?Eh(e):Xk(e)}function Zk(e){var t=e.getBoundingClientRect(),n=Gi(t.width)/e.offsetWidth||1,r=Gi(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Jk(e,t,n){n===void 0&&(n=!1);var r=Vn(t),o=Vn(t)&&Zk(t),s=xo(t),c=qi(e,o,n),u={scrollLeft:0,scrollTop:0},f={x:0,y:0};return(r||!r&&!n)&&((kr(t)!=="body"||Ih(s))&&(u=Qk(t)),Vn(t)?(f=qi(t,!0),f.x+=t.clientLeft,f.y+=t.clientTop):s&&(f.x=Ph(s))),{x:c.left+u.scrollLeft-f.x,y:c.top+u.scrollTop-f.y,width:c.width,height:c.height}}function ej(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 c=[].concat(s.requires||[],s.requiresIfExists||[]);c.forEach(function(u){if(!n.has(u)){var f=t.get(u);f&&o(f)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function tj(e){var t=ej(e);return fk.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function nj(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function rj(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 Cg={placement:"bottom",modifiers:[],strategy:"absolute"};function wg(){for(var e=arguments.length,t=new Array(e),n=0;n{}),P=g.useCallback(()=>{var F;!t||!C.current||!k.current||((F=I.current)==null||F.call(I),w.current=aj(C.current,k.current,{placement:j,modifiers:[Q6,Y6,q6,{...G6,enabled:!!x},{name:"eventListeners",...$6(c)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:u??[0,f]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!y,options:{boundary:h}},...n??[]],strategy:o}),w.current.forceUpdate(),I.current=w.current.destroy)},[j,t,n,x,c,s,u,f,p,y,h,o]);g.useEffect(()=>()=>{var F;!C.current&&!k.current&&((F=w.current)==null||F.destroy(),w.current=null)},[]);const M=g.useCallback(F=>{C.current=F,P()},[P]),T=g.useCallback((F={},L=null)=>({...F,ref:ct(M,L)}),[M]),D=g.useCallback(F=>{k.current=F,P()},[P]),_=g.useCallback((F={},L=null)=>({...F,ref:ct(D,L),style:{...F.style,position:o,minWidth:x?void 0:"max-content",inset:"0 auto auto 0"}}),[o,D,x]),R=g.useCallback((F={},L=null)=>{const{size:Q,shadowColor:U,bg:K,style:te,...ne}=F;return{...ne,ref:L,"data-popper-arrow":"",style:sj(F)}},[]),V=g.useCallback((F={},L=null)=>({...F,ref:L,"data-popper-arrow-inner":""}),[]);return{update(){var F;(F=w.current)==null||F.update()},forceUpdate(){var F;(F=w.current)==null||F.forceUpdate()},transformOrigin:Ht.transformOrigin.varRef,referenceRef:M,popperRef:D,getPopperProps:_,getArrowProps:R,getArrowInnerProps:V,getReferenceProps:T}}function sj(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 Th(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=Wt(n),c=Wt(t),[u,f]=g.useState(e.defaultIsOpen||!1),p=r!==void 0?r:u,h=r!==void 0,y=g.useId(),x=o??`disclosure-${y}`,S=g.useCallback(()=>{h||f(!1),c==null||c()},[h,c]),C=g.useCallback(()=>{h||f(!0),s==null||s()},[h,s]),k=g.useCallback(()=>{p?S():C()},[p,C,S]);function w(I={}){return{...I,"aria-expanded":p,"aria-controls":x,onClick(P){var M;(M=I.onClick)==null||M.call(I,P),k()}}}function j(I={}){return{...I,hidden:!p,id:x}}return{isOpen:p,onOpen:C,onClose:S,onToggle:k,isControlled:h,getButtonProps:w,getDisclosureProps:j}}function lj(e){const{ref:t,handler:n,enabled:r=!0}=e,o=Wt(n),c=g.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;g.useEffect(()=>{if(!r)return;const u=y=>{Cd(y,t)&&(c.isPointerDown=!0)},f=y=>{if(c.ignoreEmulatedMouseEvents){c.ignoreEmulatedMouseEvents=!1;return}c.isPointerDown&&n&&Cd(y,t)&&(c.isPointerDown=!1,o(y))},p=y=>{c.ignoreEmulatedMouseEvents=!0,n&&c.isPointerDown&&Cd(y,t)&&(c.isPointerDown=!1,o(y))},h=Dy(t.current);return h.addEventListener("mousedown",u,!0),h.addEventListener("mouseup",f,!0),h.addEventListener("touchstart",u,!0),h.addEventListener("touchend",p,!0),()=>{h.removeEventListener("mousedown",u,!0),h.removeEventListener("mouseup",f,!0),h.removeEventListener("touchstart",u,!0),h.removeEventListener("touchend",p,!0)}},[n,t,o,c,r])}function Cd(e,t){var n;const r=e.target;return e.button>0||r&&!Dy(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function Dy(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Ay(e){const{isOpen:t,ref:n}=e,[r,o]=g.useState(t),[s,c]=g.useState(!1);return g.useEffect(()=>{s||(o(t),c(!0))},[t,s,r]),$o(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var f;const p=f6(n.current),h=new p.CustomEvent("animationend",{bubbles:!0});(f=n.current)==null||f.dispatchEvent(h)}}}function _h(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[cj,uj,dj,fj]=eh(),[hj,fs]=jt({strict:!1,name:"MenuContext"});function pj(e,...t){const n=g.useId(),r=e||n;return g.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function Oy(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function kg(e){return Oy(e).activeElement===e}function mj(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:c,isOpen:u,defaultIsOpen:f,onClose:p,onOpen:h,placement:y="bottom-start",lazyBehavior:x="unmount",direction:S,computePositionOnMount:C=!1,...k}=e,w=g.useRef(null),j=g.useRef(null),I=dj(),P=g.useCallback(()=>{requestAnimationFrame(()=>{var Ie;(Ie=w.current)==null||Ie.focus({preventScroll:!1})})},[]),M=g.useCallback(()=>{const Ie=setTimeout(()=>{var pe;if(o)(pe=o.current)==null||pe.focus();else{const ce=I.firstEnabled();ce&&U(ce.index)}});Z.current.add(Ie)},[I,o]),T=g.useCallback(()=>{const Ie=setTimeout(()=>{const pe=I.lastEnabled();pe&&U(pe.index)});Z.current.add(Ie)},[I]),D=g.useCallback(()=>{h==null||h(),s?M():P()},[s,M,P,h]),{isOpen:_,onOpen:R,onClose:V,onToggle:F}=Th({isOpen:u,defaultIsOpen:f,onClose:p,onOpen:D});lj({enabled:_&&r,ref:w,handler:Ie=>{var pe;(pe=j.current)!=null&&pe.contains(Ie.target)||V()}});const L=Mh({...k,enabled:_||C,placement:y,direction:S}),[Q,U]=g.useState(-1);ei(()=>{_||U(-1)},[_]),Cy(w,{focusRef:j,visible:_,shouldFocus:!0});const K=Ay({isOpen:_,ref:w}),[te,ne]=pj(t,"menu-button","menu-list"),$=g.useCallback(()=>{R(),P()},[R,P]),Z=g.useRef(new Set([]));Cj(()=>{Z.current.forEach(Ie=>clearTimeout(Ie)),Z.current.clear()});const oe=g.useCallback(()=>{R(),M()},[M,R]),le=g.useCallback(()=>{R(),T()},[R,T]),Re=g.useCallback(()=>{var Ie,pe;const ce=Oy(w.current),Fe=(Ie=w.current)==null?void 0:Ie.contains(ce.activeElement);if(!(_&&!Fe))return;const Ue=(pe=I.item(Q))==null?void 0:pe.node;Ue==null||Ue.focus()},[_,Q,I]),Ne=g.useRef(null);return{openAndFocusMenu:$,openAndFocusFirstItem:oe,openAndFocusLastItem:le,onTransitionEnd:Re,unstable__animationState:K,descendants:I,popper:L,buttonId:te,menuId:ne,forceUpdate:L.forceUpdate,orientation:"vertical",isOpen:_,onToggle:F,onOpen:R,onClose:V,menuRef:w,buttonRef:j,focusedIndex:Q,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:U,isLazy:c,lazyBehavior:x,initialFocusRef:o,rafId:Ne}}function vj(e={},t=null){const n=fs(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:c}=n,u=g.useCallback(f=>{const p=f.key,y={Enter:s,ArrowDown:s,ArrowUp:c}[p];y&&(f.preventDefault(),f.stopPropagation(),y(f))},[s,c]);return{...e,ref:ct(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":qe(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:Ee(e.onClick,r),onKeyDown:Ee(e.onKeyDown,u)}}function jf(e){var t;return bj(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function gj(e={},t=null){const n=fs();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:c,onClose:u,menuId:f,isLazy:p,lazyBehavior:h,unstable__animationState:y}=n,x=uj(),S=z6({preventDefault:j=>j.key!==" "&&jf(j.target)}),C=g.useCallback(j=>{const I=j.key,M={Tab:D=>D.preventDefault(),Escape:u,ArrowDown:()=>{const D=x.nextEnabled(r);D&&o(D.index)},ArrowUp:()=>{const D=x.prevEnabled(r);D&&o(D.index)}}[I];if(M){j.preventDefault(),M(j);return}const T=S(D=>{const _=R6(x.values(),D,R=>{var V,F;return(F=(V=R==null?void 0:R.node)==null?void 0:V.textContent)!=null?F:""},x.item(r));if(_){const R=x.indexOf(_.node);o(R)}});jf(j.target)&&T(j)},[x,r,S,u,o]),k=g.useRef(!1);c&&(k.current=!0);const w=_h({wasSelected:k.current,enabled:p,mode:h,isSelected:y.present});return{...e,ref:ct(s,t),children:w?e.children:null,tabIndex:-1,role:"menu",id:f,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:Ee(e.onKeyDown,C)}}function yj(e={}){const{popper:t,isOpen:n}=fs();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function xj(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:c,isDisabled:u,isFocusable:f,closeOnSelect:p,type:h,...y}=e,x=fs(),{setFocusedIndex:S,focusedIndex:C,closeOnSelect:k,onClose:w,menuRef:j,isOpen:I,menuId:P,rafId:M}=x,T=g.useRef(null),D=`${P}-menuitem-${g.useId()}`,{index:_,register:R}=fj({disabled:u&&!f}),V=g.useCallback($=>{n==null||n($),!u&&S(_)},[S,_,u,n]),F=g.useCallback($=>{r==null||r($),T.current&&!kg(T.current)&&V($)},[V,r]),L=g.useCallback($=>{o==null||o($),!u&&S(-1)},[S,u,o]),Q=g.useCallback($=>{s==null||s($),jf($.currentTarget)&&(p??k)&&w()},[w,s,k,p]),U=g.useCallback($=>{c==null||c($),S(_)},[S,c,_]),K=_===C,te=u&&!f;ei(()=>{I&&(K&&!te&&T.current?(M.current&&cancelAnimationFrame(M.current),M.current=requestAnimationFrame(()=>{var $;($=T.current)==null||$.focus(),M.current=null})):j.current&&!kg(j.current)&&j.current.focus())},[K,te,j,I]);const ne=Sy({onClick:Q,onFocus:U,onMouseEnter:V,onMouseMove:F,onMouseLeave:L,ref:ct(R,T,t),isDisabled:u,isFocusable:f});return{...y,...ne,type:h??ne.type,id:D,role:"menuitem",tabIndex:K?0:-1}}function bj(e){var t;if(!Sj(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function Sj(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Cj(e,t=[]){return g.useEffect(()=>()=>e(),t)}var[wj,Ec]=jt({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Dh=e=>{const{children:t}=e,n=un("Menu",e),r=At(e),{direction:o}=ea(),{descendants:s,...c}=mj({...r,direction:o}),u=g.useMemo(()=>c,[c]),{isOpen:f,onClose:p,forceUpdate:h}=u;return l.jsx(cj,{value:s,children:l.jsx(hj,{value:u,children:l.jsx(wj,{value:n,children:y1(t,{isOpen:f,onClose:p,forceUpdate:h})})})})};Dh.displayName="Menu";var zy=fe((e,t)=>{const n=Ec();return l.jsx(re.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});zy.displayName="MenuCommand";var kj=fe((e,t)=>{const{type:n,...r}=e,o=Ec(),s=r.as||n?n??void 0:"button",c=g.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 l.jsx(re.button,{ref:t,type:s,...r,__css:c})}),Ry=e=>{const{className:t,children:n,...r}=e,o=g.Children.only(n),s=g.isValidElement(o)?g.cloneElement(o,{focusable:"false","aria-hidden":!0,className:Ae("chakra-menu__icon",o.props.className)}):null,c=Ae("chakra-menu__icon-wrapper",t);return l.jsx(re.span,{className:c,...r,__css:{flexShrink:0},children:s})};Ry.displayName="MenuIcon";var vr=fe((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:c,...u}=e,f=xj(u,t),h=n||o?l.jsx("span",{style:{pointerEvents:"none",flex:1},children:c}):c;return l.jsxs(kj,{...f,className:Ae("chakra-menu__menuitem",f.className),children:[n&&l.jsx(Ry,{fontSize:"0.8em",marginEnd:r,children:n}),h,o&&l.jsx(zy,{marginStart:s,children:o})]})});vr.displayName="MenuItem";var jj={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"}}},Ej=re(ir.div),Ah=fe(function(t,n){var r,o;const{rootProps:s,motionProps:c,...u}=t,{isOpen:f,onTransitionEnd:p,unstable__animationState:h}=fs(),y=gj(u,n),x=yj(s),S=Ec();return l.jsx(re.div,{...x,__css:{zIndex:(o=t.zIndex)!=null?o:(r=S.list)==null?void 0:r.zIndex},children:l.jsx(Ej,{variants:jj,initial:!1,animate:f?"enter":"exit",__css:{outline:0,...S.list},...c,className:Ae("chakra-menu__menu-list",y.className),...y,onUpdate:p,onAnimationComplete:yc(h.onComplete,y.onAnimationComplete)})})});Ah.displayName="MenuList";var Pj=fe((e,t)=>{const n=Ec();return l.jsx(re.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Oh=fe((e,t)=>{const{children:n,as:r,...o}=e,s=vj(o,t),c=r||Pj;return l.jsx(c,{...s,className:Ae("chakra-menu__menu-button",e.className),children:l.jsx(re.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Oh.displayName="MenuButton";var Ij={slideInBottom:{...ff,custom:{offsetY:16,reverse:!0}},slideInRight:{...ff,custom:{offsetX:16,reverse:!0}},scale:{...g2,custom:{initialScale:.95,reverse:!0}},none:{}},Mj=re(ir.section),Tj=e=>Ij[e||"none"],Ny=g.forwardRef((e,t)=>{const{preset:n,motionProps:r=Tj(n),...o}=e;return l.jsx(Mj,{ref:t,...r,...o})});Ny.displayName="ModalTransition";var _j=Object.defineProperty,Dj=(e,t,n)=>t in e?_j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Aj=(e,t,n)=>(Dj(e,typeof t!="symbol"?t+"":t,n),n),Oj=class{constructor(){Aj(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}},Ef=new Oj;function Fy(e,t){const[n,r]=g.useState(0);return g.useEffect(()=>{const o=e.current;if(o){if(t){const s=Ef.add(o);r(s)}return()=>{Ef.remove(o),r(0)}}},[t,e]),n}var zj=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ji=new WeakMap,Sl=new WeakMap,Cl={},wd=0,Ly=function(e){return e&&(e.host||Ly(e.parentNode))},Rj=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Ly(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return Boolean(n)})},Nj=function(e,t,n,r){var o=Rj(t,Array.isArray(e)?e:[e]);Cl[n]||(Cl[n]=new WeakMap);var s=Cl[n],c=[],u=new Set,f=new Set(o),p=function(y){!y||u.has(y)||(u.add(y),p(y.parentNode))};o.forEach(p);var h=function(y){!y||f.has(y)||Array.prototype.forEach.call(y.children,function(x){if(u.has(x))h(x);else{var S=x.getAttribute(r),C=S!==null&&S!=="false",k=(ji.get(x)||0)+1,w=(s.get(x)||0)+1;ji.set(x,k),s.set(x,w),c.push(x),k===1&&C&&Sl.set(x,!0),w===1&&x.setAttribute(n,"true"),C||x.setAttribute(r,"true")}})};return h(t),u.clear(),wd++,function(){c.forEach(function(y){var x=ji.get(y)-1,S=s.get(y)-1;ji.set(y,x),s.set(y,S),x||(Sl.has(y)||y.removeAttribute(r),Sl.delete(y)),S||y.removeAttribute(n)}),wd--,wd||(ji=new WeakMap,ji=new WeakMap,Sl=new WeakMap,Cl={})}},Fj=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||zj(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),Nj(r,o,n,"aria-hidden")):function(){return null}};function Lj(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:c=!0,onOverlayClick:u,onEsc:f}=e,p=g.useRef(null),h=g.useRef(null),[y,x,S]=Hj(r,"chakra-modal","chakra-modal--header","chakra-modal--body");Bj(p,t&&c),Fy(p,t);const C=g.useRef(null),k=g.useCallback(R=>{C.current=R.target},[]),w=g.useCallback(R=>{R.key==="Escape"&&(R.stopPropagation(),s&&(n==null||n()),f==null||f())},[s,n,f]),[j,I]=g.useState(!1),[P,M]=g.useState(!1),T=g.useCallback((R={},V=null)=>({role:"dialog",...R,ref:ct(V,p),id:y,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?x:void 0,"aria-describedby":P?S:void 0,onClick:Ee(R.onClick,F=>F.stopPropagation())}),[S,P,y,x,j]),D=g.useCallback(R=>{R.stopPropagation(),C.current===R.target&&Ef.isTopModal(p.current)&&(o&&(n==null||n()),u==null||u())},[n,o,u]),_=g.useCallback((R={},V=null)=>({...R,ref:ct(V,h),onClick:Ee(R.onClick,D),onKeyDown:Ee(R.onKeyDown,w),onMouseDown:Ee(R.onMouseDown,k)}),[w,k,D]);return{isOpen:t,onClose:n,headerId:x,bodyId:S,setBodyMounted:M,setHeaderMounted:I,dialogRef:p,overlayRef:h,getDialogProps:T,getDialogContainerProps:_}}function Bj(e,t){const n=e.current;g.useEffect(()=>{if(!(!e.current||!t))return Fj(e.current)},[t,e,n])}function Hj(e,...t){const n=g.useId(),r=e||n;return g.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[Wj,oa]=jt({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Vj,Qo]=jt({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),po=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:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:y,motionPreset:x,lockFocusAcrossFrames:S,onCloseComplete:C}=t,k=un("Modal",t),j={...Lj(t),autoFocus:o,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:p,allowPinchZoom:h,preserveScrollBarGap:y,motionPreset:x,lockFocusAcrossFrames:S};return l.jsx(Vj,{value:j,children:l.jsx(Wj,{value:k,children:l.jsx(yo,{onExitComplete:C,children:j.isOpen&&l.jsx(Ua,{...n,children:r})})})})};po.displayName="Modal";var Vl="right-scroll-bar-position",Ul="width-before-scroll-bar",Uj="with-scroll-bars-hidden",$j="--removed-body-scroll-bar-size",By=O2(),kd=function(){},Pc=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:kd,onWheelCapture:kd,onTouchMoveCapture:kd}),o=r[0],s=r[1],c=e.forwardProps,u=e.children,f=e.className,p=e.removeScrollBar,h=e.enabled,y=e.shards,x=e.sideCar,S=e.noIsolation,C=e.inert,k=e.allowPinchZoom,w=e.as,j=w===void 0?"div":w,I=_2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),P=x,M=T2([n,t]),T=yr(yr({},I),o);return g.createElement(g.Fragment,null,h&&g.createElement(P,{sideCar:By,removeScrollBar:p,shards:y,noIsolation:S,inert:C,setCallbacks:s,allowPinchZoom:!!k,lockRef:n}),c?g.cloneElement(g.Children.only(u),yr(yr({},T),{ref:M})):g.createElement(j,yr({},T,{className:f,ref:M}),u))});Pc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Pc.classNames={fullWidth:Ul,zeroRight:Vl};var jg,Gj=function(){if(jg)return jg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qj(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Gj();return t&&e.setAttribute("nonce",t),e}function Yj(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Kj(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Xj=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qj())&&(Yj(t,n),Kj(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Qj=function(){var e=Xj();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Hy=function(){var e=Qj(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Zj={left:0,top:0,right:0,gap:0},jd=function(e){return parseInt(e||"",10)||0},Jj=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[jd(n),jd(r),jd(o)]},e7=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Zj;var t=Jj(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])}},t7=Hy(),n7=function(e,t,n,r){var o=e.left,s=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),` + .`.concat(Uj,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(u,"px ").concat(r,`; + } + body { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(o,`px; + padding-top: `).concat(s,`px; + padding-right: `).concat(c,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(u,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(Vl,` { + right: `).concat(u,"px ").concat(r,`; + } + + .`).concat(Ul,` { + margin-right: `).concat(u,"px ").concat(r,`; + } + + .`).concat(Vl," .").concat(Vl,` { + right: 0 `).concat(r,`; + } + + .`).concat(Ul," .").concat(Ul,` { + margin-right: 0 `).concat(r,`; + } + + body { + `).concat($j,": ").concat(u,`px; + } +`)},r7=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=g.useMemo(function(){return e7(o)},[o]);return g.createElement(t7,{styles:n7(s,!t,o,n?"":"!important")})},Pf=!1;if(typeof window<"u")try{var wl=Object.defineProperty({},"passive",{get:function(){return Pf=!0,!0}});window.addEventListener("test",wl,wl),window.removeEventListener("test",wl,wl)}catch{Pf=!1}var Ei=Pf?{passive:!1}:!1,o7=function(e){return e.tagName==="TEXTAREA"},Wy=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!o7(e)&&n[t]==="visible")},i7=function(e){return Wy(e,"overflowY")},a7=function(e){return Wy(e,"overflowX")},Eg=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=Vy(e,n);if(r){var o=Uy(e,n),s=o[1],c=o[2];if(s>c)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},s7=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},l7=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Vy=function(e,t){return e==="v"?i7(t):a7(t)},Uy=function(e,t){return e==="v"?s7(t):l7(t)},c7=function(e,t){return e==="h"&&t==="rtl"?-1:1},u7=function(e,t,n,r,o){var s=c7(e,window.getComputedStyle(t).direction),c=s*r,u=n.target,f=t.contains(u),p=!1,h=c>0,y=0,x=0;do{var S=Uy(e,u),C=S[0],k=S[1],w=S[2],j=k-w-s*C;(C||j)&&Vy(e,u)&&(y+=j,x+=C),u=u.parentNode}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(h&&(o&&y===0||!o&&c>y)||!h&&(o&&x===0||!o&&-c>x))&&(p=!0),p},kl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Pg=function(e){return[e.deltaX,e.deltaY]},Ig=function(e){return e&&"current"in e?e.current:e},d7=function(e,t){return e[0]===t[0]&&e[1]===t[1]},f7=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},h7=0,Pi=[];function p7(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),o=g.useState(h7++)[0],s=g.useState(function(){return Hy()})[0],c=g.useRef(e);g.useEffect(function(){c.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var k=xf([e.lockRef.current],(e.shards||[]).map(Ig),!0).filter(Boolean);return k.forEach(function(w){return w.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),k.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var u=g.useCallback(function(k,w){if("touches"in k&&k.touches.length===2)return!c.current.allowPinchZoom;var j=kl(k),I=n.current,P="deltaX"in k?k.deltaX:I[0]-j[0],M="deltaY"in k?k.deltaY:I[1]-j[1],T,D=k.target,_=Math.abs(P)>Math.abs(M)?"h":"v";if("touches"in k&&_==="h"&&D.type==="range")return!1;var R=Eg(_,D);if(!R)return!0;if(R?T=_:(T=_==="v"?"h":"v",R=Eg(_,D)),!R)return!1;if(!r.current&&"changedTouches"in k&&(P||M)&&(r.current=T),!T)return!0;var V=r.current||T;return u7(V,w,k,V==="h"?P:M,!0)},[]),f=g.useCallback(function(k){var w=k;if(!(!Pi.length||Pi[Pi.length-1]!==s)){var j="deltaY"in w?Pg(w):kl(w),I=t.current.filter(function(T){return T.name===w.type&&T.target===w.target&&d7(T.delta,j)})[0];if(I&&I.should){w.cancelable&&w.preventDefault();return}if(!I){var P=(c.current.shards||[]).map(Ig).filter(Boolean).filter(function(T){return T.contains(w.target)}),M=P.length>0?u(w,P[0]):!c.current.noIsolation;M&&w.cancelable&&w.preventDefault()}}},[]),p=g.useCallback(function(k,w,j,I){var P={name:k,delta:w,target:j,should:I};t.current.push(P),setTimeout(function(){t.current=t.current.filter(function(M){return M!==P})},1)},[]),h=g.useCallback(function(k){n.current=kl(k),r.current=void 0},[]),y=g.useCallback(function(k){p(k.type,Pg(k),k.target,u(k,e.lockRef.current))},[]),x=g.useCallback(function(k){p(k.type,kl(k),k.target,u(k,e.lockRef.current))},[]);g.useEffect(function(){return Pi.push(s),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:x}),document.addEventListener("wheel",f,Ei),document.addEventListener("touchmove",f,Ei),document.addEventListener("touchstart",h,Ei),function(){Pi=Pi.filter(function(k){return k!==s}),document.removeEventListener("wheel",f,Ei),document.removeEventListener("touchmove",f,Ei),document.removeEventListener("touchstart",h,Ei)}},[]);var S=e.removeScrollBar,C=e.inert;return g.createElement(g.Fragment,null,C?g.createElement(s,{styles:f7(o)}):null,S?g.createElement(r7,{gapMode:"margin"}):null)}const m7=m5(By,p7);var $y=g.forwardRef(function(e,t){return g.createElement(Pc,yr({},e,{ref:t,sideCar:m7}))});$y.classNames=Pc.classNames;const v7=$y;function g7(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:c,finalFocusRef:u,returnFocusOnClose:f,preserveScrollBarGap:p,lockFocusAcrossFrames:h,isOpen:y}=Qo(),[x,S]=SC();g.useEffect(()=>{!x&&S&&setTimeout(S)},[x,S]);const C=Fy(r,y);return l.jsx(fy,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:u,restoreFocus:f,contentRef:r,lockFocusAcrossFrames:h,children:l.jsx(v7,{removeScrollBar:!p,allowPinchZoom:c,enabled:C===1&&s,forwardProps:!0,children:e.children})})}var mo=fe((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...c}=e,{getDialogProps:u,getDialogContainerProps:f}=Qo(),p=u(c,t),h=f(o),y=Ae("chakra-modal__content",n),x=oa(),S={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...x.dialog},C={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...x.dialogContainer},{motionPreset:k}=Qo();return l.jsx(g7,{children:l.jsx(re.div,{...h,className:"chakra-modal__content-container",tabIndex:-1,__css:C,children:l.jsx(Ny,{preset:k,motionProps:s,className:y,...p,__css:S,children:r})})})});mo.displayName="ModalContent";function Gy(e){const{leastDestructiveRef:t,...n}=e;return l.jsx(po,{...n,initialFocusRef:t})}var qy=fe((e,t)=>l.jsx(mo,{ref:t,role:"alertdialog",...e})),Fr=fe((e,t)=>{const{className:n,...r}=e,o=Ae("chakra-modal__footer",n),c={display:"flex",alignItems:"center",justifyContent:"flex-end",...oa().footer};return l.jsx(re.footer,{ref:t,...r,__css:c,className:o})});Fr.displayName="ModalFooter";var Lr=fe((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=Qo();g.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__header",n),f={flex:0,...oa().header};return l.jsx(re.header,{ref:t,className:c,id:o,...r,__css:f})});Lr.displayName="ModalHeader";var y7=re(ir.div),Br=fe((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,c=Ae("chakra-modal__overlay",n),f={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...oa().overlay},{motionPreset:p}=Qo(),y=o||(p==="none"?{}:v2);return l.jsx(y7,{...y,__css:f,ref:t,className:c,...s})});Br.displayName="ModalOverlay";var Hr=fe((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=Qo();g.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__body",n),u=oa();return l.jsx(re.div,{ref:t,className:c,id:o,...r,__css:u.body})});Hr.displayName="ModalBody";var ia=fe((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=Qo(),c=Ae("chakra-modal__close-btn",r),u=oa();return l.jsx(CC,{ref:t,__css:u.closeButton,className:c,onClick:Ee(n,f=>{f.stopPropagation(),s()}),...o})});ia.displayName="ModalCloseButton";var x7=e=>l.jsx(tn,{viewBox:"0 0 24 24",...e,children:l.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"})}),b7=e=>l.jsx(tn,{viewBox:"0 0 24 24",...e,children:l.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 Mg(e,t,n,r){g.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,c=Array.isArray(t)?t:[t],u=new s.MutationObserver(f=>{for(const p of f)p.type==="attributes"&&p.attributeName&&c.includes(p.attributeName)&&n(p)});return u.observe(e.current,{attributes:!0,attributeFilter:c}),()=>u.disconnect()})}function S7(e,t){const n=Wt(e);g.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var C7=50,Tg=300;function w7(e,t){const[n,r]=g.useState(!1),[o,s]=g.useState(null),[c,u]=g.useState(!0),f=g.useRef(null),p=()=>clearTimeout(f.current);S7(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?C7:null);const h=g.useCallback(()=>{c&&e(),f.current=setTimeout(()=>{u(!1),r(!0),s("increment")},Tg)},[e,c]),y=g.useCallback(()=>{c&&t(),f.current=setTimeout(()=>{u(!1),r(!0),s("decrement")},Tg)},[t,c]),x=g.useCallback(()=>{u(!0),r(!1),p()},[]);return g.useEffect(()=>()=>p(),[]),{up:h,down:y,stop:x,isSpinning:n}}var k7=/^[Ee0-9+\-.]$/;function j7(e){return k7.test(e)}function E7(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 P7(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:c=1,isReadOnly:u,isDisabled:f,isRequired:p,isInvalid:h,pattern:y="[0-9]*(.[0-9]+)?",inputMode:x="decimal",allowMouseWheel:S,id:C,onChange:k,precision:w,name:j,"aria-describedby":I,"aria-label":P,"aria-labelledby":M,onFocus:T,onBlur:D,onInvalid:_,getAriaValueText:R,isValidCharacter:V,format:F,parse:L,...Q}=e,U=Wt(T),K=Wt(D),te=Wt(_),ne=Wt(V??j7),$=Wt(R),Z=Qw(e),{update:oe,increment:le,decrement:Re}=Z,[Ne,Ie]=g.useState(!1),pe=!(u||f),ce=g.useRef(null),Fe=g.useRef(null),Ve=g.useRef(null),Ue=g.useRef(null),$e=g.useCallback(J=>J.split("").filter(ne).join(""),[ne]),Qe=g.useCallback(J=>{var Le;return(Le=L==null?void 0:L(J))!=null?Le:J},[L]),ge=g.useCallback(J=>{var Le;return((Le=F==null?void 0:F(J))!=null?Le:J).toString()},[F]);ei(()=>{(Z.valueAsNumber>s||Z.valueAsNumber{if(!ce.current)return;if(ce.current.value!=Z.value){const Le=Qe(ce.current.value);Z.setValue($e(Le))}},[Qe,$e]);const Te=g.useCallback((J=c)=>{pe&&le(J)},[le,pe,c]),Ge=g.useCallback((J=c)=>{pe&&Re(J)},[Re,pe,c]),ye=w7(Te,Ge);Mg(Ve,"disabled",ye.stop,ye.isSpinning),Mg(Ue,"disabled",ye.stop,ye.isSpinning);const Pe=g.useCallback(J=>{if(J.nativeEvent.isComposing)return;const nt=Qe(J.currentTarget.value);oe($e(nt)),Fe.current={start:J.currentTarget.selectionStart,end:J.currentTarget.selectionEnd}},[oe,$e,Qe]),et=g.useCallback(J=>{var Le,nt,Nt;U==null||U(J),Fe.current&&(J.target.selectionStart=(nt=Fe.current.start)!=null?nt:(Le=J.currentTarget.value)==null?void 0:Le.length,J.currentTarget.selectionEnd=(Nt=Fe.current.end)!=null?Nt:J.currentTarget.selectionStart)},[U]),Be=g.useCallback(J=>{if(J.nativeEvent.isComposing)return;E7(J,ne)||J.preventDefault();const Le=vt(J)*c,nt=J.key,he={ArrowUp:()=>Te(Le),ArrowDown:()=>Ge(Le),Home:()=>oe(o),End:()=>oe(s)}[nt];he&&(J.preventDefault(),he(J))},[ne,c,Te,Ge,oe,o,s]),vt=J=>{let Le=1;return(J.metaKey||J.ctrlKey)&&(Le=.1),J.shiftKey&&(Le=10),Le},Rt=g.useMemo(()=>{const J=$==null?void 0:$(Z.value);if(J!=null)return J;const Le=Z.value.toString();return Le||void 0},[Z.value,$]),N=g.useCallback(()=>{let J=Z.value;if(Z.value==="")return;/^[eE]/.test(Z.value.toString())?Z.setValue(""):(Z.valueAsNumbers&&(J=s),Z.cast(J))},[Z,s,o]),ue=g.useCallback(()=>{Ie(!1),n&&N()},[n,Ie,N]),xe=g.useCallback(()=>{t&&requestAnimationFrame(()=>{var J;(J=ce.current)==null||J.focus()})},[t]),ke=g.useCallback(J=>{J.preventDefault(),ye.up(),xe()},[xe,ye]),q=g.useCallback(J=>{J.preventDefault(),ye.down(),xe()},[xe,ye]);$o(()=>ce.current,"wheel",J=>{var Le,nt;const he=((nt=(Le=ce.current)==null?void 0:Le.ownerDocument)!=null?nt:document).activeElement===ce.current;if(!S||!he)return;J.preventDefault();const _e=vt(J)*c,dn=Math.sign(J.deltaY);dn===-1?Te(_e):dn===1&&Ge(_e)},{passive:!1});const ae=g.useCallback((J={},Le=null)=>{const nt=f||r&&Z.isAtMax;return{...J,ref:ct(Le,Ve),role:"button",tabIndex:-1,onPointerDown:Ee(J.onPointerDown,Nt=>{Nt.button!==0||nt||ke(Nt)}),onPointerLeave:Ee(J.onPointerLeave,ye.stop),onPointerUp:Ee(J.onPointerUp,ye.stop),disabled:nt,"aria-disabled":Rr(nt)}},[Z.isAtMax,r,ke,ye.stop,f]),Oe=g.useCallback((J={},Le=null)=>{const nt=f||r&&Z.isAtMin;return{...J,ref:ct(Le,Ue),role:"button",tabIndex:-1,onPointerDown:Ee(J.onPointerDown,Nt=>{Nt.button!==0||nt||q(Nt)}),onPointerLeave:Ee(J.onPointerLeave,ye.stop),onPointerUp:Ee(J.onPointerUp,ye.stop),disabled:nt,"aria-disabled":Rr(nt)}},[Z.isAtMin,r,q,ye.stop,f]),Ze=g.useCallback((J={},Le=null)=>{var nt,Nt,he,_e;return{name:j,inputMode:x,type:"text",pattern:y,"aria-labelledby":M,"aria-label":P,"aria-describedby":I,id:C,disabled:f,...J,readOnly:(nt=J.readOnly)!=null?nt:u,"aria-readonly":(Nt=J.readOnly)!=null?Nt:u,"aria-required":(he=J.required)!=null?he:p,required:(_e=J.required)!=null?_e:p,ref:ct(ce,Le),value:ge(Z.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(Z.valueAsNumber)?void 0:Z.valueAsNumber,"aria-invalid":Rr(h??Z.isOutOfRange),"aria-valuetext":Rt,autoComplete:"off",autoCorrect:"off",onChange:Ee(J.onChange,Pe),onKeyDown:Ee(J.onKeyDown,Be),onFocus:Ee(J.onFocus,et,()=>Ie(!0)),onBlur:Ee(J.onBlur,K,ue)}},[j,x,y,M,P,ge,I,C,f,p,u,h,Z.value,Z.valueAsNumber,Z.isOutOfRange,o,s,Rt,Pe,Be,et,K,ue]);return{value:ge(Z.value),valueAsNumber:Z.valueAsNumber,isFocused:Ne,isDisabled:f,isReadOnly:u,getIncrementButtonProps:ae,getDecrementButtonProps:Oe,getInputProps:Ze,htmlProps:Q}}var[I7,Ic]=jt({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[M7,zh]=jt({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Rh=fe(function(t,n){const r=un("NumberInput",t),o=At(t),s=sh(o),{htmlProps:c,...u}=P7(s),f=g.useMemo(()=>u,[u]);return l.jsx(M7,{value:f,children:l.jsx(I7,{value:r,children:l.jsx(re.div,{...c,ref:n,className:Ae("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Rh.displayName="NumberInput";var Nh=fe(function(t,n){const r=Ic();return l.jsx(re.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}})});Nh.displayName="NumberInputStepper";var Fh=fe(function(t,n){const{getInputProps:r}=zh(),o=r(t,n),s=Ic();return l.jsx(re.input,{...o,className:Ae("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});Fh.displayName="NumberInputField";var Yy=re("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Lh=fe(function(t,n){var r;const o=Ic(),{getDecrementButtonProps:s}=zh(),c=s(t,n);return l.jsx(Yy,{...c,__css:o.stepper,children:(r=t.children)!=null?r:l.jsx(x7,{})})});Lh.displayName="NumberDecrementStepper";var Bh=fe(function(t,n){var r;const{getIncrementButtonProps:o}=zh(),s=o(t,n),c=Ic();return l.jsx(Yy,{...s,__css:c.stepper,children:(r=t.children)!=null?r:l.jsx(b7,{})})});Bh.displayName="NumberIncrementStepper";var[T7,hs]=jt({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[_7,Hh]=jt({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Wh(e){const t=g.Children.only(e.children),{getTriggerProps:n}=hs();return g.cloneElement(t,n(t.props,t.ref))}Wh.displayName="PopoverTrigger";var Ii={click:"click",hover:"hover"};function D7(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:c=!0,arrowSize:u,arrowShadowColor:f,trigger:p=Ii.click,openDelay:h=200,closeDelay:y=200,isLazy:x,lazyBehavior:S="unmount",computePositionOnMount:C,...k}=e,{isOpen:w,onClose:j,onOpen:I,onToggle:P}=Th(e),M=g.useRef(null),T=g.useRef(null),D=g.useRef(null),_=g.useRef(!1),R=g.useRef(!1);w&&(R.current=!0);const[V,F]=g.useState(!1),[L,Q]=g.useState(!1),U=g.useId(),K=o??U,[te,ne,$,Z]=["popover-trigger","popover-content","popover-header","popover-body"].map(Pe=>`${Pe}-${K}`),{referenceRef:oe,getArrowProps:le,getPopperProps:Re,getArrowInnerProps:Ne,forceUpdate:Ie}=Mh({...k,enabled:w||!!C}),pe=Ay({isOpen:w,ref:D});o5({enabled:w,ref:T}),Cy(D,{focusRef:T,visible:w,shouldFocus:s&&p===Ii.click}),B6(D,{focusRef:r,visible:w,shouldFocus:c&&p===Ii.click});const ce=_h({wasSelected:R.current,enabled:x,mode:S,isSelected:pe.present}),Fe=g.useCallback((Pe={},et=null)=>{const Be={...Pe,style:{...Pe.style,transformOrigin:Ht.transformOrigin.varRef,[Ht.arrowSize.var]:u?`${u}px`:void 0,[Ht.arrowShadowColor.var]:f},ref:ct(D,et),children:ce?Pe.children:null,id:ne,tabIndex:-1,role:"dialog",onKeyDown:Ee(Pe.onKeyDown,vt=>{n&&vt.key==="Escape"&&j()}),onBlur:Ee(Pe.onBlur,vt=>{const Rt=_g(vt),N=Ed(D.current,Rt),ue=Ed(T.current,Rt);w&&t&&(!N&&!ue)&&j()}),"aria-labelledby":V?$:void 0,"aria-describedby":L?Z:void 0};return p===Ii.hover&&(Be.role="tooltip",Be.onMouseEnter=Ee(Pe.onMouseEnter,()=>{_.current=!0}),Be.onMouseLeave=Ee(Pe.onMouseLeave,vt=>{vt.nativeEvent.relatedTarget!==null&&(_.current=!1,setTimeout(()=>j(),y))})),Be},[ce,ne,V,$,L,Z,p,n,j,w,t,y,f,u]),Ve=g.useCallback((Pe={},et=null)=>Re({...Pe,style:{visibility:w?"visible":"hidden",...Pe.style}},et),[w,Re]),Ue=g.useCallback((Pe,et=null)=>({...Pe,ref:ct(et,M,oe)}),[M,oe]),$e=g.useRef(),Qe=g.useRef(),ge=g.useCallback(Pe=>{M.current==null&&oe(Pe)},[oe]),Te=g.useCallback((Pe={},et=null)=>{const Be={...Pe,ref:ct(T,et,ge),id:te,"aria-haspopup":"dialog","aria-expanded":w,"aria-controls":ne};return p===Ii.click&&(Be.onClick=Ee(Pe.onClick,P)),p===Ii.hover&&(Be.onFocus=Ee(Pe.onFocus,()=>{$e.current===void 0&&I()}),Be.onBlur=Ee(Pe.onBlur,vt=>{const Rt=_g(vt),N=!Ed(D.current,Rt);w&&t&&N&&j()}),Be.onKeyDown=Ee(Pe.onKeyDown,vt=>{vt.key==="Escape"&&j()}),Be.onMouseEnter=Ee(Pe.onMouseEnter,()=>{_.current=!0,$e.current=window.setTimeout(()=>I(),h)}),Be.onMouseLeave=Ee(Pe.onMouseLeave,()=>{_.current=!1,$e.current&&(clearTimeout($e.current),$e.current=void 0),Qe.current=window.setTimeout(()=>{_.current===!1&&j()},y)})),Be},[te,w,ne,p,ge,P,I,t,j,h,y]);g.useEffect(()=>()=>{$e.current&&clearTimeout($e.current),Qe.current&&clearTimeout(Qe.current)},[]);const Ge=g.useCallback((Pe={},et=null)=>({...Pe,id:$,ref:ct(et,Be=>{F(!!Be)})}),[$]),ye=g.useCallback((Pe={},et=null)=>({...Pe,id:Z,ref:ct(et,Be=>{Q(!!Be)})}),[Z]);return{forceUpdate:Ie,isOpen:w,onAnimationComplete:pe.onComplete,onClose:j,getAnchorProps:Ue,getArrowProps:le,getArrowInnerProps:Ne,getPopoverPositionerProps:Ve,getPopoverProps:Fe,getTriggerProps:Te,getHeaderProps:Ge,getBodyProps:ye}}function Ed(e,t){return e===t||(e==null?void 0:e.contains(t))}function _g(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Vh(e){const t=un("Popover",e),{children:n,...r}=At(e),o=ea(),s=D7({...r,direction:o.direction});return l.jsx(T7,{value:s,children:l.jsx(_7,{value:t,children:y1(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Vh.displayName="Popover";function Uh(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:c}=e,{getArrowProps:u,getArrowInnerProps:f}=hs(),p=Hh(),h=(t=n??r)!=null?t:o,y=s??c;return l.jsx(re.div,{...u(),className:"chakra-popover__arrow-positioner",children:l.jsx(re.div,{className:Ae("chakra-popover__arrow",e.className),...f(e),__css:{"--popper-arrow-bg":h?`colors.${h}, ${h}`:void 0,"--popper-arrow-shadow":y?`shadows.${y}, ${y}`:void 0,...p.arrow}})})}Uh.displayName="PopoverArrow";var Ky=fe(function(t,n){const{getBodyProps:r}=hs(),o=Hh();return l.jsx(re.div,{...r(t,n),className:Ae("chakra-popover__body",t.className),__css:o.body})});Ky.displayName="PopoverBody";function A7(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var O7={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]}}},z7=re(ir.section),Xy=fe(function(t,n){const{variants:r=O7,...o}=t,{isOpen:s}=hs();return l.jsx(z7,{ref:n,variants:A7(r),initial:!1,animate:s?"enter":"exit",...o})});Xy.displayName="PopoverTransition";var $h=fe(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:c,getPopoverPositionerProps:u,onAnimationComplete:f}=hs(),p=Hh(),h={position:"relative",display:"flex",flexDirection:"column",...p.content};return l.jsx(re.div,{...u(r),__css:p.popper,className:"chakra-popover__popper",children:l.jsx(Xy,{...o,...c(s,n),onAnimationComplete:yc(f,s.onAnimationComplete),className:Ae("chakra-popover__content",t.className),__css:h})})});$h.displayName="PopoverContent";function R7(e,t,n){return(e-t)*100/(n-t)}Jo({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});Jo({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var N7=Jo({"0%":{left:"-40%"},"100%":{left:"100%"}}),F7=Jo({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function L7(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:c,role:u="progressbar"}=e,f=R7(t,n,r);return{bind:{"data-indeterminate":c?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":c?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,f):o})(),role:u},percent:f,value:t}}var[B7,H7]=jt({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),W7=fe((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:c,...u}=e,f=L7({value:o,min:n,max:r,isIndeterminate:s,role:c}),h={height:"100%",...H7().filledTrack};return l.jsx(re.div,{ref:t,style:{width:`${f.percent}%`,...u.style},...f.bind,...u,__css:h})}),Qy=fe((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:c,isAnimated:u,children:f,borderRadius:p,isIndeterminate:h,"aria-label":y,"aria-labelledby":x,"aria-valuetext":S,title:C,role:k,...w}=At(e),j=un("Progress",e),I=p??((n=j.track)==null?void 0:n.borderRadius),P={animation:`${F7} 1s linear infinite`},D={...!h&&c&&u&&P,...h&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${N7} 1s ease infinite normal none running`}},_={overflow:"hidden",position:"relative",...j.track};return l.jsx(re.div,{ref:t,borderRadius:I,__css:_,...w,children:l.jsxs(B7,{value:j,children:[l.jsx(W7,{"aria-label":y,"aria-labelledby":x,"aria-valuetext":S,min:o,max:s,value:r,isIndeterminate:h,css:D,borderRadius:I,title:C,role:k}),f]})})});Qy.displayName="Progress";function V7(e){return e&&Kd(e)&&Kd(e.target)}function U7(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:c,isNative:u,...f}=e,[p,h]=g.useState(r||""),y=typeof n<"u",x=y?n:p,S=g.useRef(null),C=g.useCallback(()=>{const T=S.current;if(!T)return;let D="input:not(:disabled):checked";const _=T.querySelector(D);if(_){_.focus();return}D="input:not(:disabled)";const R=T.querySelector(D);R==null||R.focus()},[]),w=`radio-${g.useId()}`,j=o||w,I=g.useCallback(T=>{const D=V7(T)?T.target.value:T;y||h(D),t==null||t(String(D))},[t,y]),P=g.useCallback((T={},D=null)=>({...T,ref:ct(D,S),role:"radiogroup"}),[]),M=g.useCallback((T={},D=null)=>({...T,ref:D,name:j,[u?"checked":"isChecked"]:x!=null?T.value===x:void 0,onChange(R){I(R)},"data-radiogroup":!0}),[u,j,I,x]);return{getRootProps:P,getRadioProps:M,name:j,ref:S,focus:C,setValue:h,value:x,onChange:I,isDisabled:s,isFocusable:c,htmlProps:f}}var[$7,Zy]=jt({name:"RadioGroupContext",strict:!1}),Xa=fe((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:c,isDisabled:u,isFocusable:f,...p}=e,{value:h,onChange:y,getRootProps:x,name:S,htmlProps:C}=U7(p),k=g.useMemo(()=>({name:S,size:r,onChange:y,colorScheme:n,value:h,variant:o,isDisabled:u,isFocusable:f}),[S,r,y,n,h,o,u,f]);return l.jsx($7,{value:k,children:l.jsx(re.div,{...x(C,t),className:Ae("chakra-radio-group",c),children:s})})});Xa.displayName="RadioGroup";var G7={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function q7(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:c,onChange:u,isInvalid:f,name:p,value:h,id:y,"data-radiogroup":x,"aria-describedby":S,...C}=e,k=`radio-${g.useId()}`,w=ni(),I=!!Zy()||!!x;let M=!!w&&!I?w.id:k;M=y??M;const T=o??(w==null?void 0:w.isDisabled),D=s??(w==null?void 0:w.isReadOnly),_=c??(w==null?void 0:w.isRequired),R=f??(w==null?void 0:w.isInvalid),[V,F]=g.useState(!1),[L,Q]=g.useState(!1),[U,K]=g.useState(!1),[te,ne]=g.useState(!1),[$,Z]=g.useState(Boolean(t)),oe=typeof n<"u",le=oe?n:$;g.useEffect(()=>C2(F),[]);const Re=g.useCallback(ge=>{if(D||T){ge.preventDefault();return}oe||Z(ge.target.checked),u==null||u(ge)},[oe,T,D,u]),Ne=g.useCallback(ge=>{ge.key===" "&&ne(!0)},[ne]),Ie=g.useCallback(ge=>{ge.key===" "&&ne(!1)},[ne]),pe=g.useCallback((ge={},Te=null)=>({...ge,ref:Te,"data-active":qe(te),"data-hover":qe(U),"data-disabled":qe(T),"data-invalid":qe(R),"data-checked":qe(le),"data-focus":qe(L),"data-focus-visible":qe(L&&V),"data-readonly":qe(D),"aria-hidden":!0,onMouseDown:Ee(ge.onMouseDown,()=>ne(!0)),onMouseUp:Ee(ge.onMouseUp,()=>ne(!1)),onMouseEnter:Ee(ge.onMouseEnter,()=>K(!0)),onMouseLeave:Ee(ge.onMouseLeave,()=>K(!1))}),[te,U,T,R,le,L,D,V]),{onFocus:ce,onBlur:Fe}=w??{},Ve=g.useCallback((ge={},Te=null)=>{const Ge=T&&!r;return{...ge,id:M,ref:Te,type:"radio",name:p,value:h,onChange:Ee(ge.onChange,Re),onBlur:Ee(Fe,ge.onBlur,()=>Q(!1)),onFocus:Ee(ce,ge.onFocus,()=>Q(!0)),onKeyDown:Ee(ge.onKeyDown,Ne),onKeyUp:Ee(ge.onKeyUp,Ie),checked:le,disabled:Ge,readOnly:D,required:_,"aria-invalid":Rr(R),"aria-disabled":Rr(Ge),"aria-required":Rr(_),"data-readonly":qe(D),"aria-describedby":S,style:G7}},[T,r,M,p,h,Re,Fe,ce,Ne,Ie,le,D,_,R,S]);return{state:{isInvalid:R,isFocused:L,isChecked:le,isActive:te,isHovered:U,isDisabled:T,isReadOnly:D,isRequired:_},getCheckboxProps:pe,getInputProps:Ve,getLabelProps:(ge={},Te=null)=>({...ge,ref:Te,onMouseDown:Ee(ge.onMouseDown,Dg),onTouchStart:Ee(ge.onTouchStart,Dg),"data-disabled":qe(T),"data-checked":qe(le),"data-invalid":qe(R)}),getRootProps:(ge,Te=null)=>({...ge,ref:Te,"data-disabled":qe(T),"data-checked":qe(le),"data-invalid":qe(R)}),htmlProps:C}}function Dg(e){e.preventDefault(),e.stopPropagation()}function Y7(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 vn=fe((e,t)=>{var n;const r=Zy(),{onChange:o,value:s}=e,c=un("Radio",{...r,...e}),u=At(e),{spacing:f="0.5rem",children:p,isDisabled:h=r==null?void 0:r.isDisabled,isFocusable:y=r==null?void 0:r.isFocusable,inputProps:x,...S}=u;let C=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(C=r.value===s);let k=o;r!=null&&r.onChange&&s!=null&&(k=yc(r.onChange,o));const w=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:j,getCheckboxProps:I,getLabelProps:P,getRootProps:M,htmlProps:T}=q7({...S,isChecked:C,isFocusable:y,isDisabled:h,onChange:k,name:w}),[D,_]=Y7(T,x1),R=I(_),V=j(x,t),F=P(),L=Object.assign({},D,M()),Q={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...c.container},U={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...c.control},K={userSelect:"none",marginStart:f,...c.label};return l.jsxs(re.label,{className:"chakra-radio",...L,__css:Q,children:[l.jsx("input",{className:"chakra-radio__input",...V}),l.jsx(re.span,{className:"chakra-radio__control",...R,__css:U}),p&&l.jsx(re.span,{className:"chakra-radio__label",...F,__css:K,children:p})]})});vn.displayName="Radio";var Jy=fe(function(t,n){const{children:r,placeholder:o,className:s,...c}=t;return l.jsxs(re.select,{...c,ref:n,className:Ae("chakra-select",s),children:[o&&l.jsx("option",{value:"",children:o}),r]})});Jy.displayName="SelectField";function K7(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 ex=fe((e,t)=>{var n;const r=un("Select",e),{rootProps:o,placeholder:s,icon:c,color:u,height:f,h:p,minH:h,minHeight:y,iconColor:x,iconSize:S,...C}=At(e),[k,w]=K7(C,x1),j=ah(w),I={width:"100%",height:"fit-content",position:"relative",color:u},P={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return l.jsxs(re.div,{className:"chakra-select__wrapper",__css:I,...k,...o,children:[l.jsx(Jy,{ref:t,height:p??f,minH:h??y,placeholder:s,...j,__css:P,children:e.children}),l.jsx(tx,{"data-disabled":qe(j.disabled),...(x||u)&&{color:x||u},__css:r.icon,...S&&{fontSize:S},children:c})]})});ex.displayName="Select";var X7=e=>l.jsx("svg",{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),Q7=re("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),tx=e=>{const{children:t=l.jsx(X7,{}),...n}=e,r=g.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx(Q7,{...n,className:"chakra-select__icon-wrapper",children:g.isValidElement(t)?r:null})};tx.displayName="SelectIcon";var Mi=e=>e?"":void 0,Pd=e=>e?!0:void 0,ps=(...e)=>e.filter(Boolean).join(" ");function Id(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function jl(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var $l={width:0,height:0},El=e=>e||$l;function Z7(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=k=>{var w;const j=(w=r[k])!=null?w:$l;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...jl({orientation:t,vertical:{bottom:`calc(${n[k]}% - ${j.height/2}px)`},horizontal:{left:`calc(${n[k]}% - ${j.width/2}px)`}})}},c=t==="vertical"?r.reduce((k,w)=>El(k).height>El(w).height?k:w,$l):r.reduce((k,w)=>El(k).width>El(w).width?k:w,$l),u={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...jl({orientation:t,vertical:c?{paddingLeft:c.width/2,paddingRight:c.width/2}:{},horizontal:c?{paddingTop:c.height/2,paddingBottom:c.height/2}:{}})},f={position:"absolute",...jl({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},p=n.length===1,h=[0,o?100-n[0]:n[0]],y=p?h:n;let x=y[0];!p&&o&&(x=100-x);const S=Math.abs(y[y.length-1]-y[0]),C={...f,...jl({orientation:t,vertical:o?{height:`${S}%`,top:`${x}%`}:{height:`${S}%`,bottom:`${x}%`},horizontal:o?{width:`${S}%`,right:`${x}%`}:{width:`${S}%`,left:`${x}%`}})};return{trackStyle:f,innerTrackStyle:C,rootStyle:u,getThumbStyle:s}}function J7(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function e8(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function t8(e){const t=r8(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function nx(e){return!!e.touches}function n8(e){return nx(e)&&e.touches.length>1}function r8(e){var t;return(t=e.view)!=null?t:window}function o8(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function i8(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function rx(e,t="page"){return nx(e)?o8(e,t):i8(e,t)}function a8(e){return t=>{const n=t8(t);(!n||n&&t.button===0)&&e(t)}}function s8(e,t=!1){function n(o){e(o,{point:rx(o)})}return t?a8(n):n}function Gl(e,t,n,r){return e8(e,t,s8(n,t==="pointerdown"),r)}var l8=Object.defineProperty,c8=(e,t,n)=>t in e?l8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jn=(e,t,n)=>(c8(e,typeof t!="symbol"?t+"":t,n),n),u8=class{constructor(e,t,n){Jn(this,"history",[]),Jn(this,"startEvent",null),Jn(this,"lastEvent",null),Jn(this,"lastEventInfo",null),Jn(this,"handlers",{}),Jn(this,"removeListeners",()=>{}),Jn(this,"threshold",3),Jn(this,"win"),Jn(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const u=Md(this.lastEventInfo,this.history),f=this.startEvent!==null,p=p8(u.offset,{x:0,y:0})>=this.threshold;if(!f&&!p)return;const{timestamp:h}=$v();this.history.push({...u.point,timestamp:h});const{onStart:y,onMove:x}=this.handlers;f||(y==null||y(this.lastEvent,u),this.startEvent=this.lastEvent),x==null||x(this.lastEvent,u)}),Jn(this,"onPointerMove",(u,f)=>{this.lastEvent=u,this.lastEventInfo=f,NC.update(this.updatePoint,!0)}),Jn(this,"onPointerUp",(u,f)=>{const p=Md(f,this.history),{onEnd:h,onSessionEnd:y}=this.handlers;y==null||y(u,p),this.end(),!(!h||!this.startEvent)&&(h==null||h(u,p))});var r;if(this.win=(r=e.view)!=null?r:window,n8(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:rx(e)},{timestamp:s}=$v();this.history=[{...o.point,timestamp:s}];const{onSessionStart:c}=t;c==null||c(e,Md(o,this.history)),this.removeListeners=h8(Gl(this.win,"pointermove",this.onPointerMove),Gl(this.win,"pointerup",this.onPointerUp),Gl(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),FC.update(this.updatePoint)}};function Ag(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Md(e,t){return{point:e.point,delta:Ag(e.point,t[t.length-1]),offset:Ag(e.point,t[0]),velocity:f8(t,.1)}}var d8=e=>e*1e3;function f8(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>d8(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 c={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function h8(...e){return t=>e.reduce((n,r)=>r(n),t)}function Td(e,t){return Math.abs(e-t)}function Og(e){return"x"in e&&"y"in e}function p8(e,t){if(typeof e=="number"&&typeof t=="number")return Td(e,t);if(Og(e)&&Og(t)){const n=Td(e.x,t.x),r=Td(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function ox(e){const t=g.useRef(null);return t.current=e,t}function m8(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:c,threshold:u}=t,f=Boolean(n||r||o||s||c),p=g.useRef(null),h=ox({onSessionStart:s,onSessionEnd:c,onStart:r,onMove:n,onEnd(y,x){p.current=null,o==null||o(y,x)}});g.useEffect(()=>{var y;(y=p.current)==null||y.updateHandlers(h.current)}),g.useEffect(()=>{const y=e.current;if(!y||!f)return;function x(S){p.current=new u8(S,h.current,u)}return Gl(y,"pointerdown",x)},[e,f,h,u]),g.useEffect(()=>()=>{var y;(y=p.current)==null||y.end(),p.current=null},[])}function v8(e,t){var n;if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const r=(n=e.ownerDocument.defaultView)!=null?n:window,o=new r.ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const[c]=s;let u,f;if("borderBoxSize"in c){const p=c.borderBoxSize,h=Array.isArray(p)?p[0]:p;u=h.inlineSize,f=h.blockSize}else u=e.offsetWidth,f=e.offsetHeight;t({width:u,height:f})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}var g8=Boolean(globalThis==null?void 0:globalThis.document)?g.useLayoutEffect:g.useEffect;function y8(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 x8({getNodes:e,observeMutation:t=!0}){const[n,r]=g.useState([]),[o,s]=g.useState(0);return g8(()=>{const c=e(),u=c.map((f,p)=>v8(f,h=>{r(y=>[...y.slice(0,p),h,...y.slice(p+1)])}));if(t){const f=c[0];u.push(y8(f,()=>{s(p=>p+1)}))}return()=>{u.forEach(f=>{f==null||f()})}},[o]),n}function b8(e){return typeof e=="object"&&e!==null&&"current"in e}function S8(e){const[t]=x8({observeMutation:!1,getNodes(){return[b8(e)?e.current:e]}});return t}function C8(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:c,isReversed:u,direction:f="ltr",orientation:p="horizontal",id:h,isDisabled:y,isReadOnly:x,onChangeStart:S,onChangeEnd:C,step:k=1,getAriaValueText:w,"aria-valuetext":j,"aria-label":I,"aria-labelledby":P,name:M,focusThumbOnChange:T=!0,...D}=e,_=Wt(S),R=Wt(C),V=Wt(w),F=J7({isReversed:u,direction:f,orientation:p}),[L,Q]=nh({value:s,defaultValue:c??k8(n,r),onChange:o}),[U,K]=g.useState(!1),[te,ne]=g.useState(!1),$=!(y||x),Z=(r-n)/10,oe=k||(r-n)/100,le=Hl(L,n,r),Re=r-le+n,Ie=ng(F?Re:le,n,r),pe=p==="vertical",ce=ox({min:n,max:r,step:k,isDisabled:y,value:le,isInteractive:$,isReversed:F,isVertical:pe,eventSource:null,focusThumbOnChange:T,orientation:p}),Fe=g.useRef(null),Ve=g.useRef(null),Ue=g.useRef(null),$e=g.useId(),Qe=h??$e,[ge,Te]=[`slider-thumb-${Qe}`,`slider-track-${Qe}`],Ge=g.useCallback(he=>{var _e,dn;if(!Fe.current)return;const Vt=ce.current;Vt.eventSource="pointer";const fn=Fe.current.getBoundingClientRect(),{clientX:ar,clientY:wo}=(dn=(_e=he.touches)==null?void 0:_e[0])!=null?dn:he,sa=pe?fn.bottom-wo:ar-fn.left,Yc=pe?fn.height:fn.width;let la=sa/Yc;F&&(la=1-la);let ko=Xw(la,Vt.min,Vt.max);return Vt.step&&(ko=parseFloat(rg(ko,Vt.min,Vt.step))),ko=Hl(ko,Vt.min,Vt.max),ko},[pe,F,ce]),ye=g.useCallback(he=>{const _e=ce.current;_e.isInteractive&&(he=parseFloat(rg(he,_e.min,oe)),he=Hl(he,_e.min,_e.max),Q(he))},[oe,Q,ce]),Pe=g.useMemo(()=>({stepUp(he=oe){const _e=F?le-he:le+he;ye(_e)},stepDown(he=oe){const _e=F?le+he:le-he;ye(_e)},reset(){ye(c||0)},stepTo(he){ye(he)}}),[ye,F,le,oe,c]),et=g.useCallback(he=>{const _e=ce.current,Vt={ArrowRight:()=>Pe.stepUp(),ArrowUp:()=>Pe.stepUp(),ArrowLeft:()=>Pe.stepDown(),ArrowDown:()=>Pe.stepDown(),PageUp:()=>Pe.stepUp(Z),PageDown:()=>Pe.stepDown(Z),Home:()=>ye(_e.min),End:()=>ye(_e.max)}[he.key];Vt&&(he.preventDefault(),he.stopPropagation(),Vt(he),_e.eventSource="keyboard")},[Pe,ye,Z,ce]),Be=(t=V==null?void 0:V(le))!=null?t:j,vt=S8(Ve),{getThumbStyle:Rt,rootStyle:N,trackStyle:ue,innerTrackStyle:xe}=g.useMemo(()=>{const he=ce.current,_e=vt??{width:0,height:0};return Z7({isReversed:F,orientation:he.orientation,thumbRects:[_e],thumbPercents:[Ie]})},[F,vt,Ie,ce]),ke=g.useCallback(()=>{ce.current.focusThumbOnChange&&setTimeout(()=>{var _e;return(_e=Ve.current)==null?void 0:_e.focus()})},[ce]);ei(()=>{const he=ce.current;ke(),he.eventSource==="keyboard"&&(R==null||R(he.value))},[le,R]);function q(he){const _e=Ge(he);_e!=null&&_e!==ce.current.value&&Q(_e)}m8(Ue,{onPanSessionStart(he){const _e=ce.current;_e.isInteractive&&(K(!0),ke(),q(he),_==null||_(_e.value))},onPanSessionEnd(){const he=ce.current;he.isInteractive&&(K(!1),R==null||R(he.value))},onPan(he){ce.current.isInteractive&&q(he)}});const ae=g.useCallback((he={},_e=null)=>({...he,...D,ref:ct(_e,Ue),tabIndex:-1,"aria-disabled":Pd(y),"data-focused":Mi(te),style:{...he.style,...N}}),[D,y,te,N]),Oe=g.useCallback((he={},_e=null)=>({...he,ref:ct(_e,Fe),id:Te,"data-disabled":Mi(y),style:{...he.style,...ue}}),[y,Te,ue]),Ze=g.useCallback((he={},_e=null)=>({...he,ref:_e,style:{...he.style,...xe}}),[xe]),J=g.useCallback((he={},_e=null)=>({...he,ref:ct(_e,Ve),role:"slider",tabIndex:$?0:void 0,id:ge,"data-active":Mi(U),"aria-valuetext":Be,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":le,"aria-orientation":p,"aria-disabled":Pd(y),"aria-readonly":Pd(x),"aria-label":I,"aria-labelledby":I?void 0:P,style:{...he.style,...Rt(0)},onKeyDown:Id(he.onKeyDown,et),onFocus:Id(he.onFocus,()=>ne(!0)),onBlur:Id(he.onBlur,()=>ne(!1))}),[$,ge,U,Be,n,r,le,p,y,x,I,P,Rt,et]),Le=g.useCallback((he,_e=null)=>{const dn=!(he.valuer),Vt=le>=he.value,fn=ng(he.value,n,r),ar={position:"absolute",pointerEvents:"none",...w8({orientation:p,vertical:{bottom:F?`${100-fn}%`:`${fn}%`},horizontal:{left:F?`${100-fn}%`:`${fn}%`}})};return{...he,ref:_e,role:"presentation","aria-hidden":!0,"data-disabled":Mi(y),"data-invalid":Mi(!dn),"data-highlighted":Mi(Vt),style:{...he.style,...ar}}},[y,F,r,n,p,le]),nt=g.useCallback((he={},_e=null)=>({...he,ref:_e,type:"hidden",value:le,name:M}),[M,le]);return{state:{value:le,isFocused:te,isDragging:U},actions:Pe,getRootProps:ae,getTrackProps:Oe,getInnerTrackProps:Ze,getThumbProps:J,getMarkerProps:Le,getInputProps:nt}}function w8(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function k8(e,t){return t"}),[E8,Tc]=jt({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),ix=fe((e,t)=>{const n={orientation:"horizontal",...e},r=un("Slider",n),o=At(n),{direction:s}=ea();o.direction=s;const{getInputProps:c,getRootProps:u,...f}=C8(o),p=u(),h=c({},t);return l.jsx(j8,{value:f,children:l.jsx(E8,{value:r,children:l.jsxs(re.div,{...p,className:ps("chakra-slider",n.className),__css:r.container,children:[n.children,l.jsx("input",{...h})]})})})});ix.displayName="Slider";var ax=fe((e,t)=>{const{getThumbProps:n}=Mc(),r=Tc(),o=n(e,t);return l.jsx(re.div,{...o,className:ps("chakra-slider__thumb",e.className),__css:r.thumb})});ax.displayName="SliderThumb";var sx=fe((e,t)=>{const{getTrackProps:n}=Mc(),r=Tc(),o=n(e,t);return l.jsx(re.div,{...o,className:ps("chakra-slider__track",e.className),__css:r.track})});sx.displayName="SliderTrack";var lx=fe((e,t)=>{const{getInnerTrackProps:n}=Mc(),r=Tc(),o=n(e,t);return l.jsx(re.div,{...o,className:ps("chakra-slider__filled-track",e.className),__css:r.filledTrack})});lx.displayName="SliderFilledTrack";var If=fe((e,t)=>{const{getMarkerProps:n}=Mc(),r=Tc(),o=n(e,t);return l.jsx(re.div,{...o,className:ps("chakra-slider__marker",e.className),__css:r.mark})});If.displayName="SliderMark";var cx=fe(function(t,n){const r=un("Switch",t),{spacing:o="0.5rem",children:s,...c}=At(t),{state:u,getInputProps:f,getCheckboxProps:p,getRootProps:h,getLabelProps:y}=w2(c),x=g.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),S=g.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),C=g.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return l.jsxs(re.label,{...h(),className:Ae("chakra-switch",t.className),__css:x,children:[l.jsx("input",{className:"chakra-switch__input",...f({},n)}),l.jsx(re.span,{...p(),className:"chakra-switch__track",__css:S,children:l.jsx(re.span,{__css:r.thumb,className:"chakra-switch__thumb","data-checked":qe(u.isChecked),"data-hover":qe(u.isHovered)})}),s&&l.jsx(re.span,{className:"chakra-switch__label",...y(),__css:C,children:s})]})});cx.displayName="Switch";var[P8,I8,M8,T8]=eh();function _8(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:c,lazyBehavior:u="unmount",orientation:f="horizontal",direction:p="ltr",...h}=e,[y,x]=g.useState(n??0),[S,C]=nh({defaultValue:n??0,value:o,onChange:r});g.useEffect(()=>{o!=null&&x(o)},[o]);const k=M8(),w=g.useId();return{id:`tabs-${(t=e.id)!=null?t:w}`,selectedIndex:S,focusedIndex:y,setSelectedIndex:C,setFocusedIndex:x,isManual:s,isLazy:c,lazyBehavior:u,orientation:f,descendants:k,direction:p,htmlProps:h}}var[D8,_c]=jt({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function A8(e){const{focusedIndex:t,orientation:n,direction:r}=_c(),o=I8(),s=g.useCallback(c=>{const u=()=>{var I;const P=o.nextEnabled(t);P&&((I=P.node)==null||I.focus())},f=()=>{var I;const P=o.prevEnabled(t);P&&((I=P.node)==null||I.focus())},p=()=>{var I;const P=o.firstEnabled();P&&((I=P.node)==null||I.focus())},h=()=>{var I;const P=o.lastEnabled();P&&((I=P.node)==null||I.focus())},y=n==="horizontal",x=n==="vertical",S=c.key,C=r==="ltr"?"ArrowLeft":"ArrowRight",k=r==="ltr"?"ArrowRight":"ArrowLeft",j={[C]:()=>y&&f(),[k]:()=>y&&u(),ArrowDown:()=>x&&u(),ArrowUp:()=>x&&f(),Home:p,End:h}[S];j&&(c.preventDefault(),j(c))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:Ee(e.onKeyDown,s)}}function O8(e){const{isDisabled:t,isFocusable:n,...r}=e,{setSelectedIndex:o,isManual:s,id:c,setFocusedIndex:u,selectedIndex:f}=_c(),{index:p,register:h}=T8({disabled:t&&!n}),y=p===f,x=()=>{o(p)},S=()=>{u(p),!s&&!(t&&n)&&o(p)},C=Sy({...r,ref:ct(h,e.ref),isDisabled:t,isFocusable:n,onClick:Ee(e.onClick,x)}),k="button";return{...C,id:ux(c,p),role:"tab",tabIndex:y?0:-1,type:k,"aria-selected":y,"aria-controls":dx(c,p),onFocus:t?void 0:Ee(e.onFocus,S)}}var[z8,R8]=jt({});function N8(e){const t=_c(),{id:n,selectedIndex:r}=t,s=ih(e.children).map((c,u)=>g.createElement(z8,{key:u,value:{isSelected:u===r,id:dx(n,u),tabId:ux(n,u),selectedIndex:r}},c));return{...e,children:s}}function F8(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=_c(),{isSelected:s,id:c,tabId:u}=R8(),f=g.useRef(!1);s&&(f.current=!0);const p=_h({wasSelected:f.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:p?t:null,role:"tabpanel","aria-labelledby":u,hidden:!s,id:c}}function ux(e,t){return`${e}--tab-${t}`}function dx(e,t){return`${e}--tabpanel-${t}`}var[L8,Dc]=jt({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),fx=fe(function(t,n){const r=un("Tabs",t),{children:o,className:s,...c}=At(t),{htmlProps:u,descendants:f,...p}=_8(c),h=g.useMemo(()=>p,[p]),{isFitted:y,...x}=u;return l.jsx(P8,{value:f,children:l.jsx(D8,{value:h,children:l.jsx(L8,{value:r,children:l.jsx(re.div,{className:Ae("chakra-tabs",s),ref:n,...x,__css:r.root,children:o})})})})});fx.displayName="Tabs";var hx=fe(function(t,n){const r=A8({...t,ref:n}),s={display:"flex",...Dc().tablist};return l.jsx(re.div,{...r,className:Ae("chakra-tabs__tablist",t.className),__css:s})});hx.displayName="TabList";var px=fe(function(t,n){const r=F8({...t,ref:n}),o=Dc();return l.jsx(re.div,{outline:"0",...r,className:Ae("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});px.displayName="TabPanel";var mx=fe(function(t,n){const r=N8(t),o=Dc();return l.jsx(re.div,{...r,width:"100%",ref:n,className:Ae("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});mx.displayName="TabPanels";var vx=fe(function(t,n){const r=Dc(),o=O8({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return l.jsx(re.button,{...o,className:Ae("chakra-tabs__tab",t.className),__css:s})});vx.displayName="Tab";function B8(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var H8=["h","minH","height","minHeight"],Gh=fe((e,t)=>{const n=go("Textarea",e),{className:r,rows:o,...s}=At(e),c=ah(s),u=o?B8(n,H8):n;return l.jsx(re.textarea,{ref:t,rows:o,...c,className:Ae("chakra-textarea",r),__css:u})});Gh.displayName="Textarea";var W8={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]}}}},sc=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},Mf=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function V8(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:c=o,closeOnEsc:u=!0,onOpen:f,onClose:p,placement:h,id:y,isOpen:x,defaultIsOpen:S,arrowSize:C=10,arrowShadowColor:k,arrowPadding:w,modifiers:j,isDisabled:I,gutter:P,offset:M,direction:T,...D}=e,{isOpen:_,onOpen:R,onClose:V}=Th({isOpen:x,defaultIsOpen:S,onOpen:f,onClose:p}),{referenceRef:F,getPopperProps:L,getArrowInnerProps:Q,getArrowProps:U}=Mh({enabled:_,placement:h,arrowPadding:w,modifiers:j,gutter:P,offset:M,direction:T}),K=g.useId(),ne=`tooltip-${y??K}`,$=g.useRef(null),Z=g.useRef(),oe=g.useCallback(()=>{Z.current&&(clearTimeout(Z.current),Z.current=void 0)},[]),le=g.useRef(),Re=g.useCallback(()=>{le.current&&(clearTimeout(le.current),le.current=void 0)},[]),Ne=g.useCallback(()=>{Re(),V()},[V,Re]),Ie=U8($,Ne),pe=g.useCallback(()=>{if(!I&&!Z.current){Ie();const Te=Mf($);Z.current=Te.setTimeout(R,t)}},[Ie,I,R,t]),ce=g.useCallback(()=>{oe();const Te=Mf($);le.current=Te.setTimeout(Ne,n)},[n,Ne,oe]),Fe=g.useCallback(()=>{_&&r&&ce()},[r,ce,_]),Ve=g.useCallback(()=>{_&&c&&ce()},[c,ce,_]),Ue=g.useCallback(Te=>{_&&Te.key==="Escape"&&ce()},[_,ce]);$o(()=>sc($),"keydown",u?Ue:void 0),$o(()=>sc($),"scroll",()=>{_&&s&&Ne()}),g.useEffect(()=>{I&&(oe(),_&&V())},[I,_,V,oe]),g.useEffect(()=>()=>{oe(),Re()},[oe,Re]),$o(()=>$.current,"pointerleave",ce);const $e=g.useCallback((Te={},Ge=null)=>({...Te,ref:ct($,Ge,F),onPointerEnter:Ee(Te.onPointerEnter,Pe=>{Pe.pointerType!=="touch"&&pe()}),onClick:Ee(Te.onClick,Fe),onPointerDown:Ee(Te.onPointerDown,Ve),onFocus:Ee(Te.onFocus,pe),onBlur:Ee(Te.onBlur,ce),"aria-describedby":_?ne:void 0}),[pe,ce,Ve,_,ne,Fe,F]),Qe=g.useCallback((Te={},Ge=null)=>L({...Te,style:{...Te.style,[Ht.arrowSize.var]:C?`${C}px`:void 0,[Ht.arrowShadowColor.var]:k}},Ge),[L,C,k]),ge=g.useCallback((Te={},Ge=null)=>{const ye={...Te.style,position:"relative",transformOrigin:Ht.transformOrigin.varRef};return{ref:Ge,...D,...Te,id:ne,role:"tooltip",style:ye}},[D,ne]);return{isOpen:_,show:pe,hide:ce,getTriggerProps:$e,getTooltipProps:ge,getTooltipPositionerProps:Qe,getArrowProps:U,getArrowInnerProps:Q}}var _d="chakra-ui:close-tooltip";function U8(e,t){return g.useEffect(()=>{const n=sc(e);return n.addEventListener(_d,t),()=>n.removeEventListener(_d,t)},[t,e]),()=>{const n=sc(e),r=Mf(e);n.dispatchEvent(new r.CustomEvent(_d))}}function $8(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function G8(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var q8=re(ir.div),Gt=fe((e,t)=>{var n,r;const o=go("Tooltip",e),s=At(e),c=ea(),{children:u,label:f,shouldWrapChildren:p,"aria-label":h,hasArrow:y,bg:x,portalProps:S,background:C,backgroundColor:k,bgColor:w,motionProps:j,...I}=s,P=(r=(n=C??k)!=null?n:x)!=null?r:w;if(P){o.bg=P;const L=LS(c,"colors",P);o[Ht.arrowBg.var]=L}const M=V8({...I,direction:c.direction}),T=typeof u=="string"||p;let D;if(T)D=l.jsx(re.span,{display:"inline-block",tabIndex:0,...M.getTriggerProps(),children:u});else{const L=g.Children.only(u);D=g.cloneElement(L,M.getTriggerProps(L.props,L.ref))}const _=!!h,R=M.getTooltipProps({},t),V=_?$8(R,["role","id"]):R,F=G8(R,["role","id"]);return f?l.jsxs(l.Fragment,{children:[D,l.jsx(yo,{children:M.isOpen&&l.jsx(Ua,{...S,children:l.jsx(re.div,{...M.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:l.jsxs(q8,{variants:W8,initial:"exit",animate:"enter",exit:"exit",...j,...V,__css:o,children:[f,_&&l.jsx(re.span,{srOnly:!0,...F,children:h}),y&&l.jsx(re.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:l.jsx(re.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):l.jsx(l.Fragment,{children:u})});Gt.displayName="Tooltip";const qh=g.createContext(null);let zg;const Yh=()=>({setOpenUploader:e=>{e&&(zg=e)},openUploader:zg}),bt=me(e=>e.ui,e=>BS[e.activeTab],{memoizeOptions:{equalityCheck:ee.isEqual}}),Y8=me(e=>e.ui,e=>e.activeTab,{memoizeOptions:{equalityCheck:ee.isEqual}}),Er=me(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:ee.isEqual}}),Rg=e=>async(t,n)=>{const{imageFile:r}=e,o=n(),s=bt(o),c=new FormData;c.append("file",r,r.name),c.append("data",JSON.stringify({kind:"init"}));const f=await(await fetch(`${window.location.origin}/upload`,{method:"POST",body:c})).json(),p={uuid:b1(),category:"user",...f};t(S1({image:p,category:"user"})),s==="unifiedCanvas"?t(xc(p)):s==="img2img"&&t(ns(p))};var K8=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 ms(e,t){var n=X8(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 X8(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=K8.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var Q8=[".DS_Store","Thumbs.db"];function Z8(e){return ta(this,void 0,void 0,function(){return na(this,function(t){return lc(e)&&J8(e.dataTransfer)?[2,rE(e.dataTransfer,e.type)]:eE(e)?[2,tE(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,nE(e)]:[2,[]]})})}function J8(e){return lc(e)}function eE(e){return lc(e)&&lc(e.target)}function lc(e){return typeof e=="object"&&e!==null}function tE(e){return Tf(e.target.files).map(function(t){return ms(t)})}function nE(e){return ta(this,void 0,void 0,function(){var t;return na(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 ms(r)})]}})})}function rE(e,t){return ta(this,void 0,void 0,function(){var n,r;return na(this,function(o){switch(o.label){case 0:return e.items?(n=Tf(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(oE))]):[3,2];case 1:return r=o.sent(),[2,Ng(gx(r))];case 2:return[2,Ng(Tf(e.files).map(function(s){return ms(s)}))]}})})}function Ng(e){return e.filter(function(t){return Q8.indexOf(t.name)===-1})}function Tf(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,Wg(n)];if(e.sizen)return[!1,Wg(n)]}return[!0,null]}function Lo(e){return e!=null}function bE(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,c=e.maxFiles,u=e.validator;return!s&&t.length>1||s&&c>=1&&t.length>c?!1:t.every(function(f){var p=Sx(f,n),h=Qa(p,1),y=h[0],x=Cx(f,r,o),S=Qa(x,1),C=S[0],k=u?u(f):null;return y&&C&&!k})}function cc(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Pl(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 Ug(e){e.preventDefault()}function SE(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function CE(e){return e.indexOf("Edge/")!==-1}function wE(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return SE(e)||CE(e)}function mr(){for(var e=arguments.length,t=new Array(e),n=0;n1?o-1:0),c=1;ce.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 BE(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 Kh=g.forwardRef(function(e,t){var n=e.children,r=uc(e,ME),o=Px(r),s=o.open,c=uc(o,TE);return g.useImperativeHandle(t,function(){return{open:s}},[s]),Me.createElement(g.Fragment,null,n(Dt(Dt({},c),{},{open:s})))});Kh.displayName="Dropzone";var Ex={disabled:!1,getFilesFromEvent:Z8,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};Kh.defaultProps=Ex;Kh.propTypes={children:lt.func,accept:lt.objectOf(lt.arrayOf(lt.string)),multiple:lt.bool,preventDropOnDocument:lt.bool,noClick:lt.bool,noKeyboard:lt.bool,noDrag:lt.bool,noDragEventsBubbling:lt.bool,minSize:lt.number,maxSize:lt.number,maxFiles:lt.number,disabled:lt.bool,getFilesFromEvent:lt.func,onFileDialogCancel:lt.func,onFileDialogOpen:lt.func,useFsAccessApi:lt.bool,autoFocus:lt.bool,onDragEnter:lt.func,onDragLeave:lt.func,onDragOver:lt.func,onDrop:lt.func,onDropAccepted:lt.func,onDropRejected:lt.func,onError:lt.func,validator:lt.func};var Of={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Px(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Dt(Dt({},Ex),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,c=t.minSize,u=t.multiple,f=t.maxFiles,p=t.onDragEnter,h=t.onDragLeave,y=t.onDragOver,x=t.onDrop,S=t.onDropAccepted,C=t.onDropRejected,k=t.onFileDialogCancel,w=t.onFileDialogOpen,j=t.useFsAccessApi,I=t.autoFocus,P=t.preventDropOnDocument,M=t.noClick,T=t.noKeyboard,D=t.noDrag,_=t.noDragEventsBubbling,R=t.onError,V=t.validator,F=g.useMemo(function(){return EE(n)},[n]),L=g.useMemo(function(){return jE(n)},[n]),Q=g.useMemo(function(){return typeof w=="function"?w:Gg},[w]),U=g.useMemo(function(){return typeof k=="function"?k:Gg},[k]),K=g.useRef(null),te=g.useRef(null),ne=g.useReducer(HE,Of),$=Dd(ne,2),Z=$[0],oe=$[1],le=Z.isFocused,Re=Z.isFileDialogActive,Ne=g.useRef(typeof window<"u"&&window.isSecureContext&&j&&kE()),Ie=function(){!Ne.current&&Re&&setTimeout(function(){if(te.current){var ae=te.current.files;ae.length||(oe({type:"closeDialog"}),U())}},300)};g.useEffect(function(){return window.addEventListener("focus",Ie,!1),function(){window.removeEventListener("focus",Ie,!1)}},[te,Re,U,Ne]);var pe=g.useRef([]),ce=function(ae){K.current&&K.current.contains(ae.target)||(ae.preventDefault(),pe.current=[])};g.useEffect(function(){return P&&(document.addEventListener("dragover",Ug,!1),document.addEventListener("drop",ce,!1)),function(){P&&(document.removeEventListener("dragover",Ug),document.removeEventListener("drop",ce))}},[K,P]),g.useEffect(function(){return!r&&I&&K.current&&K.current.focus(),function(){}},[K,I,r]);var Fe=g.useCallback(function(q){R?R(q):console.error(q)},[R]),Ve=g.useCallback(function(q){q.preventDefault(),q.persist(),N(q),pe.current=[].concat(AE(pe.current),[q.target]),Pl(q)&&Promise.resolve(o(q)).then(function(ae){if(!(cc(q)&&!_)){var Oe=ae.length,Ze=Oe>0&&bE({files:ae,accept:F,minSize:c,maxSize:s,multiple:u,maxFiles:f,validator:V}),J=Oe>0&&!Ze;oe({isDragAccept:Ze,isDragReject:J,isDragActive:!0,type:"setDraggedFiles"}),p&&p(q)}}).catch(function(ae){return Fe(ae)})},[o,p,Fe,_,F,c,s,u,f,V]),Ue=g.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var ae=Pl(q);if(ae&&q.dataTransfer)try{q.dataTransfer.dropEffect="copy"}catch{}return ae&&y&&y(q),!1},[y,_]),$e=g.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var ae=pe.current.filter(function(Ze){return K.current&&K.current.contains(Ze)}),Oe=ae.indexOf(q.target);Oe!==-1&&ae.splice(Oe,1),pe.current=ae,!(ae.length>0)&&(oe({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Pl(q)&&h&&h(q))},[K,h,_]),Qe=g.useCallback(function(q,ae){var Oe=[],Ze=[];q.forEach(function(J){var Le=Sx(J,F),nt=Dd(Le,2),Nt=nt[0],he=nt[1],_e=Cx(J,c,s),dn=Dd(_e,2),Vt=dn[0],fn=dn[1],ar=V?V(J):null;if(Nt&&Vt&&!ar)Oe.push(J);else{var wo=[he,fn];ar&&(wo=wo.concat(ar)),Ze.push({file:J,errors:wo.filter(function(sa){return sa})})}}),(!u&&Oe.length>1||u&&f>=1&&Oe.length>f)&&(Oe.forEach(function(J){Ze.push({file:J,errors:[xE]})}),Oe.splice(0)),oe({acceptedFiles:Oe,fileRejections:Ze,type:"setFiles"}),x&&x(Oe,Ze,ae),Ze.length>0&&C&&C(Ze,ae),Oe.length>0&&S&&S(Oe,ae)},[oe,u,F,c,s,f,x,S,C,V]),ge=g.useCallback(function(q){q.preventDefault(),q.persist(),N(q),pe.current=[],Pl(q)&&Promise.resolve(o(q)).then(function(ae){cc(q)&&!_||Qe(ae,q)}).catch(function(ae){return Fe(ae)}),oe({type:"reset"})},[o,Qe,Fe,_]),Te=g.useCallback(function(){if(Ne.current){oe({type:"openDialog"}),Q();var q={multiple:u,types:L};window.showOpenFilePicker(q).then(function(ae){return o(ae)}).then(function(ae){Qe(ae,null),oe({type:"closeDialog"})}).catch(function(ae){PE(ae)?(U(ae),oe({type:"closeDialog"})):IE(ae)?(Ne.current=!1,te.current?(te.current.value=null,te.current.click()):Fe(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."))):Fe(ae)});return}te.current&&(oe({type:"openDialog"}),Q(),te.current.value=null,te.current.click())},[oe,Q,U,j,Qe,Fe,L,u]),Ge=g.useCallback(function(q){!K.current||!K.current.isEqualNode(q.target)||(q.key===" "||q.key==="Enter"||q.keyCode===32||q.keyCode===13)&&(q.preventDefault(),Te())},[K,Te]),ye=g.useCallback(function(){oe({type:"focus"})},[]),Pe=g.useCallback(function(){oe({type:"blur"})},[]),et=g.useCallback(function(){M||(wE()?setTimeout(Te,0):Te())},[M,Te]),Be=function(ae){return r?null:ae},vt=function(ae){return T?null:Be(ae)},Rt=function(ae){return D?null:Be(ae)},N=function(ae){_&&ae.stopPropagation()},ue=g.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ae=q.refKey,Oe=ae===void 0?"ref":ae,Ze=q.role,J=q.onKeyDown,Le=q.onFocus,nt=q.onBlur,Nt=q.onClick,he=q.onDragEnter,_e=q.onDragOver,dn=q.onDragLeave,Vt=q.onDrop,fn=uc(q,_E);return Dt(Dt(Af({onKeyDown:vt(mr(J,Ge)),onFocus:vt(mr(Le,ye)),onBlur:vt(mr(nt,Pe)),onClick:Be(mr(Nt,et)),onDragEnter:Rt(mr(he,Ve)),onDragOver:Rt(mr(_e,Ue)),onDragLeave:Rt(mr(dn,$e)),onDrop:Rt(mr(Vt,ge)),role:typeof Ze=="string"&&Ze!==""?Ze:"presentation"},Oe,K),!r&&!T?{tabIndex:0}:{}),fn)}},[K,Ge,ye,Pe,et,Ve,Ue,$e,ge,T,D,r]),xe=g.useCallback(function(q){q.stopPropagation()},[]),ke=g.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ae=q.refKey,Oe=ae===void 0?"ref":ae,Ze=q.onChange,J=q.onClick,Le=uc(q,DE),nt=Af({accept:F,multiple:u,type:"file",style:{display:"none"},onChange:Be(mr(Ze,ge)),onClick:Be(mr(J,xe)),tabIndex:-1},Oe,te);return Dt(Dt({},nt),Le)}},[te,n,u,ge,r]);return Dt(Dt({},Z),{},{isFocused:le&&!r,getRootProps:ue,getInputProps:ke,rootRef:K,inputRef:te,open:Be(Te)})}function HE(e,t){switch(t.type){case"focus":return Dt(Dt({},e),{},{isFocused:!0});case"blur":return Dt(Dt({},e),{},{isFocused:!1});case"openDialog":return Dt(Dt({},Of),{},{isFileDialogActive:!0});case"closeDialog":return Dt(Dt({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return Dt(Dt({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Dt(Dt({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return Dt({},Of);default:return e}}function Gg(){}function zf(){return zf=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 KE=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,c=n.mod,u=n.shift,f=n.ctrl,p=n.keys,h=t.key,y=t.code,x=t.ctrlKey,S=t.metaKey,C=t.shiftKey,k=t.altKey,w=ao(y),j=h.toLowerCase();if(!r){if(o===!k&&j!=="alt"||u===!C&&j!=="shift")return!1;if(c){if(!S&&!x)return!1}else if(s===!S&&j!=="meta"||f===!x&&j!=="ctrl")return!1}return p&&p.length===1&&(p.includes(j)||p.includes(w))?!0:p?UE(p):!p},XE=g.createContext(void 0),QE=function(){return g.useContext(XE)};function Dx(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&&Dx(e[r],t[r])},!0):e===t}var ZE=g.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),JE=function(){return g.useContext(ZE)};function e9(e){var t=g.useRef(void 0);return Dx(t.current,e)||(t.current=e),t.current}var qg=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},t9=typeof window<"u"?g.useLayoutEffect:g.useEffect;function de(e,t,n,r){var o=g.useRef(null),s=g.useRef(!1),c=n instanceof Array?r instanceof Array?void 0:r:n,u=n instanceof Array?n:r instanceof Array?r:void 0,f=g.useCallback(t,u??[]),p=g.useRef(f);u?p.current=f:p.current=t;var h=e9(c),y=JE(),x=y.enabledScopes,S=QE();return t9(function(){if(!((h==null?void 0:h.enabled)===!1||!YE(x,h==null?void 0:h.scopes))){var C=function(I,P){var M;if(P===void 0&&(P=!1),!(qE(I)&&!_x(I,h==null?void 0:h.enableOnFormTags))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){qg(I);return}(M=I.target)!=null&&M.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||Ad(e,h==null?void 0:h.splitKey).forEach(function(T){var D,_=Od(T,h==null?void 0:h.combinationKey);if(KE(I,_,h==null?void 0:h.ignoreModifiers)||(D=_.keys)!=null&&D.includes("*")){if(P&&s.current)return;if($E(I,_,h==null?void 0:h.preventDefault),!GE(I,_,h==null?void 0:h.enabled)){qg(I);return}p.current(I,_),P||(s.current=!0)}})}},k=function(I){I.key!==void 0&&(Mx(ao(I.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&C(I))},w=function(I){I.key!==void 0&&(Tx(ao(I.code)),s.current=!1,h!=null&&h.keyup&&C(I,!0))};return(o.current||(c==null?void 0:c.document)||document).addEventListener("keyup",w),(o.current||(c==null?void 0:c.document)||document).addEventListener("keydown",k),S&&Ad(e,h==null?void 0:h.splitKey).forEach(function(j){return S.addHotkey(Od(j,h==null?void 0:h.combinationKey))}),function(){(o.current||(c==null?void 0:c.document)||document).removeEventListener("keyup",w),(o.current||(c==null?void 0:c.document)||document).removeEventListener("keydown",k),S&&Ad(e,h==null?void 0:h.splitKey).forEach(function(j){return S.removeHotkey(Od(j,h==null?void 0:h.combinationKey))})}}},[e,h,x]),o}const n9=e=>{const{isDragAccept:t,isDragReject:n,overlaySecondaryText:r,setIsHandlingUpload:o}=e;return de("esc",()=>{o(!1)}),l.jsx(Ye,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:l.jsx(B,{sx:{opacity:.4,width:"100%",height:"100%",flexDirection:"column",rowGap:4,alignItems:"center",justifyContent:"center",bg:"base.900",boxShadow:`inset 0 0 20rem 1rem var(--invokeai-colors-${t?"accent":"error"}-500)`},children:t?l.jsxs(Wn,{size:"lg",children:["Upload Image",r]}):l.jsxs(l.Fragment,{children:[l.jsx(Wn,{size:"lg",children:"Invalid Upload"}),l.jsx(Wn,{size:"md",children:"Must be single JPEG or PNG image"})]})})})},r9=e=>{const{children:t}=e,n=Y(),r=A(bt),o=ss({}),{t:s}=X(),[c,u]=g.useState(!1),{setOpenUploader:f}=Yh(),p=g.useCallback(P=>{u(!0);const M=P.errors.reduce((T,D)=>`${T} +${D.message}`,"");o({title:s("toast.uploadFailed"),description:M,status:"error",isClosable:!0})},[s,o]),h=g.useCallback(async P=>{n(Rg({imageFile:P}))},[n]),y=g.useCallback((P,M)=>{M.forEach(T=>{p(T)}),P.forEach(T=>{h(T)})},[h,p]),{getRootProps:x,getInputProps:S,isDragAccept:C,isDragReject:k,isDragActive:w,open:j}=Px({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:y,onDragOver:()=>u(!0),maxFiles:1});f(j),g.useEffect(()=>{const P=M=>{var R;const T=(R=M.clipboardData)==null?void 0:R.items;if(!T)return;const D=[];for(const V of T)V.kind==="file"&&["image/png","image/jpg"].includes(V.type)&&D.push(V);if(!D.length)return;if(M.stopImmediatePropagation(),D.length>1){o({description:s("toast.uploadFailedMultipleImagesDesc"),status:"error",isClosable:!0});return}const _=D[0].getAsFile();if(!_){o({description:s("toast.uploadFailedUnableToLoadDesc"),status:"error",isClosable:!0});return}n(Rg({imageFile:_}))};return document.addEventListener("paste",P),()=>{document.removeEventListener("paste",P)}},[s,n,o,r]);const I=["img2img","unifiedCanvas"].includes(r)?` to ${String(s(`common.${r}`))}`:"";return l.jsx(qh.Provider,{value:j,children:l.jsxs(Ye,{...x({style:{}}),onKeyDown:P=>{P.key},children:[l.jsx("input",{...S()}),t,w&&c&&l.jsx(n9,{isDragAccept:C,isDragReject:k,overlaySecondaryText:I,setIsHandlingUpload:u})]})})},o9=g.memo(r9),Ax=fe((e,t)=>{const{role:n,tooltip:r="",tooltipProps:o,isChecked:s,...c}=e;return l.jsx(Gt,{label:r,hasArrow:!0,...o,...o!=null&&o.placement?{placement:o.placement}:{placement:"top"},children:l.jsx(fo,{ref:t,role:n,"aria-checked":s!==void 0?s:void 0,...c})})});Ax.displayName="IAIIconButton";const se=g.memo(Ax);var i9=globalThis&&globalThis.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Bt=globalThis&&globalThis.__assign||function(){return Bt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"u"?void 0:Number(r),maxHeight:typeof o>"u"?void 0:Number(o),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof c>"u"?void 0:Number(c)}},f9=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],Zg="__resizable_base__",Ox=function(e){l9(t,e);function t(n){var r=e.call(this,n)||this;return r.ratio=1,r.resizable=null,r.parentLeft=0,r.parentTop=0,r.resizableLeft=0,r.resizableRight=0,r.resizableTop=0,r.resizableBottom=0,r.targetLeft=0,r.targetTop=0,r.appendBase=function(){if(!r.resizable||!r.window)return null;var o=r.parentNode;if(!o)return null;var s=r.window.document.createElement("div");return s.style.width="100%",s.style.height="100%",s.style.position="absolute",s.style.transform="scale(0, 0)",s.style.left="0",s.style.flex="0 0 100%",s.classList?s.classList.add(Zg):s.className+=Zg,o.appendChild(s),s},r.removeBase=function(o){var s=r.parentNode;s&&s.removeChild(o)},r.ref=function(o){o&&(r.resizable=o)},r.state={isResizing:!1,width:typeof(r.propsSize&&r.propsSize.width)>"u"?"auto":r.propsSize&&r.propsSize.width,height:typeof(r.propsSize&&r.propsSize.height)>"u"?"auto":r.propsSize&&r.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},r.onResizeStart=r.onResizeStart.bind(r),r.onMouseMove=r.onMouseMove.bind(r),r.onMouseUp=r.onMouseUp.bind(r),r}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||c9},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,s=this.resizable.offsetHeight,c=this.resizable.style.position;c!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:o,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=c}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,o=function(u){if(typeof n.state[u]>"u"||n.state[u]==="auto")return"auto";if(n.propsSize&&n.propsSize[u]&&n.propsSize[u].toString().endsWith("%")){if(n.state[u].toString().endsWith("%"))return n.state[u].toString();var f=n.getParentSize(),p=Number(n.state[u].toString().replace("px","")),h=p/f[u]*100;return h+"%"}return zd(n.state[u])},s=r&&typeof r.width<"u"&&!this.state.isResizing?zd(r.width):o("width"),c=r&&typeof r.height<"u"&&!this.state.isResizing?zd(r.height):o("height");return{width:s,height:c}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var r=!1,o=this.parentNode.style.flexWrap;o!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var s={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=o),this.removeBase(n),s},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,r){var o=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof o>"u"||o==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var o=this.props.boundsByDirection,s=this.state.direction,c=o&&Ti("left",s),u=o&&Ti("top",s),f,p;if(this.props.bounds==="parent"){var h=this.parentNode;h&&(f=c?this.resizableRight-this.parentLeft:h.offsetWidth+(this.parentLeft-this.resizableLeft),p=u?this.resizableBottom-this.parentTop:h.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(f=c?this.resizableRight:this.window.innerWidth-this.resizableLeft,p=u?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(f=c?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),p=u?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return f&&Number.isFinite(f)&&(n=n&&n"u"?10:s.width,y=typeof o.width>"u"||o.width<0?n:o.width,x=typeof s.height>"u"?10:s.height,S=typeof o.height>"u"||o.height<0?r:o.height,C=f||0,k=p||0;if(u){var w=(x-C)*this.ratio+k,j=(S-C)*this.ratio+k,I=(h-k)/this.ratio+C,P=(y-k)/this.ratio+C,M=Math.max(h,w),T=Math.min(y,j),D=Math.max(x,I),_=Math.min(S,P);n=Ml(n,M,T),r=Ml(r,D,_)}else n=Ml(n,h,y),r=Ml(r,x,S);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var r=n.getBoundingClientRect();this.parentLeft=r.left,this.parentTop=r.top}}if(this.props.bounds&&typeof this.props.bounds!="string"){var o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left,this.targetTop=o.top}if(this.resizable){var s=this.resizable.getBoundingClientRect(),c=s.left,u=s.top,f=s.right,p=s.bottom;this.resizableLeft=c,this.resizableRight=f,this.resizableTop=u,this.resizableBottom=p}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var o=0,s=0;if(n.nativeEvent&&u9(n.nativeEvent)?(o=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&Tl(n.nativeEvent)&&(o=n.nativeEvent.touches[0].clientX,s=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var c=this.props.onResizeStart(n,r,this.resizable);if(c===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var u,f=this.window.getComputedStyle(this.resizable);if(f.flexBasis!=="auto"){var p=this.parentNode;if(p){var h=this.window.getComputedStyle(p).flexDirection;this.flexDir=h.startsWith("row")?"row":"column",u=f.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var y={original:{x:o,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:gr(gr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:u};this.setState(y)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Tl(n))try{n.preventDefault(),n.stopPropagation()}catch{}var o=this.props,s=o.maxWidth,c=o.maxHeight,u=o.minWidth,f=o.minHeight,p=Tl(n)?n.touches[0].clientX:n.clientX,h=Tl(n)?n.touches[0].clientY:n.clientY,y=this.state,x=y.direction,S=y.original,C=y.width,k=y.height,w=this.getParentSize(),j=d9(w,this.window.innerWidth,this.window.innerHeight,s,c,u,f);s=j.maxWidth,c=j.maxHeight,u=j.minWidth,f=j.minHeight;var I=this.calculateNewSizeFromDirection(p,h),P=I.newHeight,M=I.newWidth,T=this.calculateNewMaxFromBoundary(s,c);this.props.snap&&this.props.snap.x&&(M=Qg(M,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(P=Qg(P,this.props.snap.y,this.props.snapGap));var D=this.calculateNewSizeFromAspectRatio(M,P,{width:T.maxWidth,height:T.maxHeight},{width:u,height:f});if(M=D.newWidth,P=D.newHeight,this.props.grid){var _=Xg(M,this.props.grid[0]),R=Xg(P,this.props.grid[1]),V=this.props.snapGap||0;M=V===0||Math.abs(_-M)<=V?_:M,P=V===0||Math.abs(R-P)<=V?R:P}var F={width:M-S.width,height:P-S.height};if(C&&typeof C=="string"){if(C.endsWith("%")){var L=M/w.width*100;M=L+"%"}else if(C.endsWith("vw")){var Q=M/this.window.innerWidth*100;M=Q+"vw"}else if(C.endsWith("vh")){var U=M/this.window.innerHeight*100;M=U+"vh"}}if(k&&typeof k=="string"){if(k.endsWith("%")){var L=P/w.height*100;P=L+"%"}else if(k.endsWith("vw")){var Q=P/this.window.innerWidth*100;P=Q+"vw"}else if(k.endsWith("vh")){var U=P/this.window.innerHeight*100;P=U+"vh"}}var K={width:this.createSizeForCssProperty(M,"width"),height:this.createSizeForCssProperty(P,"height")};this.flexDir==="row"?K.flexBasis=K.width:this.flexDir==="column"&&(K.flexBasis=K.height),HS.flushSync(function(){r.setState(K)}),this.props.onResize&&this.props.onResize(n,x,this.resizable,F)}},t.prototype.onMouseUp=function(n){var r=this.state,o=r.isResizing,s=r.direction,c=r.original;if(!(!o||!this.resizable)){var u={width:this.size.width-c.width,height:this.size.height-c.height};this.props.onResizeStop&&this.props.onResizeStop(n,s,this.resizable,u),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:gr(gr({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){this.setState({width:n.width,height:n.height})},t.prototype.renderResizer=function(){var n=this,r=this.props,o=r.enable,s=r.handleStyles,c=r.handleClasses,u=r.handleWrapperStyle,f=r.handleWrapperClass,p=r.handleComponent;if(!o)return null;var h=Object.keys(o).map(function(y){return o[y]!==!1?g.createElement(s9,{key:y,direction:y,onResizeStart:n.onResizeStart,replaceStyles:s&&s[y],className:c&&c[y]},p&&p[y]?p[y]:null):null});return g.createElement("div",{className:f,style:u},h)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(c,u){return f9.indexOf(u)!==-1||(c[u]=n.props[u]),c},{}),o=gr(gr(gr({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(o.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return g.createElement(s,gr({ref:this.ref,style:o,className:this.props.className},r),this.state.isResizing&&g.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(g.PureComponent),zx={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Jg=Me.createContext&&Me.createContext(zx),co=globalThis&&globalThis.__assign||function(){return co=Object.assign||function(e){for(var t,n=1,r=arguments.length;ne.system,G9=e=>e.system.toastQueue,$x=me(Et,e=>{const{model_list:t}=e,n=ee.reduce(t,(r,o,s)=>(o.status==="active"&&(r=s),r),"");return{...t[n],name:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),q9=me(Et,e=>{const{model_list:t}=e;return ee.pickBy(t,(r,o)=>{if(r.format==="diffusers")return{name:o,...r}})},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Y9=me(Et,e=>e.log,{memoizeOptions:{resultEqualityCheck:(e,t)=>e.length===t.length}}),K9=me(Et,e=>({shouldShowLogViewer:e.shouldShowLogViewer,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),X9=()=>{const e=Y(),{t}=X(),n=A(Y9),{shouldShowLogViewer:r,hasError:o,wasErrorSeen:s}=A(K9),[c,u]=g.useState(!0),f=g.useRef(null);g.useLayoutEffect(()=>{f.current!==null&&c&&(f.current.scrollTop=f.current.scrollHeight)},[c,n,r]);const p=()=>{e(C1()),e(cd(!r))};de("`",()=>{e(cd(!r))},[r]),de("esc",()=>{e(cd(!1))});const h=()=>{f.current&&c&&f.current.scrollTop{const{timestamp:S,message:C,level:k}=y,w=k==="info"?"base":k;return l.jsxs(B,{sx:{gap:2,color:`${w}.300`},children:[l.jsxs(Ce,{fontWeight:"600",children:[S,":"]}),l.jsx(Ce,{wordBreak:"break-all",children:C})]},x)})})}),r&&l.jsx(Gt,{hasArrow:!0,label:c?"Autoscroll On":"Autoscroll Off",children:l.jsx(se,{size:"sm","aria-label":t("accessibility.toggleAutoscroll"),icon:l.jsx(g9,{}),onClick:()=>u(!c),isChecked:c,sx:{position:"fixed",insetInlineStart:2,bottom:12,zIndex:"10000"}})}),l.jsx(Gt,{hasArrow:!0,label:r?"Hide Console":"Show Console",children:l.jsx(se,{size:"sm","aria-label":t("accessibility.toggleLogViewer"),icon:r?l.jsx(O9,{}):l.jsx(Fx,{}),onClick:p,sx:{position:"fixed",insetInlineStart:2,bottom:2,zIndex:"10000"},colorScheme:o||!s?"error":"base"})})]})},Q9="0px",Gx="calc(70px + 1rem)",dc=1.5,Z9=`calc(100vw - ${Q9})`,J9=`calc(100vh - ${dc*4}px)`,eP=`calc(100vh - ${Gx})`,tP=`calc(100vh - (${Gx} + 4.4rem))`,t0=384,nP=me(Et,e=>({isProcessing:e.isProcessing,currentStep:e.currentStep,totalSteps:e.totalSteps,currentStatusHasSteps:e.currentStatusHasSteps}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),rP=()=>{const{t:e}=X(),{isProcessing:t,currentStep:n,totalSteps:r,currentStatusHasSteps:o}=A(nP),s=n?Math.round(n*100/r):0;return l.jsx(Qy,{value:s,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:t&&!o,height:dc,zIndex:99})};function oP(e){const{title:t,hotkey:n,description:r}=e;return l.jsxs(or,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[l.jsxs(or,{children:[l.jsx(Ce,{fontWeight:600,children:t}),r&&l.jsx(Ce,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),l.jsx(Ye,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function iP({children:e}){const{isOpen:t,onOpen:n,onClose:r}=ho(),{t:o}=X(),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.pinOptions.title"),desc:o("hotkeys.pinOptions.desc"),hotkey:"Shift+O"},{title:o("hotkeys.toggleViewer.title"),desc:o("hotkeys.toggleViewer.desc"),hotkey:"Z"},{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"},{title:o("hotkeys.consoleToggle.title"),desc:o("hotkeys.consoleToggle.desc"),hotkey:"`"}],c=[{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.restoreFaces.title"),desc:o("hotkeys.restoreFaces.desc"),hotkey:"Shift+R"},{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"}],u=[{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.toggleGalleryPin.title"),desc:o("hotkeys.toggleGalleryPin.desc"),hotkey:"Shift+G"},{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"}],f=[{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=h=>l.jsx(B,{flexDir:"column",gap:4,children:h.map((y,x)=>l.jsxs(B,{flexDir:"column",px:2,gap:4,children:[l.jsx(oP,{title:y.title,description:y.desc,hotkey:y.hotkey}),x{const{children:n,tooltip:r="",tooltipProps:o,isChecked:s,...c}=e;return l.jsx(Gt,{label:r,...o,children:l.jsx(ti,{ref:t,"aria-checked":s,...c,children:n})})}),Je=g.memo(aP),sP=e=>{const{label:t="",isDisabled:n=!1,isInvalid:r,formControlProps:o,...s}=e;return l.jsxs(rt,{isInvalid:r,isDisabled:n,...o,children:[t!==""&&l.jsx(st,{children:t}),l.jsx(xh,{...s})]})},mt=g.memo(sP),n0=/^-?(0\.)?\.?$/,lP=e=>{const{label:t,isDisabled:n=!1,showStepper:r=!0,isInvalid:o,value:s,onChange:c,min:u,max:f,isInteger:p=!0,formControlProps:h,formLabelProps:y,numberInputFieldProps:x,numberInputStepperProps:S,tooltipProps:C,...k}=e,[w,j]=g.useState(String(s));g.useEffect(()=>{!w.match(n0)&&s!==Number(w)&&j(String(s))},[s,w]);const I=M=>{j(M),M.match(n0)||c(p?Math.floor(Number(M)):Number(M))},P=M=>{const T=ee.clamp(p?Math.floor(Number(M.target.value)):Number(M.target.value),u,f);j(String(T)),c(T)};return l.jsx(Gt,{...C,children:l.jsxs(rt,{isDisabled:n,isInvalid:o,...h,children:[t&&l.jsx(st,{...y,children:t}),l.jsxs(Rh,{value:w,min:u,max:f,keepWithinRange:!0,clampValueOnBlur:!1,onChange:I,onBlur:P,...k,children:[l.jsx(Fh,{...x}),r&&l.jsxs(Nh,{children:[l.jsx(Bh,{...S}),l.jsx(Lh,{...S})]})]})]})})},Wr=g.memo(lP);var r0=Array.isArray,o0=Object.keys,cP=Object.prototype.hasOwnProperty,uP=typeof Element<"u";function Rf(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var n=r0(e),r=r0(t),o,s,c;if(n&&r){if(s=e.length,s!=t.length)return!1;for(o=s;o--!==0;)if(!Rf(e[o],t[o]))return!1;return!0}if(n!=r)return!1;var u=e instanceof Date,f=t instanceof Date;if(u!=f)return!1;if(u&&f)return e.getTime()==t.getTime();var p=e instanceof RegExp,h=t instanceof RegExp;if(p!=h)return!1;if(p&&h)return e.toString()==t.toString();var y=o0(e);if(s=y.length,s!==o0(t).length)return!1;for(o=s;o--!==0;)if(!cP.call(t,y[o]))return!1;if(uP&&e instanceof Element&&t instanceof Element)return e===t;for(o=s;o--!==0;)if(c=y[o],!(c==="_owner"&&e.$$typeof)&&!Rf(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}var io=function(t,n){try{return Rf(t,n)}catch(r){if(r.message&&r.message.match(/stack|recursion/i)||r.number===-2146828260)return console.warn("Warning: react-fast-compare does not handle circular references.",r.name,r.message),!1;throw r}},dP=function(t){return fP(t)&&!hP(t)};function fP(e){return!!e&&typeof e=="object"}function hP(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||vP(e)}var pP=typeof Symbol=="function"&&Symbol.for,mP=pP?Symbol.for("react.element"):60103;function vP(e){return e.$$typeof===mP}function gP(e){return Array.isArray(e)?[]:{}}function fc(e,t){return t.clone!==!1&&t.isMergeableObject(e)?Za(gP(e),e,t):e}function yP(e,t,n){return e.concat(t).map(function(r){return fc(r,n)})}function xP(e,t,n){var r={};return n.isMergeableObject(e)&&Object.keys(e).forEach(function(o){r[o]=fc(e[o],n)}),Object.keys(t).forEach(function(o){!n.isMergeableObject(t[o])||!e[o]?r[o]=fc(t[o],n):r[o]=Za(e[o],t[o],n)}),r}function Za(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||yP,n.isMergeableObject=n.isMergeableObject||dP;var r=Array.isArray(t),o=Array.isArray(e),s=r===o;return s?r?n.arrayMerge(e,t,n):xP(e,t,n):fc(t,n)}Za.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return Za(r,o,n)},{})};var Nf=Za,bP=typeof global=="object"&&global&&global.Object===Object&&global;const qx=bP;var SP=typeof self=="object"&&self&&self.Object===Object&&self,CP=qx||SP||Function("return this")();const Pr=CP;var wP=Pr.Symbol;const vo=wP;var Yx=Object.prototype,kP=Yx.hasOwnProperty,jP=Yx.toString,_a=vo?vo.toStringTag:void 0;function EP(e){var t=kP.call(e,_a),n=e[_a];try{e[_a]=void 0;var r=!0}catch{}var o=jP.call(e);return r&&(t?e[_a]=n:delete e[_a]),o}var PP=Object.prototype,IP=PP.toString;function MP(e){return IP.call(e)}var TP="[object Null]",_P="[object Undefined]",i0=vo?vo.toStringTag:void 0;function oi(e){return e==null?e===void 0?_P:TP:i0&&i0 in Object(e)?EP(e):MP(e)}function Kx(e,t){return function(n){return e(t(n))}}var DP=Kx(Object.getPrototypeOf,Object);const ep=DP;function ii(e){return e!=null&&typeof e=="object"}var AP="[object Object]",OP=Function.prototype,zP=Object.prototype,Xx=OP.toString,RP=zP.hasOwnProperty,NP=Xx.call(Object);function a0(e){if(!ii(e)||oi(e)!=AP)return!1;var t=ep(e);if(t===null)return!0;var n=RP.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Xx.call(n)==NP}function FP(){this.__data__=[],this.size=0}function Qx(e,t){return e===t||e!==e&&t!==t}function zc(e,t){for(var n=e.length;n--;)if(Qx(e[n][0],t))return n;return-1}var LP=Array.prototype,BP=LP.splice;function HP(e){var t=this.__data__,n=zc(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():BP.call(t,n,1),--this.size,!0}function WP(e){var t=this.__data__,n=zc(t,e);return n<0?void 0:t[n][1]}function VP(e){return zc(this.__data__,e)>-1}function UP(e,t){var n=this.__data__,r=zc(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function $r(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=QI}var ZI="[object Arguments]",JI="[object Array]",eM="[object Boolean]",tM="[object Date]",nM="[object Error]",rM="[object Function]",oM="[object Map]",iM="[object Number]",aM="[object Object]",sM="[object RegExp]",lM="[object Set]",cM="[object String]",uM="[object WeakMap]",dM="[object ArrayBuffer]",fM="[object DataView]",hM="[object Float32Array]",pM="[object Float64Array]",mM="[object Int8Array]",vM="[object Int16Array]",gM="[object Int32Array]",yM="[object Uint8Array]",xM="[object Uint8ClampedArray]",bM="[object Uint16Array]",SM="[object Uint32Array]",wt={};wt[hM]=wt[pM]=wt[mM]=wt[vM]=wt[gM]=wt[yM]=wt[xM]=wt[bM]=wt[SM]=!0;wt[ZI]=wt[JI]=wt[dM]=wt[eM]=wt[fM]=wt[tM]=wt[nM]=wt[rM]=wt[oM]=wt[iM]=wt[aM]=wt[sM]=wt[lM]=wt[cM]=wt[uM]=!1;function CM(e){return ii(e)&&o4(e.length)&&!!wt[oi(e)]}function tp(e){return function(t){return e(t)}}var i4=typeof exports=="object"&&exports&&!exports.nodeType&&exports,La=i4&&typeof module=="object"&&module&&!module.nodeType&&module,wM=La&&La.exports===i4,Nd=wM&&qx.process,kM=function(){try{var e=La&&La.require&&La.require("util").types;return e||Nd&&Nd.binding&&Nd.binding("util")}catch{}}();const Xi=kM;var f0=Xi&&Xi.isTypedArray,jM=f0?tp(f0):CM;const EM=jM;var PM=Object.prototype,IM=PM.hasOwnProperty;function a4(e,t){var n=ys(e),r=!n&&WI(e),o=!n&&!r&&r4(e),s=!n&&!r&&!o&&EM(e),c=n||r||o||s,u=c?NI(e.length,String):[],f=u.length;for(var p in e)(t||IM.call(e,p))&&!(c&&(p=="length"||o&&(p=="offset"||p=="parent")||s&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||XI(p,f)))&&u.push(p);return u}var MM=Object.prototype;function np(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||MM;return e===n}var TM=Kx(Object.keys,Object);const _M=TM;var DM=Object.prototype,AM=DM.hasOwnProperty;function OM(e){if(!np(e))return _M(e);var t=[];for(var n in Object(e))AM.call(e,n)&&n!="constructor"&&t.push(n);return t}function s4(e){return e!=null&&o4(e.length)&&!Zx(e)}function rp(e){return s4(e)?a4(e):OM(e)}function zM(e,t){return e&&Nc(t,rp(t),e)}function RM(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var NM=Object.prototype,FM=NM.hasOwnProperty;function LM(e){if(!gs(e))return RM(e);var t=np(e),n=[];for(var r in e)r=="constructor"&&(t||!FM.call(e,r))||n.push(r);return n}function op(e){return s4(e)?a4(e,!0):LM(e)}function BM(e,t){return e&&Nc(t,op(t),e)}var l4=typeof exports=="object"&&exports&&!exports.nodeType&&exports,h0=l4&&typeof module=="object"&&module&&!module.nodeType&&module,HM=h0&&h0.exports===l4,p0=HM?Pr.Buffer:void 0,m0=p0?p0.allocUnsafe:void 0;function WM(e,t){if(t)return e.slice();var n=e.length,r=m0?m0(n):new e.constructor(n);return e.copy(r),r}function c4(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n=0)&&(n[o]=e[o]);return n}function _0(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var D0=function(t){return Array.isArray(t)&&t.length===0},kn=function(t){return typeof t=="function"},Fc=function(t){return t!==null&&typeof t=="object"},B_=function(t){return String(Math.floor(Number(t)))===t},Fd=function(t){return Object.prototype.toString.call(t)==="[object String]"},b4=function(t){return g.Children.count(t)===0},Ld=function(t){return Fc(t)&&kn(t.then)};function en(e,t,n,r){r===void 0&&(r=0);for(var o=x4(t);e&&r=0?[]:{}}}return(s===0?e:o)[c[s]]===n?e:(n===void 0?delete o[c[s]]:o[c[s]]=n,s===0&&n===void 0&&delete r[c[s]],r)}function S4(e,t,n,r){n===void 0&&(n=new WeakMap),r===void 0&&(r={});for(var o=0,s=Object.keys(e);o0?ue.map(function(ke){return R(ke,en(N,ke))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(xe).then(function(ke){return ke.reduce(function(q,ae,Oe){return ae==="DO_NOT_DELETE_YOU_WILL_BE_FIRED"||ae&&(q=Cr(q,ue[Oe],ae)),q},{})})},[R]),F=g.useCallback(function(N){return Promise.all([V(N),x.validationSchema?_(N):{},x.validate?D(N):{}]).then(function(ue){var xe=ue[0],ke=ue[1],q=ue[2],ae=Nf.all([xe,ke,q],{arrayMerge:G_});return ae})},[x.validate,x.validationSchema,V,D,_]),L=Bn(function(N){return N===void 0&&(N=M.values),T({type:"SET_ISVALIDATING",payload:!0}),F(N).then(function(ue){return j.current&&(T({type:"SET_ISVALIDATING",payload:!1}),T({type:"SET_ERRORS",payload:ue})),ue})});g.useEffect(function(){c&&j.current===!0&&io(S.current,x.initialValues)&&L(S.current)},[c,L]);var Q=g.useCallback(function(N){var ue=N&&N.values?N.values:S.current,xe=N&&N.errors?N.errors:C.current?C.current:x.initialErrors||{},ke=N&&N.touched?N.touched:k.current?k.current:x.initialTouched||{},q=N&&N.status?N.status:w.current?w.current:x.initialStatus;S.current=ue,C.current=xe,k.current=ke,w.current=q;var ae=function(){T({type:"RESET_FORM",payload:{isSubmitting:!!N&&!!N.isSubmitting,errors:xe,touched:ke,status:q,values:ue,isValidating:!!N&&!!N.isValidating,submitCount:N&&N.submitCount&&typeof N.submitCount=="number"?N.submitCount:0}})};if(x.onReset){var Oe=x.onReset(M.values,ge);Ld(Oe)?Oe.then(ae):ae()}else ae()},[x.initialErrors,x.initialStatus,x.initialTouched]);g.useEffect(function(){j.current===!0&&!io(S.current,x.initialValues)&&(p&&(S.current=x.initialValues,Q()),c&&L(S.current))},[p,x.initialValues,Q,c,L]),g.useEffect(function(){p&&j.current===!0&&!io(C.current,x.initialErrors)&&(C.current=x.initialErrors||zo,T({type:"SET_ERRORS",payload:x.initialErrors||zo}))},[p,x.initialErrors]),g.useEffect(function(){p&&j.current===!0&&!io(k.current,x.initialTouched)&&(k.current=x.initialTouched||Dl,T({type:"SET_TOUCHED",payload:x.initialTouched||Dl}))},[p,x.initialTouched]),g.useEffect(function(){p&&j.current===!0&&!io(w.current,x.initialStatus)&&(w.current=x.initialStatus,T({type:"SET_STATUS",payload:x.initialStatus}))},[p,x.initialStatus,x.initialTouched]);var U=Bn(function(N){if(I.current[N]&&kn(I.current[N].validate)){var ue=en(M.values,N),xe=I.current[N].validate(ue);return Ld(xe)?(T({type:"SET_ISVALIDATING",payload:!0}),xe.then(function(ke){return ke}).then(function(ke){T({type:"SET_FIELD_ERROR",payload:{field:N,value:ke}}),T({type:"SET_ISVALIDATING",payload:!1})})):(T({type:"SET_FIELD_ERROR",payload:{field:N,value:xe}}),Promise.resolve(xe))}else if(x.validationSchema)return T({type:"SET_ISVALIDATING",payload:!0}),_(M.values,N).then(function(ke){return ke}).then(function(ke){T({type:"SET_FIELD_ERROR",payload:{field:N,value:ke[N]}}),T({type:"SET_ISVALIDATING",payload:!1})});return Promise.resolve()}),K=g.useCallback(function(N,ue){var xe=ue.validate;I.current[N]={validate:xe}},[]),te=g.useCallback(function(N){delete I.current[N]},[]),ne=Bn(function(N,ue){T({type:"SET_TOUCHED",payload:N});var xe=ue===void 0?o:ue;return xe?L(M.values):Promise.resolve()}),$=g.useCallback(function(N){T({type:"SET_ERRORS",payload:N})},[]),Z=Bn(function(N,ue){var xe=kn(N)?N(M.values):N;T({type:"SET_VALUES",payload:xe});var ke=ue===void 0?n:ue;return ke?L(xe):Promise.resolve()}),oe=g.useCallback(function(N,ue){T({type:"SET_FIELD_ERROR",payload:{field:N,value:ue}})},[]),le=Bn(function(N,ue,xe){T({type:"SET_FIELD_VALUE",payload:{field:N,value:ue}});var ke=xe===void 0?n:xe;return ke?L(Cr(M.values,N,ue)):Promise.resolve()}),Re=g.useCallback(function(N,ue){var xe=ue,ke=N,q;if(!Fd(N)){N.persist&&N.persist();var ae=N.target?N.target:N.currentTarget,Oe=ae.type,Ze=ae.name,J=ae.id,Le=ae.value,nt=ae.checked,Nt=ae.outerHTML,he=ae.options,_e=ae.multiple;xe=ue||Ze||J,ke=/number|range/.test(Oe)?(q=parseFloat(Le),isNaN(q)?"":q):/checkbox/.test(Oe)?Y_(en(M.values,xe),nt,Le):he&&_e?q_(he):Le}xe&&le(xe,ke)},[le,M.values]),Ne=Bn(function(N){if(Fd(N))return function(ue){return Re(ue,N)};Re(N)}),Ie=Bn(function(N,ue,xe){ue===void 0&&(ue=!0),T({type:"SET_FIELD_TOUCHED",payload:{field:N,value:ue}});var ke=xe===void 0?o:xe;return ke?L(M.values):Promise.resolve()}),pe=g.useCallback(function(N,ue){N.persist&&N.persist();var xe=N.target,ke=xe.name,q=xe.id,ae=xe.outerHTML,Oe=ue||ke||q;Ie(Oe,!0)},[Ie]),ce=Bn(function(N){if(Fd(N))return function(ue){return pe(ue,N)};pe(N)}),Fe=g.useCallback(function(N){kn(N)?T({type:"SET_FORMIK_STATE",payload:N}):T({type:"SET_FORMIK_STATE",payload:function(){return N}})},[]),Ve=g.useCallback(function(N){T({type:"SET_STATUS",payload:N})},[]),Ue=g.useCallback(function(N){T({type:"SET_ISSUBMITTING",payload:N})},[]),$e=Bn(function(){return T({type:"SUBMIT_ATTEMPT"}),L().then(function(N){var ue=N instanceof Error,xe=!ue&&Object.keys(N).length===0;if(xe){var ke;try{if(ke=Te(),ke===void 0)return}catch(q){throw q}return Promise.resolve(ke).then(function(q){return j.current&&T({type:"SUBMIT_SUCCESS"}),q}).catch(function(q){if(j.current)throw T({type:"SUBMIT_FAILURE"}),q})}else if(j.current&&(T({type:"SUBMIT_FAILURE"}),ue))throw N})}),Qe=Bn(function(N){N&&N.preventDefault&&kn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&kn(N.stopPropagation)&&N.stopPropagation(),$e().catch(function(ue){console.warn("Warning: An unhandled error was caught from submitForm()",ue)})}),ge={resetForm:Q,validateForm:L,validateField:U,setErrors:$,setFieldError:oe,setFieldTouched:Ie,setFieldValue:le,setStatus:Ve,setSubmitting:Ue,setTouched:ne,setValues:Z,setFormikState:Fe,submitForm:$e},Te=Bn(function(){return h(M.values,ge)}),Ge=Bn(function(N){N&&N.preventDefault&&kn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&kn(N.stopPropagation)&&N.stopPropagation(),Q()}),ye=g.useCallback(function(N){return{value:en(M.values,N),error:en(M.errors,N),touched:!!en(M.touched,N),initialValue:en(S.current,N),initialTouched:!!en(k.current,N),initialError:en(C.current,N)}},[M.errors,M.touched,M.values]),Pe=g.useCallback(function(N){return{setValue:function(xe,ke){return le(N,xe,ke)},setTouched:function(xe,ke){return Ie(N,xe,ke)},setError:function(xe){return oe(N,xe)}}},[le,Ie,oe]),et=g.useCallback(function(N){var ue=Fc(N),xe=ue?N.name:N,ke=en(M.values,xe),q={name:xe,value:ke,onChange:Ne,onBlur:ce};if(ue){var ae=N.type,Oe=N.value,Ze=N.as,J=N.multiple;ae==="checkbox"?Oe===void 0?q.checked=!!ke:(q.checked=!!(Array.isArray(ke)&&~ke.indexOf(Oe)),q.value=Oe):ae==="radio"?(q.checked=ke===Oe,q.value=Oe):Ze==="select"&&J&&(q.value=q.value||[],q.multiple=!0)}return q},[ce,Ne,M.values]),Be=g.useMemo(function(){return!io(S.current,M.values)},[S.current,M.values]),vt=g.useMemo(function(){return typeof u<"u"?Be?M.errors&&Object.keys(M.errors).length===0:u!==!1&&kn(u)?u(x):u:M.errors&&Object.keys(M.errors).length===0},[u,Be,M.errors,x]),Rt=ht({},M,{initialValues:S.current,initialErrors:C.current,initialTouched:k.current,initialStatus:w.current,handleBlur:ce,handleChange:Ne,handleReset:Ge,handleSubmit:Qe,resetForm:Q,setErrors:$,setFormikState:Fe,setFieldTouched:Ie,setFieldValue:le,setFieldError:oe,setStatus:Ve,setSubmitting:Ue,setTouched:ne,setValues:Z,submitForm:$e,validateForm:L,validateField:U,isValid:vt,dirty:Be,unregisterField:te,registerField:K,getFieldProps:et,getFieldMeta:ye,getFieldHelpers:Pe,validateOnBlur:o,validateOnChange:n,validateOnMount:c});return Rt}function xs(e){var t=V_(e),n=e.component,r=e.children,o=e.render,s=e.innerRef;return g.useImperativeHandle(s,function(){return t}),g.createElement(H_,{value:t},n?g.createElement(n,t):o?o(t):r?kn(r)?r(t):b4(r)?null:g.Children.only(r):null)}function U_(e){var t={};if(e.inner){if(e.inner.length===0)return Cr(t,e.path,e.message);for(var o=e.inner,n=Array.isArray(o),r=0,o=n?o:o[Symbol.iterator]();;){var s;if(n){if(r>=o.length)break;s=o[r++]}else{if(r=o.next(),r.done)break;s=r.value}var c=s;en(t,c.path)||(t=Cr(t,c.path,c.message))}}return t}function $_(e,t,n,r){n===void 0&&(n=!1),r===void 0&&(r={});var o=Wf(e);return t[n?"validateSync":"validate"](o,{abortEarly:!1,context:r})}function Wf(e){var t=Array.isArray(e)?[]:{};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=String(n);Array.isArray(e[r])===!0?t[r]=e[r].map(function(o){return Array.isArray(o)===!0||a0(o)?Wf(o):o!==""?o:void 0}):a0(e[r])?t[r]=Wf(e[r]):t[r]=e[r]!==""?e[r]:void 0}return t}function G_(e,t,n){var r=e.slice();return t.forEach(function(s,c){if(typeof r[c]>"u"){var u=n.clone!==!1,f=u&&n.isMergeableObject(s);r[c]=f?Nf(Array.isArray(s)?[]:{},s,n):s}else n.isMergeableObject(s)?r[c]=Nf(e[c],s,n):e.indexOf(s)===-1&&r.push(s)}),r}function q_(e){return Array.from(e).filter(function(t){return t.selected}).map(function(t){return t.value})}function Y_(e,t,n){if(typeof e=="boolean")return Boolean(t);var r=[],o=!1,s=-1;if(Array.isArray(e))r=e,s=e.indexOf(n),o=s>=0;else if(!n||n=="true"||n=="false")return Boolean(t);return t&&n&&!o?r.concat(n):o?r.slice(0,s).concat(r.slice(s+1)):r}var K_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?g.useLayoutEffect:g.useEffect;function Bn(e){var t=g.useRef(e);return K_(function(){t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;or?o:r},0);return Array.from(ht({},t,{length:n+1}))}else return[]},eD=function(e){L_(t,e);function t(r){var o;return o=e.call(this,r)||this,o.updateArrayField=function(s,c,u){var f=o.props,p=f.name,h=f.formik.setFormikState;h(function(y){var x=typeof u=="function"?u:s,S=typeof c=="function"?c:s,C=Cr(y.values,p,s(en(y.values,p))),k=u?x(en(y.errors,p)):void 0,w=c?S(en(y.touched,p)):void 0;return D0(k)&&(k=void 0),D0(w)&&(w=void 0),ht({},y,{values:C,errors:u?Cr(y.errors,p,k):y.errors,touched:c?Cr(y.touched,p,w):y.touched})})},o.push=function(s){return o.updateArrayField(function(c){return[].concat(Qi(c),[F_(s)])},!1,!1)},o.handlePush=function(s){return function(){return o.push(s)}},o.swap=function(s,c){return o.updateArrayField(function(u){return Z_(u,s,c)},!0,!0)},o.handleSwap=function(s,c){return function(){return o.swap(s,c)}},o.move=function(s,c){return o.updateArrayField(function(u){return Q_(u,s,c)},!0,!0)},o.handleMove=function(s,c){return function(){return o.move(s,c)}},o.insert=function(s,c){return o.updateArrayField(function(u){return Bd(u,s,c)},function(u){return Bd(u,s,null)},function(u){return Bd(u,s,null)})},o.handleInsert=function(s,c){return function(){return o.insert(s,c)}},o.replace=function(s,c){return o.updateArrayField(function(u){return J_(u,s,c)},!1,!1)},o.handleReplace=function(s,c){return function(){return o.replace(s,c)}},o.unshift=function(s){var c=-1;return o.updateArrayField(function(u){var f=u?[s].concat(u):[s];return c<0&&(c=f.length),f},function(u){var f=u?[null].concat(u):[null];return c<0&&(c=f.length),f},function(u){var f=u?[null].concat(u):[null];return c<0&&(c=f.length),f}),c},o.handleUnshift=function(s){return function(){return o.unshift(s)}},o.handleRemove=function(s){return function(){return o.remove(s)}},o.handlePop=function(){return function(){return o.pop()}},o.remove=o.remove.bind(_0(o)),o.pop=o.pop.bind(_0(o)),o}var n=t.prototype;return n.componentDidUpdate=function(o){this.props.validateOnChange&&this.props.formik.validateOnChange&&!io(en(o.formik.values,o.name),en(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},n.remove=function(o){var s;return this.updateArrayField(function(c){var u=c?Qi(c):[];return s||(s=u[o]),kn(u.splice)&&u.splice(o,1),u},!0,!0),s},n.pop=function(){var o;return this.updateArrayField(function(s){var c=s;return o||(o=c&&c.pop&&c.pop()),c},!0,!0),o},n.render=function(){var o={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},s=this.props,c=s.component,u=s.render,f=s.children,p=s.name,h=s.formik,y=Ho(h,["validate","validationSchema"]),x=ht({},o,{form:y,name:p});return c?g.createElement(c,x):u?u(x):f?typeof f=="function"?f(x):b4(f)?null:g.Children.only(f):null},t}(g.Component);eD.defaultProps={validateOnChange:!0};const tD=fe((e,t)=>{const{acceptButtonText:n="Accept",acceptCallback:r,cancelButtonText:o="Cancel",cancelCallback:s,children:c,title:u,triggerComponent:f}=e,{isOpen:p,onOpen:h,onClose:y}=ho(),x=g.useRef(null),S=()=>{r(),y()},C=()=>{s&&s(),y()};return l.jsxs(l.Fragment,{children:[g.cloneElement(f,{onClick:h,ref:t}),l.jsx(Gy,{isOpen:p,leastDestructiveRef:x,onClose:y,children:l.jsx(Br,{children:l.jsxs(qy,{children:[l.jsx(Lr,{fontSize:"lg",fontWeight:"bold",children:u}),l.jsx(Hr,{children:c}),l.jsxs(Fr,{children:[l.jsx(Je,{ref:x,onClick:C,children:o}),l.jsx(Je,{colorScheme:"error",onClick:S,ml:3,children:n})]})]})})})]})}),Bc=g.memo(tD);function nD(e){const{model:t}=e,r=A(C=>C.system.model_list)[t],o=Y(),{t:s}=X(),c=A(C=>C.system.isProcessing),u=A(C=>C.system.isConnected),[f,p]=g.useState("same"),[h,y]=g.useState("");g.useEffect(()=>{p("same")},[t]);const x=()=>{p("same")},S=()=>{o(WS({model_name:t,save_location:f,custom_location:f==="custom"&&h!==""?h:null}))};return l.jsxs(Bc,{title:`${s("modelManager.convert")} ${t}`,acceptCallback:S,cancelCallback:x,acceptButtonText:`${s("modelManager.convert")}`,triggerComponent:l.jsxs(Je,{size:"sm","aria-label":s("modelManager.convertToDiffusers"),isDisabled:r.status==="active"||c||!u,className:" modal-close-btn",marginInlineEnd:8,children:["🧨 ",s("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[l.jsxs(B,{flexDirection:"column",rowGap:4,children:[l.jsx(Ce,{children:s("modelManager.convertToDiffusersHelpText1")}),l.jsxs(py,{children:[l.jsx(za,{children:s("modelManager.convertToDiffusersHelpText2")}),l.jsx(za,{children:s("modelManager.convertToDiffusersHelpText3")}),l.jsx(za,{children:s("modelManager.convertToDiffusersHelpText4")}),l.jsx(za,{children:s("modelManager.convertToDiffusersHelpText5")})]}),l.jsx(Ce,{children:s("modelManager.convertToDiffusersHelpText6")})]}),l.jsxs(B,{flexDir:"column",gap:4,children:[l.jsxs(B,{marginTop:4,flexDir:"column",gap:2,children:[l.jsx(Ce,{fontWeight:"600",children:s("modelManager.convertToDiffusersSaveLocation")}),l.jsx(Xa,{value:f,onChange:C=>p(C),children:l.jsxs(B,{gap:4,children:[l.jsx(vn,{value:"same",children:l.jsx(Gt,{label:"Save converted model in the same folder",children:s("modelManager.sameFolder")})}),l.jsx(vn,{value:"root",children:l.jsx(Gt,{label:"Save converted model in the InvokeAI root folder",children:s("modelManager.invokeRoot")})}),l.jsx(vn,{value:"custom",children:l.jsx(Gt,{label:"Save converted model in a custom folder",children:s("modelManager.custom")})})]})})]}),f==="custom"&&l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:s("modelManager.customSaveLocation")}),l.jsx(mt,{value:h,onChange:C=>{C.target.value!==""&&y(C.target.value)},width:"full"})]})]})]})}function er(e){const{children:t,...n}=e;return l.jsx(pn,{margin:0,color:"base.400",...n,children:t})}function tr(e){const{children:t,...n}=e;return l.jsx(mn,{color:"error.400",...n,children:t})}const rD=me([Et],e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),A0=64,O0=2048;function oD(){const{openModel:e,model_list:t}=A(rD),n=A(f=>f.system.isProcessing),r=Y(),{t:o}=X(),[s,c]=g.useState({name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,default:!1,format:"ckpt"});g.useEffect(()=>{var f,p,h,y,x,S,C;if(e){const k=ee.pickBy(t,(w,j)=>ee.isEqual(j,e));c({name:e,description:(f=k[e])==null?void 0:f.description,config:(p=k[e])==null?void 0:p.config,weights:(h=k[e])==null?void 0:h.weights,vae:(y=k[e])==null?void 0:y.vae,width:(x=k[e])==null?void 0:x.width,height:(S=k[e])==null?void 0:S.height,default:(C=k[e])==null?void 0:C.default,format:"ckpt"})}},[t,e]);const u=f=>{r(rs({...f,width:Number(f.width),height:Number(f.height)}))};return e?l.jsxs(B,{flexDirection:"column",rowGap:4,width:"100%",children:[l.jsxs(B,{alignItems:"center",gap:4,justifyContent:"space-between",children:[l.jsx(Ce,{fontSize:"lg",fontWeight:"bold",children:e}),l.jsx(nD,{model:e})]}),l.jsx(B,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",paddingInlineEnd:8,children:l.jsx(xs,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:p,touched:h})=>l.jsx("form",{onSubmit:f,children:l.jsxs(ze,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!p.description&&h.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:o("modelManager.description")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),p.description&&h.description?l.jsx(tr,{children:p.description}):l.jsx(er,{children:o("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.config&&h.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:o("modelManager.config")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"config",name:"config",type:"text",width:"full"}),p.config&&h.config?l.jsx(tr,{children:p.config}):l.jsx(er,{children:o("modelManager.configValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.weights&&h.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:o("modelManager.modelLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"weights",name:"weights",type:"text",width:"full"}),p.weights&&h.weights?l.jsx(tr,{children:p.weights}):l.jsx(er,{children:o("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.vae&&h.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:o("modelManager.vaeLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"vae",name:"vae",type:"text",width:"full"}),p.vae&&h.vae?l.jsx(tr,{children:p.vae}):l.jsx(er,{children:o("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(ra,{width:"100%",children:[l.jsxs(rt,{isInvalid:!!p.width&&h.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:o("modelManager.width")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{id:"width",name:"width",children:({field:y,form:x})=>l.jsx(Wr,{id:"width",name:"width",min:A0,max:O0,step:64,value:x.values.width,onChange:S=>x.setFieldValue(y.name,Number(S))})}),p.width&&h.width?l.jsx(tr,{children:p.width}):l.jsx(er,{children:o("modelManager.widthValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.height&&h.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:o("modelManager.height")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{id:"height",name:"height",children:({field:y,form:x})=>l.jsx(Wr,{id:"height",name:"height",min:A0,max:O0,step:64,value:x.values.height,onChange:S=>x.setFieldValue(y.name,Number(S))})}),p.height&&h.height?l.jsx(tr,{children:p.height}):l.jsx(er,{children:o("modelManager.heightValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:o("modelManager.updateModel")})]})})})})]}):l.jsx(B,{sx:{width:"100%",justifyContent:"center",alignItems:"center",borderRadius:"base",bg:"base.900"},children:l.jsx(Ce,{fontWeight:500,children:"Pick A Model To Edit"})})}const iD=me([Et],e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function aD(){const{openModel:e,model_list:t}=A(iD),n=A(f=>f.system.isProcessing),r=Y(),{t:o}=X(),[s,c]=g.useState({name:"",description:"",repo_id:"",path:"",vae:{repo_id:"",path:""},default:!1,format:"diffusers"});g.useEffect(()=>{var f,p,h,y,x,S,C,k,w,j,I,P,M,T,D,_;if(e){const R=ee.pickBy(t,(V,F)=>ee.isEqual(F,e));c({name:e,description:(f=R[e])==null?void 0:f.description,path:(p=R[e])!=null&&p.path&&((h=R[e])==null?void 0:h.path)!=="None"?(y=R[e])==null?void 0:y.path:"",repo_id:(x=R[e])!=null&&x.repo_id&&((S=R[e])==null?void 0:S.repo_id)!=="None"?(C=R[e])==null?void 0:C.repo_id:"",vae:{repo_id:(w=(k=R[e])==null?void 0:k.vae)!=null&&w.repo_id?(I=(j=R[e])==null?void 0:j.vae)==null?void 0:I.repo_id:"",path:(M=(P=R[e])==null?void 0:P.vae)!=null&&M.path?(D=(T=R[e])==null?void 0:T.vae)==null?void 0:D.path:""},default:(_=R[e])==null?void 0:_.default,format:"diffusers"})}},[t,e]);const u=f=>{const p=f;f.path===""&&delete p.path,f.repo_id===""&&delete p.repo_id,f.vae.path===""&&delete p.vae.path,f.vae.repo_id===""&&delete p.vae.repo_id,r(rs(f))};return e?l.jsxs(B,{flexDirection:"column",rowGap:4,width:"100%",children:[l.jsx(B,{alignItems:"center",children:l.jsx(Ce,{fontSize:"lg",fontWeight:"bold",children:e})}),l.jsx(B,{flexDirection:"column",overflowY:"scroll",paddingInlineEnd:8,children:l.jsx(xs,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:p,touched:h})=>{var y,x,S,C,k,w,j,I,P,M;return l.jsx("form",{onSubmit:f,children:l.jsxs(ze,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!p.description&&h.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:o("modelManager.description")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),p.description&&h.description?l.jsx(tr,{children:p.description}):l.jsx(er,{children:o("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.path&&h.path,isRequired:!0,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:o("modelManager.modelLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"path",name:"path",type:"text",width:"full"}),p.path&&h.path?l.jsx(tr,{children:p.path}):l.jsx(er,{children:o("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.repo_id&&h.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:o("modelManager.repo_id")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"full"}),p.repo_id&&h.repo_id?l.jsx(tr,{children:p.repo_id}):l.jsx(er,{children:o("modelManager.repoIDValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((y=p.vae)!=null&&y.path)&&((x=h.vae)==null?void 0:x.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:o("modelManager.vaeLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"full"}),(S=p.vae)!=null&&S.path&&((C=h.vae)!=null&&C.path)?l.jsx(tr,{children:(k=p.vae)==null?void 0:k.path}):l.jsx(er,{children:o("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((w=p.vae)!=null&&w.repo_id)&&((j=h.vae)==null?void 0:j.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:o("modelManager.vaeRepoID")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"full"}),(I=p.vae)!=null&&I.repo_id&&((P=h.vae)!=null&&P.repo_id)?l.jsx(tr,{children:(M=p.vae)==null?void 0:M.repo_id}):l.jsx(er,{children:o("modelManager.vaeRepoIDValidationMsg")})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:o("modelManager.updateModel")})]})})}})})]}):l.jsx(B,{sx:{width:"100%",justifyContent:"center",alignItems:"center",borderRadius:"base",bg:"base.900"},children:l.jsx(Ce,{fontWeight:"500",children:"Pick A Model To Edit"})})}const sD=e=>{const{label:t,...n}=e;return l.jsx(k2,{colorScheme:"accent",...n,children:t})},pt=g.memo(sD);function w4(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M21 11H6.414l5.293-5.293-1.414-1.414L2.586 12l7.707 7.707 1.414-1.414L6.414 13H21z"}}]})(e)}function lD(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M19.002 3h-14c-1.103 0-2 .897-2 2v4h2V5h14v14h-14v-4h-2v4c0 1.103.897 2 2 2h14c1.103 0 2-.897 2-2V5c0-1.103-.898-2-2-2z"}},{tag:"path",attr:{d:"m11 16 5-4-5-4v3.001H3v2h8z"}}]})(e)}function up(e){return ve({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)}function cD(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M6.758 8.758 5.344 7.344a8.048 8.048 0 0 0-1.841 2.859l1.873.701a6.048 6.048 0 0 1 1.382-2.146zM19 12.999a7.935 7.935 0 0 0-2.344-5.655A7.917 7.917 0 0 0 12 5.069V2L7 6l5 4V7.089a5.944 5.944 0 0 1 3.242 1.669A5.956 5.956 0 0 1 17 13v.002c0 .33-.033.655-.086.977-.007.043-.011.088-.019.131a6.053 6.053 0 0 1-1.138 2.536c-.16.209-.331.412-.516.597a5.954 5.954 0 0 1-.728.613 5.906 5.906 0 0 1-2.277 1.015c-.142.03-.285.05-.43.069-.062.009-.122.021-.184.027a6.104 6.104 0 0 1-1.898-.103L9.3 20.819a8.087 8.087 0 0 0 2.534.136c.069-.007.138-.021.207-.03.205-.026.409-.056.61-.098l.053-.009-.001-.005a7.877 7.877 0 0 0 2.136-.795l.001.001.028-.019a7.906 7.906 0 0 0 1.01-.67c.27-.209.532-.43.777-.675.248-.247.47-.513.681-.785.021-.028.049-.053.07-.081l-.006-.004a7.899 7.899 0 0 0 1.093-1.997l.008.003c.029-.078.05-.158.076-.237.037-.11.075-.221.107-.333.04-.14.073-.281.105-.423.022-.099.048-.195.066-.295.032-.171.056-.344.076-.516.01-.076.023-.15.03-.227.023-.249.037-.5.037-.753.002-.002.002-.004.002-.008zM6.197 16.597l-1.6 1.201a8.045 8.045 0 0 0 2.569 2.225l.961-1.754a6.018 6.018 0 0 1-1.93-1.672zM5 13c0-.145.005-.287.015-.429l-1.994-.143a7.977 7.977 0 0 0 .483 3.372l1.873-.701A5.975 5.975 0 0 1 5 13z"}}]})(e)}function uD(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M16.242 17.242a6.04 6.04 0 0 1-1.37 1.027l.961 1.754a8.068 8.068 0 0 0 2.569-2.225l-1.6-1.201a5.938 5.938 0 0 1-.56.645zm1.743-4.671a5.975 5.975 0 0 1-.362 2.528l1.873.701a7.977 7.977 0 0 0 .483-3.371l-1.994.142zm1.512-2.368a8.048 8.048 0 0 0-1.841-2.859l-1.414 1.414a6.071 6.071 0 0 1 1.382 2.146l1.873-.701zm-8.128 8.763c-.047-.005-.094-.015-.141-.021a6.701 6.701 0 0 1-.468-.075 5.923 5.923 0 0 1-2.421-1.122 5.954 5.954 0 0 1-.583-.506 6.138 6.138 0 0 1-.516-.597 5.91 5.91 0 0 1-.891-1.634 6.086 6.086 0 0 1-.247-.902c-.008-.043-.012-.088-.019-.131A6.332 6.332 0 0 1 6 13.002V13c0-1.603.624-3.109 1.758-4.242A5.944 5.944 0 0 1 11 7.089V10l5-4-5-4v3.069a7.917 7.917 0 0 0-4.656 2.275A7.936 7.936 0 0 0 4 12.999v.009c0 .253.014.504.037.753.007.076.021.15.03.227.021.172.044.345.076.516.019.1.044.196.066.295.032.142.065.283.105.423.032.112.07.223.107.333.026.079.047.159.076.237l.008-.003A7.948 7.948 0 0 0 5.6 17.785l-.007.005c.021.028.049.053.07.081.211.272.433.538.681.785a8.236 8.236 0 0 0 .966.816c.265.192.537.372.821.529l.028.019.001-.001a7.877 7.877 0 0 0 2.136.795l-.001.005.053.009c.201.042.405.071.61.098.069.009.138.023.207.03a8.038 8.038 0 0 0 2.532-.137l-.424-1.955a6.11 6.11 0 0 1-1.904.102z"}}]})(e)}function dD(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M11 6H9v3H6v2h3v3h2v-3h3V9h-3z"}},{tag:"path",attr:{d:"M10 2c-4.411 0-8 3.589-8 8s3.589 8 8 8a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8zm0 14c-3.309 0-6-2.691-6-6s2.691-6 6-6 6 2.691 6 6-2.691 6-6 6z"}}]})(e)}function fD(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M6 9h8v2H6z"}},{tag:"path",attr:{d:"M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"}}]})(e)}const k4=me([Et],e=>{const{model_list:t}=e,n=[];return ee.forEach(t,r=>{n.push(r.weights)}),n});function z0({model:e,modelsToAdd:t,setModelsToAdd:n}){const{t:r}=X(),o=A(k4),s=c=>{t.includes(c.target.value)?n(ee.remove(t,u=>u!==c.target.value)):n([...t,c.target.value])};return l.jsx(ze,{children:l.jsxs(B,{flexDirection:"column",gap:2,backgroundColor:t.includes(e.name)?"accent.650":"base.800",paddingX:4,paddingY:2,borderRadius:4,children:[l.jsxs(B,{gap:4,children:[l.jsx(pt,{value:e.name,label:l.jsx(Ce,{fontWeight:500,children:e.name}),isChecked:t.includes(e.name),isDisabled:o.includes(e.location),onChange:s}),o.includes(e.location)&&l.jsx(yy,{colorScheme:"accent",children:r("modelManager.modelExists")})]}),l.jsx(Ce,{fontStyle:"italic",variant:"subtext",children:e.location})]})})}function hD(){const e=Y(),{t}=X(),n=A(P=>P.system.searchFolder),r=A(P=>P.system.foundModels),o=A(k4),s=A(P=>P.ui.shouldShowExistingModelsInSearch),c=A(P=>P.system.isProcessing),[u,f]=Me.useState([]),[p,h]=Me.useState("v1"),[y,x]=Me.useState(""),S=()=>{e(US(null)),e($S(null)),f([])},C=P=>{e(Pv(P.checkpointFolder))},k=()=>{f([]),r&&r.forEach(P=>{o.includes(P.location)||f(M=>[...M,P.name])})},w=()=>{f([])},j=()=>{const P=r==null?void 0:r.filter(T=>u.includes(T.name)),M={v1:"configs/stable-diffusion/v1-inference.yaml",v2_base:"configs/stable-diffusion/v2-inference-v.yaml",v2_768:"configs/stable-diffusion/v2-inference-v.yaml",inpainting:"configs/stable-diffusion/v1-inpainting-inference.yaml",custom:y};P==null||P.forEach(T=>{const D={name:T.name,description:"",config:M[p],weights:T.location,vae:"",width:512,height:512,default:!1,format:"ckpt"};e(rs(D))}),f([])},I=()=>{const P=[],M=[];return r&&r.forEach((T,D)=>{o.includes(T.location)?M.push(l.jsx(z0,{model:T,modelsToAdd:u,setModelsToAdd:f},D)):P.push(l.jsx(z0,{model:T,modelsToAdd:u,setModelsToAdd:f},D))}),l.jsxs(l.Fragment,{children:[P,s&&M]})};return l.jsxs(l.Fragment,{children:[n?l.jsxs(B,{sx:{padding:4,gap:2,position:"relative",borderRadius:"base",alignItems:"center",w:"full",bg:"base.900"},children:[l.jsxs(B,{sx:{flexDir:"column",gap:2},children:[l.jsx(Ce,{sx:{fontWeight:500,fontSize:"sm"},variant:"subtext",children:t("modelManager.checkpointFolder")}),l.jsx(Ce,{sx:{fontWeight:500,fontSize:"sm"},children:n})]}),l.jsx(kc,{}),l.jsx(se,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:l.jsx(up,{}),fontSize:18,disabled:c,onClick:()=>e(Pv(n))}),l.jsx(se,{"aria-label":t("modelManager.clearCheckpointFolder"),icon:l.jsx(vs,{style:{transform:"rotate(45deg)"}}),onClick:S})]}):l.jsx(xs,{initialValues:{checkpointFolder:""},onSubmit:P=>{C(P)},children:({handleSubmit:P})=>l.jsx("form",{onSubmit:P,children:l.jsxs(ra,{columnGap:2,alignItems:"flex-end",width:"100%",children:[l.jsx(rt,{isRequired:!0,width:"lg",children:l.jsx(kt,{as:mt,id:"checkpointFolder",name:"checkpointFolder",type:"text",size:"md",label:t("modelManager.checkpointFolder")})}),l.jsx(Je,{leftIcon:l.jsx(B9,{}),"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),type:"submit",disabled:c,paddingX:10,children:t("modelManager.findModels")})]})})}),r&&l.jsxs(B,{flexDirection:"column",rowGap:4,width:"full",children:[l.jsxs(B,{justifyContent:"space-between",alignItems:"center",children:[l.jsxs("p",{children:[t("modelManager.modelsFound"),": ",r.length]}),l.jsxs("p",{children:[t("modelManager.selected"),": ",u.length]})]}),l.jsxs(B,{columnGap:2,justifyContent:"space-between",children:[l.jsxs(B,{columnGap:2,children:[l.jsx(Je,{isDisabled:u.length===r.length,onClick:k,children:t("modelManager.selectAll")}),l.jsx(Je,{isDisabled:u.length===0,onClick:w,children:t("modelManager.deselectAll")}),l.jsx(pt,{label:t("modelManager.showExisting"),isChecked:s,onChange:()=>e(VS(!s))})]}),l.jsx(Je,{isDisabled:u.length===0,onClick:j,colorScheme:"accent",children:t("modelManager.addSelected")})]}),l.jsxs(B,{sx:{flexDirection:"column",padding:4,rowGap:4,borderRadius:"base",width:"full",bg:"base.900"},children:[l.jsxs(B,{gap:4,children:[l.jsx(Ce,{fontWeight:500,variant:"subtext",children:t("modelManager.pickModelType")}),l.jsx(Xa,{value:p,onChange:P=>h(P),defaultValue:"v1",name:"model_type",children:l.jsxs(B,{gap:4,children:[l.jsx(vn,{value:"v1",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v1")})}),l.jsx(vn,{value:"v2_base",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v2_base")})}),l.jsx(vn,{value:"v2_768",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v2_768")})}),l.jsx(vn,{value:"inpainting",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.inpainting")})}),l.jsx(vn,{value:"custom",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.customConfig")})})]})})]}),p==="custom"&&l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:t("modelManager.pathToCustomConfig")}),l.jsx(mt,{value:y,onChange:P=>{P.target.value!==""&&x(P.target.value)},width:"full"})]})]}),l.jsx(B,{flexDirection:"column",maxHeight:72,overflowY:"scroll",borderRadius:"sm",paddingInlineEnd:4,gap:2,children:r.length>0?I():l.jsx(Ce,{fontWeight:"500",padding:2,borderRadius:"sm",textAlign:"center",variant:"subtext",children:t("modelManager.noModelsFound")})})]})]})}const R0=64,N0=2048;function pD(){const e=Y(),{t}=X(),n=A(p=>p.system.isProcessing);function r(p){return/\s/.test(p)}function o(p){let h;return r(p)&&(h=t("modelManager.cannotUseSpaces")),h}const s={name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,format:"ckpt",default:!1},c=p=>{e(rs(p)),e(Wo(null))},[u,f]=Me.useState(!1);return l.jsxs(ze,{gap:2,alignItems:"flex-start",children:[l.jsx(se,{"aria-label":t("common.back"),tooltip:t("common.back"),onClick:()=>e(Wo(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",insetInlineEnd:12,top:3,icon:l.jsx(w4,{})}),l.jsx(hD,{}),l.jsx(pt,{label:t("modelManager.addManually"),isChecked:u,onChange:()=>f(!u)}),u&&l.jsx(xs,{initialValues:s,onSubmit:c,children:({handleSubmit:p,errors:h,touched:y})=>l.jsx("form",{onSubmit:p,children:l.jsxs(ze,{rowGap:2,children:[l.jsx(Ce,{fontSize:20,fontWeight:"bold",alignSelf:"start",children:t("modelManager.manual")}),l.jsxs(rt,{isInvalid:!!h.name&&y.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"name",name:"name",type:"text",validate:o,width:"2xl"}),h.name&&y.name?l.jsx(mn,{children:h.name}):l.jsx(pn,{margin:0,children:t("modelManager.nameValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.description&&y.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"description",name:"description",type:"text",width:"2xl"}),h.description&&y.description?l.jsx(mn,{children:h.description}):l.jsx(pn,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.config&&y.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.config")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"config",name:"config",type:"text",width:"2xl"}),h.config&&y.config?l.jsx(mn,{children:h.config}):l.jsx(pn,{margin:0,children:t("modelManager.configValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.weights&&y.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"weights",name:"weights",type:"text",width:"2xl"}),h.weights&&y.weights?l.jsx(mn,{children:h.weights}):l.jsx(pn,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.vae&&y.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"vae",name:"vae",type:"text",width:"2xl"}),h.vae&&y.vae?l.jsx(mn,{children:h.vae}):l.jsx(pn,{margin:0,children:t("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(ra,{width:"100%",children:[l.jsxs(rt,{isInvalid:!!h.width&&y.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:t("modelManager.width")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{id:"width",name:"width",children:({field:x,form:S})=>l.jsx(Wr,{id:"width",name:"width",min:R0,max:N0,step:64,width:"90%",value:S.values.width,onChange:C=>S.setFieldValue(x.name,Number(C))})}),h.width&&y.width?l.jsx(mn,{children:h.width}):l.jsx(pn,{margin:0,children:t("modelManager.widthValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.height&&y.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:t("modelManager.height")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{id:"height",name:"height",children:({field:x,form:S})=>l.jsx(Wr,{id:"height",name:"height",min:R0,max:N0,width:"90%",step:64,value:S.values.height,onChange:C=>S.setFieldValue(x.name,Number(C))})}),h.height&&y.height?l.jsx(mn,{children:h.height}):l.jsx(pn,{margin:0,children:t("modelManager.heightValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:t("modelManager.addModel")})]})})})]})}function Al({children:e}){return l.jsx(B,{sx:{flexDirection:"column",padding:4,rowGap:4,borderRadius:"base",width:"full",bg:"base.900"},children:e})}function mD(){const e=Y(),{t}=X(),n=A(u=>u.system.isProcessing);function r(u){return/\s/.test(u)}function o(u){let f;return r(u)&&(f=t("modelManager.cannotUseSpaces")),f}const s={name:"",description:"",repo_id:"",path:"",format:"diffusers",default:!1,vae:{repo_id:"",path:""}},c=u=>{const f=u;u.path===""&&delete f.path,u.repo_id===""&&delete f.repo_id,u.vae.path===""&&delete f.vae.path,u.vae.repo_id===""&&delete f.vae.repo_id,e(rs(f)),e(Wo(null))};return l.jsxs(B,{children:[l.jsx(se,{"aria-label":t("common.back"),tooltip:t("common.back"),onClick:()=>e(Wo(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",insetInlineEnd:12,top:3,icon:l.jsx(w4,{})}),l.jsx(xs,{initialValues:s,onSubmit:c,children:({handleSubmit:u,errors:f,touched:p})=>{var h,y,x,S,C,k,w,j,I,P;return l.jsx("form",{onSubmit:u,children:l.jsxs(ze,{rowGap:2,children:[l.jsx(Al,{children:l.jsxs(rt,{isInvalid:!!f.name&&p.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"name",name:"name",type:"text",validate:o,width:"2xl",isRequired:!0}),f.name&&p.name?l.jsx(mn,{children:f.name}):l.jsx(pn,{margin:0,children:t("modelManager.nameValidationMsg")})]})]})}),l.jsx(Al,{children:l.jsxs(rt,{isInvalid:!!f.description&&p.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"description",name:"description",type:"text",width:"2xl",isRequired:!0}),f.description&&p.description?l.jsx(mn,{children:f.description}):l.jsx(pn,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]})}),l.jsxs(Al,{children:[l.jsx(Ce,{fontWeight:"bold",fontSize:"sm",children:t("modelManager.formMessageDiffusersModelLocation")}),l.jsx(Ce,{sx:{fontSize:"sm",fontStyle:"italic"},variant:"subtext",children:t("modelManager.formMessageDiffusersModelLocationDesc")}),l.jsxs(rt,{isInvalid:!!f.path&&p.path,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"path",name:"path",type:"text",width:"2xl"}),f.path&&p.path?l.jsx(mn,{children:f.path}):l.jsx(pn,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!f.repo_id&&p.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:t("modelManager.repo_id")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"2xl"}),f.repo_id&&p.repo_id?l.jsx(mn,{children:f.repo_id}):l.jsx(pn,{margin:0,children:t("modelManager.repoIDValidationMsg")})]})]})]}),l.jsxs(Al,{children:[l.jsx(Ce,{fontWeight:"bold",children:t("modelManager.formMessageDiffusersVAELocation")}),l.jsx(Ce,{sx:{fontSize:"sm",fontStyle:"italic"},variant:"subtext",children:t("modelManager.formMessageDiffusersVAELocationDesc")}),l.jsxs(rt,{isInvalid:!!((h=f.vae)!=null&&h.path)&&((y=p.vae)==null?void 0:y.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"2xl"}),(x=f.vae)!=null&&x.path&&((S=p.vae)!=null&&S.path)?l.jsx(mn,{children:(C=f.vae)==null?void 0:C.path}):l.jsx(pn,{margin:0,children:t("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((k=f.vae)!=null&&k.repo_id)&&((w=p.vae)==null?void 0:w.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:t("modelManager.vaeRepoID")}),l.jsxs(ze,{alignItems:"start",children:[l.jsx(kt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"2xl"}),(j=f.vae)!=null&&j.repo_id&&((I=p.vae)!=null&&I.repo_id)?l.jsx(mn,{children:(P=f.vae)==null?void 0:P.repo_id}):l.jsx(pn,{margin:0,children:t("modelManager.vaeRepoIDValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",isLoading:n,children:t("modelManager.addModel")})]})})}})]})}function F0({text:e,onClick:t}){return l.jsx(B,{position:"relative",width:"50%",height:40,justifyContent:"center",alignItems:"center",onClick:t,as:ti,children:l.jsx(Ce,{fontWeight:"bold",children:e})})}function vD(){const{isOpen:e,onOpen:t,onClose:n}=ho(),r=A(u=>u.ui.addNewModelUIOption),o=Y(),{t:s}=X(),c=()=>{n(),o(Wo(null))};return l.jsxs(l.Fragment,{children:[l.jsx(Je,{"aria-label":s("modelManager.addNewModel"),tooltip:s("modelManager.addNewModel"),onClick:t,size:"sm",children:l.jsxs(B,{columnGap:2,alignItems:"center",children:[l.jsx(vs,{}),s("modelManager.addNew")]})}),l.jsxs(po,{isOpen:e,onClose:c,size:"3xl",closeOnOverlayClick:!1,children:[l.jsx(Br,{}),l.jsxs(mo,{margin:"auto",paddingInlineEnd:4,children:[l.jsx(Lr,{children:s("modelManager.addNewModel")}),l.jsx(ia,{}),l.jsxs(Hr,{children:[r==null&&l.jsxs(B,{columnGap:4,children:[l.jsx(F0,{text:s("modelManager.addCheckpointModel"),onClick:()=>o(Wo("ckpt"))}),l.jsx(F0,{text:s("modelManager.addDiffuserModel"),onClick:()=>o(Wo("diffusers"))})]}),r=="ckpt"&&l.jsx(pD,{}),r=="diffusers"&&l.jsx(mD,{})]}),l.jsx(Fr,{})]})]})]})}var gD=Jf({displayName:"EditIcon",path:l.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})}),j4=Jf({displayName:"ExternalLinkIcon",path:l.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[l.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),l.jsx("path",{d:"M15 3h6v6"}),l.jsx("path",{d:"M10 14L21 3"})]})}),yD=Jf({displayName:"DeleteIcon",path:l.jsx("g",{fill:"currentColor",children:l.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"})})});function Ol(e){const{isProcessing:t,isConnected:n}=A(S=>S.system),r=A(S=>S.system.openModel),{t:o}=X(),s=Y(),{name:c,status:u,description:f}=e,p=()=>{s(w1(c))},h=()=>{s(Iv(c))},y=()=>{s(GS(c)),s(Iv(null))},x=()=>{switch(u){case"active":return"ok.500";case"cached":return"warning.500";case"not loaded":return"inherit"}};return l.jsxs(B,{alignItems:"center",p:2,borderRadius:"base",sx:c===r?{bg:"accent.750",_hover:{bg:"accent.750"}}:{_hover:{bg:"base.750"}},children:[l.jsx(Ye,{onClick:h,cursor:"pointer",children:l.jsx(Gt,{label:f,hasArrow:!0,placement:"bottom",children:l.jsx(Ce,{fontWeight:"600",children:c})})}),l.jsx(kc,{onClick:h,cursor:"pointer"}),l.jsxs(B,{gap:2,alignItems:"center",children:[l.jsx(Ce,{color:x(),children:u}),l.jsx(ti,{size:"sm",onClick:p,isDisabled:u==="active"||t||!n,children:o("modelManager.load")}),l.jsx(se,{icon:l.jsx(gD,{}),size:"sm",onClick:h,"aria-label":o("accessibility.modifyConfig"),isDisabled:u==="active"||t||!n}),l.jsx(Bc,{title:o("modelManager.deleteModel"),acceptCallback:y,acceptButtonText:o("modelManager.delete"),triggerComponent:l.jsx(se,{icon:l.jsx(yD,{}),size:"sm","aria-label":o("modelManager.deleteConfig"),isDisabled:u==="active"||t||!n,colorScheme:"error"}),children:l.jsxs(B,{rowGap:4,flexDirection:"column",children:[l.jsx("p",{style:{fontWeight:"bold"},children:o("modelManager.deleteMsg1")}),l.jsx("p",{children:o("modelManager.deleteMsg2")})]})})]})]})}function L0(e){const{children:t,value:n}=e,[r,o]=k1("colors",["base.800","base.200"]);return l.jsx("option",{value:n,style:{background:r,color:o},children:t})}const xD=e=>{const{label:t,isDisabled:n,validValues:r,tooltip:o,tooltipProps:s,...c}=e;return l.jsxs(rt,{isDisabled:n,onClick:u=>{u.stopPropagation(),u.nativeEvent.stopImmediatePropagation(),u.nativeEvent.stopPropagation(),u.nativeEvent.cancelBubble=!0},children:[t&&l.jsx(st,{children:t}),l.jsx(Gt,{label:o,...s,children:l.jsx(ex,{...c,children:r.map(u=>typeof u=="string"||typeof u=="number"?l.jsx(L0,{value:u,children:u},u):l.jsx(L0,{value:u.value,children:u.key},u.value))})})]})},Mn=g.memo(xD),bD=e=>{const[t,n]=g.useState(!1),{label:r,value:o,min:s=1,max:c=100,step:u=1,onChange:f,tooltipSuffix:p="",withSliderMarks:h=!1,withInput:y=!1,isInteger:x=!1,inputWidth:S=16,inputReadOnly:C=!1,withReset:k=!1,hideTooltip:w=!1,isCompact:j=!1,handleReset:I,isResetDisabled:P,isSliderDisabled:M,isInputDisabled:T,sliderFormControlProps:D,sliderFormLabelProps:_,sliderMarkProps:R,sliderTrackProps:V,sliderThumbProps:F,sliderNumberInputProps:L,sliderNumberInputFieldProps:Q,sliderNumberInputStepperProps:U,sliderTooltipProps:K,sliderIAIIconButtonProps:te,...ne}=e,{t:$}=X(),[Z,oe]=g.useState(String(o));g.useEffect(()=>{oe(o)},[o]);const le=g.useMemo(()=>L!=null&&L.max?L.max:c,[c,L==null?void 0:L.max]),Re=ce=>{f(ce)},Ne=ce=>{ce.target.value===""&&(ce.target.value=String(s));const Fe=ee.clamp(x?Math.floor(Number(ce.target.value)):Number(Z),s,le);f(Fe)},Ie=ce=>{oe(ce)},pe=()=>{I&&I()};return l.jsxs(rt,{sx:j?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},...D,children:[l.jsx(st,{..._,mb:-1,children:r}),l.jsxs(ra,{w:"100%",gap:2,alignItems:"center",children:[l.jsxs(ix,{"aria-label":r,value:o,min:s,max:c,step:u,onChange:Re,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),focusThumbOnChange:!1,isDisabled:M,...ne,children:[h&&l.jsxs(l.Fragment,{children:[l.jsx(If,{value:s,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...R,children:s}),l.jsx(If,{value:c,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...R,children:c})]}),l.jsx(sx,{...V,children:l.jsx(lx,{})}),l.jsx(Gt,{hasArrow:!0,placement:"top",isOpen:t,label:`${o}${p}`,hidden:w,...K,children:l.jsx(ax,{...F})})]}),y&&l.jsxs(Rh,{min:s,max:le,step:u,value:Z,onChange:Ie,onBlur:Ne,isDisabled:T,...L,children:[l.jsx(Fh,{readOnly:C,minWidth:S,...Q}),l.jsxs(Nh,{...U,children:[l.jsx(Bh,{onClick:()=>f(Number(Z))}),l.jsx(Lh,{onClick:()=>f(Number(Z))})]})]}),k&&l.jsx(se,{size:"sm","aria-label":$("accessibility.reset"),tooltip:"Reset",icon:l.jsx(up,{}),onClick:pe,isDisabled:P,...te})]})]})},ut=g.memo(bD);function SD(){const e=Y(),{isOpen:t,onOpen:n,onClose:r}=ho(),o=A(q9),{t:s}=X(),[c,u]=g.useState(Object.keys(o)[0]),[f,p]=g.useState(Object.keys(o)[1]),[h,y]=g.useState("none"),[x,S]=g.useState(""),[C,k]=g.useState(.5),[w,j]=g.useState("weighted_sum"),[I,P]=g.useState("root"),[M,T]=g.useState(""),[D,_]=g.useState(!1),R=Object.keys(o).filter(U=>U!==f&&U!==h),V=Object.keys(o).filter(U=>U!==c&&U!==h),F=[{key:s("modelManager.none"),value:"none"},...Object.keys(o).filter(U=>U!==c&&U!==f).map(U=>({key:U,value:U}))],L=A(U=>U.system.isProcessing),Q=()=>{let U=[c,f,h];U=U.filter(te=>te!=="none");const K={models_to_merge:U,merged_model_name:x!==""?x:U.join("-"),alpha:C,interp:w,model_merge_save_path:I==="root"?null:M,force:D};e(qS(K))};return l.jsxs(l.Fragment,{children:[l.jsx(Je,{onClick:n,size:"sm",children:l.jsx(B,{columnGap:2,alignItems:"center",children:s("modelManager.mergeModels")})}),l.jsxs(po,{isOpen:t,onClose:r,size:"4xl",closeOnOverlayClick:!1,children:[l.jsx(Br,{}),l.jsxs(mo,{fontFamily:"Inter",margin:"auto",paddingInlineEnd:4,children:[l.jsx(Lr,{children:s("modelManager.mergeModels")}),l.jsx(ia,{}),l.jsx(Hr,{children:l.jsxs(B,{flexDirection:"column",rowGap:4,children:[l.jsxs(B,{sx:{flexDirection:"column",marginBottom:4,padding:4,borderRadius:"base",rowGap:1,bg:"base.900"},children:[l.jsx(Ce,{children:s("modelManager.modelMergeHeaderHelp1")}),l.jsx(Ce,{fontSize:"sm",variant:"subtext",children:s("modelManager.modelMergeHeaderHelp2")})]}),l.jsxs(B,{columnGap:4,children:[l.jsx(Mn,{label:s("modelManager.modelOne"),validValues:R,onChange:U=>u(U.target.value)}),l.jsx(Mn,{label:s("modelManager.modelTwo"),validValues:V,onChange:U=>p(U.target.value)}),l.jsx(Mn,{label:s("modelManager.modelThree"),validValues:F,onChange:U=>{U.target.value!=="none"?(y(U.target.value),j("add_difference")):(y("none"),j("weighted_sum"))}})]}),l.jsx(mt,{label:s("modelManager.mergedModelName"),value:x,onChange:U=>S(U.target.value)}),l.jsxs(B,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsx(ut,{label:s("modelManager.alpha"),min:.01,max:.99,step:.01,value:C,onChange:U=>k(U),withInput:!0,withReset:!0,handleReset:()=>k(.5),withSliderMarks:!0}),l.jsx(Ce,{variant:"subtext",fontSize:"sm",children:s("modelManager.modelMergeAlphaHelp")})]}),l.jsxs(B,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsx(Ce,{fontWeight:500,fontSize:"sm",variant:"subtext",children:s("modelManager.interpolationType")}),l.jsx(Xa,{value:w,onChange:U=>j(U),children:l.jsx(B,{columnGap:4,children:h==="none"?l.jsxs(l.Fragment,{children:[l.jsx(vn,{value:"weighted_sum",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.weightedSum")})}),l.jsx(vn,{value:"sigmoid",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.sigmoid")})}),l.jsx(vn,{value:"inv_sigmoid",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.inverseSigmoid")})})]}):l.jsx(vn,{value:"add_difference",children:l.jsx(Gt,{label:s("modelManager.modelMergeInterpAddDifferenceHelp"),children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.addDifference")})})})})})]}),l.jsxs(B,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsxs(B,{columnGap:4,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:s("modelManager.mergedModelSaveLocation")}),l.jsx(Xa,{value:I,onChange:U=>P(U),children:l.jsxs(B,{columnGap:4,children:[l.jsx(vn,{value:"root",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.invokeAIFolder")})}),l.jsx(vn,{value:"custom",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.custom")})})]})})]}),I==="custom"&&l.jsx(mt,{label:s("modelManager.mergedModelCustomSaveLocation"),value:M,onChange:U=>T(U.target.value)})]}),l.jsx(pt,{label:s("modelManager.ignoreMismatch"),isChecked:D,onChange:U=>_(U.target.checked),fontWeight:"500"}),l.jsx(Je,{onClick:Q,isLoading:L,isDisabled:I==="custom"&&M==="",children:s("modelManager.merge")})]})}),l.jsx(Fr,{})]})]})]})}const CD=me(Et,e=>ee.map(e.model_list,(n,r)=>({name:r,...n})),{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function Hd({label:e,isActive:t,onClick:n}){return l.jsx(Je,{onClick:n,isActive:t,sx:{_active:{bg:"accent.750"}},size:"sm",children:e})}const wD=()=>{const e=A(CD),[t,n]=Me.useState(!1);Me.useEffect(()=>{const x=setTimeout(()=>{n(!0)},200);return()=>clearTimeout(x)},[]);const[r,o]=g.useState(""),[s,c]=g.useState("all"),[u,f]=g.useTransition(),{t:p}=X(),h=x=>{f(()=>{o(x.target.value)})},y=g.useMemo(()=>{const x=[],S=[],C=[],k=[];return e.forEach((w,j)=>{w.name.toLowerCase().includes(r.toLowerCase())&&(C.push(l.jsx(Ol,{name:w.name,status:w.status,description:w.description},j)),w.format===s&&k.push(l.jsx(Ol,{name:w.name,status:w.status,description:w.description},j))),w.format!=="diffusers"?x.push(l.jsx(Ol,{name:w.name,status:w.status,description:w.description},j)):S.push(l.jsx(Ol,{name:w.name,status:w.status,description:w.description},j))}),r!==""?s==="all"?l.jsx(Ye,{marginTop:4,children:C}):l.jsx(Ye,{marginTop:4,children:k}):l.jsxs(B,{flexDirection:"column",rowGap:6,children:[s==="all"&&l.jsxs(l.Fragment,{children:[l.jsxs(Ye,{children:[l.jsx(Ce,{sx:{fontWeight:"500",py:2,px:4,my:4,mx:0,borderRadius:"base",width:"max-content",fontSize:"sm",bg:"base.750"},children:p("modelManager.checkpointModels")}),x]}),l.jsxs(Ye,{children:[l.jsx(Ce,{sx:{fontWeight:"500",py:2,px:4,mb:4,borderRadius:"base",width:"max-content",fontSize:"sm",bg:"base.750"},children:p("modelManager.diffusersModels")}),S]})]}),s==="ckpt"&&l.jsx(B,{flexDirection:"column",marginTop:4,children:x}),s==="diffusers"&&l.jsx(B,{flexDirection:"column",marginTop:4,children:S})]})},[e,r,p,s]);return l.jsxs(B,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:[l.jsxs(B,{justifyContent:"space-between",alignItems:"center",gap:2,children:[l.jsx(Wn,{size:"md",children:p("modelManager.availableModels")}),l.jsx(kc,{}),l.jsx(vD,{}),l.jsx(SD,{})]}),l.jsx(mt,{onChange:h,label:p("modelManager.search")}),l.jsxs(B,{flexDirection:"column",gap:1,maxHeight:window.innerHeight-240,overflow:"scroll",paddingInlineEnd:4,children:[l.jsxs(B,{columnGap:2,children:[l.jsx(Hd,{label:p("modelManager.allModels"),onClick:()=>c("all"),isActive:s==="all"}),l.jsx(Hd,{label:p("modelManager.checkpointModels"),onClick:()=>c("ckpt"),isActive:s==="ckpt"}),l.jsx(Hd,{label:p("modelManager.diffusersModels"),onClick:()=>c("diffusers"),isActive:s==="diffusers"})]}),t?y:l.jsx(B,{width:"100%",minHeight:96,justifyContent:"center",alignItems:"center",children:l.jsx(Xf,{})})]})]})};function kD({children:e}){const{isOpen:t,onOpen:n,onClose:r}=ho(),o=A(u=>u.system.model_list),s=A(u=>u.system.openModel),{t:c}=X();return l.jsxs(l.Fragment,{children:[g.cloneElement(e,{onClick:n}),l.jsxs(po,{isOpen:t,onClose:r,size:"full",children:[l.jsx(Br,{}),l.jsxs(mo,{children:[l.jsx(ia,{}),l.jsx(Lr,{children:c("modelManager.modelManager")}),l.jsx(Hr,{children:l.jsxs(B,{width:"100%",columnGap:8,children:[l.jsx(wD,{}),s&&o[s].format==="diffusers"?l.jsx(aD,{}):l.jsx(oD,{})]})}),l.jsx(Fr,{})]})]})]})}const jD=me([Et],e=>{const{isProcessing:t,model_list:n}=e;return{models:ee.map(n,(o,s)=>s),isProcessing:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),ED=()=>{const e=Y(),{t}=X(),{models:n,isProcessing:r}=A(jD),o=A($x),s=c=>{e(w1(c.target.value))};return l.jsx(B,{style:{paddingInlineStart:1.5},children:l.jsx(Mn,{style:{fontSize:"sm"},"aria-label":t("accessibility.modelSelect"),tooltip:o.description,isDisabled:r,value:o.name,validValues:n,onChange:s})})},PD=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,...c}=e;return l.jsxs(rt,{isDisabled:n,width:r,display:"flex",gap:4,alignItems:"center",justifyContent:"space-between",...o,children:[l.jsx(st,{my:1,...s,children:t}),l.jsx(cx,{...c})]})},En=g.memo(PD),ID=me([Et,Er],(e,t)=>{const{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:o,model_list:s,saveIntermediatesInterval:c,enableImageDebugging:u}=e,{shouldUseCanvasBetaLayout:f,shouldUseSliders:p}=t;return{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:o,models:ee.map(s,(h,y)=>y),saveIntermediatesInterval:c,enableImageDebugging:u,shouldUseCanvasBetaLayout:f,shouldUseSliders:p}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Wd={flexDirection:"column",gap:2,p:4,bg:"base.900"},MD=({children:e})=>{const t=Y(),{t:n}=X(),r=A(P=>P.generation.steps),{isOpen:o,onOpen:s,onClose:c}=ho(),{isOpen:u,onOpen:f,onClose:p}=ho(),{shouldDisplayInProgressType:h,shouldConfirmOnDelete:y,shouldDisplayGuides:x,saveIntermediatesInterval:S,enableImageDebugging:C,shouldUseCanvasBetaLayout:k,shouldUseSliders:w}=A(ID),j=()=>{e3.purge().then(()=>{c(),f()})},I=P=>{P>r&&(P=r),P<1&&(P=1),t(t3(P))};return l.jsxs(l.Fragment,{children:[g.cloneElement(e,{onClick:s}),l.jsxs(po,{isOpen:o,onClose:c,size:"xl",children:[l.jsx(Br,{}),l.jsxs(mo,{paddingInlineEnd:4,children:[l.jsx(Lr,{children:n("common.settingsLabel")}),l.jsx(ia,{}),l.jsx(Hr,{children:l.jsxs(or,{gap:4,children:[l.jsxs(B,{sx:Wd,children:[l.jsx(Mn,{label:n("settings.displayInProgress"),validValues:YS,value:h,onChange:P=>t(KS(P.target.value))}),h==="full-res"&&l.jsx(Wr,{label:n("settings.saveSteps"),min:1,max:r,step:1,onChange:I,value:S,width:"auto",textAlign:"center"}),l.jsx(En,{label:n("settings.confirmOnDelete"),isChecked:y,onChange:P=>t(j1(P.target.checked))}),l.jsx(En,{label:n("settings.displayHelpIcons"),isChecked:x,onChange:P=>t(XS(P.target.checked))}),l.jsx(En,{label:n("settings.useCanvasBeta"),isChecked:k,onChange:P=>t(QS(P.target.checked))}),l.jsx(En,{label:n("settings.useSlidersForAll"),isChecked:w,onChange:P=>t(ZS(P.target.checked))})]}),l.jsxs(B,{sx:Wd,children:[l.jsx(Wn,{size:"sm",style:{fontWeight:"bold"},children:"Developer"}),l.jsx(En,{label:n("settings.enableImageDebugging"),isChecked:C,onChange:P=>t(JS(P.target.checked))})]}),l.jsxs(B,{sx:Wd,children:[l.jsx(Wn,{size:"sm",children:n("settings.resetWebUI")}),l.jsx(Je,{colorScheme:"error",onClick:j,children:n("settings.resetWebUI")}),l.jsx(Ce,{children:n("settings.resetWebUIDesc1")}),l.jsx(Ce,{children:n("settings.resetWebUIDesc2")})]})]})}),l.jsx(Fr,{children:l.jsx(Je,{onClick:c,children:n("common.close")})})]})]}),l.jsxs(po,{closeOnOverlayClick:!1,isOpen:u,onClose:p,isCentered:!0,children:[l.jsx(Br,{backdropFilter:"blur(40px)"}),l.jsxs(mo,{children:[l.jsx(Lr,{}),l.jsx(Hr,{children:l.jsx(B,{justifyContent:"center",children:l.jsx(Ce,{fontSize:"lg",children:l.jsx(Ce,{children:n("settings.resetComplete")})})})}),l.jsx(Fr,{})]})]})]})},TD=me(Et,e=>({isConnected:e.isConnected,isProcessing:e.isProcessing,currentIteration:e.currentIteration,totalIterations:e.totalIterations,currentStatus:e.currentStatus,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),_D=()=>{const{isConnected:e,isProcessing:t,currentIteration:n,totalIterations:r,currentStatus:o,hasError:s,wasErrorSeen:c}=A(TD),u=Y(),{t:f}=X();let p;e&&!s?p="ok":p="error";let h=o;t&&(p="working"),h&&t&&r>1&&(h=`${f(h)} (${n}/${r})`);const y=s&&!c?"Click to clear, check logs for details":void 0,x=s&&!c?"pointer":"initial",S=()=>{(s||!c)&&u(C1())};return l.jsx(Gt,{label:y,children:l.jsx(Ce,{cursor:x,onClick:S,sx:{fontSize:"xs",fontWeight:"600",color:`${p}.400`},children:f(h)})})},DD=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return l.jsxs(Vh,{isLazy:o,...s,children:[l.jsx(Wh,{children:t}),l.jsxs($h,{children:[r&&l.jsx(Uh,{}),n]})]})},rr=g.memo(DD);function AD(){const{t:e}=X(),t=Y(),n=A(c=>c.ui.currentTheme),r={dark:e("common.darkTheme"),light:e("common.lightTheme"),green:e("common.greenTheme"),ocean:e("common.oceanTheme")},o=c=>{t(n3(c))},s=()=>{const c=[];return Object.keys(r).forEach(u=>{c.push(l.jsx(Je,{isChecked:n===u,leftIcon:n===u?l.jsx(Ac,{}):void 0,size:"sm",onClick:()=>o(u),children:r[u]},u))}),c};return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{"aria-label":e("common.themeLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(z9,{})}),children:l.jsx(ze,{align:"stretch",children:s()})})}function OD(){const{t:e,i18n:t}=X(),n={ar:e("common.langArabic",{lng:"ar"}),nl:e("common.langDutch",{lng:"nl"}),en:e("common.langEnglish",{lng:"en"}),fr:e("common.langFrench",{lng:"fr"}),de:e("common.langGerman",{lng:"de"}),he:e("common.langHebrew",{lng:"he"}),it:e("common.langItalian",{lng:"it"}),ja:e("common.langJapanese",{lng:"ja"}),ko:e("common.langKorean",{lng:"ko"}),pl:e("common.langPolish",{lng:"pl"}),pt_BR:e("common.langBrPortuguese",{lng:"pt_BR"}),pt:e("common.langPortuguese",{lng:"pt"}),ru:e("common.langRussian",{lng:"ru"}),zh_CN:e("common.langSimplifiedChinese",{lng:"zh_CN"}),es:e("common.langSpanish",{lng:"es"}),uk:e("common.langUkranian",{lng:"ua"})},r=()=>{const o=[];return Object.keys(n).forEach(s=>{o.push(l.jsx(Je,{isChecked:localStorage.getItem("i18nextLng")===s,leftIcon:localStorage.getItem("i18nextLng")===s?l.jsx(Ac,{}):void 0,onClick:()=>t.changeLanguage(s),"aria-label":n[s],size:"sm",minWidth:"200px",children:n[s]},s))}),o};return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{"aria-label":e("common.languagePickerLabel"),tooltip:e("common.languagePickerLabel"),icon:l.jsx(D9,{}),size:"sm",variant:"link","data-variant":"link",fontSize:26}),children:l.jsx(ze,{children:r()})})}function zD(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M16.5 9c-.42 0-.83.04-1.24.11L1.01 3 1 10l9 2-9 2 .01 7 8.07-3.46C9.59 21.19 12.71 24 16.5 24c4.14 0 7.5-3.36 7.5-7.5S20.64 9 16.5 9zm0 13c-3.03 0-5.5-2.47-5.5-5.5s2.47-5.5 5.5-5.5 5.5 2.47 5.5 5.5-2.47 5.5-5.5 5.5z"}},{tag:"path",attr:{d:"M18.27 14.03l-1.77 1.76-1.77-1.76-.7.7 1.76 1.77-1.76 1.77.7.7 1.77-1.76 1.77 1.76.7-.7-1.76-1.77 1.76-1.77z"}}]})(e)}function RD(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}}]})(e)}function ND(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 00.12-.61l-1.92-3.32a.488.488 0 00-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 00-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 00-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}}]})(e)}function FD(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"}}]})(e)}function LD(e){return ve({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 BD(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 2v11h3v9l7-12h-4l4-8z"}}]})(e)}function B0(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"}}]})(e)}function HD(e){return ve({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 WD(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.02 10v9H5V5h9V3H5.02c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-9h-2zM17 10l.94-2.06L20 7l-2.06-.94L17 4l-.94 2.06L14 7l2.06.94zm-3.75.75L12 8l-1.25 2.75L8 12l2.75 1.25L12 16l1.25-2.75L16 12z"}}]})(e)}function dp(e){return ve({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 VD(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"}}]})(e)}function UD(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 10l5 5 5-5z"}}]})(e)}function $D(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 14l5-5 5 5z"}}]})(e)}function GD(e){return ve({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}}]})(e)}const qD=""+new URL("logo-13003d72.png",import.meta.url).href,E4=()=>{const e=A(t=>t.system.app_version);return l.jsxs(B,{alignItems:"center",gap:3,ps:1,children:[l.jsx(ls,{src:qD,alt:"invoke-ai-logo",w:"32px",h:"32px"}),l.jsxs(Ce,{fontSize:"xl",children:["invoke ",l.jsx("strong",{children:"ai"})]}),l.jsx(Ce,{sx:{fontWeight:300,marginTop:1},variant:"subtext",children:e})]})},P4=()=>{const{t:e}=X();return l.jsxs(or,{gridTemplateColumns:"auto max-content",children:[l.jsx(E4,{}),l.jsxs(B,{alignItems:"center",gap:2,children:[l.jsx(_D,{}),l.jsx(ED,{}),l.jsx(kD,{children:l.jsx(se,{"aria-label":e("modelManager.modelManager"),tooltip:e("modelManager.modelManager"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(k9,{})})}),l.jsx(iP,{children:l.jsx(se,{"aria-label":e("common.hotkeysLabel"),tooltip:e("common.hotkeysLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(_9,{})})}),l.jsx(AD,{}),l.jsx(OD,{}),l.jsx(Go,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI/issues",marginBottom:"-0.25rem",children:l.jsx(se,{"aria-label":e("common.reportBugLabel"),tooltip:e("common.reportBugLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx(w9,{})})}),l.jsx(Go,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI",marginBottom:"-0.25rem",children:l.jsx(se,{"aria-label":e("common.githubLabel"),tooltip:e("common.githubLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx(v9,{})})}),l.jsx(Go,{isExternal:!0,href:"https://discord.gg/ZmtBAhwWhy",marginBottom:"-0.25rem",children:l.jsx(se,{"aria-label":e("common.discordLabel"),tooltip:e("common.discordLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx(m9,{})})}),l.jsx(MD,{children:l.jsx(se,{"aria-label":e("common.settingsLabel"),tooltip:e("common.settingsLabel"),variant:"link","data-variant":"link",fontSize:22,size:"sm",icon:l.jsx(ND,{})})})]})]})};P4.displayName="SiteHeader";const fp=e=>{const{children:t}=e;return l.jsx(B,{sx:{width:"100%",height:"100%",bg:"base.850"},children:t})};function YD(){const{t:e}=X();return l.jsx(fp,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Wn,{children:e("common.nodes")}),l.jsx(ze,{maxW:"50rem",gap:4,children:l.jsx(Ce,{children:e("common.nodesDesc")})})]})})}const KD=()=>{const{t:e}=X();return l.jsx(fp,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Wn,{children:e("common.postProcessing")}),l.jsxs(ze,{maxW:"50rem",gap:4,children:[l.jsx(Ce,{children:e("common.postProcessDesc1")}),l.jsx(Ce,{children:e("common.postProcessDesc2")}),l.jsx(Ce,{children:e("common.postProcessDesc3")})]})]})})};function XD(){const{t:e}=X();return l.jsx(fp,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Wn,{children:e("common.training")}),l.jsxs(ze,{maxW:"50rem",gap:4,children:[l.jsx(Ce,{children:e("common.trainingDesc1")}),l.jsx(Ce,{children:e("common.trainingDesc2")})]})]})})}const bs=me(e=>e.lightbox,e=>e,{memoizeOptions:{equalityCheck:ee.isEqual}}),Gr=e=>e.gallery,QD=me([Gr,Er,bs,bt],(e,t,n,r)=>{const{categories:o,currentCategory:s,currentImageUuid:c,galleryImageMinimumWidth:u,galleryImageObjectFit:f,shouldAutoSwitchToNewImages:p,galleryWidth:h,shouldUseSingleGalleryColumn:y}=e,{shouldPinGallery:x}=t,{isLightboxOpen:S}=n;return{currentImageUuid:c,shouldPinGallery:x,galleryImageMinimumWidth:u,galleryImageObjectFit:f,galleryGridTemplateColumns:y?"auto":`repeat(auto-fill, minmax(${u}px, auto))`,shouldAutoSwitchToNewImages:p,currentCategory:s,images:o[s].images,areMoreImagesAvailable:o[s].areMoreImagesAvailable,galleryWidth:h,shouldEnableResize:!(S||r==="unifiedCanvas"&&x),shouldUseSingleGalleryColumn:y}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),ZD=me([Gr,Et,bs,bt],(e,t,n,r)=>({mayDeleteImage:t.isConnected&&!t.isProcessing,galleryImageObjectFit:e.galleryImageObjectFit,galleryImageMinimumWidth:e.galleryImageMinimumWidth,shouldUseSingleGalleryColumn:e.shouldUseSingleGalleryColumn,activeTabName:r,isLightboxOpen:n.isLightboxOpen}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),JD=me(Gr,e=>({resultImages:e.categories.result.images,userImages:e.categories.user.images})),eA=()=>{const{resultImages:e,userImages:t}=A(JD);return n=>{const r=e.find(s=>s.uuid===n);if(r)return r;const o=t.find(s=>s.uuid===n);if(o)return o}},tA=({direction:e,langDirection:t})=>({top:e==="bottom",right:t!=="rtl"&&e==="left"||t==="rtl"&&e==="right",bottom:e==="top",left:t!=="rtl"&&e==="right"||t==="rtl"&&e==="left"}),nA=({direction:e,minWidth:t,maxWidth:n,minHeight:r,maxHeight:o})=>{const s=t??(["left","right"].includes(e)?10:void 0),c=n??(["left","right"].includes(e)?"95vw":void 0),u=r??(["top","bottom"].includes(e)?10:void 0),f=o??(["top","bottom"].includes(e)?"95vh":void 0);return{...s?{minWidth:s}:{},...c?{maxWidth:c}:{},...u?{minHeight:u}:{},...f?{maxHeight:f}:{}}},zr="0.75rem",zl="1rem",rA="2px",oA="5px",iA=({isPinned:e,isResizable:t,direction:n})=>{if(!t)return{containerStyles:{},handleStyles:{}};const r=e?rA:oA,o=`calc((2 * ${zr} + ${r}) / -2)`;return n==="top"?{containerStyles:{borderBottomWidth:r,paddingBottom:zl},handleStyles:{top:{paddingTop:zr,paddingBottom:zr,bottom:o}}}:n==="left"?{containerStyles:{borderInlineEndWidth:r,paddingInlineEnd:zl},handleStyles:{right:{paddingInlineStart:zr,paddingInlineEnd:zr,insetInlineEnd:o}}}:n==="bottom"?{containerStyles:{borderTopWidth:r,paddingTop:zl},handleStyles:{bottom:{paddingTop:zr,paddingBottom:zr,top:o}}}:n==="right"?{containerStyles:{borderInlineStartWidth:r,paddingInlineStart:zl},handleStyles:{left:{paddingInlineStart:zr,paddingInlineEnd:zr,insetInlineStart:o}}}:{containerStyles:{},handleStyles:{}}},aA=(e,t)=>["top","bottom"].includes(e)?e:e==="left"?t==="rtl"?"right":"left":e==="right"?t==="rtl"?"left":"right":"left",ro=(e,t)=>{if(e)return t?e+t:e},sA=re(Ox,{shouldForwardProp:e=>!["sx"].includes(e)}),I4=({direction:e="left",isResizable:t,isPinned:n,isOpen:r,onClose:o,children:s,initialWidth:c,minWidth:u,maxWidth:f,initialHeight:p,minHeight:h,maxHeight:y,onResizeStart:x,onResizeStop:S,onResize:C,sx:k={}})=>{const w=ea().direction,j=g.useRef(null),I=g.useMemo(()=>c??u??(["left","right"].includes(e)?500:"100%"),[c,u,e]),P=g.useMemo(()=>p??h??(["top","bottom"].includes(e)?500:"100%"),[p,h,e]),[M,T]=g.useState(I),[D,_]=g.useState(P);k6({ref:j,handler:()=>{n||o()}});const R=g.useMemo(()=>t?tA({direction:e,langDirection:w}):{},[t,w,e]),V=g.useMemo(()=>nA({direction:e,minWidth:t?ro(u,18):ro(u),maxWidth:t?ro(f,18):ro(f),minHeight:t?ro(h,18):ro(h),maxHeight:t?ro(y,18):ro(y)}),[u,f,h,y,e,t]),{containerStyles:F,handleStyles:L}=g.useMemo(()=>iA({isPinned:n,isResizable:t,direction:e}),[n,t,e]),Q=g.useMemo(()=>aA(e,w),[e,w]);return g.useEffect(()=>{["left","right"].includes(e)&&_(n?"100%":"100vh"),["top","bottom"].includes(e)&&T(n?"100%":"100vw")},[n,e]),l.jsx(y2,{direction:Q,in:r,unmountOnExit:n,motionProps:{initial:n},...n?{style:{position:void 0,left:void 0,right:void 0,top:void 0,bottom:void 0,width:void 0}}:{style:{zIndex:99,width:"full"}},children:l.jsx(Ye,{ref:j,sx:{width:"full",height:"full"},children:l.jsx(sA,{size:{width:t?M:I,height:t?D:P},enable:R,handleStyles:L,...V,sx:{borderColor:"base.800",p:n?0:4,bg:"base.900",height:"full",boxShadow:n?"":"0 0 4rem 0 rgba(0, 0, 0, 0.8)",...F,...k},onResizeStart:(U,K,te)=>{x&&x(U,K,te)},onResize:(U,K,te,ne)=>{C&&C(U,K,te,ne)},onResizeStop:(U,K,te,ne)=>{["left","right"].includes(K)&&T(Number(M)+ne.width),["top","bottom"].includes(K)&&_(Number(D)+ne.height),S&&S(U,K,te,ne)},children:s})})})},H0={position:"absolute",width:"full",height:24,left:0,pointerEvents:"none",transition:"opacity 0.2s ease-in-out"},M4=({children:e})=>{const t=g.useRef(null),n=g.useRef(null),r=g.useRef(null),o=ee.throttle(()=>{if(!t.current||!n.current||!r.current)return;const{scrollTop:s,scrollHeight:c,offsetHeight:u}=t.current;s>0?n.current.style.opacity="1":n.current.style.opacity="0",s>=c-u?r.current.style.opacity="0":r.current.style.opacity="1"},33,{leading:!0});return g.useEffect(()=>{o()},[o]),l.jsxs(Ye,{position:"relative",w:"full",h:"full",children:[l.jsx(Ye,{ref:t,position:"absolute",w:"full",h:"full",overflowY:"scroll",onScroll:o,children:e}),l.jsx(Ye,{ref:r,sx:{...H0,bottom:0,boxShadow:"inset 0 -3.5rem 2rem -2rem var(--invokeai-colors-base-900)"}}),l.jsx(Ye,{ref:n,sx:{...H0,top:0,boxShadow:"inset 0 3.5rem 2rem -2rem var(--invokeai-colors-base-900)"}})]})},lA=ee.debounce(e=>{e(E1(!0))},300),cn=()=>(e,t)=>{bt(t())==="unifiedCanvas"&&lA(e)};function T4(e){return ve({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z"}}]})(e)}function _4(e){return ve({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146zm.122 2.112v-.002.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a4.507 4.507 0 0 0-.288-.076 4.922 4.922 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a4.924 4.924 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034.114 0 .23-.011.343-.04L9.927 2.028c-.029.113-.04.23-.04.343a1.779 1.779 0 0 0 .062.46z"}}]})(e)}const W0=e=>{const{sx:t}=e,n=Y(),r=A(c=>c.ui.shouldPinParametersPanel),{t:o}=X(),s=()=>{n(r3(!r)),n(cn())};return l.jsx(Gt,{label:o("common.pinOptionsPanel"),children:l.jsx(se,{...e,"aria-label":o("common.pinOptionsPanel"),onClick:s,icon:r?l.jsx(T4,{}):l.jsx(_4,{}),variant:"ghost",size:"sm",sx:{color:"base.700",_hover:{color:"base.550"},_active:{color:"base.500"},...t}})})},cA=me([Er,bt,bs],(e,t,n)=>{const{shouldPinParametersPanel:r,shouldShowParametersPanel:o}=e,{isLightboxOpen:s}=n;return{shouldPinParametersPanel:r,shouldShowParametersPanel:o,isResizable:t!=="unifiedCanvas",isLightboxOpen:s}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),uA=({children:e})=>{const t=Y(),{shouldPinParametersPanel:n,shouldShowParametersPanel:r,isResizable:o,isLightboxOpen:s}=A(cA),c=()=>{t(ql(!1))};return de("o",()=>{t(o3()),n&&t(cn())},{enabled:()=>!s},[n,s]),de("esc",()=>{t(ql(!1))},{enabled:()=>!n,preventDefault:!0},[n]),de("shift+o",()=>{t(i3()),t(cn())},[]),l.jsx(I4,{direction:"left",isResizable:o||!n,isOpen:r,onClose:c,isPinned:n||s,sx:{borderColor:"base.700",p:n?0:4,bg:"base.900"},initialWidth:t0,minWidth:t0,children:l.jsxs(B,{flexDir:"column",position:"relative",h:"full",w:"full",children:[!n&&l.jsxs(B,{paddingTop:1.5,paddingBottom:4,justifyContent:"space-between",alignItems:"center",children:[l.jsx(E4,{}),l.jsx(W0,{})]}),l.jsx(M4,{children:e}),n&&l.jsx(W0,{sx:{position:"absolute",top:0,insetInlineEnd:0}})]})})},dA=g.memo(uA),fA=me([Er,bt],(e,t)=>{const{shouldPinParametersPanel:n}=e;return{shouldPinParametersPanel:n,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),hp=e=>{const{parametersPanelContent:t,children:n,...r}=e,o=Y(),{activeTabName:s}=A(fA),c=eA(),u=f=>{const p=f.dataTransfer.getData("invokeai/imageUuid"),h=c(p);h&&(s==="img2img"?o(ns(h)):s==="unifiedCanvas"&&o(xc(h)))};return l.jsxs(B,{...r,pos:"relative",w:"full",h:eP,gap:4,children:[l.jsx(dA,{children:t}),l.jsx(Ye,{pos:"relative",w:"100%",h:"100%",onDrop:u,children:n})]})},hA=e=>{const{styleClass:t}=e,n=g.useContext(qh),r=()=>{n&&n()};return l.jsx(B,{sx:{width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},className:t,children:l.jsxs(B,{onClick:r,sx:{display:"flex",flexDirection:"column",rowGap:8,p:8,borderRadius:"base",alignItems:"center",justifyContent:"center",textAlign:"center",cursor:"pointer",color:"base.600",bg:"base.800",_hover:{bg:"base.700"}},children:[l.jsx(tn,{as:Oc,boxSize:24}),l.jsx(Wn,{size:"md",children:"Click or Drag and Drop"})]})})};function pA(){const e=A(o=>o.postprocessing.facetoolType),t=Y(),{t:n}=X(),r=o=>t(Nl(o.target.value));return l.jsx(Mn,{label:n("parameters.type"),validValues:a3.concat(),value:e,onChange:r})}function mA(){const e=A(o=>o.system.isGFPGANAvailable),t=A(o=>o.postprocessing.facetoolStrength),{t:n}=X(),r=Y();return l.jsx(ut,{isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e,label:n("parameters.strength"),step:.05,min:0,max:1,onChange:o=>r(Yl(o)),handleReset:()=>r(Yl(.75)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}function vA(){const e=A(o=>o.system.isGFPGANAvailable),t=A(o=>o.postprocessing.codeformerFidelity),{t:n}=X(),r=Y();return l.jsx(ut,{isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e,label:n("parameters.codeformerFidelity"),step:.05,min:0,max:1,onChange:o=>r(Xd(o)),handleReset:()=>r(Xd(1)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}const pp=()=>{const e=A(t=>t.postprocessing.facetoolType);return l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(pA,{}),l.jsx(mA,{}),e==="codeformer"&&l.jsx(vA,{})]})};function gA(){const e=A(o=>o.system.isESRGANAvailable),t=A(o=>o.postprocessing.upscalingDenoising),{t:n}=X(),r=Y();return l.jsx(ut,{label:n("parameters.denoisingStrength"),value:t,min:0,max:1,step:.01,onChange:o=>{r(Qd(o))},handleReset:()=>r(Qd(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function yA(){const e=A(o=>o.system.isESRGANAvailable),t=A(o=>o.postprocessing.upscalingStrength),{t:n}=X(),r=Y();return l.jsx(ut,{label:`${n("parameters.upscale")} ${n("parameters.strength")}`,value:t,min:0,max:1,step:.05,onChange:o=>r(Zd(o)),handleReset:()=>r(Zd(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function xA(){const e=A(s=>s.system.isESRGANAvailable),t=A(s=>s.postprocessing.upscalingLevel),{t:n}=X(),r=Y(),o=s=>r(P1(Number(s.target.value)));return l.jsx(Mn,{isDisabled:!e,label:n("parameters.scale"),value:t,onChange:o,validValues:s3})}const mp=()=>l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(xA,{}),l.jsx(gA,{}),l.jsx(yA,{})]}),vp=e=>e.postprocessing,bA=me(Et,e=>{const{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}=e;return{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),hc=fe(({image:e,children:t},n)=>{const{isOpen:r,onOpen:o,onClose:s}=ho(),c=Y(),{shouldConfirmOnDelete:u,isConnected:f,isProcessing:p}=A(bA),h=g.useRef(null),y=C=>{C.stopPropagation(),u?o():x()},x=()=>{f&&!p&&e&&c(l3(e)),s()};de("delete",()=>{u?o():x()},[e,u,f,p]);const S=C=>c(j1(!C.target.checked));return l.jsxs(l.Fragment,{children:[g.cloneElement(t,{onClick:e?y:void 0,ref:n}),l.jsx(Gy,{isOpen:r,leastDestructiveRef:h,onClose:s,children:l.jsx(Br,{children:l.jsxs(qy,{children:[l.jsx(Lr,{fontSize:"lg",fontWeight:"bold",children:"Delete image"}),l.jsx(Hr,{children:l.jsxs(B,{direction:"column",gap:5,children:[l.jsx(Ce,{children:"Are you sure? Deleted images will be sent to the Bin. You can restore from there if you wish to."}),l.jsx(En,{label:"Don't ask me again",isChecked:!u,onChange:S})]})}),l.jsxs(Fr,{children:[l.jsx(Je,{ref:h,onClick:s,children:"Cancel"}),l.jsx(Je,{colorScheme:"error",onClick:x,ml:3,children:"Delete"})]})]})})})]})});hc.displayName="DeleteImageModal";const gp=()=>{const e=Y();return t=>{const n=typeof t=="string"?t:I1(t),[r,o]=c3(n);e(M1(r)),e(T1(o))}},SA=me([Et,Gr,vp,Er,bs,bt],(e,t,n,r,o,s)=>{const{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:p}=e,{upscalingLevel:h,facetoolStrength:y}=n,{isLightboxOpen:x}=o,{shouldShowImageDetails:S}=r,{intermediateImage:C,currentImage:k}=t;return{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:p,upscalingLevel:h,facetoolStrength:y,shouldDisableToolbarButtons:Boolean(C)||!k,currentImage:k,shouldShowImageDetails:S,activeTabName:s,isLightboxOpen:x}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),D4=e=>{var L,Q,U,K,te,ne,$,Z;const t=Y(),{isProcessing:n,isConnected:r,isGFPGANAvailable:o,isESRGANAvailable:s,upscalingLevel:c,facetoolStrength:u,shouldDisableToolbarButtons:f,shouldShowImageDetails:p,currentImage:h,isLightboxOpen:y,activeTabName:x}=A(SA),S=ss(),{t:C}=X(),k=gp(),w=()=>{h&&(y&&t(Vo(!1)),t(ns(h)),t(jn("img2img")))},j=async()=>{if(!h)return;const oe=await fetch(h.url).then(Re=>Re.blob()),le=[new ClipboardItem({[oe.type]:oe})];await navigator.clipboard.write(le),S({title:C("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})},I=()=>{navigator.clipboard.writeText(h?window.location.toString()+h.url:"").then(()=>{S({title:C("toast.imageLinkCopied"),status:"success",duration:2500,isClosable:!0})})};de("shift+i",()=>{h?(w(),S({title:C("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.imageNotLoaded"),description:C("toast.imageNotLoadedDesc"),status:"error",duration:2500,isClosable:!0})},[h]);const P=()=>{var oe,le;h&&(h.metadata&&t(_1(h.metadata)),((oe=h.metadata)==null?void 0:oe.image.type)==="img2img"?t(jn("img2img")):((le=h.metadata)==null?void 0:le.image.type)==="txt2img"&&t(jn("txt2img")))};de("a",()=>{var oe,le;["txt2img","img2img"].includes((le=(oe=h==null?void 0:h.metadata)==null?void 0:oe.image)==null?void 0:le.type)?(P(),S({title:C("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.parametersNotSet"),description:C("toast.parametersNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[h]);const M=()=>{h!=null&&h.metadata&&t(os(h.metadata.image.seed))};de("s",()=>{var oe,le;(le=(oe=h==null?void 0:h.metadata)==null?void 0:oe.image)!=null&&le.seed?(M(),S({title:C("toast.seedSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.seedNotSet"),description:C("toast.seedNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[h]);const T=g.useCallback(()=>{var oe,le,Re,Ne;(le=(oe=h==null?void 0:h.metadata)==null?void 0:oe.image)!=null&&le.prompt&&k((Ne=(Re=h==null?void 0:h.metadata)==null?void 0:Re.image)==null?void 0:Ne.prompt)},[(Q=(L=h==null?void 0:h.metadata)==null?void 0:L.image)==null?void 0:Q.prompt,k]);de("p",()=>{var oe,le;(le=(oe=h==null?void 0:h.metadata)==null?void 0:oe.image)!=null&&le.prompt?(T(),S({title:C("toast.promptSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.promptNotSet"),description:C("toast.promptNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[h]);const D=()=>{h&&t(u3(h))};de("Shift+U",()=>{s&&!f&&r&&!n&&c?D():S({title:C("toast.upscalingFailed"),status:"error",duration:2500,isClosable:!0})},[h,s,f,r,n,c]);const _=()=>{h&&t(d3(h))};de("Shift+R",()=>{o&&!f&&r&&!n&&u?_():S({title:C("toast.faceRestoreFailed"),status:"error",duration:2500,isClosable:!0})},[h,o,f,r,n,u]);const R=()=>t(D1(!p)),V=()=>{h&&(y&&t(Vo(!1)),t(xc(h)),t(cn()),x!=="unifiedCanvas"&&t(jn("unifiedCanvas")),S({title:C("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0}))};de("i",()=>{h?R():S({title:C("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[h,p]);const F=()=>{t(Vo(!y))};return l.jsxs(B,{sx:{justifyContent:"center",alignItems:"center",columnGap:"0.5em"},...e,children:[l.jsxs(Qt,{isAttached:!0,children:[l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{"aria-label":`${C("parameters.sendTo")}...`,icon:l.jsx(W9,{})}),children:l.jsxs(B,{sx:{flexDirection:"column",rowGap:2},children:[l.jsx(Je,{size:"sm",onClick:w,leftIcon:l.jsx(e0,{}),children:C("parameters.sendToImg2Img")}),l.jsx(Je,{size:"sm",onClick:V,leftIcon:l.jsx(e0,{}),children:C("parameters.sendToUnifiedCanvas")}),l.jsx(Je,{size:"sm",onClick:j,leftIcon:l.jsx(Ki,{}),children:C("parameters.copyImage")}),l.jsx(Je,{size:"sm",onClick:I,leftIcon:l.jsx(Ki,{}),children:C("parameters.copyImageToLink")}),l.jsx(Go,{download:!0,href:h==null?void 0:h.url,children:l.jsx(Je,{leftIcon:l.jsx(Xh,{}),size:"sm",w:"100%",children:C("parameters.downloadImage")})})]})}),l.jsx(se,{icon:l.jsx(E9,{}),tooltip:y?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,"aria-label":y?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,isChecked:y,onClick:F})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{icon:l.jsx(N9,{}),tooltip:`${C("parameters.usePrompt")} (P)`,"aria-label":`${C("parameters.usePrompt")} (P)`,isDisabled:!((K=(U=h==null?void 0:h.metadata)==null?void 0:U.image)!=null&&K.prompt),onClick:T}),l.jsx(se,{icon:l.jsx(H9,{}),tooltip:`${C("parameters.useSeed")} (S)`,"aria-label":`${C("parameters.useSeed")} (S)`,isDisabled:!((ne=(te=h==null?void 0:h.metadata)==null?void 0:te.image)!=null&&ne.seed),onClick:M}),l.jsx(se,{icon:l.jsx(C9,{}),tooltip:`${C("parameters.useAll")} (A)`,"aria-label":`${C("parameters.useAll")} (A)`,isDisabled:!["txt2img","img2img"].includes((Z=($=h==null?void 0:h.metadata)==null?void 0:$.image)==null?void 0:Z.type),onClick:P})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{icon:l.jsx(M9,{}),"aria-label":C("parameters.restoreFaces")}),children:l.jsxs(B,{sx:{flexDirection:"column",rowGap:4},children:[l.jsx(pp,{}),l.jsx(Je,{isDisabled:!o||!h||!(r&&!n)||!u,onClick:_,children:C("parameters.restoreFaces")})]})}),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{icon:l.jsx(j9,{}),"aria-label":C("parameters.upscale")}),children:l.jsxs(B,{sx:{flexDirection:"column",gap:4},children:[l.jsx(mp,{}),l.jsx(Je,{isDisabled:!s||!h||!(r&&!n)||!c,onClick:D,children:C("parameters.upscaleImage")})]})})]}),l.jsx(Qt,{isAttached:!0,children:l.jsx(se,{icon:l.jsx(Fx,{}),tooltip:`${C("parameters.info")} (I)`,"aria-label":`${C("parameters.info")} (I)`,isChecked:p,onClick:R})}),l.jsx(hc,{image:h,children:l.jsx(se,{icon:l.jsx(ri,{}),tooltip:`${C("parameters.deleteImage")} (Del)`,"aria-label":`${C("parameters.deleteImage")} (Del)`,isDisabled:!h||!r||n,colorScheme:"error"})})]})};function CA(e){return ve({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 yt=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:c}=X();return l.jsxs(B,{gap:2,children:[n&&l.jsx(Gt,{label:`Recall ${e}`,children:l.jsx(fo,{"aria-label":c("accessibility.useThisParameter"),icon:l.jsx(CA,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&l.jsx(Gt,{label:`Copy ${e}`,children:l.jsx(fo,{"aria-label":`Copy ${e}`,icon:l.jsx(Ki,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),l.jsxs(B,{direction:o?"column":"row",children:[l.jsxs(Ce,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?l.jsxs(Go,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",l.jsx(j4,{mx:"2px"})]}):l.jsx(Ce,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]})},wA=(e,t)=>e.image.uuid===t.image.uuid,yp=g.memo(({image:e})=>{var F,L;const t=Y(),n=gp();de("esc",()=>{t(D1(!1))});const r=((F=e==null?void 0:e.metadata)==null?void 0:F.image)||{},o=e==null?void 0:e.dreamPrompt,{cfg_scale:s,fit:c,height:u,hires_fix:f,init_image_path:p,mask_image_path:h,orig_path:y,perlin:x,postprocessing:S,prompt:C,sampler:k,seamless:w,seed:j,steps:I,strength:P,threshold:M,type:T,variations:D,width:_}=r,{t:R}=X(),V=JSON.stringify(e.metadata,null,2);return l.jsxs(B,{sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",backdropFilter:"blur(20px)",bg:"whiteAlpha.600",_dark:{bg:"blackAlpha.600"}},children:[l.jsxs(B,{gap:2,children:[l.jsx(Ce,{fontWeight:"semibold",children:"File:"}),l.jsxs(Go,{href:e.url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.url.length>64?e.url.substring(0,64).concat("..."):e.url,l.jsx(j4,{mx:"2px"})]})]}),Object.keys(r).length>0?l.jsxs(l.Fragment,{children:[T&&l.jsx(yt,{label:"Generation type",value:T}),((L=e.metadata)==null?void 0:L.model_weights)&&l.jsx(yt,{label:"Model",value:e.metadata.model_weights}),["esrgan","gfpgan"].includes(T)&&l.jsx(yt,{label:"Original image",value:y}),C&&l.jsx(yt,{label:"Prompt",labelPosition:"top",value:typeof C=="string"?C:I1(C),onClick:()=>n(C)}),j!==void 0&&l.jsx(yt,{label:"Seed",value:j,onClick:()=>t(os(j))}),M!==void 0&&l.jsx(yt,{label:"Noise Threshold",value:M,onClick:()=>t(Jd(M))}),x!==void 0&&l.jsx(yt,{label:"Perlin Noise",value:x,onClick:()=>t(ef(x))}),k&&l.jsx(yt,{label:"Sampler",value:k,onClick:()=>t(A1(k))}),I&&l.jsx(yt,{label:"Steps",value:I,onClick:()=>t(tf(I))}),s!==void 0&&l.jsx(yt,{label:"CFG scale",value:s,onClick:()=>t(nf(s))}),D&&D.length>0&&l.jsx(yt,{label:"Seed-weight pairs",value:Mv(D),onClick:()=>t(O1(Mv(D)))}),w&&l.jsx(yt,{label:"Seamless",value:w,onClick:()=>t(z1(w))}),f&&l.jsx(yt,{label:"High Resolution Optimization",value:f,onClick:()=>t(R1(f))}),_&&l.jsx(yt,{label:"Width",value:_,onClick:()=>t(Fl(_))}),u&&l.jsx(yt,{label:"Height",value:u,onClick:()=>t(Ll(u))}),p&&l.jsx(yt,{label:"Initial image",value:p,isLink:!0,onClick:()=>t(ns(p))}),h&&l.jsx(yt,{label:"Mask image",value:h,isLink:!0,onClick:()=>t(f3(h))}),T==="img2img"&&P&&l.jsx(yt,{label:"Image to image strength",value:P,onClick:()=>t(rf(P))}),c&&l.jsx(yt,{label:"Image to image fit",value:c,onClick:()=>t(N1(c))}),S&&S.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Wn,{size:"sm",children:"Postprocessing"}),S.map((Q,U)=>{if(Q.type==="esrgan"){const{scale:K,strength:te,denoise_str:ne}=Q;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${U+1}: Upscale (ESRGAN)`}),l.jsx(yt,{label:"Scale",value:K,onClick:()=>t(P1(K))}),l.jsx(yt,{label:"Strength",value:te,onClick:()=>t(Zd(te))}),ne!==void 0&&l.jsx(yt,{label:"Denoising strength",value:ne,onClick:()=>t(Qd(ne))})]},U)}else if(Q.type==="gfpgan"){const{strength:K}=Q;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${U+1}: Face restoration (GFPGAN)`}),l.jsx(yt,{label:"Strength",value:K,onClick:()=>{t(Yl(K)),t(Nl("gfpgan"))}})]},U)}else if(Q.type==="codeformer"){const{strength:K,fidelity:te}=Q;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${U+1}: Face restoration (Codeformer)`}),l.jsx(yt,{label:"Strength",value:K,onClick:()=>{t(Yl(K)),t(Nl("codeformer"))}}),te&&l.jsx(yt,{label:"Fidelity",value:te,onClick:()=>{t(Xd(te)),t(Nl("codeformer"))}})]},U)}})]}),o&&l.jsx(yt,{withCopy:!0,label:"Dream Prompt",value:o}),l.jsxs(B,{gap:2,direction:"column",children:[l.jsxs(B,{gap:2,children:[l.jsx(Gt,{label:"Copy metadata JSON",children:l.jsx(fo,{"aria-label":R("accessibility.copyMetadataJson"),icon:l.jsx(Ki,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(V)})}),l.jsx(Ce,{fontWeight:"semibold",children:"Metadata JSON:"})]}),l.jsx(Ye,{sx:{mt:0,mr:2,mb:4,ml:2,padding:4,borderRadius:"base",overflowX:"scroll",wordBreak:"break-all",bg:"whiteAlpha.500",_dark:{bg:"blackAlpha.500"}},children:l.jsx("pre",{children:V})})]})]}):l.jsx(xy,{width:"100%",pt:10,children:l.jsx(Ce,{fontSize:"lg",fontWeight:"semibold",children:"No metadata available"})})]})},wA);yp.displayName="ImageMetadataViewer";const V0={height:"100%",width:"15%",alignItems:"center",pointerEvents:"auto"},U0={color:"base.100"},kA=me(Gr,e=>{const{currentImage:t}=e,n=e.categories[t?t.category:"result"].images,r=n.findIndex(s=>{var c;return s.uuid===((c=e==null?void 0:e.currentImage)==null?void 0:c.uuid)}),o=n.length;return{isOnFirstImage:r===0,isOnLastImage:!isNaN(r)&&r===o-1}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),A4=()=>{const e=Y(),{t}=X(),{isOnFirstImage:n,isOnLastImage:r}=A(kA),[o,s]=g.useState(!1),c=()=>{s(!0)},u=()=>{s(!1)},f=()=>{e(F1())},p=()=>{e(L1())};return l.jsxs(B,{sx:{justifyContent:"space-between",zIndex:1,height:"100%",width:"100%",pointerEvents:"none"},children:[l.jsx(or,{sx:{...V0,justifyContent:"flex-start"},onMouseOver:c,onMouseOut:u,children:o&&!n&&l.jsx(fo,{"aria-label":t("accessibility.previousImage"),icon:l.jsx(y9,{size:64}),variant:"unstyled",onClick:f,boxSize:16,sx:U0})}),l.jsx(or,{sx:{...V0,justifyContent:"flex-end"},onMouseOver:c,onMouseOut:u,children:o&&!r&&l.jsx(fo,{"aria-label":t("accessibility.nextImage"),icon:l.jsx(x9,{size:64}),variant:"unstyled",onClick:p,boxSize:16,sx:U0})})]})},jA=me([Gr,Er],(e,t)=>{const{currentImage:n,intermediateImage:r}=e,{shouldShowImageDetails:o}=t;return{imageToDisplay:r||n,isIntermediate:Boolean(r),shouldShowImageDetails:o}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function EA(){const{shouldShowImageDetails:e,imageToDisplay:t,isIntermediate:n}=A(jA);return l.jsxs(B,{sx:{position:"relative",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:[t&&l.jsx(ls,{src:t.url,width:t.width,height:t.height,sx:{objectFit:"contain",maxWidth:"100%",maxHeight:"100%",height:"auto",position:"absolute",imageRendering:n?"pixelated":"initial",borderRadius:"base"}}),!e&&l.jsx(A4,{}),e&&t&&l.jsx(Ye,{sx:{position:"absolute",top:"0",width:"100%",height:"100%",borderRadius:"base",overflow:"scroll",maxHeight:tP},children:l.jsx(yp,{image:t})})]})}const PA=me([Gr],e=>{const{currentImage:t,intermediateImage:n}=e;return{hasAnImageToDisplay:t||n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),O4=()=>{const{hasAnImageToDisplay:e}=A(PA);return l.jsx(B,{sx:{flexDirection:"column",height:"100%",width:"100%",rowGap:4,borderRadius:"base"},children:e?l.jsxs(l.Fragment,{children:[l.jsx(D4,{}),l.jsx(EA,{})]}):l.jsx(B,{sx:{alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:l.jsx(tn,{as:VD,sx:{boxSize:24,color:"base.500"}})})})},IA=()=>{const{t:e}=X(),t=g.useContext(qh);return l.jsx(se,{"aria-label":e("accessibility.uploadImage"),tooltip:"Upload Image",icon:l.jsx(Oc,{}),onClick:t||void 0})};function MA(){const e=A(s=>s.generation.initialImage),{t}=X(),n=Y(),r=ss(),o=()=>{r({title:t("toast.parametersFailed"),description:t("toast.parametersFailedDesc"),status:"error",isClosable:!0}),n(h3())};return l.jsxs(l.Fragment,{children:[l.jsxs(B,{sx:{alignItems:"center",justifyContent:"center",w:"100%",gap:4},children:[l.jsx(Ce,{sx:{fontSize:"lg"},variant:"subtext",children:t("parameters.initialImage")}),l.jsx(IA,{})]}),e&&l.jsx(B,{sx:{position:"relative",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:l.jsx(ls,{sx:{fit:"contain",maxWidth:"100%",maxHeight:"100%",borderRadius:"base",objectFit:"contain",position:"absolute"},src:typeof e=="string"?e:e.url,onError:o})})]})}const $0={flexDirection:"column",height:"100%",width:"100%",gap:4,padding:4},TA=()=>{const t=A(n=>n.generation.initialImage)?l.jsx(B,{flexDirection:"column",gap:4,w:"100%",h:"100%",children:l.jsx(MA,{})}):l.jsx(hA,{});return l.jsxs(or,{sx:{w:"100%",h:"100%",gridTemplateColumns:"1fr 1fr",borderRadius:"base",bg:"base.850"},children:[l.jsx(B,{sx:{...$0,paddingInlineEnd:2},children:t}),l.jsx(B,{sx:{...$0,paddingInlineStart:2},children:l.jsx(O4,{})})]})};var ln=(e=>(e[e.PROMPT=0]="PROMPT",e[e.GALLERY=1]="GALLERY",e[e.OTHER=2]="OTHER",e[e.SEED=3]="SEED",e[e.VARIATIONS=4]="VARIATIONS",e[e.UPSCALE=5]="UPSCALE",e[e.FACE_CORRECTION=6]="FACE_CORRECTION",e[e.IMAGE_TO_IMAGE=7]="IMAGE_TO_IMAGE",e[e.BOUNDING_BOX=8]="BOUNDING_BOX",e[e.SEAM_CORRECTION=9]="SEAM_CORRECTION",e[e.INFILL_AND_SCALING=10]="INFILL_AND_SCALING",e))(ln||{});const _A=()=>{const{t:e}=X();return g.useMemo(()=>({[0]:{text:e("tooltip.feature.prompt"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[1]:{text:e("tooltip.feature.gallery"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[2]:{text:e("tooltip.feature.other"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[3]:{text:e("tooltip.feature.seed"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[4]:{text:e("tooltip.feature.variations"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[5]:{text:e("tooltip.feature.upscale"),href:"link/to/docs/feature1.html",guideImage:"asset/path.gif"},[6]:{text:e("tooltip.feature.faceCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[7]:{text:e("tooltip.feature.imageToImage"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[8]:{text:e("tooltip.feature.boundingBox"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[9]:{text:e("tooltip.feature.seamCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[10]:{text:e("tooltip.feature.infillAndScaling"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"}}),[e])},DA=e=>_A()[e];function z4(){const e=A(o=>o.system.isGFPGANAvailable),t=A(o=>o.postprocessing.shouldRunFacetool),n=Y(),r=o=>n(p3(o.target.checked));return l.jsx(En,{isDisabled:!e,isChecked:t,onChange:r})}const R4=()=>{const e=Y(),t=A(o=>o.generation.seamless),n=o=>e(z1(o.target.checked)),{t:r}=X();return l.jsx(En,{label:r("parameters.seamlessTiling"),fontSize:"md",isChecked:t,onChange:n})},AA=()=>l.jsx(ze,{gap:2,alignItems:"stretch",children:l.jsx(R4,{})});function xp(){const e=A(s=>s.generation.horizontalSymmetrySteps),t=A(s=>s.generation.verticalSymmetrySteps),n=A(s=>s.generation.steps),r=Y(),{t:o}=X();return l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(ut,{label:o("parameters.hSymmetryStep"),value:e,onChange:s=>r(Tv(s)),min:0,max:n,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>r(Tv(0))}),l.jsx(ut,{label:o("parameters.vSymmetryStep"),value:t,onChange:s=>r(_v(s)),min:0,max:n,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>r(_v(0))})]})}function bp(){const e=A(n=>n.generation.shouldUseSymmetry),t=Y();return l.jsx(En,{isChecked:e,onChange:n=>t(m3(n.target.checked))})}function OA(){const e=Y(),t=A(r=>r.generation.perlin),{t:n}=X();return l.jsx(ut,{label:n("parameters.perlinNoise"),min:0,max:1,step:.05,onChange:r=>e(ef(r)),handleReset:()=>e(ef(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}function zA(){const e=Y(),{t}=X(),n=A(o=>o.generation.shouldRandomizeSeed),r=o=>e(v3(o.target.checked));return l.jsx(En,{label:t("parameters.randomizeSeed"),isChecked:n,onChange:r})}function RA(){const e=Y(),t=A(o=>o.generation.shouldRandomizeSeed),{t:n}=X(),r=()=>e(os(g3(H1,B1)));return l.jsx(ti,{size:"sm",isDisabled:t,onClick:r,padding:"0 1.5rem",children:l.jsx("p",{children:n("parameters.shuffle")})})}function NA(){const e=A(c=>c.generation.seed),t=A(c=>c.generation.shouldRandomizeSeed),n=A(c=>c.generation.shouldGenerateVariations),{t:r}=X(),o=Y(),s=c=>o(os(c));return l.jsxs(ra,{gap:2,children:[l.jsx(Wr,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:H1,max:B1,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e,formControlProps:{display:"flex",alignItems:"center",gap:3}}),l.jsx(RA,{})]})}function FA(){const e=Y(),t=A(r=>r.generation.threshold),{t:n}=X();return l.jsx(ut,{label:n("parameters.noiseThreshold"),min:0,max:20,step:.1,onChange:r=>e(Jd(r)),handleReset:()=>e(Jd(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}const Sp=()=>l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(zA,{}),l.jsx(NA,{}),l.jsx(FA,{}),l.jsx(OA,{})]});function N4(){const e=A(o=>o.system.isESRGANAvailable),t=A(o=>o.postprocessing.shouldRunESRGAN),n=Y(),r=o=>n(y3(o.target.checked));return l.jsx(En,{isDisabled:!e,isChecked:t,onChange:r})}function Cp(){const e=A(r=>r.generation.shouldGenerateVariations),t=Y(),n=r=>t(x3(r.target.checked));return l.jsx(En,{isChecked:e,width:"auto",onChange:n})}function LA(){const e=A(s=>s.generation.seedWeights),t=A(s=>s.generation.shouldGenerateVariations),{t:n}=X(),r=Y(),o=s=>r(O1(s.target.value));return l.jsx(mt,{label:n("parameters.seedWeights"),value:e,isInvalid:t&&!(W1(e)||e===""),isDisabled:!t,onChange:o})}function BA(){const e=A(o=>o.generation.variationAmount),t=A(o=>o.generation.shouldGenerateVariations),{t:n}=X(),r=Y();return l.jsx(ut,{label:n("parameters.variationAmount"),value:e,step:.01,min:0,max:1,isSliderDisabled:!t,isInputDisabled:!t,isResetDisabled:!t,onChange:o=>r(Dv(o)),handleReset:()=>r(Dv(.1)),withInput:!0,withReset:!0,withSliderMarks:!0})}const wp=()=>l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(BA,{}),l.jsx(LA,{})]});function G0(){const e=Y(),t=A(s=>s.generation.cfgScale),n=A(s=>s.ui.shouldUseSliders),{t:r}=X(),o=s=>e(nf(s));return n?l.jsx(ut,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:30,onChange:o,handleReset:()=>e(nf(7.5)),value:t,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0}):l.jsx(Wr,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:200,onChange:o,value:t,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})}function q0(){const e=A(s=>s.generation.height),t=A(s=>s.ui.shouldUseSliders),n=A(bt),r=Y(),{t:o}=X();return t?l.jsx(ut,{isSliderDisabled:n==="unifiedCanvas",isInputDisabled:n==="unifiedCanvas",isResetDisabled:n==="unifiedCanvas",label:o("parameters.height"),value:e,min:64,step:64,max:2048,onChange:s=>r(Ll(s)),handleReset:()=>r(Ll(512)),withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:15360}}):l.jsx(Mn,{isDisabled:n==="unifiedCanvas",label:o("parameters.height"),value:e,flexGrow:1,onChange:s=>r(Ll(Number(s.target.value))),validValues:b3})}function Y0(){const e=A(s=>s.generation.iterations),t=A(s=>s.ui.shouldUseSliders),n=Y(),{t:r}=X(),o=s=>n(Av(s));return t?l.jsx(ut,{label:r("parameters.images"),step:1,min:1,max:16,onChange:o,handleReset:()=>n(Av(1)),value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:9999}}):l.jsx(Wr,{label:r("parameters.images"),step:1,min:1,max:9999,onChange:o,value:e,numberInputFieldProps:{textAlign:"center"}})}function K0(){const e=A(s=>s.generation.sampler),t=A($x),n=Y(),{t:r}=X(),o=s=>n(A1(s.target.value));return l.jsx(Mn,{label:r("parameters.sampler"),value:e,onChange:o,validValues:t.format==="diffusers"?S3:C3,minWidth:36})}function X0(){const e=Y(),t=A(c=>c.generation.steps),n=A(c=>c.ui.shouldUseSliders),{t:r}=X(),o=c=>{e(tf(c))},s=()=>{e(V1())};return n?l.jsx(ut,{label:r("parameters.steps"),min:1,step:1,onChange:o,handleReset:()=>e(tf(20)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:9999}}):l.jsx(Wr,{label:r("parameters.steps"),min:1,max:9999,step:1,onChange:o,value:t,numberInputFieldProps:{textAlign:"center"},onBlur:s})}function Q0(){const e=A(s=>s.generation.width),t=A(s=>s.ui.shouldUseSliders),n=A(bt),{t:r}=X(),o=Y();return t?l.jsx(ut,{isSliderDisabled:n==="unifiedCanvas",isInputDisabled:n==="unifiedCanvas",isResetDisabled:n==="unifiedCanvas",label:r("parameters.width"),value:e,min:64,step:64,max:2048,onChange:s=>o(Fl(s)),handleReset:()=>o(Fl(512)),withInput:!0,withReset:!0,withSliderMarks:!0,inputReadOnly:!0,sliderNumberInputProps:{max:15360}}):l.jsx(Mn,{isDisabled:n==="unifiedCanvas",label:r("parameters.width"),value:e,flexGrow:1,onChange:s=>o(Fl(Number(s.target.value))),validValues:w3})}function kp(){return A(t=>t.ui.shouldUseSliders)?l.jsxs(ze,{gap:2,children:[l.jsx(Y0,{}),l.jsx(X0,{}),l.jsx(G0,{}),l.jsx(Q0,{}),l.jsx(q0,{}),l.jsx(K0,{})]}):l.jsxs(B,{rowGap:2,flexDirection:"column",children:[l.jsxs(B,{columnGap:1,children:[l.jsx(Y0,{}),l.jsx(X0,{}),l.jsx(G0,{})]}),l.jsxs(B,{columnGap:1,children:[l.jsx(Q0,{}),l.jsx(q0,{}),l.jsx(K0,{})]})]})}const HA=me(Et,e=>e.shouldDisplayGuides),WA=({children:e,feature:t})=>{const n=A(HA),{text:r}=DA(t);return n?l.jsxs(Vh,{trigger:"hover",isLazy:!0,children:[l.jsx(Wh,{children:l.jsx(Ye,{children:e})}),l.jsxs($h,{maxWidth:"400px",onClick:o=>o.preventDefault(),cursor:"initial",children:[l.jsx(Uh,{}),l.jsx(Ky,{children:r})]})]}):null},VA=g.memo(WA),UA=fe(({feature:e,icon:t=RD},n)=>l.jsx(VA,{feature:e,children:l.jsx(Ye,{ref:n,children:l.jsx(tn,{marginBottom:"-.15rem",as:t})})})),$A=g.memo(UA);function GA(e){const{header:t,feature:n,content:r,additionalHeaderComponents:o}=e;return l.jsxs(Oi,{children:[l.jsx(Di,{children:l.jsxs(B,{width:"100%",gap:2,align:"center",children:[l.jsx(Ye,{flexGrow:1,textAlign:"start",children:t}),o,n&&l.jsx($A,{feature:n}),l.jsx(Ai,{})]})}),l.jsx(zi,{children:r})]})}const jp=e=>{const{accordionInfo:t}=e,n=A(c=>c.system.openAccordions),r=Y(),o=c=>r(k3(c)),s=()=>{const c=[];return t&&Object.keys(t).forEach(u=>{const{header:f,feature:p,content:h,additionalHeaderComponents:y}=t[u];c.push(l.jsx(GA,{header:f,feature:p,content:h,additionalHeaderComponents:y},u))}),c};return l.jsx(oh,{defaultIndex:n,allowMultiple:!0,reduceMotion:!0,onChange:o,sx:{display:"flex",flexDirection:"column",gap:2},children:s()})},qA=e=>{const{menuType:t="icon",iconTooltip:n,buttonText:r,isLazy:o=!0,menuItems:s,menuProps:c,menuButtonProps:u,menuListProps:f,menuItemProps:p}=e,h=()=>{const y=[];return s.forEach((x,S)=>{y.push(l.jsx(vr,{onClick:x.onClick,fontSize:"sm",...p,children:x.item},S))}),y};return l.jsx(Dh,{...c,isLazy:o,children:({isOpen:y})=>l.jsxs(l.Fragment,{children:[l.jsx(Oh,{as:t==="icon"?fo:ti,tooltip:n,"aria-label":n,icon:y?l.jsx($D,{}):l.jsx(UD,{}),paddingX:0,paddingY:t==="regular"?2:0,...u,children:t==="regular"&&r}),l.jsx(Ah,{zIndex:15,padding:0,...f,children:h()})]})})},YA=g.memo(qA),KA=me(Et,e=>({isProcessing:e.isProcessing,isConnected:e.isConnected,isCancelable:e.isCancelable,currentIteration:e.currentIteration,totalIterations:e.totalIterations,cancelType:e.cancelOptions.cancelType,cancelAfter:e.cancelOptions.cancelAfter}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),XA=e=>{const t=Y(),{btnGroupWidth:n="auto",...r}=e,{isProcessing:o,isConnected:s,isCancelable:c,currentIteration:u,totalIterations:f,cancelType:p,cancelAfter:h}=A(KA),y=g.useCallback(()=>{t(j3()),t(ud(null))},[t]),{t:x}=X(),S=h!==null;de("shift+x",()=>{(s||o)&&c&&y()},[s,o,c]),g.useEffect(()=>{h!==null&&ht(Ov("immediate"))},{item:x("parameters.cancel.schedule"),onClick:()=>t(Ov("scheduled"))}];return l.jsxs(Qt,{isAttached:!0,width:n,children:[p==="immediate"?l.jsx(se,{icon:l.jsx(GD,{}),tooltip:x("parameters.cancel.immediate"),"aria-label":x("parameters.cancel.immediate"),isDisabled:!s||!o||!c,onClick:y,colorScheme:"error",...r}):l.jsx(se,{icon:S?l.jsx(tc,{}):l.jsx(zD,{}),tooltip:x(S?"parameters.cancel.isScheduled":"parameters.cancel.schedule"),"aria-label":x(S?"parameters.cancel.isScheduled":"parameters.cancel.schedule"),isDisabled:!s||!o||!c||u===f,onClick:()=>{t(S?ud(null):ud(u))},colorScheme:"error",...r}),l.jsx(YA,{menuItems:C,iconTooltip:x("parameters.cancel.setType"),menuButtonProps:{colorScheme:"error",minWidth:5}})]})},Ep=g.memo(XA),tt=e=>e.canvas,Ot=me([tt,bt,Et],(e,t,n)=>e.layerState.stagingArea.images.length>0||t==="unifiedCanvas"&&n.isProcessing),F4=e=>e.canvas.layerState.objects.find(U1),Pp=e=>e.generation;me(Pp,({shouldRandomizeSeed:e,shouldGenerateVariations:t})=>e||t,{memoizeOptions:{resultEqualityCheck:ee.isEqual}});const L4=me([Pp,Et,F4,bt],(e,t,n,r)=>{const{prompt:o,shouldGenerateVariations:s,seedWeights:c,initialImage:u,seed:f}=e,{isProcessing:p,isConnected:h}=t;let y=!0;const x=[];return(!o||Boolean(o.match(/^[\s\r\n]+$/)))&&(y=!1,x.push("Missing prompt")),r==="img2img"&&!u&&(y=!1,x.push("No initial image selected")),p&&(y=!1,x.push("System Busy")),h||(y=!1,x.push("System Disconnected")),s&&(!(W1(c)||c==="")||f===-1)&&(y=!1,x.push("Seed-Weights badly formatted.")),{isReady:y,reasonsWhyNotReady:x}},{memoizeOptions:{equalityCheck:ee.isEqual,resultEqualityCheck:ee.isEqual}});function Ip(e){const{iconButton:t=!1,...n}=e,r=Y(),{isReady:o}=A(L4),s=A(bt),c=()=>{r(of(s))},{t:u}=X();return de(["ctrl+enter","meta+enter"],()=>{r(V1()),r(of(s))},{enabled:()=>o,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s]),l.jsx(Ye,{style:{flexGrow:4},children:t?l.jsx(se,{"aria-label":u("parameters.invoke"),type:"submit",icon:l.jsx(R9,{}),isDisabled:!o,onClick:c,flexGrow:1,w:"100%",tooltip:u("parameters.invoke"),tooltipProps:{placement:"bottom"},colorScheme:"accent",...n}):l.jsx(Je,{"aria-label":u("parameters.invoke"),type:"submit",isDisabled:!o,onClick:c,flexGrow:1,w:"100%",colorScheme:"accent",fontWeight:700,...n,children:"Invoke"})})}const QA=me(vp,({shouldLoopback:e})=>e),ZA=()=>{const e=Y(),t=A(QA),{t:n}=X();return l.jsx(se,{"aria-label":n("parameters.toggleLoopback"),tooltip:n("parameters.toggleLoopback"),isChecked:t,icon:l.jsx(F9,{}),onClick:()=>{e(E3(!t))}})},Mp=()=>{const e=A(bt);return l.jsxs(B,{gap:2,children:[l.jsx(Ip,{}),e==="img2img"&&l.jsx(ZA,{}),l.jsx(Ep,{})]})},Tp=()=>{const e=A(r=>r.generation.negativePrompt),t=Y(),{t:n}=X();return l.jsx(rt,{children:l.jsx(Gh,{id:"negativePrompt",name:"negativePrompt",value:e,onChange:r=>t(T1(r.target.value)),placeholder:n("parameters.negativePrompts"),_focusVisible:{borderColor:"error.600"},fontSize:"sm"})})},JA=me([e=>e.generation,bt],(e,t)=>({prompt:e.prompt,activeTabName:t}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),_p=()=>{const e=Y(),{prompt:t,activeTabName:n}=A(JA),{isReady:r}=A(L4),o=g.useRef(null),{t:s}=X(),c=f=>{e(M1(f.target.value))};de("alt+a",()=>{var f;(f=o.current)==null||f.focus()},[]);const u=f=>{f.key==="Enter"&&f.shiftKey===!1&&r&&(f.preventDefault(),e(of(n)))};return l.jsx(Ye,{children:l.jsx(rt,{isInvalid:t.length===0||Boolean(t.match(/^[\s\r\n]+$/)),children:l.jsx(Gh,{id:"prompt",name:"prompt",placeholder:s("parameters.promptPlaceholder"),value:t,onChange:c,onKeyDown:u,resize:"vertical",ref:o,minH:40})})})};function eO(){const e=Y(),t=A(o=>o.generation.shouldFitToWidthHeight),n=o=>e(N1(o.target.checked)),{t:r}=X();return l.jsx(En,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function B4(e){const{t}=X(),{label:n=`${t("parameters.strength")}`}=e,r=A(u=>u.generation.img2imgStrength),o=Y(),s=u=>o(rf(u)),c=()=>{o(rf(.75))};return l.jsx(ut,{label:n,step:.01,min:.01,max:1,onChange:s,value:r,isInteger:!1,withInput:!0,withSliderMarks:!0,inputWidth:22,withReset:!0,handleReset:c})}function tO(){const{t:e}=X();return l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(B4,{label:e("parameters.img2imgStrength")}),l.jsx(eO,{})]})}const nO=()=>{const{t:e}=X(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(kp,{})},imageToImage:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(tO,{})},seed:{header:`${e("parameters.seed")}`,feature:ln.SEED,content:l.jsx(Sp,{})},variations:{header:`${e("parameters.variations")}`,feature:ln.VARIATIONS,content:l.jsx(wp,{}),additionalHeaderComponents:l.jsx(Cp,{})},face_restore:{header:`${e("parameters.faceRestoration")}`,feature:ln.FACE_CORRECTION,content:l.jsx(pp,{}),additionalHeaderComponents:l.jsx(z4,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:ln.UPSCALE,content:l.jsx(mp,{}),additionalHeaderComponents:l.jsx(N4,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(xp,{}),additionalHeaderComponents:l.jsx(bp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:ln.OTHER,content:l.jsx(AA,{})}};return l.jsxs(B,{flexDir:"column",gap:2,position:"relative",children:[l.jsx(_p,{}),l.jsx(Tp,{}),l.jsx(Mp,{}),l.jsx(jp,{accordionInfo:t})]})},rO=g.memo(nO);function oO(){return l.jsx(hp,{parametersPanelContent:l.jsx(rO,{}),children:l.jsx(TA,{})})}const iO=()=>l.jsx(Ye,{sx:{width:"100%",height:"100%",borderRadius:"base",bg:"base.850"},children:l.jsx(B,{sx:{p:4,width:"100%",height:"100%"},children:l.jsx(O4,{})})}),aO=me([vp],({hiresFix:e,hiresStrength:t})=>({hiresFix:e,hiresStrength:t}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),sO=()=>{const{hiresFix:e,hiresStrength:t}=A(aO),n=Y(),{t:r}=X(),o=c=>{n(zv(c))},s=()=>{n(zv(.75))};return l.jsx(ut,{label:r("parameters.hiresStrength"),step:.01,min:.01,max:.99,onChange:o,value:t,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})},lO=()=>{const e=Y(),t=A(o=>o.postprocessing.hiresFix),{t:n}=X(),r=o=>e(R1(o.target.checked));return l.jsx(En,{label:n("parameters.hiresOptim"),fontSize:"md",isChecked:t,onChange:r})},cO=()=>l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(R4,{}),l.jsx(lO,{}),l.jsx(sO,{})]}),uO=()=>{const{t:e}=X(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(kp,{})},seed:{header:`${e("parameters.seed")}`,feature:ln.SEED,content:l.jsx(Sp,{})},variations:{header:`${e("parameters.variations")}`,feature:ln.VARIATIONS,content:l.jsx(wp,{}),additionalHeaderComponents:l.jsx(Cp,{})},face_restore:{header:`${e("parameters.faceRestoration")}`,feature:ln.FACE_CORRECTION,content:l.jsx(pp,{}),additionalHeaderComponents:l.jsx(z4,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:ln.UPSCALE,content:l.jsx(mp,{}),additionalHeaderComponents:l.jsx(N4,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(xp,{}),additionalHeaderComponents:l.jsx(bp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:ln.OTHER,content:l.jsx(cO,{})}};return l.jsxs(B,{flexDir:"column",gap:2,children:[l.jsx(_p,{}),l.jsx(Tp,{}),l.jsx(Mp,{}),l.jsx(jp,{accordionInfo:t})]})},dO=g.memo(uO);function fO(){return l.jsx(hp,{parametersPanelContent:l.jsx(dO,{}),children:l.jsx(iO,{})})}var Vf={},hO={get exports(){return Vf},set exports(e){Vf=e}};/** + * @license React + * react-reconciler.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 pO=function(t){var n={},r=g,o=Bl,s=Object.assign;function c(i){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+i,d=1;dO||v[E]!==b[O]){var W=` +`+v[E].replace(" at new "," at ");return i.displayName&&W.includes("")&&(W=W.replace("",i.displayName)),W}while(1<=E&&0<=O);break}}}finally{Zc=!1,Error.prepareStackTrace=d}return(i=i?i.displayName||i.name:"")?ca(i):""}var Vb=Object.prototype.hasOwnProperty,eu=[],ci=-1;function qr(i){return{current:i}}function St(i){0>ci||(i.current=eu[ci],eu[ci]=null,ci--)}function gt(i,a){ci++,eu[ci]=i.current,i.current=a}var Yr={},nn=qr(Yr),yn=qr(!1),jo=Yr;function ui(i,a){var d=i.type.contextTypes;if(!d)return Yr;var m=i.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===a)return m.__reactInternalMemoizedMaskedChildContext;var v={},b;for(b in d)v[b]=a[b];return m&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=a,i.__reactInternalMemoizedMaskedChildContext=v),v}function xn(i){return i=i.childContextTypes,i!=null}function ws(){St(yn),St(nn)}function Up(i,a,d){if(nn.current!==Yr)throw Error(c(168));gt(nn,a),gt(yn,d)}function $p(i,a,d){var m=i.stateNode;if(a=a.childContextTypes,typeof m.getChildContext!="function")return d;m=m.getChildContext();for(var v in m)if(!(v in a))throw Error(c(108,R(i)||"Unknown",v));return s({},d,m)}function ks(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Yr,jo=nn.current,gt(nn,i),gt(yn,yn.current),!0}function Gp(i,a,d){var m=i.stateNode;if(!m)throw Error(c(169));d?(i=$p(i,a,jo),m.__reactInternalMemoizedMergedChildContext=i,St(yn),St(nn),gt(nn,i)):St(yn),gt(yn,d)}var qn=Math.clz32?Math.clz32:Gb,Ub=Math.log,$b=Math.LN2;function Gb(i){return i>>>=0,i===0?32:31-(Ub(i)/$b|0)|0}var js=64,Es=4194304;function ua(i){switch(i&-i){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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function Ps(i,a){var d=i.pendingLanes;if(d===0)return 0;var m=0,v=i.suspendedLanes,b=i.pingedLanes,E=d&268435455;if(E!==0){var O=E&~v;O!==0?m=ua(O):(b&=E,b!==0&&(m=ua(b)))}else E=d&~v,E!==0?m=ua(E):b!==0&&(m=ua(b));if(m===0)return 0;if(a!==0&&a!==m&&!(a&v)&&(v=m&-m,b=a&-a,v>=b||v===16&&(b&4194240)!==0))return a;if(m&4&&(m|=d&16),a=i.entangledLanes,a!==0)for(i=i.entanglements,a&=m;0d;d++)a.push(i);return a}function da(i,a,d){i.pendingLanes|=a,a!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,a=31-qn(a),i[a]=d}function Kb(i,a){var d=i.pendingLanes&~a;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=a,i.mutableReadLanes&=a,i.entangledLanes&=a,a=i.entanglements;var m=i.eventTimes;for(i=i.expirationTimes;0>=E,v-=E,Mr=1<<32-qn(a)+v|d<it?(Xt=We,We=null):Xt=We.sibling;var at=be(H,We,G[it],Se);if(at===null){We===null&&(We=Xt);break}i&&We&&at.alternate===null&&a(H,We),z=b(at,z,it),Ke===null?De=at:Ke.sibling=at,Ke=at,We=Xt}if(it===G.length)return d(H,We),Pt&&Po(H,it),De;if(We===null){for(;itit?(Xt=We,We=null):Xt=We.sibling;var no=be(H,We,at.value,Se);if(no===null){We===null&&(We=Xt);break}i&&We&&no.alternate===null&&a(H,We),z=b(no,z,it),Ke===null?De=no:Ke.sibling=no,Ke=no,We=Xt}if(at.done)return d(H,We),Pt&&Po(H,it),De;if(We===null){for(;!at.done;it++,at=G.next())at=He(H,at.value,Se),at!==null&&(z=b(at,z,it),Ke===null?De=at:Ke.sibling=at,Ke=at);return Pt&&Po(H,it),De}for(We=m(H,We);!at.done;it++,at=G.next())at=Ct(We,H,it,at.value,Se),at!==null&&(i&&at.alternate!==null&&We.delete(at.key===null?it:at.key),z=b(at,z,it),Ke===null?De=at:Ke.sibling=at,Ke=at);return i&&We.forEach(function(OS){return a(H,OS)}),Pt&&Po(H,it),De}function Or(H,z,G,Se){if(typeof G=="object"&&G!==null&&G.type===h&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case f:e:{for(var De=G.key,Ke=z;Ke!==null;){if(Ke.key===De){if(De=G.type,De===h){if(Ke.tag===7){d(H,Ke.sibling),z=v(Ke,G.props.children),z.return=H,H=z;break e}}else if(Ke.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===P&&dm(De)===Ke.type){d(H,Ke.sibling),z=v(Ke,G.props),z.ref=ha(H,Ke,G),z.return=H,H=z;break e}d(H,Ke);break}else a(H,Ke);Ke=Ke.sibling}G.type===h?(z=Oo(G.props.children,H.mode,Se,G.key),z.return=H,H=z):(Se=dl(G.type,G.key,G.props,null,H.mode,Se),Se.ref=ha(H,z,G),Se.return=H,H=Se)}return E(H);case p:e:{for(Ke=G.key;z!==null;){if(z.key===Ke)if(z.tag===4&&z.stateNode.containerInfo===G.containerInfo&&z.stateNode.implementation===G.implementation){d(H,z.sibling),z=v(z,G.children||[]),z.return=H,H=z;break e}else{d(H,z);break}else a(H,z);z=z.sibling}z=ld(G,H.mode,Se),z.return=H,H=z}return E(H);case P:return Ke=G._init,Or(H,z,Ke(G._payload),Se)}if(te(G))return ft(H,z,G,Se);if(D(G))return wn(H,z,G,Se);Ls(H,G)}return typeof G=="string"&&G!==""||typeof G=="number"?(G=""+G,z!==null&&z.tag===6?(d(H,z.sibling),z=v(z,G),z.return=H,H=z):(d(H,z),z=sd(G,H.mode,Se),z.return=H,H=z),E(H)):d(H,z)}return Or}var vi=fm(!0),hm=fm(!1),pa={},Rn=qr(pa),ma=qr(pa),gi=qr(pa);function ur(i){if(i===pa)throw Error(c(174));return i}function Su(i,a){gt(gi,a),gt(ma,i),gt(Rn,pa),i=$(a),St(Rn),gt(Rn,i)}function yi(){St(Rn),St(ma),St(gi)}function pm(i){var a=ur(gi.current),d=ur(Rn.current);a=Z(d,i.type,a),d!==a&&(gt(ma,i),gt(Rn,a))}function Cu(i){ma.current===i&&(St(Rn),St(ma))}var Tt=qr(0);function Bs(i){for(var a=i;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Vp(d)||Xc(d)))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if(a.flags&128)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var wu=[];function ku(){for(var i=0;id?d:4,i(!0);var m=ju.transition;ju.transition={};try{i(!1),a()}finally{ot=d,ju.transition=m}}function Dm(){return Nn().memoizedState}function sS(i,a,d){var m=Jr(i);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},Am(i))Om(a,d);else if(d=rm(i,a,d,m),d!==null){var v=sn();Fn(d,i,m,v),zm(d,a,m)}}function lS(i,a,d){var m=Jr(i),v={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(Am(i))Om(a,v);else{var b=i.alternate;if(i.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var E=a.lastRenderedState,O=b(E,d);if(v.hasEagerState=!0,v.eagerState=O,Yn(O,E)){var W=a.interleaved;W===null?(v.next=v,gu(a)):(v.next=W.next,W.next=v),a.interleaved=v;return}}catch{}finally{}d=rm(i,a,v,m),d!==null&&(v=sn(),Fn(d,i,m,v),zm(d,a,m))}}function Am(i){var a=i.alternate;return i===_t||a!==null&&a===_t}function Om(i,a){va=Ws=!0;var d=i.pending;d===null?a.next=a:(a.next=d.next,d.next=a),i.pending=a}function zm(i,a,d){if(d&4194240){var m=a.lanes;m&=i.pendingLanes,d|=m,a.lanes=d,ru(i,d)}}var $s={readContext:zn,useCallback:rn,useContext:rn,useEffect:rn,useImperativeHandle:rn,useInsertionEffect:rn,useLayoutEffect:rn,useMemo:rn,useReducer:rn,useRef:rn,useState:rn,useDebugValue:rn,useDeferredValue:rn,useTransition:rn,useMutableSource:rn,useSyncExternalStore:rn,useId:rn,unstable_isNewReconciler:!1},cS={readContext:zn,useCallback:function(i,a){return dr().memoizedState=[i,a===void 0?null:a],i},useContext:zn,useEffect:km,useImperativeHandle:function(i,a,d){return d=d!=null?d.concat([i]):null,Vs(4194308,4,Pm.bind(null,a,i),d)},useLayoutEffect:function(i,a){return Vs(4194308,4,i,a)},useInsertionEffect:function(i,a){return Vs(4,2,i,a)},useMemo:function(i,a){var d=dr();return a=a===void 0?null:a,i=i(),d.memoizedState=[i,a],i},useReducer:function(i,a,d){var m=dr();return a=d!==void 0?d(a):a,m.memoizedState=m.baseState=a,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:a},m.queue=i,i=i.dispatch=sS.bind(null,_t,i),[m.memoizedState,i]},useRef:function(i){var a=dr();return i={current:i},a.memoizedState=i},useState:Cm,useDebugValue:Du,useDeferredValue:function(i){return dr().memoizedState=i},useTransition:function(){var i=Cm(!1),a=i[0];return i=aS.bind(null,i[1]),dr().memoizedState=i,[a,i]},useMutableSource:function(){},useSyncExternalStore:function(i,a,d){var m=_t,v=dr();if(Pt){if(d===void 0)throw Error(c(407));d=d()}else{if(d=a(),Kt===null)throw Error(c(349));Mo&30||gm(m,a,d)}v.memoizedState=d;var b={value:d,getSnapshot:a};return v.queue=b,km(xm.bind(null,m,b,i),[i]),m.flags|=2048,xa(9,ym.bind(null,m,b,d,a),void 0,null),d},useId:function(){var i=dr(),a=Kt.identifierPrefix;if(Pt){var d=Tr,m=Mr;d=(m&~(1<<32-qn(m)-1)).toString(32)+d,a=":"+a+"R"+d,d=ga++,0Ju&&(a.flags|=128,m=!0,Ca(v,!1),a.lanes=4194304)}else{if(!m)if(i=Bs(b),i!==null){if(a.flags|=128,m=!0,i=i.updateQueue,i!==null&&(a.updateQueue=i,a.flags|=4),Ca(v,!0),v.tail===null&&v.tailMode==="hidden"&&!b.alternate&&!Pt)return on(a),null}else 2*qt()-v.renderingStartTime>Ju&&d!==1073741824&&(a.flags|=128,m=!0,Ca(v,!1),a.lanes=4194304);v.isBackwards?(b.sibling=a.child,a.child=b):(i=v.last,i!==null?i.sibling=b:a.child=b,v.last=b)}return v.tail!==null?(a=v.tail,v.rendering=a,v.tail=a.sibling,v.renderingStartTime=qt(),a.sibling=null,i=Tt.current,gt(Tt,m?i&1|2:i&1),a):(on(a),null);case 22:case 23:return od(),d=a.memoizedState!==null,i!==null&&i.memoizedState!==null!==d&&(a.flags|=8192),d&&a.mode&1?_n&1073741824&&(on(a),ge&&a.subtreeFlags&6&&(a.flags|=8192)):on(a),null;case 24:return null;case 25:return null}throw Error(c(156,a.tag))}function gS(i,a){switch(cu(a),a.tag){case 1:return xn(a.type)&&ws(),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return yi(),St(yn),St(nn),ku(),i=a.flags,i&65536&&!(i&128)?(a.flags=i&-65537|128,a):null;case 5:return Cu(a),null;case 13:if(St(Tt),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(c(340));hi()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return St(Tt),null;case 4:return yi(),null;case 10:return mu(a.type._context),null;case 22:case 23:return od(),null;case 24:return null;default:return null}}var Xs=!1,an=!1,yS=typeof WeakSet=="function"?WeakSet:Set,we=null;function bi(i,a){var d=i.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(m){It(i,a,m)}else d.current=null}function Hu(i,a,d){try{d()}catch(m){It(i,a,m)}}var ev=!1;function xS(i,a){for(oe(i.containerInfo),we=a;we!==null;)if(i=we,a=i.child,(i.subtreeFlags&1028)!==0&&a!==null)a.return=i,we=a;else for(;we!==null;){i=we;try{var d=i.alternate;if(i.flags&1024)switch(i.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var m=d.memoizedProps,v=d.memoizedState,b=i.stateNode,E=b.getSnapshotBeforeUpdate(i.elementType===i.type?m:Xn(i.type,m),v);b.__reactInternalSnapshotBeforeUpdate=E}break;case 3:ge&&ko(i.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(c(163))}}catch(O){It(i,i.return,O)}if(a=i.sibling,a!==null){a.return=i.return,we=a;break}we=i.return}return d=ev,ev=!1,d}function wa(i,a,d){var m=a.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var v=m=m.next;do{if((v.tag&i)===i){var b=v.destroy;v.destroy=void 0,b!==void 0&&Hu(a,d,b)}v=v.next}while(v!==m)}}function Qs(i,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&i)===i){var m=d.create;d.destroy=m()}d=d.next}while(d!==a)}}function Wu(i){var a=i.ref;if(a!==null){var d=i.stateNode;switch(i.tag){case 5:i=ne(d);break;default:i=d}typeof a=="function"?a(i):a.current=i}}function tv(i){var a=i.alternate;a!==null&&(i.alternate=null,tv(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&Be(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function nv(i){return i.tag===5||i.tag===3||i.tag===4}function rv(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||nv(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Vu(i,a,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,a?dn(d,i,a):Le(d,i);else if(m!==4&&(i=i.child,i!==null))for(Vu(i,a,d),i=i.sibling;i!==null;)Vu(i,a,d),i=i.sibling}function Uu(i,a,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,a?_e(d,i,a):J(d,i);else if(m!==4&&(i=i.child,i!==null))for(Uu(i,a,d),i=i.sibling;i!==null;)Uu(i,a,d),i=i.sibling}var Zt=null,Qn=!1;function hr(i,a,d){for(d=d.child;d!==null;)$u(i,a,d),d=d.sibling}function $u(i,a,d){if(sr&&typeof sr.onCommitFiberUnmount=="function")try{sr.onCommitFiberUnmount(Is,d)}catch{}switch(d.tag){case 5:an||bi(d,a);case 6:if(ge){var m=Zt,v=Qn;Zt=null,hr(i,a,d),Zt=m,Qn=v,Zt!==null&&(Qn?fn(Zt,d.stateNode):Vt(Zt,d.stateNode))}else hr(i,a,d);break;case 18:ge&&Zt!==null&&(Qn?Lb(Zt,d.stateNode):Fb(Zt,d.stateNode));break;case 4:ge?(m=Zt,v=Qn,Zt=d.stateNode.containerInfo,Qn=!0,hr(i,a,d),Zt=m,Qn=v):(Te&&(m=d.stateNode.containerInfo,v=Lp(m),Kc(m,v)),hr(i,a,d));break;case 0:case 11:case 14:case 15:if(!an&&(m=d.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){v=m=m.next;do{var b=v,E=b.destroy;b=b.tag,E!==void 0&&(b&2||b&4)&&Hu(d,a,E),v=v.next}while(v!==m)}hr(i,a,d);break;case 1:if(!an&&(bi(d,a),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(O){It(d,a,O)}hr(i,a,d);break;case 21:hr(i,a,d);break;case 22:d.mode&1?(an=(m=an)||d.memoizedState!==null,hr(i,a,d),an=m):hr(i,a,d);break;default:hr(i,a,d)}}function ov(i){var a=i.updateQueue;if(a!==null){i.updateQueue=null;var d=i.stateNode;d===null&&(d=i.stateNode=new yS),a.forEach(function(m){var v=IS.bind(null,i,m);d.has(m)||(d.add(m),m.then(v,v))})}}function Zn(i,a){var d=a.deletions;if(d!==null)for(var m=0;m";case Js:return":has("+(Yu(i)||"")+")";case el:return'[role="'+i.value+'"]';case nl:return'"'+i.value+'"';case tl:return'[data-testname="'+i.value+'"]';default:throw Error(c(365))}}function uv(i,a){var d=[];i=[i,0];for(var m=0;mv&&(v=E),m&=~b}if(m=v,m=qt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*SS(m/1960))-m,10i?16:i,Zr===null)var m=!1;else{if(i=Zr,Zr=null,sl=0,Xe&6)throw Error(c(331));var v=Xe;for(Xe|=4,we=i.current;we!==null;){var b=we,E=b.child;if(we.flags&16){var O=b.deletions;if(O!==null){for(var W=0;Wqt()-Zu?_o(i,0):Qu|=d),Cn(i,a)}function xv(i,a){a===0&&(i.mode&1?(a=Es,Es<<=1,!(Es&130023424)&&(Es=4194304)):a=1);var d=sn();i=cr(i,a),i!==null&&(da(i,a,d),Cn(i,d))}function PS(i){var a=i.memoizedState,d=0;a!==null&&(d=a.retryLane),xv(i,d)}function IS(i,a){var d=0;switch(i.tag){case 13:var m=i.stateNode,v=i.memoizedState;v!==null&&(d=v.retryLane);break;case 19:m=i.stateNode;break;default:throw Error(c(314))}m!==null&&m.delete(a),xv(i,d)}var bv;bv=function(i,a,d){if(i!==null)if(i.memoizedProps!==a.pendingProps||yn.current)bn=!0;else{if(!(i.lanes&d)&&!(a.flags&128))return bn=!1,mS(i,a,d);bn=!!(i.flags&131072)}else bn=!1,Pt&&a.flags&1048576&&Qp(a,_s,a.index);switch(a.lanes=0,a.tag){case 2:var m=a.type;qs(i,a),i=a.pendingProps;var v=ui(a,nn.current);mi(a,d),v=Pu(null,a,m,i,v,d);var b=Iu();return a.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,xn(m)?(b=!0,ks(a)):b=!1,a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,yu(a),v.updater=Fs,a.stateNode=v,v._reactInternals=a,bu(a,m,i,d),a=Ru(null,a,m,!0,b,d)):(a.tag=0,Pt&&b&&lu(a),hn(null,a,v,d),a=a.child),a;case 16:m=a.elementType;e:{switch(qs(i,a),i=a.pendingProps,v=m._init,m=v(m._payload),a.type=m,v=a.tag=TS(m),i=Xn(m,i),v){case 0:a=zu(null,a,m,i,d);break e;case 1:a=Gm(null,a,m,i,d);break e;case 11:a=Hm(null,a,m,i,d);break e;case 14:a=Wm(null,a,m,Xn(m.type,i),d);break e}throw Error(c(306,m,""))}return a;case 0:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Xn(m,v),zu(i,a,m,v,d);case 1:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Xn(m,v),Gm(i,a,m,v,d);case 3:e:{if(qm(a),i===null)throw Error(c(387));m=a.pendingProps,b=a.memoizedState,v=b.element,om(i,a),Ns(a,m,null,d);var E=a.memoizedState;if(m=E.element,Ge&&b.isDehydrated)if(b={element:m,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){v=xi(Error(c(423)),a),a=Ym(i,a,m,d,v);break e}else if(m!==v){v=xi(Error(c(424)),a),a=Ym(i,a,m,d,v);break e}else for(Ge&&(On=Tb(a.stateNode.containerInfo),Tn=a,Pt=!0,Kn=null,fa=!1),d=hm(a,null,m,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(hi(),m===v){a=Dr(i,a,d);break e}hn(i,a,m,d)}a=a.child}return a;case 5:return pm(a),i===null&&du(a),m=a.type,v=a.pendingProps,b=i!==null?i.memoizedProps:null,E=v.children,ce(m,v)?E=null:b!==null&&ce(m,b)&&(a.flags|=32),$m(i,a),hn(i,a,E,d),a.child;case 6:return i===null&&du(a),null;case 13:return Km(i,a,d);case 4:return Su(a,a.stateNode.containerInfo),m=a.pendingProps,i===null?a.child=vi(a,null,m,d):hn(i,a,m,d),a.child;case 11:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Xn(m,v),Hm(i,a,m,v,d);case 7:return hn(i,a,a.pendingProps,d),a.child;case 8:return hn(i,a,a.pendingProps.children,d),a.child;case 12:return hn(i,a,a.pendingProps.children,d),a.child;case 10:e:{if(m=a.type._context,v=a.pendingProps,b=a.memoizedProps,E=v.value,nm(a,m,E),b!==null)if(Yn(b.value,E)){if(b.children===v.children&&!yn.current){a=Dr(i,a,d);break e}}else for(b=a.child,b!==null&&(b.return=a);b!==null;){var O=b.dependencies;if(O!==null){E=b.child;for(var W=O.firstContext;W!==null;){if(W.context===m){if(b.tag===1){W=_r(-1,d&-d),W.tag=2;var ie=b.updateQueue;if(ie!==null){ie=ie.shared;var je=ie.pending;je===null?W.next=W:(W.next=je.next,je.next=W),ie.pending=W}}b.lanes|=d,W=b.alternate,W!==null&&(W.lanes|=d),vu(b.return,d,a),O.lanes|=d;break}W=W.next}}else if(b.tag===10)E=b.type===a.type?null:b.child;else if(b.tag===18){if(E=b.return,E===null)throw Error(c(341));E.lanes|=d,O=E.alternate,O!==null&&(O.lanes|=d),vu(E,d,a),E=b.sibling}else E=b.child;if(E!==null)E.return=b;else for(E=b;E!==null;){if(E===a){E=null;break}if(b=E.sibling,b!==null){b.return=E.return,E=b;break}E=E.return}b=E}hn(i,a,v.children,d),a=a.child}return a;case 9:return v=a.type,m=a.pendingProps.children,mi(a,d),v=zn(v),m=m(v),a.flags|=1,hn(i,a,m,d),a.child;case 14:return m=a.type,v=Xn(m,a.pendingProps),v=Xn(m.type,v),Wm(i,a,m,v,d);case 15:return Vm(i,a,a.type,a.pendingProps,d);case 17:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Xn(m,v),qs(i,a),a.tag=1,xn(m)?(i=!0,ks(a)):i=!1,mi(a,d),cm(a,m,v),bu(a,m,v,d),Ru(null,a,m,!0,i,d);case 19:return Qm(i,a,d);case 22:return Um(i,a,d)}throw Error(c(156,a.tag))};function Sv(i,a){return ou(i,a)}function MS(i,a,d,m){this.tag=i,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ln(i,a,d,m){return new MS(i,a,d,m)}function ad(i){return i=i.prototype,!(!i||!i.isReactComponent)}function TS(i){if(typeof i=="function")return ad(i)?1:0;if(i!=null){if(i=i.$$typeof,i===k)return 11;if(i===I)return 14}return 2}function to(i,a){var d=i.alternate;return d===null?(d=Ln(i.tag,a,i.key,i.mode),d.elementType=i.elementType,d.type=i.type,d.stateNode=i.stateNode,d.alternate=i,i.alternate=d):(d.pendingProps=a,d.type=i.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=i.flags&14680064,d.childLanes=i.childLanes,d.lanes=i.lanes,d.child=i.child,d.memoizedProps=i.memoizedProps,d.memoizedState=i.memoizedState,d.updateQueue=i.updateQueue,a=i.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=i.sibling,d.index=i.index,d.ref=i.ref,d}function dl(i,a,d,m,v,b){var E=2;if(m=i,typeof i=="function")ad(i)&&(E=1);else if(typeof i=="string")E=5;else e:switch(i){case h:return Oo(d.children,v,b,a);case y:E=8,v|=8;break;case x:return i=Ln(12,d,a,v|2),i.elementType=x,i.lanes=b,i;case w:return i=Ln(13,d,a,v),i.elementType=w,i.lanes=b,i;case j:return i=Ln(19,d,a,v),i.elementType=j,i.lanes=b,i;case M:return fl(d,v,b,a);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case S:E=10;break e;case C:E=9;break e;case k:E=11;break e;case I:E=14;break e;case P:E=16,m=null;break e}throw Error(c(130,i==null?i:typeof i,""))}return a=Ln(E,d,a,v),a.elementType=i,a.type=m,a.lanes=b,a}function Oo(i,a,d,m){return i=Ln(7,i,m,a),i.lanes=d,i}function fl(i,a,d,m){return i=Ln(22,i,m,a),i.elementType=M,i.lanes=d,i.stateNode={isHidden:!1},i}function sd(i,a,d){return i=Ln(6,i,null,a),i.lanes=d,i}function ld(i,a,d){return a=Ln(4,i.children!==null?i.children:[],i.key,a),a.lanes=d,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}function _S(i,a,d,m,v){this.tag=a,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=$e,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=nu(0),this.expirationTimes=nu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nu(0),this.identifierPrefix=m,this.onRecoverableError=v,Ge&&(this.mutableSourceEagerHydrationData=null)}function Cv(i,a,d,m,v,b,E,O,W){return i=new _S(i,a,d,O,W),a===1?(a=1,b===!0&&(a|=8)):a=0,b=Ln(3,null,null,a),i.current=b,b.stateNode=i,b.memoizedState={element:m,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},yu(b),i}function wv(i){if(!i)return Yr;i=i._reactInternals;e:{if(V(i)!==i||i.tag!==1)throw Error(c(170));var a=i;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(xn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(c(171))}if(i.tag===1){var d=i.type;if(xn(d))return $p(i,d,a)}return a}function kv(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(c(188)):(i=Object.keys(i).join(","),Error(c(268,i)));return i=Q(a),i===null?null:i.stateNode}function jv(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var d=i.retryLane;i.retryLane=d!==0&&d=ie&&b>=He&&v<=je&&E<=be){i.splice(a,1);break}else if(m!==ie||d.width!==W.width||beE){if(!(b!==He||d.height!==W.height||jev)){ie>m&&(W.width+=ie-m,W.x=m),jeb&&(W.height+=He-b,W.y=b),bed&&(d=E)),E ")+` + +No matching component was found for: + `)+i.join(" > ")}return null},n.getPublicRootInstance=function(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return ne(i.child.stateNode);default:return i.child.stateNode}},n.injectIntoDevTools=function(i){if(i={bundleType:i.bundleType,version:i.version,rendererPackageName:i.rendererPackageName,rendererConfig:i.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:u.ReactCurrentDispatcher,findHostInstanceByFiber:DS,findFiberByHostInstance:i.findFiberByHostInstance||AS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")i=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)i=!0;else{try{Is=a.inject(i),sr=a}catch{}i=!!a.checkDCE}}return i},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(i,a,d,m){if(!N)throw Error(c(363));i=Ku(i,a);var v=Ze(i,d,m).disconnect;return{disconnect:function(){v()}}},n.registerMutableSourceForHydration=function(i,a){var d=a._getVersion;d=d(a._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[a,d]:i.mutableSourceEagerHydrationData.push(a,d)},n.runWithPriority=function(i,a){var d=ot;try{return ot=i,a()}finally{ot=d}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(i,a,d,m){var v=a.current,b=sn(),E=Jr(v);return d=wv(d),a.context===null?a.context=d:a.pendingContext=d,a=_r(b,E),a.payload={element:i},m=m===void 0?null:m,m!==null&&(a.callback=m),i=Xr(v,a,E),i!==null&&(Fn(i,v,E,b),Rs(i,v,E)),E},n};(function(e){e.exports=pO})(hO);const mO=P3(Vf);var pc={},vO={get exports(){return pc},set exports(e){pc=e}},li={};/** + * @license React + * react-reconciler-constants.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. + */li.ConcurrentRoot=1;li.ContinuousEventPriority=4;li.DefaultEventPriority=16;li.DiscreteEventPriority=1;li.IdleEventPriority=536870912;li.LegacyRoot=0;(function(e){e.exports=li})(vO);const Z0={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let J0=!1,e1=!1;const Dp=".react-konva-event",gO=`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 +`,yO=`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 +`,xO={};function Hc(e,t,n=xO){if(!J0&&"zIndex"in t&&(console.warn(yO),J0=!0),!e1&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(gO),e1=!0)}for(var s in n)if(!Z0[s]){var c=s.slice(0,2)==="on",u=n[s]!==t[s];if(c&&u){var f=s.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),e.off(f,n[s])}var p=!t.hasOwnProperty(s);p&&e.setAttr(s,void 0)}var h=t._useStrictMode,y={},x=!1;const S={};for(var s in t)if(!Z0[s]){var c=s.slice(0,2)==="on",C=n[s]!==t[s];if(c&&C){var f=s.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),t[s]&&(S[f]=t[s])}!c&&(t[s]!==n[s]||h&&t[s]!==e.getAttr(s))&&(x=!0,y[s]=t[s])}x&&(e.setAttrs(y),So(e));for(var f in S)e.on(f+Dp,S[f])}function So(e){if(!I3.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const H4={},bO={};Va.Node.prototype._applyProps=Hc;function SO(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),So(e)}function CO(e,t,n){let r=Va[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=Va.Group);const o={},s={};for(var c in t){var u=c.slice(0,2)==="on";u?s[c]=t[c]:o[c]=t[c]}const f=new r(o);return Hc(f,s),f}function wO(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function kO(e,t,n){return!1}function jO(e){return e}function EO(){return null}function PO(){return null}function IO(e,t,n,r){return bO}function MO(){}function TO(e){}function _O(e,t){return!1}function DO(){return H4}function AO(){return H4}const OO=setTimeout,zO=clearTimeout,RO=-1;function NO(e,t){return!1}const FO=!1,LO=!0,BO=!0;function HO(e,t){t.parent===e?t.moveToTop():e.add(t),So(e)}function WO(e,t){t.parent===e?t.moveToTop():e.add(t),So(e)}function W4(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),So(e)}function VO(e,t,n){W4(e,t,n)}function UO(e,t){t.destroy(),t.off(Dp),So(e)}function $O(e,t){t.destroy(),t.off(Dp),So(e)}function GO(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function qO(e,t,n){}function YO(e,t,n,r,o){Hc(e,o,r)}function KO(e){e.hide(),So(e)}function XO(e){}function QO(e,t){(t.visible==null||t.visible)&&e.show()}function ZO(e,t){}function JO(e){}function ez(){}const tz=()=>pc.DefaultEventPriority,nz=Object.freeze(Object.defineProperty({__proto__:null,appendChild:HO,appendChildToContainer:WO,appendInitialChild:SO,cancelTimeout:zO,clearContainer:JO,commitMount:qO,commitTextUpdate:GO,commitUpdate:YO,createInstance:CO,createTextInstance:wO,detachDeletedInstance:ez,finalizeInitialChildren:kO,getChildHostContext:AO,getCurrentEventPriority:tz,getPublicInstance:jO,getRootHostContext:DO,hideInstance:KO,hideTextInstance:XO,idlePriority:Bl.unstable_IdlePriority,insertBefore:W4,insertInContainerBefore:VO,isPrimaryRenderer:FO,noTimeout:RO,now:Bl.unstable_now,prepareForCommit:EO,preparePortalMount:PO,prepareUpdate:IO,removeChild:UO,removeChildFromContainer:$O,resetAfterCommit:MO,resetTextContent:TO,run:Bl.unstable_runWithPriority,scheduleTimeout:OO,shouldDeprioritizeSubtree:_O,shouldSetTextContent:NO,supportsMutation:BO,unhideInstance:QO,unhideTextInstance:ZO,warnsIfNotActing:LO},Symbol.toStringTag,{value:"Module"}));var rz=Object.defineProperty,oz=Object.defineProperties,iz=Object.getOwnPropertyDescriptors,t1=Object.getOwnPropertySymbols,az=Object.prototype.hasOwnProperty,sz=Object.prototype.propertyIsEnumerable,n1=(e,t,n)=>t in e?rz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,r1=(e,t)=>{for(var n in t||(t={}))az.call(t,n)&&n1(e,n,t[n]);if(t1)for(var n of t1(t))sz.call(t,n)&&n1(e,n,t[n]);return e},lz=(e,t)=>oz(e,iz(t));function V4(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=V4(r,t,n);if(o)return o;r=t?null:r.sibling}}function U4(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const Ap=U4(g.createContext(null));class $4 extends g.Component{render(){return g.createElement(Ap.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:cz,ReactCurrentDispatcher:uz}=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function dz(){const e=g.useContext(Ap);if(!e)throw new Error("its-fine: useFiber must be called within a !");const t=g.useId();return g.useMemo(()=>{var r;return(r=cz.current)!=null?r:V4(e,!1,o=>{let s=o.memoizedState;for(;s;){if(s.memoizedState===t)return!0;s=s.next}})},[e,t])}function fz(){var e,t;const n=dz(),[r]=g.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==Ap&&!r.has(s)&&r.set(s,(t=uz.current)==null?void 0:t.readContext(U4(s))),o=o.return}return g.useMemo(()=>Array.from(r.keys()).reduce((s,c)=>u=>g.createElement(s,null,g.createElement(c.Provider,lz(r1({},u),{value:r.get(c)}))),s=>g.createElement($4,r1({},s))),[r])}function hz(e){const t=Me.useRef();return Me.useLayoutEffect(()=>{t.current=e}),t.current}const pz=e=>{const t=Me.useRef(),n=Me.useRef(),r=Me.useRef(),o=hz(e),s=fz(),c=u=>{const{forwardedRef:f}=e;f&&(typeof f=="function"?f(u):f.current=u)};return Me.useLayoutEffect(()=>(n.current=new Va.Stage({width:e.width,height:e.height,container:t.current}),c(n.current),r.current=Ra.createContainer(n.current,pc.LegacyRoot,!1,null),Ra.updateContainer(Me.createElement(s,{},e.children),r.current),()=>{Va.isBrowser&&(c(null),Ra.updateContainer(null,r.current,null),n.current.destroy())}),[]),Me.useLayoutEffect(()=>{c(n.current),Hc(n.current,e,o),Ra.updateContainer(Me.createElement(s,{},e.children),r.current,null)}),Me.createElement("div",{ref:t,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},Da="Layer",Vr="Group",Ur="Rect",Ro="Circle",mc="Line",G4="Image",mz="Transformer",Ra=mO(nz);Ra.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:Me.version,rendererPackageName:"react-konva"});const vz=Me.forwardRef((e,t)=>Me.createElement($4,{},Me.createElement(pz,{...e,forwardedRef:t}))),gz=me([tt,Ot],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),yz=()=>{const e=Y(),{tool:t,isStaging:n,isMovingBoundingBox:r}=A(gz);return{handleDragStart:g.useCallback(()=>{(t==="move"||n)&&!r&&e(Kl(!0))},[e,r,n,t]),handleDragMove:g.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e($1(s))},[e,r,n,t]),handleDragEnd:g.useCallback(()=>{(t==="move"||n)&&!r&&e(Kl(!1))},[e,r,n,t])}},xz=me([tt,bt,Ot],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:c,isMaskEnabled:u,shouldSnapToGrid:f}=e;return{activeTabName:t,isCursorOnCanvas:Boolean(r),shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:c,isStaging:n,isMaskEnabled:u,shouldSnapToGrid:f}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),bz=()=>{const e=Y(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:c}=A(xz),u=g.useRef(null),f=G1(),p=()=>e(Qf());de(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const h=()=>e(is(!s));de(["h"],()=>{h()},{enabled:()=>!o,preventDefault:!0},[s]),de(["n"],()=>{e(Xl(!c))},{enabled:!0,preventDefault:!0},[c]),de("esc",()=>{e(M3())},{enabled:()=>!0,preventDefault:!0}),de("shift+h",()=>{e(T3(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),de(["space"],y=>{y.repeat||(f==null||f.container().focus(),r!=="move"&&(u.current=r,e(br("move"))),r==="move"&&u.current&&u.current!=="move"&&(e(br(u.current)),u.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,u])},Op=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}},q4=()=>{const e=Y(),t=wr(),n=G1();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=_3.pixelRatio,[s,c,u,f]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;e(D3({r:s,g:c,b:u,a:f}))},commitColorUnderCursor:()=>{e(A3())}}},Sz=me([bt,tt,Ot],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Cz=e=>{const t=Y(),{tool:n,isStaging:r}=A(Sz),{commitColorUnderCursor:o}=q4();return g.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Kl(!0));return}if(n==="colorPicker"){o();return}const c=Op(e.current);c&&(s.evt.preventDefault(),t(q1(!0)),t(O3([c.x,c.y])))},[e,n,r,t,o])},wz=me([bt,tt,Ot],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),kz=(e,t,n)=>{const r=Y(),{isDrawing:o,tool:s,isStaging:c}=A(wz),{updateColorUnderCursor:u}=q4();return g.useCallback(()=>{if(!e.current)return;const f=Op(e.current);if(f){if(r(z3(f)),n.current=f,s==="colorPicker"){u();return}!o||s==="move"||c||(t.current=!0,r(Y1([f.x,f.y])))}},[t,r,o,c,n,e,s,u])},jz=()=>{const e=Y();return g.useCallback(()=>{e(R3())},[e])},Ez=me([bt,tt,Ot],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Pz=(e,t)=>{const n=Y(),{tool:r,isDrawing:o,isStaging:s}=A(Ez);return g.useCallback(()=>{if(r==="move"||s){n(Kl(!1));return}if(!t.current&&o&&e.current){const c=Op(e.current);if(!c)return;n(Y1([c.x,c.y]))}else t.current=!1;n(q1(!1))},[t,n,o,s,e,r])},Iz=me([tt],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Mz=e=>{const t=Y(),{isMoveStageKeyHeld:n,stageScale:r}=A(Iz);return g.useCallback(o=>{if(!e.current||n)return;o.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const c={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let u=o.evt.deltaY;o.evt.ctrlKey&&(u=-u);const f=ee.clamp(r*N3**u,F3,L3),p={x:s.x-c.x*f,y:s.y-c.y*f};t(B3(f)),t($1(p))},[e,n,r,t])},Tz=me(tt,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:o,shouldDarkenOutsideBoundingBox:s,stageCoordinates:c}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:c,stageDimensions:r,stageScale:o}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),_z=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=A(Tz);return l.jsxs(Vr,{children:[l.jsx(Ur,{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}),l.jsx(Ur,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},Dz=me([tt],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Az=()=>{const e=A(f=>f.ui.currentTheme),{stageScale:t,stageCoordinates:n,stageDimensions:r}=A(Dz),[o,s]=g.useState([]),[c]=k1("colors",["gridLineColor"]),u=g.useCallback(f=>f/t,[t]);return g.useLayoutEffect(()=>{const{width:f,height:p}=r,{x:h,y}=n,x={x1:0,y1:0,x2:f,y2:p,offset:{x:u(h),y:u(y)}},S={x:Math.ceil(u(h)/64)*64,y:Math.ceil(u(y)/64)*64},C={x1:-S.x,y1:-S.y,x2:u(f)-S.x+64,y2:u(p)-S.y+64},w={x1:Math.min(x.x1,C.x1),y1:Math.min(x.y1,C.y1),x2:Math.max(x.x2,C.x2),y2:Math.max(x.y2,C.y2)},j=w.x2-w.x1,I=w.y2-w.y1,P=Math.round(j/64)+1,M=Math.round(I/64)+1,T=ee.range(0,P).map(_=>l.jsx(mc,{x:w.x1+_*64,y:w.y1,points:[0,0,0,I],stroke:c,strokeWidth:1},`x_${_}`)),D=ee.range(0,M).map(_=>l.jsx(mc,{x:w.x1,y:w.y1+_*64,points:[0,0,j,0],stroke:c,strokeWidth:1},`y_${_}`));s(T.concat(D))},[t,n,r,e,u,c]),l.jsx(Vr,{children:o})},Oz=me([e=>e.gallery],e=>e.intermediateImage?e.intermediateImage:null,{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),zz=e=>{const{...t}=e,n=A(Oz),[r,o]=g.useState(null);if(g.useEffect(()=>{if(!n)return;const p=new Image;p.onload=()=>{o(p)},p.src=n.url},[n]),!(n!=null&&n.boundingBox))return null;const{boundingBox:{x:s,y:c,width:u,height:f}}=n;return r?l.jsx(G4,{x:s,y:c,width:u,height:f,image:r,listening:!1,...t}):null},Yo=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},Rz=me(tt,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:Yo(t)}}),o1=e=>`data:image/svg+xml;utf8, + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`.replaceAll("black",e),Nz=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=A(Rz),[c,u]=g.useState(null),[f,p]=g.useState(0),h=g.useRef(null),y=g.useCallback(()=>{p(f+1),setTimeout(y,500)},[f]);return g.useEffect(()=>{if(c)return;const x=new Image;x.onload=()=>{u(x)},x.src=o1(n)},[c,n]),g.useEffect(()=>{c&&(c.src=o1(n))},[c,n]),g.useEffect(()=>{const x=setInterval(()=>p(S=>(S+1)%5),50);return()=>clearInterval(x)},[]),!c||!ee.isNumber(r.x)||!ee.isNumber(r.y)||!ee.isNumber(s)||!ee.isNumber(o.width)||!ee.isNumber(o.height)?null:l.jsx(Ur,{ref:h,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:c,fillPatternOffsetY:ee.isNumber(f)?f:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},Fz=me([tt],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Lz=e=>{const{...t}=e,{objects:n}=A(Fz);return l.jsx(Vr,{listening:!1,...t,children:n.filter(H3).map((r,o)=>l.jsx(mc,{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))})};var No=g,Bz=function(t,n,r){const o=No.useRef("loading"),s=No.useRef(),[c,u]=No.useState(0),f=No.useRef(),p=No.useRef(),h=No.useRef();return(f.current!==t||p.current!==n||h.current!==r)&&(o.current="loading",s.current=void 0,f.current=t,p.current=n,h.current=r),No.useLayoutEffect(function(){if(!t)return;var y=document.createElement("img");function x(){o.current="loaded",s.current=y,u(Math.random())}function S(){o.current="failed",s.current=void 0,u(Math.random())}return y.addEventListener("load",x),y.addEventListener("error",S),n&&(y.crossOrigin=n),r&&(y.referrerpolicy=r),y.src=t,function(){y.removeEventListener("load",x),y.removeEventListener("error",S)}},[t,n,r]),[s.current,o.current]};const Y4=e=>{const{url:t,x:n,y:r}=e,[o]=Bz(t);return l.jsx(G4,{x:n,y:r,image:o,listening:!1})},Hz=me([tt],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Wz=()=>{const{objects:e}=A(Hz);return e?l.jsx(Vr,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(U1(t))return l.jsx(Y4,{x:t.x,y:t.y,url:t.image.url},n);if(W3(t)){const r=l.jsx(mc,{points:t.points,stroke:t.color?Yo(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?l.jsx(Vr,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(V3(t))return l.jsx(Ur,{x:t.x,y:t.y,width:t.width,height:t.height,fill:Yo(t.color)},n);if(U3(t))return l.jsx(Ur,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},Vz=me([tt],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingImage:r,shouldShowStagingOutline:o,boundingBoxCoordinates:{x:s,y:c},boundingBoxDimensions:{width:u,height:f}}=e;return{currentStagingAreaImage:t.length>0?t[n]:void 0,isOnFirstImage:n===0,isOnLastImage:n===t.length-1,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:c,width:u,height:f}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Uz=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:c,width:u,height:f}=A(Vz);return l.jsxs(Vr,{...t,children:[r&&n&&l.jsx(Y4,{url:n.image.url,x:s,y:c}),o&&l.jsxs(Vr,{children:[l.jsx(Ur,{x:s,y:c,width:u,height:f,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),l.jsx(Ur,{x:s,y:c,width:u,height:f,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},$z=me([tt],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingOutline:r,shouldShowStagingImage:o}=e;return{currentStagingAreaImage:t.length>0?t[n]:void 0,isOnFirstImage:n===0,isOnLastImage:n===t.length-1,shouldShowStagingImage:o,shouldShowStagingOutline:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Gz=()=>{const e=Y(),{isOnFirstImage:t,isOnLastImage:n,currentStagingAreaImage:r,shouldShowStagingImage:o}=A($z),{t:s}=X(),c=g.useCallback(()=>{e(Rv(!0))},[e]),u=g.useCallback(()=>{e(Rv(!1))},[e]);de(["left"],()=>{f()},{enabled:()=>!0,preventDefault:!0}),de(["right"],()=>{p()},{enabled:()=>!0,preventDefault:!0}),de(["enter"],()=>{h()},{enabled:()=>!0,preventDefault:!0});const f=()=>e($3()),p=()=>e(G3()),h=()=>e(q3());return r?l.jsx(B,{pos:"absolute",bottom:4,w:"100%",align:"center",justify:"center",filter:"drop-shadow(0 0.5rem 1rem rgba(0,0,0))",onMouseOver:c,onMouseOut:u,children:l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:l.jsx(b9,{}),onClick:f,colorScheme:"accent",isDisabled:t}),l.jsx(se,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:l.jsx(S9,{}),onClick:p,colorScheme:"accent",isDisabled:n}),l.jsx(se,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:l.jsx(Ac,{}),onClick:h,colorScheme:"accent"}),l.jsx(se,{tooltip:s("unifiedCanvas.showHide"),"aria-label":s("unifiedCanvas.showHide"),"data-alert":!o,icon:o?l.jsx(I9,{}):l.jsx(P9,{}),onClick:()=>e(Y3(!o)),colorScheme:"accent"}),l.jsx(se,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),icon:l.jsx(Qh,{}),onClick:()=>e(K3(r.image.url)),colorScheme:"accent"}),l.jsx(se,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:l.jsx(vs,{style:{transform:"rotate(45deg)"}}),onClick:()=>e(X3()),colorScheme:"error",fontSize:20})]})}):null},Ni=e=>Math.round(e*100)/100,qz=me([tt],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${Ni(n)}, ${Ni(r)})`}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function Yz(){const{cursorCoordinatesString:e}=A(qz),{t}=X();return l.jsx(Ye,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const Uf="var(--invokeai-colors-warning-500)",Kz=me([tt],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:c},scaledBoundingBoxDimensions:{width:u,height:f},boundingBoxCoordinates:{x:p,y:h},stageScale:y,shouldShowCanvasDebugInfo:x,layer:S,boundingBoxScaleMethod:C,shouldPreserveMaskedArea:k}=e;let w="inherit";return(C==="none"&&(s<512||c<512)||C==="manual"&&u*f<512*512)&&(w=Uf),{activeLayerColor:S==="mask"?Uf:"inherit",activeLayerString:S.charAt(0).toUpperCase()+S.slice(1),boundingBoxColor:w,boundingBoxCoordinatesString:`(${Ni(p)}, ${Ni(h)})`,boundingBoxDimensionsString:`${s}×${c}`,scaledBoundingBoxDimensionsString:`${u}×${f}`,canvasCoordinatesString:`${Ni(r)}×${Ni(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(y*100),shouldShowCanvasDebugInfo:x,shouldShowBoundingBox:C!=="auto",shouldShowScaledBoundingBox:C!=="none",shouldPreserveMaskedArea:k}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Xz=()=>{const{activeLayerColor:e,activeLayerString:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:c,canvasCoordinatesString:u,canvasDimensionsString:f,canvasScaleString:p,shouldShowCanvasDebugInfo:h,shouldShowBoundingBox:y,shouldPreserveMaskedArea:x}=A(Kz),{t:S}=X();return l.jsxs(B,{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.800"},children:[l.jsx(Ye,{style:{color:e},children:`${S("unifiedCanvas.activeLayer")}: ${t}`}),l.jsx(Ye,{children:`${S("unifiedCanvas.canvasScale")}: ${p}%`}),x&&l.jsx(Ye,{style:{color:Uf},children:"Preserve Masked Area: On"}),y&&l.jsx(Ye,{style:{color:n},children:`${S("unifiedCanvas.boundingBox")}: ${o}`}),c&&l.jsx(Ye,{style:{color:n},children:`${S("unifiedCanvas.scaledBoundingBox")}: ${s}`}),h&&l.jsxs(l.Fragment,{children:[l.jsx(Ye,{children:`${S("unifiedCanvas.boundingBoxPosition")}: ${r}`}),l.jsx(Ye,{children:`${S("unifiedCanvas.canvasDimensions")}: ${f}`}),l.jsx(Ye,{children:`${S("unifiedCanvas.canvasPosition")}: ${u}`}),l.jsx(Yz,{})]})]})},Qz=me(tt,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageScale:r,isDrawing:o,isTransformingBoundingBox:s,isMovingBoundingBox:c,tool:u,shouldSnapToGrid:f}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,isDrawing:o,isMovingBoundingBox:c,isTransformingBoundingBox:s,stageScale:r,shouldSnapToGrid:f,tool:u,hitStrokeWidth:20/r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Zz=e=>{const{...t}=e,n=Y(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:c,isTransformingBoundingBox:u,stageScale:f,shouldSnapToGrid:p,tool:h,hitStrokeWidth:y}=A(Qz),x=g.useRef(null),S=g.useRef(null),[C,k]=g.useState(!1);g.useEffect(()=>{var Q;!x.current||!S.current||(x.current.nodes([S.current]),(Q=x.current.getLayer())==null||Q.batchDraw())},[]);const w=64*f,j=g.useCallback(Q=>{if(!p){n(dd({x:Math.floor(Q.target.x()),y:Math.floor(Q.target.y())}));return}const U=Q.target.x(),K=Q.target.y(),te=Nv(U,64),ne=Nv(K,64);Q.target.x(te),Q.target.y(ne),n(dd({x:te,y:ne}))},[n,p]),I=g.useCallback(()=>{if(!S.current)return;const Q=S.current,U=Q.scaleX(),K=Q.scaleY(),te=Math.round(Q.width()*U),ne=Math.round(Q.height()*K),$=Math.round(Q.x()),Z=Math.round(Q.y());n(Oa({width:te,height:ne})),n(dd({x:p?pl($,64):$,y:p?pl(Z,64):Z})),Q.scaleX(1),Q.scaleY(1)},[n,p]),P=g.useCallback((Q,U,K)=>{const te=Q.x%w,ne=Q.y%w;return{x:pl(U.x,w)+te,y:pl(U.y,w)+ne}},[w]),M=()=>{n(fd(!0))},T=()=>{n(fd(!1)),n(hd(!1)),n(ml(!1)),k(!1)},D=()=>{n(hd(!0))},_=()=>{n(fd(!1)),n(hd(!1)),n(ml(!1)),k(!1)},R=()=>{k(!0)},V=()=>{!u&&!c&&k(!1)},F=()=>{n(ml(!0))},L=()=>{n(ml(!1))};return l.jsxs(Vr,{...t,children:[l.jsx(Ur,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:F,onMouseOver:F,onMouseLeave:L,onMouseOut:L}),l.jsx(Ur,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:y,listening:!s&&h==="move",onDragStart:D,onDragEnd:_,onDragMove:j,onMouseDown:D,onMouseOut:V,onMouseOver:R,onMouseEnter:R,onMouseUp:_,onTransform:I,onTransformEnd:T,ref:S,stroke:C?"rgba(255,255,255,0.7)":"white",strokeWidth:(C?8:1)/f,width:o.width,x:r.x,y:r.y}),l.jsx(mz,{anchorCornerRadius:3,anchorDragBoundFunc:P,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:h==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&h==="move",onDragStart:D,onDragEnd:_,onMouseDown:M,onMouseUp:T,onTransformEnd:T,ref:x,rotateEnabled:!1})]})},Jz=me(tt,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:c,layer:u,shouldShowBrush:f,isMovingBoundingBox:p,isTransformingBoundingBox:h,stageScale:y,stageDimensions:x,boundingBoxCoordinates:S,boundingBoxDimensions:C,shouldRestrictStrokesToBox:k}=e,w=k?{clipX:S.x,clipY:S.y,clipWidth:C.width,clipHeight:C.height}:{};return{cursorPosition:t,brushX:t?t.x:x.width/2,brushY:t?t.y:x.height/2,radius:n/2,colorPickerOuterRadius:Fv/y,colorPickerInnerRadius:(Fv-af+1)/y,maskColorString:Yo({...o,a:.5}),brushColorString:Yo(s),colorPickerColorString:Yo(r),tool:c,layer:u,shouldShowBrush:f,shouldDrawBrushPreview:!(p||h||!t)&&f,strokeWidth:1.5/y,dotRadius:1.5/y,clip:w}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),eR=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:c,layer:u,shouldDrawBrushPreview:f,dotRadius:p,strokeWidth:h,brushColorString:y,colorPickerColorString:x,colorPickerInnerRadius:S,colorPickerOuterRadius:C,clip:k}=A(Jz);return f?l.jsxs(Vr,{listening:!1,...k,...t,children:[c==="colorPicker"?l.jsxs(l.Fragment,{children:[l.jsx(Ro,{x:n,y:r,radius:C,stroke:y,strokeWidth:af,strokeScaleEnabled:!1}),l.jsx(Ro,{x:n,y:r,radius:S,stroke:x,strokeWidth:af,strokeScaleEnabled:!1})]}):l.jsxs(l.Fragment,{children:[l.jsx(Ro,{x:n,y:r,radius:o,fill:u==="mask"?s:y,globalCompositeOperation:c==="eraser"?"destination-out":"source-out"}),l.jsx(Ro,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:h*2,strokeEnabled:!0,listening:!1}),l.jsx(Ro,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:h,strokeEnabled:!0,listening:!1})]}),l.jsx(Ro,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),l.jsx(Ro,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},tR=me([tt,Ot],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:c,isMovingBoundingBox:u,stageDimensions:f,stageCoordinates:p,tool:h,isMovingStage:y,shouldShowIntermediates:x,shouldShowGrid:S,shouldRestrictStrokesToBox:C}=e;let k="none";return h==="move"||t?y?k="grabbing":k="grab":s?k=void 0:C&&!c&&(k="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||u,shouldShowBoundingBox:o,shouldShowGrid:S,stageCoordinates:p,stageCursor:k,stageDimensions:f,stageScale:r,tool:h,isStaging:t,shouldShowIntermediates:x}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),nR=re(vz,{shouldForwardProp:e=>!["sx"].includes(e)}),K4=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:c,stageScale:u,tool:f,isStaging:p,shouldShowIntermediates:h}=A(tR);bz();const y=g.useRef(null),x=g.useRef(null),S=g.useCallback(V=>{Z3(V),y.current=V},[]),C=g.useCallback(V=>{Q3(V),x.current=V},[]),k=g.useRef({x:0,y:0}),w=g.useRef(!1),j=Mz(y),I=Cz(y),P=Pz(y,w),M=kz(y,w,k),T=jz(),{handleDragStart:D,handleDragMove:_,handleDragEnd:R}=yz();return l.jsx(B,{sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:l.jsxs(Ye,{sx:{position:"relative"},children:[l.jsxs(nR,{tabIndex:-1,ref:S,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:c.width,height:c.height,scale:{x:u,y:u},onTouchStart:I,onTouchMove:M,onTouchEnd:P,onMouseDown:I,onMouseLeave:T,onMouseMove:M,onMouseUp:P,onDragStart:D,onDragMove:_,onDragEnd:R,onContextMenu:V=>V.evt.preventDefault(),onWheel:j,draggable:(f==="move"||p)&&!t,children:[l.jsx(Da,{id:"grid",visible:r,children:l.jsx(Az,{})}),l.jsx(Da,{id:"base",ref:C,listening:!1,imageSmoothingEnabled:!1,children:l.jsx(Wz,{})}),l.jsxs(Da,{id:"mask",visible:e,listening:!1,children:[l.jsx(Lz,{visible:!0,listening:!1}),l.jsx(Nz,{listening:!1})]}),l.jsx(Da,{children:l.jsx(_z,{})}),l.jsxs(Da,{id:"preview",imageSmoothingEnabled:!1,children:[!p&&l.jsx(eR,{visible:f!=="move",listening:!1}),l.jsx(Uz,{visible:p}),h&&l.jsx(zz,{}),l.jsx(Zz,{visible:n&&!p})]})]}),l.jsx(Xz,{}),l.jsx(Gz,{})]})})},rR=me(tt,F4,bt,(e,t,n)=>{const{doesCanvasNeedScaling:r,isCanvasInitialized:o}=e;return{doesCanvasNeedScaling:r,activeTabName:n,initialCanvasImage:t,isCanvasInitialized:o}}),X4=()=>{const e=Y(),{doesCanvasNeedScaling:t,activeTabName:n,initialCanvasImage:r,isCanvasInitialized:o}=A(rR),s=g.useRef(null);return g.useLayoutEffect(()=>{window.setTimeout(()=>{if(!s.current)return;const{clientWidth:c,clientHeight:u}=s.current;e(J3({width:c,height:u})),e(o?eC():bc()),e(E1(!1))},0)},[e,r,t,n,o]),l.jsx(B,{ref:s,sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:l.jsx(Xf,{thickness:"2px",speed:"1s",size:"xl"})})},oR=me([tt,bt,Et],(e,t,n)=>{const{futureLayerStates:r}=e;return{canRedo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function Q4(){const e=Y(),{canRedo:t,activeTabName:n}=A(oR),{t:r}=X(),o=()=>{e(tC())};return de(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),l.jsx(se,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:l.jsx(L9,{}),onClick:o,isDisabled:!t})}const iR=me([tt,bt,Et],(e,t,n)=>{const{pastLayerStates:r}=e;return{canUndo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function Z4(){const e=Y(),{t}=X(),{canUndo:n,activeTabName:r}=A(iR),o=()=>{e(nC())};return de(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),l.jsx(se,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:l.jsx(U9,{}),onClick:o,isDisabled:!n})}const aR=(e,t,n)=>{const r=document.createElement("img");r.addEventListener("load",()=>{const o=document.createElement("canvas");o.width=t,o.height=n;const s=o.getContext("2d");s&&(s.drawImage(r,0,0),o.toBlob(c=>{c&&navigator.clipboard.write([new ClipboardItem({[c.type]:c})])}),o.remove(),r.remove())}),r.src=e},sR=e=>{const t=document.createElement("a");t.href=e,t.download="",document.body.appendChild(t),t.click(),document.body.removeChild(t),t.remove()},lR=(e,t,n,r)=>{const o=e.scale(),s=e.getClientRect({relativeTo:e.getParent()});e.scale({x:1/t,y:1/t});const{x:c,y:u,width:f,height:p}=e.getClientRect(),h=r?{x:r.x+n.x,y:r.y+n.y,width:r.width,height:r.height}:{x:c,y:u,width:f,height:p},y=e.toDataURL(h);return e.scale(o),{dataURL:y,boundingBox:{x:s.x,y:s.y,width:f,height:p}}},cR={cropVisible:!1,cropToBoundingBox:!1,shouldSaveToGallery:!1,shouldDownload:!1,shouldCopy:!1,shouldSetAsInitialImage:!0},lo=(e=cR)=>async(t,n)=>{const{cropVisible:r,cropToBoundingBox:o,shouldSaveToGallery:s,shouldDownload:c,shouldCopy:u,shouldSetAsInitialImage:f}=e;t(rC("Exporting Image")),t(vl(!1));const p=n(),{stageScale:h,boundingBoxCoordinates:y,boundingBoxDimensions:x,stageCoordinates:S}=p.canvas,C=wr();if(!C){t(pd(!1)),t(vl(!0));return}const{dataURL:k,boundingBox:w}=lR(C,h,S,o?{...y,...x}:void 0);if(!k){t(pd(!1)),t(vl(!0));return}const j=new FormData;j.append("data",JSON.stringify({dataURL:k,filename:"merged_canvas.png",kind:s?"result":"temp",cropVisible:r}));const P=await(await fetch(`${window.location.origin}/upload`,{method:"POST",body:j})).json(),{url:M,width:T,height:D}=P,_={uuid:b1(),category:s?"result":"user",...P};c&&(sR(M),t(gl({title:Ia.t("toast.downloadImageStarted"),status:"success",duration:2500,isClosable:!0}))),u&&(aR(M,T,D),t(gl({title:Ia.t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0}))),s&&(t(S1({image:_,category:"result"})),t(gl({title:Ia.t("toast.imageSavedToGallery"),status:"success",duration:2500,isClosable:!0}))),f&&(t(oC({kind:"image",layer:"base",...w,image:_})),t(gl({title:Ia.t("toast.canvasMerged"),status:"success",duration:2500,isClosable:!0}))),t(pd(!1)),t(iC(Ia.t("common.statusConnected"))),t(vl(!0))};function uR(){const e=A(Ot),t=wr(),n=A(u=>u.system.isProcessing),r=A(u=>u.canvas.shouldCropToBoundingBoxOnSave),o=Y(),{t:s}=X();de(["meta+c","ctrl+c"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{o(lo({cropVisible:!r,cropToBoundingBox:r,shouldCopy:!0}))};return l.jsx(se,{"aria-label":`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:l.jsx(Ki,{}),onClick:c,isDisabled:e})}function dR(){const e=Y(),{t}=X(),n=wr(),r=A(Ot),o=A(u=>u.system.isProcessing),s=A(u=>u.canvas.shouldCropToBoundingBoxOnSave);de(["shift+d"],()=>{c()},{enabled:()=>!r,preventDefault:!0},[n,o]);const c=()=>{e(lo({cropVisible:!s,cropToBoundingBox:s,shouldDownload:!0}))};return l.jsx(se,{"aria-label":`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:l.jsx(Xh,{}),onClick:c,isDisabled:r})}function fR(){const e=A(Ot),{openUploader:t}=Yh(),{t:n}=X();return l.jsx(se,{"aria-label":n("common.upload"),tooltip:n("common.upload"),icon:l.jsx(Oc,{}),onClick:t,isDisabled:e})}const hR=me([tt,Ot],(e,t)=>{const{layer:n,isMaskEnabled:r}=e;return{layer:n,isMaskEnabled:r,isStaging:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function pR(){const e=Y(),{t}=X(),{layer:n,isMaskEnabled:r,isStaging:o}=A(hR),s=()=>{e(Ql(n==="mask"?"base":"mask"))};de(["q"],()=>{s()},{enabled:()=>!o,preventDefault:!0},[n]);const c=u=>{const f=u.target.value;e(Ql(f)),f==="mask"&&!r&&e(is(!0))};return l.jsx(Mn,{tooltip:`${t("unifiedCanvas.layer")} (Q)`,"aria-label":`${t("unifiedCanvas.layer")} (Q)`,tooltipProps:{hasArrow:!0,placement:"top"},value:n,validValues:K1,onChange:c,isDisabled:o})}function mR(){const e=Y(),{t}=X(),n=wr(),r=A(Ot),o=A(c=>c.system.isProcessing);de(["shift+m"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n,o]);const s=()=>{e(lo({cropVisible:!1,shouldSetAsInitialImage:!0}))};return l.jsx(se,{"aria-label":`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:l.jsx(Vx,{}),onClick:s,isDisabled:r})}function vR(){const e=A(s=>s.canvas.tool),t=A(Ot),n=Y(),{t:r}=X();de(["v"],()=>{o()},{enabled:()=>!t,preventDefault:!0},[]);const o=()=>n(br("move"));return l.jsx(se,{"aria-label":`${r("unifiedCanvas.move")} (V)`,tooltip:`${r("unifiedCanvas.move")} (V)`,icon:l.jsx(Nx,{}),isChecked:e==="move"||t,onClick:o})}function gR(){const e=A(s=>s.ui.shouldPinParametersPanel),t=A(s=>s.ui.shouldShowParametersPanel),n=Y(),{t:r}=X(),o=()=>{n(ql(!0)),e&&n(cn())};return!e||!t?l.jsxs(B,{flexDirection:"column",gap:2,children:[l.jsx(se,{tooltip:`${r("parameters.showOptionsPanel")} (O)`,tooltipProps:{placement:"top"},"aria-label":r("parameters.showOptionsPanel"),onClick:o,children:l.jsx(Zh,{})}),l.jsx(B,{children:l.jsx(Ip,{iconButton:!0})}),l.jsx(B,{children:l.jsx(Ep,{width:"100%",height:"40px",btnGroupWidth:"100%"})})]}):null}function yR(){const e=Y(),{t}=X(),n=A(Ot),r=()=>{e(Zf()),e(bc())};return l.jsx(se,{"aria-label":t("unifiedCanvas.clearCanvas"),tooltip:t("unifiedCanvas.clearCanvas"),icon:l.jsx(ri,{}),onClick:r,isDisabled:n,colorScheme:"error"})}function J4(e,t,n=250){const[r,o]=g.useState(0);return g.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),o(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>o(s=>s+1)}function xR(){const e=wr(),t=Y(),{t:n}=X();de(["r"],()=>{o()},{enabled:()=>!0,preventDefault:!0},[e]);const r=J4(()=>o(!1),()=>o(!0)),o=(s=!1)=>{const c=wr();if(!c)return;const u=c.getClientRect({skipTransform:!0});t(X1({contentRect:u,shouldScaleTo1:s}))};return l.jsx(se,{"aria-label":`${n("unifiedCanvas.resetView")} (R)`,tooltip:`${n("unifiedCanvas.resetView")} (R)`,icon:l.jsx(Lx,{}),onClick:r})}function bR(){const e=A(Ot),t=wr(),n=A(u=>u.system.isProcessing),r=A(u=>u.canvas.shouldCropToBoundingBoxOnSave),o=Y(),{t:s}=X();de(["shift+s"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{o(lo({cropVisible:!r,cropToBoundingBox:r,shouldSaveToGallery:!0}))};return l.jsx(se,{"aria-label":`${s("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${s("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:l.jsx(Qh,{}),onClick:c,isDisabled:e})}const SR=me([tt,Ot,Et],(e,t,n)=>{const{isProcessing:r}=n,{tool:o}=e;return{tool:o,isStaging:t,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),CR=()=>{const e=Y(),{t}=X(),{tool:n,isStaging:r}=A(SR);de(["b"],()=>{o()},{enabled:()=>!r,preventDefault:!0},[]),de(["e"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n]),de(["c"],()=>{c()},{enabled:()=>!r,preventDefault:!0},[n]),de(["shift+f"],()=>{u()},{enabled:()=>!r,preventDefault:!0}),de(["delete","backspace"],()=>{f()},{enabled:()=>!r,preventDefault:!0});const o=()=>e(br("brush")),s=()=>e(br("eraser")),c=()=>e(br("colorPicker")),u=()=>e(Q1()),f=()=>e(Z1());return l.jsxs(B,{flexDirection:"column",gap:2,children:[l.jsxs(Qt,{children:[l.jsx(se,{"aria-label":`${t("unifiedCanvas.brush")} (B)`,tooltip:`${t("unifiedCanvas.brush")} (B)`,icon:l.jsx(Ux,{}),isChecked:n==="brush"&&!r,onClick:o,isDisabled:r}),l.jsx(se,{"aria-label":`${t("unifiedCanvas.eraser")} (E)`,tooltip:`${t("unifiedCanvas.eraser")} (B)`,icon:l.jsx(Bx,{}),isChecked:n==="eraser"&&!r,isDisabled:r,onClick:s})]}),l.jsxs(Qt,{children:[l.jsx(se,{"aria-label":`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:l.jsx(Wx,{}),isDisabled:r,onClick:u}),l.jsx(se,{"aria-label":`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(vs,{style:{transform:"rotate(45deg)"}}),isDisabled:r,onClick:f})]}),l.jsx(se,{"aria-label":`${t("unifiedCanvas.colorPicker")} (C)`,tooltip:`${t("unifiedCanvas.colorPicker")} (C)`,icon:l.jsx(Hx,{}),isChecked:n==="colorPicker"&&!r,isDisabled:r,onClick:c,width:"max-content"})]})},eb=()=>{const e=A(Ot),t=Y(),{t:n}=X(),r=()=>{t(aC()),t(Zf()),t(J1())};return l.jsxs(Bc,{title:n("unifiedCanvas.emptyTempImageFolder"),acceptCallback:r,acceptButtonText:n("unifiedCanvas.emptyFolder"),triggerComponent:l.jsx(Je,{leftIcon:l.jsx(ri,{}),size:"sm",isDisabled:e,children:n("unifiedCanvas.emptyTempImageFolder")}),children:[l.jsx("p",{children:n("unifiedCanvas.emptyTempImagesFolderMessage")}),l.jsx("br",{}),l.jsx("p",{children:n("unifiedCanvas.emptyTempImagesFolderConfirm")})]})},tb=()=>{const e=A(Ot),t=Y(),{t:n}=X();return l.jsxs(Bc,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(J1()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:l.jsx(Je,{size:"sm",leftIcon:l.jsx(ri,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),l.jsx("br",{}),l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},wR=me([tt],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:o}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:o}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),kR=()=>{const e=Y(),{t}=X(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldShowCanvasDebugInfo:o,shouldShowIntermediates:s}=A(wR);return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{tooltip:t("unifiedCanvas.canvasSettings"),tooltipProps:{placement:"bottom"},"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(Jh,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:t("unifiedCanvas.showIntermediates"),isChecked:s,onChange:c=>e(e2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:c=>e(t2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:c=>e(n2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:o,onChange:c=>e(r2(c.target.checked))}),l.jsx(tb,{}),l.jsx(eb,{})]})})},jR=()=>l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(pR,{}),l.jsx(CR,{}),l.jsxs(B,{gap:2,children:[l.jsx(vR,{}),l.jsx(xR,{})]}),l.jsxs(B,{columnGap:2,children:[l.jsx(mR,{}),l.jsx(bR,{})]}),l.jsxs(B,{columnGap:2,children:[l.jsx(uR,{}),l.jsx(dR,{})]}),l.jsxs(B,{gap:2,children:[l.jsx(Z4,{}),l.jsx(Q4,{})]}),l.jsxs(B,{gap:2,children:[l.jsx(fR,{}),l.jsx(yR,{})]}),l.jsx(kR,{}),l.jsx(gR,{})]});function ER(){const e=Y(),t=A(o=>o.canvas.brushSize),{t:n}=X(),r=A(Ot);return de(["BracketLeft"],()=>{e(Fi(Math.max(t-5,5)))},{enabled:()=>!r,preventDefault:!0},[t]),de(["BracketRight"],()=>{e(Fi(Math.min(t+5,500)))},{enabled:()=>!r,preventDefault:!0},[t]),l.jsx(ut,{label:n("unifiedCanvas.brushSize"),value:t,withInput:!0,onChange:o=>e(Fi(o)),sliderNumberInputProps:{max:500},inputReadOnly:!1,isCompact:!0})}function Wc(){return(Wc=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function $f(e){var t=g.useRef(e),n=g.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Zi=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(i1(o.current,w,u.current)):k(!1)},C=function(){return k(!1)};function k(w){var j=f.current,I=Gf(o.current),P=w?I.addEventListener:I.removeEventListener;P(j?"touchmove":"mousemove",S),P(j?"touchend":"mouseup",C)}return[function(w){var j=w.nativeEvent,I=o.current;if(I&&(a1(j),!function(M,T){return T&&!Ha(M)}(j,f.current)&&I)){if(Ha(j)){f.current=!0;var P=j.changedTouches||[];P.length&&(u.current=P[0].identifier)}I.focus(),s(i1(I,j,u.current)),k(!0)}},function(w){var j=w.which||w.keyCode;j<37||j>40||(w.preventDefault(),c({left:j===39?.05:j===37?-.05:0,top:j===40?.05:j===38?-.05:0}))},k]},[c,s]),h=p[0],y=p[1],x=p[2];return g.useEffect(function(){return x},[x]),Me.createElement("div",Wc({},r,{onTouchStart:h,onMouseDown:h,className:"react-colorful__interactive",ref:o,onKeyDown:y,tabIndex:0,role:"slider"}))}),Vc=function(e){return e.filter(Boolean).join(" ")},Rp=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=Vc(["react-colorful__pointer",e.className]);return Me.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},Me.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},gn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},rb=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:gn(e.h),s:gn(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:gn(o/2),a:gn(r,2)}},qf=function(e){var t=rb(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Vd=function(e){var t=rb(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},PR=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),c=r*(1-n),u=r*(1-(t-s)*n),f=r*(1-(1-t+s)*n),p=s%6;return{r:gn(255*[r,u,c,c,f,r][p]),g:gn(255*[f,r,r,u,c,c][p]),b:gn(255*[c,c,f,r,r,u][p]),a:gn(o,2)}},IR=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),c=s-Math.min(t,n,r),u=c?s===t?(n-r)/c:s===n?2+(r-t)/c:4+(t-n)/c:0;return{h:gn(60*(u<0?u+6:u)),s:gn(s?c/s*100:0),v:gn(s/255*100),a:o}},MR=Me.memo(function(e){var t=e.hue,n=e.onChange,r=Vc(["react-colorful__hue",e.className]);return Me.createElement("div",{className:r},Me.createElement(zp,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Zi(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":gn(t),"aria-valuemax":"360","aria-valuemin":"0"},Me.createElement(Rp,{className:"react-colorful__hue-pointer",left:t/360,color:qf({h:t,s:100,v:100,a:1})})))}),TR=Me.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:qf({h:t.h,s:100,v:100,a:1})};return Me.createElement("div",{className:"react-colorful__saturation",style:r},Me.createElement(zp,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Zi(t.s+100*o.left,0,100),v:Zi(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+gn(t.s)+"%, Brightness "+gn(t.v)+"%"},Me.createElement(Rp,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:qf(t)})))}),ob=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function _R(e,t,n){var r=$f(n),o=g.useState(function(){return e.toHsva(t)}),s=o[0],c=o[1],u=g.useRef({color:t,hsva:s});g.useEffect(function(){if(!e.equal(t,u.current.color)){var p=e.toHsva(t);u.current={hsva:p,color:t},c(p)}},[t,e]),g.useEffect(function(){var p;ob(s,u.current.hsva)||e.equal(p=e.fromHsva(s),u.current.color)||(u.current={hsva:s,color:p},r(p))},[s,e,r]);var f=g.useCallback(function(p){c(function(h){return Object.assign({},h,p)})},[]);return[s,f]}var DR=typeof window<"u"?g.useLayoutEffect:g.useEffect,AR=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},s1=new Map,OR=function(e){DR(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!s1.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}`,s1.set(t,n);var r=AR();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},zR=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+Vd(Object.assign({},n,{a:0}))+", "+Vd(Object.assign({},n,{a:1}))+")"},s=Vc(["react-colorful__alpha",t]),c=gn(100*n.a);return Me.createElement("div",{className:s},Me.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),Me.createElement(zp,{onMove:function(u){r({a:u.left})},onKey:function(u){r({a:Zi(n.a+u.left)})},"aria-label":"Alpha","aria-valuetext":c+"%","aria-valuenow":c,"aria-valuemin":"0","aria-valuemax":"100"},Me.createElement(Rp,{className:"react-colorful__alpha-pointer",left:n.a,color:Vd(n)})))},RR=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,c=nb(e,["className","colorModel","color","onChange"]),u=g.useRef(null);OR(u);var f=_R(n,o,s),p=f[0],h=f[1],y=Vc(["react-colorful",t]);return Me.createElement("div",Wc({},c,{ref:u,className:y}),Me.createElement(TR,{hsva:p,onChange:h}),Me.createElement(MR,{hue:p.h,onChange:h}),Me.createElement(zR,{hsva:p,onChange:h,className:"react-colorful__last-control"}))},NR={defaultColor:{r:0,g:0,b:0,a:1},toHsva:IR,fromHsva:PR,equal:ob},FR=function(e){return Me.createElement(RR,Wc({},e,{colorModel:NR}))};const LR=re(FR,{baseStyle:{paddingInline:4},shouldForwardProp:e=>!["pickerColor"].includes(e)}),Ud={width:6,height:6,borderColor:"base.100"},BR=e=>{const{styleClass:t="",...n}=e;return l.jsx(LR,{sx:{".react-colorful__hue-pointer":Ud,".react-colorful__saturation-pointer":Ud,".react-colorful__alpha-pointer":Ud},className:t,...n})},vc=g.memo(BR),HR=me([tt,Ot],(e,t)=>{const{brushColor:n,maskColor:r,layer:o}=e;return{brushColor:n,maskColor:r,layer:o,isStaging:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function WR(){const e=Y(),{brushColor:t,maskColor:n,layer:r,isStaging:o}=A(HR),s=()=>{if(r==="base")return`rgba(${t.r},${t.g},${t.b},${t.a})`;if(r==="mask")return`rgba(${n.r},${n.g},${n.b},${n.a})`};return de(["shift+BracketLeft"],()=>{e(Li({...t,a:ee.clamp(t.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[t]),de(["shift+BracketRight"],()=>{e(Li({...t,a:ee.clamp(t.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[t]),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(Ye,{sx:{width:7,height:7,minWidth:7,minHeight:7,borderRadius:"full",bg:s(),cursor:"pointer"}}),children:l.jsxs(B,{minWidth:60,direction:"column",gap:4,width:"100%",children:[r==="base"&&l.jsx(vc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:t,onChange:c=>e(Li(c))}),r==="mask"&&l.jsx(vc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:c=>e(o2(c))})]})})}function ib(){return l.jsxs(B,{columnGap:4,alignItems:"center",children:[l.jsx(ER,{}),l.jsx(WR,{})]})}function VR(){const e=Y(),t=A(r=>r.canvas.shouldRestrictStrokesToBox),{t:n}=X();return l.jsx(pt,{label:n("unifiedCanvas.betaLimitToBox"),isChecked:t,onChange:r=>e(i2(r.target.checked))})}function UR(){return l.jsxs(B,{gap:4,alignItems:"center",children:[l.jsx(ib,{}),l.jsx(VR,{})]})}function $R(){const e=Y(),{t}=X(),n=()=>e(Qf());return l.jsx(Je,{size:"sm",leftIcon:l.jsx(ri,{}),onClick:n,tooltip:`${t("unifiedCanvas.clearMask")} (Shift+C)`,children:t("unifiedCanvas.betaClear")})}function GR(){const e=A(o=>o.canvas.isMaskEnabled),t=Y(),{t:n}=X(),r=()=>t(is(!e));return l.jsx(pt,{label:`${n("unifiedCanvas.enableMask")} (H)`,isChecked:e,onChange:r})}function qR(){const e=Y(),{t}=X(),n=A(r=>r.canvas.shouldPreserveMaskedArea);return l.jsx(pt,{label:t("unifiedCanvas.betaPreserveMasked"),isChecked:n,onChange:r=>e(a2(r.target.checked))})}function YR(){return l.jsxs(B,{gap:4,alignItems:"center",children:[l.jsx(ib,{}),l.jsx(GR,{}),l.jsx(qR,{}),l.jsx($R,{})]})}function KR(){const e=A(r=>r.canvas.shouldDarkenOutsideBoundingBox),t=Y(),{t:n}=X();return l.jsx(pt,{label:n("unifiedCanvas.betaDarkenOutside"),isChecked:e,onChange:r=>t(s2(r.target.checked))})}function XR(){const e=A(r=>r.canvas.shouldShowGrid),t=Y(),{t:n}=X();return l.jsx(pt,{label:n("unifiedCanvas.showGrid"),isChecked:e,onChange:r=>t(l2(r.target.checked))})}function QR(){const e=A(o=>o.canvas.shouldSnapToGrid),t=Y(),{t:n}=X(),r=o=>t(Xl(o.target.checked));return l.jsx(pt,{label:`${n("unifiedCanvas.snapToGrid")} (N)`,isChecked:e,onChange:r})}function ZR(){return l.jsxs(B,{alignItems:"center",gap:4,children:[l.jsx(XR,{}),l.jsx(QR,{}),l.jsx(KR,{})]})}const JR=me([tt],e=>{const{tool:t,layer:n}=e;return{tool:t,layer:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function eN(){const{tool:e,layer:t}=A(JR);return l.jsxs(B,{height:8,minHeight:8,maxHeight:8,alignItems:"center",children:[t=="base"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx(UR,{}),t=="mask"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx(YR,{}),e=="move"&&l.jsx(ZR,{})]})}const tN=me([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),nN=()=>{const e=Y(),{doesCanvasNeedScaling:t}=A(tN);return g.useLayoutEffect(()=>{e(cn());const n=()=>{e(cn())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),l.jsx(Ye,{sx:{width:"100%",height:"100%",borderRadius:"base",bg:"base.850"},children:l.jsxs(B,{flexDirection:"row",width:"100%",height:"100%",columnGap:4,padding:4,children:[l.jsx(jR,{}),l.jsxs(B,{width:"100%",height:"100%",flexDirection:"column",rowGap:4,children:[l.jsx(eN,{}),t?l.jsx(X4,{}):l.jsx(K4,{})]})]})})},rN=me([tt,Ot],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:Yo(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),oN=()=>{const e=Y(),{t}=X(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:c}=A(rN);de(["q"],()=>{u()},{enabled:()=>!c,preventDefault:!0},[n]),de(["shift+c"],()=>{f()},{enabled:()=>!c,preventDefault:!0},[]),de(["h"],()=>{p()},{enabled:()=>!c,preventDefault:!0},[o]);const u=()=>{e(Ql(n==="mask"?"base":"mask"))},f=()=>e(Qf()),p=()=>e(is(!o));return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(Qt,{children:l.jsx(se,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:l.jsx(A9,{}),isChecked:n==="mask",isDisabled:c})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:p}),l.jsx(pt,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:h=>e(a2(h.target.checked))}),l.jsx(vc,{sx:{paddingTop:2,paddingBottom:2},pickerColor:r,onChange:h=>e(o2(h))}),l.jsxs(Je,{size:"sm",leftIcon:l.jsx(ri,{}),onClick:f,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},iN=me([tt],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:c,shouldSnapToGrid:u,shouldRestrictStrokesToBox:f}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:c,shouldSnapToGrid:u,shouldRestrictStrokesToBox:f}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),aN=()=>{const e=Y(),{t}=X(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:c,shouldShowIntermediates:u,shouldSnapToGrid:f,shouldRestrictStrokesToBox:p}=A(iN);de(["n"],()=>{e(Xl(!f))},{enabled:!0,preventDefault:!0},[f]);const h=y=>e(Xl(y.target.checked));return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(Jh,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:t("unifiedCanvas.showIntermediates"),isChecked:u,onChange:y=>e(e2(y.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showGrid"),isChecked:c,onChange:y=>e(l2(y.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.snapToGrid"),isChecked:f,onChange:h}),l.jsx(pt,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:y=>e(s2(y.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:y=>e(t2(y.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:y=>e(n2(y.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:y=>e(i2(y.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:y=>e(r2(y.target.checked))}),l.jsx(tb,{}),l.jsx(eb,{})]})})},sN=me([tt,Ot,Et],(e,t,n)=>{const{isProcessing:r}=n,{tool:o,brushColor:s,brushSize:c}=e;return{tool:o,isStaging:t,isProcessing:r,brushColor:s,brushSize:c}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),lN=()=>{const e=Y(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=A(sN),{t:s}=X();de(["b"],()=>{c()},{enabled:()=>!o,preventDefault:!0},[]),de(["e"],()=>{u()},{enabled:()=>!o,preventDefault:!0},[t]),de(["c"],()=>{f()},{enabled:()=>!o,preventDefault:!0},[t]),de(["shift+f"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),de(["delete","backspace"],()=>{h()},{enabled:()=>!o,preventDefault:!0}),de(["BracketLeft"],()=>{e(Fi(Math.max(r-5,5)))},{enabled:()=>!o,preventDefault:!0},[r]),de(["BracketRight"],()=>{e(Fi(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),de(["shift+BracketLeft"],()=>{e(Li({...n,a:ee.clamp(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),de(["shift+BracketRight"],()=>{e(Li({...n,a:ee.clamp(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const c=()=>e(br("brush")),u=()=>e(br("eraser")),f=()=>e(br("colorPicker")),p=()=>e(Q1()),h=()=>e(Z1());return l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:l.jsx(Ux,{}),isChecked:t==="brush"&&!o,onClick:c,isDisabled:o}),l.jsx(se,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:l.jsx(Bx,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:u}),l.jsx(se,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:l.jsx(Wx,{}),isDisabled:o,onClick:p}),l.jsx(se,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(vs,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:h}),l.jsx(se,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:l.jsx(Hx,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:f}),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(se,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:l.jsx(Zh,{})}),children:l.jsxs(B,{minWidth:60,direction:"column",gap:4,width:"100%",children:[l.jsx(B,{gap:4,justifyContent:"space-between",children:l.jsx(ut,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:y=>e(Fi(y)),sliderNumberInputProps:{max:500},inputReadOnly:!1})}),l.jsx(vc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:y=>e(Li(y))})]})})]})},cN=me([Et,tt,Ot],(e,t,n)=>{const{isProcessing:r}=e,{tool:o,shouldCropToBoundingBoxOnSave:s,layer:c,isMaskEnabled:u}=t;return{isProcessing:r,isStaging:n,isMaskEnabled:u,tool:o,layer:c,shouldCropToBoundingBoxOnSave:s}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),uN=()=>{const e=Y(),{isProcessing:t,isStaging:n,isMaskEnabled:r,layer:o,tool:s,shouldCropToBoundingBoxOnSave:c}=A(cN),u=wr(),{t:f}=X(),{openUploader:p}=Yh();de(["v"],()=>{h()},{enabled:()=>!n,preventDefault:!0},[]),de(["r"],()=>{x()},{enabled:()=>!0,preventDefault:!0},[u]),de(["shift+m"],()=>{C()},{enabled:()=>!n,preventDefault:!0},[u,t]),de(["shift+s"],()=>{k()},{enabled:()=>!n,preventDefault:!0},[u,t]),de(["meta+c","ctrl+c"],()=>{w()},{enabled:()=>!n,preventDefault:!0},[u,t]),de(["shift+d"],()=>{j()},{enabled:()=>!n,preventDefault:!0},[u,t]);const h=()=>e(br("move")),y=J4(()=>x(!1),()=>x(!0)),x=(P=!1)=>{const M=wr();if(!M)return;const T=M.getClientRect({skipTransform:!0});e(X1({contentRect:T,shouldScaleTo1:P}))},S=()=>{e(Zf()),e(bc())},C=()=>{e(lo({cropVisible:!1,shouldSetAsInitialImage:!0}))},k=()=>{e(lo({cropVisible:!c,cropToBoundingBox:c,shouldSaveToGallery:!0}))},w=()=>{e(lo({cropVisible:!c,cropToBoundingBox:c,shouldCopy:!0}))},j=()=>{e(lo({cropVisible:!c,cropToBoundingBox:c,shouldDownload:!0}))},I=P=>{const M=P.target.value;e(Ql(M)),M==="mask"&&!r&&e(is(!0))};return l.jsxs(B,{sx:{alignItems:"center",gap:2},children:[l.jsx(Mn,{tooltip:`${f("unifiedCanvas.layer")} (Q)`,tooltipProps:{hasArrow:!0,placement:"top"},value:o,validValues:K1,onChange:I,isDisabled:n}),l.jsx(oN,{}),l.jsx(lN,{}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{"aria-label":`${f("unifiedCanvas.move")} (V)`,tooltip:`${f("unifiedCanvas.move")} (V)`,icon:l.jsx(Nx,{}),isChecked:s==="move"||n,onClick:h}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.resetView")} (R)`,tooltip:`${f("unifiedCanvas.resetView")} (R)`,icon:l.jsx(Lx,{}),onClick:y})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{"aria-label":`${f("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${f("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:l.jsx(Vx,{}),onClick:C,isDisabled:n}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:l.jsx(Qh,{}),onClick:k,isDisabled:n}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:l.jsx(Ki,{}),onClick:w,isDisabled:n}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:l.jsx(Xh,{}),onClick:j,isDisabled:n})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(Z4,{}),l.jsx(Q4,{})]}),l.jsxs(Qt,{isAttached:!0,children:[l.jsx(se,{"aria-label":`${f("common.upload")}`,tooltip:`${f("common.upload")}`,icon:l.jsx(Oc,{}),onClick:p,isDisabled:n}),l.jsx(se,{"aria-label":`${f("unifiedCanvas.clearCanvas")}`,tooltip:`${f("unifiedCanvas.clearCanvas")}`,icon:l.jsx(ri,{}),onClick:S,colorScheme:"error",isDisabled:n})]}),l.jsx(Qt,{isAttached:!0,children:l.jsx(aN,{})})]})},dN=me([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),fN=()=>{const e=Y(),{doesCanvasNeedScaling:t}=A(dN);return g.useLayoutEffect(()=>{e(cn());const n=()=>{e(cn())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),l.jsx(Ye,{sx:{width:"100%",height:"100%",padding:4,borderRadius:"base",bg:"base.850"},children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",gap:4,width:"100%",height:"100%"},children:[l.jsx(uN,{}),l.jsx(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:t?l.jsx(X4,{}):l.jsx(K4,{})})]})})},hN=me(tt,e=>{const{boundingBoxDimensions:t,boundingBoxScaleMethod:n}=e;return{boundingBoxDimensions:t,boundingBoxScale:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),pN=()=>{const e=Y(),{boundingBoxDimensions:t}=A(hN),{t:n}=X(),r=u=>{e(Oa({...t,width:Math.floor(u)}))},o=u=>{e(Oa({...t,height:Math.floor(u)}))},s=()=>{e(Oa({...t,width:Math.floor(512)}))},c=()=>{e(Oa({...t,height:Math.floor(512)}))};return l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(ut,{label:n("parameters.width"),min:64,max:1024,step:64,value:t.width,onChange:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:s}),l.jsx(ut,{label:n("parameters.height"),min:64,max:1024,step:64,value:t.height,onChange:o,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:c})]})},mN=me([Pp,Et,tt],(e,t,n)=>{const{tileSize:r,infillMethod:o}=e,{infill_methods:s}=t,{boundingBoxScaleMethod:c,scaledBoundingBoxDimensions:u}=n;return{boundingBoxScale:c,scaledBoundingBoxDimensions:u,tileSize:r,infillMethod:o,availableInfillMethods:s,isManual:c==="manual"}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),vN=()=>{const e=Y(),{tileSize:t,infillMethod:n,availableInfillMethods:r,boundingBoxScale:o,isManual:s,scaledBoundingBoxDimensions:c}=A(mN),{t:u}=X(),f=S=>{e(yl({...c,width:Math.floor(S)}))},p=S=>{e(yl({...c,height:Math.floor(S)}))},h=()=>{e(yl({...c,width:Math.floor(512)}))},y=()=>{e(yl({...c,height:Math.floor(512)}))},x=S=>{e(cC(S.target.value))};return l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(Mn,{label:u("parameters.scaleBeforeProcessing"),validValues:sC,value:o,onChange:x}),l.jsx(ut,{isInputDisabled:!s,isResetDisabled:!s,isSliderDisabled:!s,label:u("parameters.scaledWidth"),min:64,max:1024,step:64,value:c.width,onChange:f,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:h}),l.jsx(ut,{isInputDisabled:!s,isResetDisabled:!s,isSliderDisabled:!s,label:u("parameters.scaledHeight"),min:64,max:1024,step:64,value:c.height,onChange:p,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:y}),l.jsx(Mn,{label:u("parameters.infillMethod"),value:n,validValues:r,onChange:S=>e(lC(S.target.value))}),l.jsx(ut,{isInputDisabled:n!=="tile",isResetDisabled:n!=="tile",isSliderDisabled:n!=="tile",label:u("parameters.tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:S=>{e(Lv(S))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Lv(32))}})]})};function gN(){const e=Y(),t=A(r=>r.generation.seamBlur),{t:n}=X();return l.jsx(ut,{label:n("parameters.seamBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(Bv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Bv(16))}})}function yN(){const e=Y(),{t}=X(),n=A(r=>r.generation.seamSize);return l.jsx(ut,{label:t("parameters.seamSize"),min:1,max:256,sliderNumberInputProps:{max:512},value:n,onChange:r=>{e(Hv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>e(Hv(96))})}function xN(){const{t:e}=X(),t=A(r=>r.generation.seamSteps),n=Y();return l.jsx(ut,{label:e("parameters.seamSteps"),min:1,max:100,sliderNumberInputProps:{max:999},value:t,onChange:r=>{n(Wv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{n(Wv(30))}})}function bN(){const e=Y(),{t}=X(),n=A(r=>r.generation.seamStrength);return l.jsx(ut,{label:t("parameters.seamStrength"),min:.01,max:.99,step:.01,value:n,onChange:r=>{e(Vv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Vv(.7))}})}const SN=()=>l.jsxs(ze,{gap:2,alignItems:"stretch",children:[l.jsx(yN,{}),l.jsx(gN,{}),l.jsx(bN,{}),l.jsx(xN,{})]});function CN(){const{t:e}=X(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(kp,{})},unifiedCanvasImg2Img:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(B4,{label:e("parameters.img2imgStrength")})},seed:{header:`${e("parameters.seed")}`,feature:ln.SEED,content:l.jsx(Sp,{})},boundingBox:{header:`${e("parameters.boundingBoxHeader")}`,feature:ln.BOUNDING_BOX,content:l.jsx(pN,{})},seamCorrection:{header:`${e("parameters.seamCorrectionHeader")}`,feature:ln.SEAM_CORRECTION,content:l.jsx(SN,{})},infillAndScaling:{header:`${e("parameters.infillScalingHeader")}`,feature:ln.INFILL_AND_SCALING,content:l.jsx(vN,{})},variations:{header:`${e("parameters.variations")}`,feature:ln.VARIATIONS,content:l.jsx(wp,{}),additionalHeaderComponents:l.jsx(Cp,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(xp,{}),additionalHeaderComponents:l.jsx(bp,{})}};return l.jsxs(B,{flexDir:"column",gap:2,position:"relative",children:[l.jsx(_p,{}),l.jsx(Tp,{}),l.jsx(Mp,{}),l.jsx(jp,{accordionInfo:t})]})}function wN(){const e=A(n=>n.ui.shouldUseCanvasBetaLayout),t=A(bt);return l.jsx(hp,{parametersPanelContent:l.jsx(CN,{}),children:t==="unifiedCanvas"&&(e?l.jsx(nN,{}):l.jsx(fN,{}))})}const _i={boxSize:6},l1=[{id:"txt2img",icon:l.jsx(tn,{as:FD,sx:_i}),workarea:l.jsx(fO,{})},{id:"img2img",icon:l.jsx(tn,{as:dp,sx:_i}),workarea:l.jsx(oO,{})},{id:"unifiedCanvas",icon:l.jsx(tn,{as:HD,sx:_i}),workarea:l.jsx(wN,{})},{id:"nodes",icon:l.jsx(tn,{as:LD,sx:_i}),workarea:l.jsx(YD,{})},{id:"postprocessing",icon:l.jsx(tn,{as:WD,sx:_i}),workarea:l.jsx(KD,{})},{id:"training",icon:l.jsx(tn,{as:BD,sx:_i}),workarea:l.jsx(XD,{})}];function kN(){const e=A(Y8),t=A(f=>f.lightbox.isLightboxOpen),n=A(f=>f.ui.shouldPinGallery),r=A(f=>f.ui.shouldPinParametersPanel),{t:o}=X(),s=Y();de("1",()=>{s(jn(0))}),de("2",()=>{s(jn(1))}),de("3",()=>{s(jn(2))}),de("4",()=>{s(jn(3))}),de("5",()=>{s(jn(4))}),de("6",()=>{s(jn(5))}),de("z",()=>{s(Vo(!t))},[t]),de("f",()=>{s(uC()),(n||r)&&s(cn())},[n,r]);const c=g.useMemo(()=>l1.map(f=>l.jsx(Gt,{hasArrow:!0,label:String(o(`common.${f.id}`)),placement:"end",children:l.jsxs(vx,{children:[l.jsx(S2,{children:String(o(`common.${f.id}`))}),f.icon]})},f.id)),[o]),u=g.useMemo(()=>l1.map(f=>l.jsx(px,{children:f.workarea},f.id)),[]);return l.jsxs(fx,{isLazy:!0,defaultIndex:e,index:e,onChange:f=>{s(jn(f))},flexGrow:1,children:[l.jsx(hx,{children:c}),l.jsx(mx,{children:u})]})}function jN(){async function e(n=""){return await fetch(n,{method:"GET",cache:"no-cache"})}const t=()=>{const n=document.location;e(n+"/flaskwebgui-keep-server-alive").then(o=>o)};(!{}.NODE_ENV||{}.NODE_ENV==="production")&&document.addEventListener("DOMContentLoaded",()=>{t(),setInterval(t,3e3)})}const EN=()=>{const e=Y(),t=A(G9),n=ss();g.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(dC())},[e,n,t])},PN=me([bt,Er],(e,t)=>{const{shouldPinGallery:n,shouldShowGallery:r}=t;return{shouldPinGallery:n,shouldShowGalleryButton:(!n||!r)&&["txt2img","img2img","unifiedCanvas"].includes(e)}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),IN=()=>{const{t:e}=X(),{shouldPinGallery:t,shouldShowGalleryButton:n}=A(PN),r=Y(),o=()=>{r(sf(!0)),t&&r(cn())};return n?l.jsx(se,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":e("accessibility.showGallery"),onClick:o,sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",zIndex:31,p:0,insetInlineEnd:0,px:3,h:48,w:8,borderStartEndRadius:0,borderEndEndRadius:0},children:l.jsx(dp,{})}):null},$d={borderStartStartRadius:0,borderEndStartRadius:0},MN=me([Er,bt],(e,t)=>{const{shouldPinParametersPanel:n,shouldUseCanvasBetaLayout:r,shouldShowParametersPanel:o}=e,s=r&&t==="unifiedCanvas",c=!s&&(!n||!o),u=!s&&(!n||!o)&&["txt2img","img2img","unifiedCanvas"].includes(t);return{shouldPinParametersPanel:n,shouldShowParametersPanelButton:u,shouldShowProcessButtons:c}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),TN=()=>{const e=Y(),{t}=X(),{shouldShowProcessButtons:n,shouldShowParametersPanelButton:r,shouldPinParametersPanel:o}=A(MN),s=()=>{e(ql(!0)),o&&e(cn())};return r?l.jsxs(B,{pos:"absolute",transform:"translate(0, -50%)",zIndex:20,minW:8,top:"50%",insetInlineStart:"4.5rem",direction:"column",gap:2,children:[l.jsx(se,{tooltip:"Show Options Panel (O)",tooltipProps:{placement:"top"},"aria-label":t("accessibility.showOptionsPanel"),onClick:s,sx:$d,children:l.jsx(Zh,{})}),n&&l.jsxs(l.Fragment,{children:[l.jsx(Ip,{iconButton:!0,sx:$d}),l.jsx(Ep,{sx:$d})]})]}):null};var Wa=globalThis&&globalThis.__assign||function(){return Wa=Object.assign||function(e){for(var t,n=1,r=arguments.length;ne.image.uuid===t.image.uuid&&e.isSelected===t.isSelected,ab=g.memo(e=>{const t=Y(),{activeTabName:n,galleryImageObjectFit:r,galleryImageMinimumWidth:o,mayDeleteImage:s,shouldUseSingleGalleryColumn:c}=A(ZD),{image:u,isSelected:f}=e,{url:p,thumbnail:h,uuid:y,metadata:x}=u,[S,C]=g.useState(!1),k=ss(),{direction:w}=ea(),{t:j}=X(),I=gp(),P=()=>C(!0),M=()=>C(!1),T=()=>{var K,te,ne,$;(te=(K=u.metadata)==null?void 0:K.image)!=null&&te.prompt&&I(($=(ne=u.metadata)==null?void 0:ne.image)==null?void 0:$.prompt),k({title:j("toast.promptSet"),status:"success",duration:2500,isClosable:!0})},D=()=>{u.metadata&&t(os(u.metadata.image.seed)),k({title:j("toast.seedSet"),status:"success",duration:2500,isClosable:!0})},_=()=>{t(ns(u)),n!=="img2img"&&t(jn("img2img")),k({title:j("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})},R=()=>{t(xc(u)),t(bc()),n!=="unifiedCanvas"&&t(jn("unifiedCanvas")),k({title:j("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},V=()=>{x&&t(_1(x)),k({title:j("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})},F=async()=>{var K;if((K=x==null?void 0:x.image)!=null&&K.init_image_path&&(await fetch(x.image.init_image_path)).ok){t(jn("img2img")),t(fC(x)),k({title:j("toast.initialImageSet"),status:"success",duration:2500,isClosable:!0});return}k({title:j("toast.initialImageNotSet"),description:j("toast.initialImageNotSetDesc"),status:"error",duration:2500,isClosable:!0})},L=()=>t(Uv(u)),Q=K=>{K.dataTransfer.setData("invokeai/imageUuid",y),K.dataTransfer.effectAllowed="move"},U=()=>{t(Uv(u)),t(Vo(!0))};return l.jsx(_N,{menuProps:{size:"sm",isLazy:!0},renderMenu:()=>{var K,te,ne,$,Z,oe,le,Re;return l.jsxs(Ah,{children:[l.jsx(vr,{onClickCapture:U,children:j("parameters.openInViewer")}),l.jsx(vr,{onClickCapture:T,isDisabled:((te=(K=u==null?void 0:u.metadata)==null?void 0:K.image)==null?void 0:te.prompt)===void 0,children:j("parameters.usePrompt")}),l.jsx(vr,{onClickCapture:D,isDisabled:(($=(ne=u==null?void 0:u.metadata)==null?void 0:ne.image)==null?void 0:$.seed)===void 0,children:j("parameters.useSeed")}),l.jsx(vr,{onClickCapture:V,isDisabled:!["txt2img","img2img"].includes((oe=(Z=u==null?void 0:u.metadata)==null?void 0:Z.image)==null?void 0:oe.type),children:j("parameters.useAll")}),l.jsx(vr,{onClickCapture:F,isDisabled:((Re=(le=u==null?void 0:u.metadata)==null?void 0:le.image)==null?void 0:Re.type)!=="img2img",children:j("parameters.useInitImg")}),l.jsx(vr,{onClickCapture:_,children:j("parameters.sendToImg2Img")}),l.jsx(vr,{onClickCapture:R,children:j("parameters.sendToUnifiedCanvas")}),l.jsx(vr,{"data-warning":!0,children:l.jsx(hc,{image:u,children:l.jsx("p",{children:j("parameters.deleteImage")})})})]})},children:K=>l.jsxs(Ye,{position:"relative",onMouseOver:P,onMouseOut:M,userSelect:"none",draggable:!0,onDragStart:Q,ref:K,sx:{padding:2,display:"flex",justifyContent:"center",transition:"transform 0.2s ease-out",_hover:{cursor:"pointer",zIndex:2},_before:{content:'""',display:"block",paddingBottom:"100%"}},children:[l.jsx(ls,{objectFit:c?"contain":r,rounded:"md",src:h||p,loading:"lazy",sx:{position:"absolute",width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",top:"50%",transform:"translate(-50%,-50%)",...w==="rtl"?{insetInlineEnd:"50%"}:{insetInlineStart:"50%"}}}),l.jsx(B,{onClick:L,sx:{position:"absolute",top:"0",insetInlineStart:"0",width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},children:f&&l.jsx(tn,{as:Ac,sx:{width:"50%",height:"50%",fill:"ok.500"}})}),S&&o>=64&&l.jsx(Ye,{sx:{position:"absolute",top:1,insetInlineEnd:1},children:l.jsx(hc,{image:u,children:l.jsx(se,{"aria-label":j("parameters.deleteImage"),icon:l.jsx(V9,{}),size:"xs",fontSize:14,isDisabled:!s})})})]},y)})},DN);ab.displayName="HoverableImage";const AN=290,sb=()=>{const e=Y(),{t}=X(),n=g.useRef(null),[r,o]=g.useState(!0),{images:s,currentCategory:c,currentImageUuid:u,shouldPinGallery:f,galleryImageMinimumWidth:p,galleryGridTemplateColumns:h,galleryImageObjectFit:y,shouldAutoSwitchToNewImages:x,areMoreImagesAvailable:S,shouldUseSingleGalleryColumn:C}=A(QD),k=()=>{e(vC(c))},w=I=>{e(Zl(I))},j=()=>{e(c2()),e(cn())};return g.useEffect(()=>{if(!n.current)return;const I=new ResizeObserver(()=>{if(n.current){if(n.current.clientWidthI.disconnect()},[]),l.jsxs(B,{flexDirection:"column",w:"full",h:"full",gap:4,children:[l.jsxs(B,{ref:n,alignItems:"center",justifyContent:"space-between",children:[l.jsx(Qt,{size:"sm",isAttached:!0,w:"max-content",justifyContent:"stretch",children:r?l.jsxs(l.Fragment,{children:[l.jsx(se,{"aria-label":t("gallery.showGenerations"),tooltip:t("gallery.showGenerations"),isChecked:c==="result",role:"radio",icon:l.jsx(T9,{}),onClick:()=>e(xl("result"))}),l.jsx(se,{"aria-label":t("gallery.showUploads"),tooltip:t("gallery.showUploads"),role:"radio",isChecked:c==="user",icon:l.jsx($9,{}),onClick:()=>e(xl("user"))})]}):l.jsxs(l.Fragment,{children:[l.jsx(Je,{size:"sm",isChecked:c==="result",onClick:()=>e(xl("result")),flexGrow:1,children:t("gallery.generations")}),l.jsx(Je,{size:"sm",isChecked:c==="user",onClick:()=>e(xl("user")),flexGrow:1,children:t("gallery.uploads")})]})}),l.jsxs(B,{gap:2,children:[l.jsx(rr,{triggerComponent:l.jsx(se,{size:"sm","aria-label":t("gallery.gallerySettings"),icon:l.jsx(Jh,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(ut,{value:p,onChange:w,min:32,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:()=>e(Zl(64))}),l.jsx(pt,{label:t("gallery.maintainAspectRatio"),isChecked:y==="contain",onChange:()=>e(hC(y==="contain"?"cover":"contain"))}),l.jsx(pt,{label:t("gallery.autoSwitchNewImages"),isChecked:x,onChange:I=>e(pC(I.target.checked))}),l.jsx(pt,{label:t("gallery.singleColumnLayout"),isChecked:C,onChange:I=>e(mC(I.target.checked))})]})}),l.jsx(se,{size:"sm","aria-label":t("gallery.pinGallery"),tooltip:`${t("gallery.pinGallery")} (Shift+G)`,onClick:j,icon:f?l.jsx(T4,{}):l.jsx(_4,{})})]})]}),l.jsx(M4,{children:l.jsx(B,{direction:"column",gap:2,h:"full",children:s.length||S?l.jsxs(l.Fragment,{children:[l.jsx(or,{gap:2,style:{gridTemplateColumns:h},children:s.map(I=>{const{uuid:P}=I,M=u===P;return l.jsx(ab,{image:I,isSelected:M},P)})}),l.jsx(Je,{onClick:k,isDisabled:!S,flexShrink:0,children:t(S?"gallery.loadMore":"gallery.allImagesLoaded")})]}):l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,padding:8,h:"100%",w:"100%",color:"base.500"},children:[l.jsx(tn,{as:dp,sx:{w:16,h:16}}),l.jsx(Ce,{textAlign:"center",children:t("gallery.noImagesInGallery")})]})})})]})};sb.displayName="ImageGalleryContent";const c1={txt2img:{galleryMinWidth:200,galleryMaxWidth:500},img2img:{galleryMinWidth:200,galleryMaxWidth:500},unifiedCanvas:{galleryMinWidth:200,galleryMaxWidth:200},nodes:{galleryMinWidth:200,galleryMaxWidth:500},postprocessing:{galleryMinWidth:200,galleryMaxWidth:500},training:{galleryMinWidth:200,galleryMaxWidth:500}},ON=me([bt,Er,Gr,Ot,bs],(e,t,n,r,o)=>{const{shouldPinGallery:s,shouldShowGallery:c}=t,{galleryImageMinimumWidth:u}=n,{isLightboxOpen:f}=o;return{activeTabName:e,isStaging:r,shouldPinGallery:s,shouldShowGallery:c,galleryImageMinimumWidth:u,isResizable:e!=="unifiedCanvas",isLightboxOpen:f}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function zN(){const e=Y(),{shouldPinGallery:t,shouldShowGallery:n,galleryImageMinimumWidth:r,activeTabName:o,isStaging:s,isResizable:c,isLightboxOpen:u}=A(ON),f=()=>{e(c2()),e(cn())},p=()=>{e(gC()),t&&e(cn())},h=()=>{e(sf(!1)),t&&e(cn())};de("g",()=>{p()},[t]),de("left",()=>{e(F1())},{enabled:!s||o!=="unifiedCanvas"},[s,o]),de("right",()=>{e(L1())},{enabled:!s||o!=="unifiedCanvas"},[s,o]),de("shift+g",()=>{f()},[t]),de("esc",()=>{e(sf(!1))},{enabled:()=>!t,preventDefault:!0},[t]);const y=32;return de("shift+up",()=>{if(r<256){const x=ee.clamp(r+y,32,256);e(Zl(x))}},[r]),de("shift+down",()=>{if(r>32){const x=ee.clamp(r-y,32,256);e(Zl(x))}},[r]),l.jsx(I4,{direction:"right",isResizable:c||!t,isOpen:n,onClose:h,isPinned:t&&!u,minWidth:t?c1[o].galleryMinWidth:200,maxWidth:t?c1[o].galleryMaxWidth:void 0,children:l.jsx(sb,{})})}var Hn=function(e,t){return Number(e.toFixed(t))},RN=function(e,t){return typeof e=="number"?e:t},Mt=function(e,t,n){n&&typeof n=="function"&&n(e,t)},NN=function(e){return-Math.cos(e*Math.PI)/2+.5},FN=function(e){return e},LN=function(e){return e*e},BN=function(e){return e*(2-e)},HN=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},WN=function(e){return e*e*e},VN=function(e){return--e*e*e+1},UN=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},$N=function(e){return e*e*e*e},GN=function(e){return 1- --e*e*e*e},qN=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},YN=function(e){return e*e*e*e*e},KN=function(e){return 1+--e*e*e*e*e},XN=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},lb={easeOut:NN,linear:FN,easeInQuad:LN,easeOutQuad:BN,easeInOutQuad:HN,easeInCubic:WN,easeOutCubic:VN,easeInOutCubic:UN,easeInQuart:$N,easeOutQuart:GN,easeInOutQuart:qN,easeInQuint:YN,easeOutQuint:KN,easeInOutQuint:XN},cb=function(e){typeof e=="number"&&cancelAnimationFrame(e)},xr=function(e){e.mounted&&(cb(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function ub(e,t,n,r){if(e.mounted){var o=new Date().getTime(),s=1;xr(e),e.animation=function(){if(!e.mounted)return cb(e.animation);var c=new Date().getTime()-o,u=c/n,f=lb[t],p=f(u);c>=n?(r(s),e.animation=null):e.animation&&(r(p),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function QN(e){var t=e.scale,n=e.positionX,r=e.positionY;return!(Number.isNaN(t)||Number.isNaN(n)||Number.isNaN(r))}function Co(e,t,n,r){var o=QN(t);if(!(!e.mounted||!o)){var s=e.setTransformState,c=e.transformState,u=c.scale,f=c.positionX,p=c.positionY,h=t.scale-u,y=t.positionX-f,x=t.positionY-p;n===0?s(t.scale,t.positionX,t.positionY):ub(e,r,n,function(S){var C=u+h*S,k=f+y*S,w=p+x*S;s(C,k,w)})}}function ZN(e,t,n){var r=e.offsetWidth,o=e.offsetHeight,s=t.offsetWidth,c=t.offsetHeight,u=s*n,f=c*n,p=r-u,h=o-f;return{wrapperWidth:r,wrapperHeight:o,newContentWidth:u,newDiffWidth:p,newContentHeight:f,newDiffHeight:h}}var JN=function(e,t,n,r,o,s,c){var u=e>t?n*(c?1:.5):0,f=r>o?s*(c?1:.5):0,p=e-t-u,h=u,y=r-o-f,x=f;return{minPositionX:p,maxPositionX:h,minPositionY:y,maxPositionY:x}},Np=function(e,t){var n=e.wrapperComponent,r=e.contentComponent,o=e.setup.centerZoomedOut;if(!n||!r)throw new Error("Components are not mounted");var s=ZN(n,r,t),c=s.wrapperWidth,u=s.wrapperHeight,f=s.newContentWidth,p=s.newDiffWidth,h=s.newContentHeight,y=s.newDiffHeight,x=JN(c,f,p,u,h,y,Boolean(o));return x},Yf=function(e,t,n,r){return r?en?Hn(n,2):Hn(e,2):Hn(e,2)},Ji=function(e,t){var n=Np(e,t);return e.bounds=n,n};function Uc(e,t,n,r,o,s,c){var u=n.minPositionX,f=n.minPositionY,p=n.maxPositionX,h=n.maxPositionY,y=0,x=0;c&&(y=o,x=s);var S=Yf(e,u-y,p+y,r),C=Yf(t,f-x,h+x,r);return{x:S,y:C}}function $c(e,t,n,r,o,s){var c=e.transformState,u=c.scale,f=c.positionX,p=c.positionY,h=r-u;if(typeof t!="number"||typeof n!="number")return console.error("Mouse X and Y position were not provided!"),{x:f,y:p};var y=f-t*h,x=p-n*h,S=Uc(y,x,o,s,0,0,null);return S}function Ss(e,t,n,r,o){var s=o?r:0,c=t-s;return!Number.isNaN(n)&&e>=n?n:!Number.isNaN(t)&&e<=c?c:e}var u1=function(e,t){var n=e.setup.panning.excluded,r=e.isInitialized,o=e.wrapperComponent,s=t.target,c=o==null?void 0:o.contains(s),u=r&&s&&c;if(!u)return!1;var f=Gc(s,n);return!f},d1=function(e){var t=e.isInitialized,n=e.isPanning,r=e.setup,o=r.panning.disabled,s=t&&n&&!o;return!!s},eF=function(e,t){var n=e.transformState,r=n.positionX,o=n.positionY;e.isPanning=!0;var s=t.clientX,c=t.clientY;e.startCoords={x:s-r,y:c-o}},tF=function(e,t){var n=t.touches,r=e.transformState,o=r.positionX,s=r.positionY;e.isPanning=!0;var c=n.length===1;if(c){var u=n[0].clientX,f=n[0].clientY;e.startCoords={x:u-o,y:f-s}}};function nF(e){var t=e.transformState,n=t.positionX,r=t.positionY,o=t.scale,s=e.setup,c=s.disabled,u=s.limitToBounds,f=s.centerZoomedOut,p=e.wrapperComponent;if(!(c||!p||!e.bounds)){var h=e.bounds,y=h.maxPositionX,x=h.minPositionX,S=h.maxPositionY,C=h.minPositionY,k=n>y||nS||ry?p.offsetWidth:e.setup.minPositionX||0,I=r>S?p.offsetHeight:e.setup.minPositionY||0,P=$c(e,j,I,o,e.bounds,u||f),M=P.x,T=P.y;return{scale:o,positionX:k?M:n,positionY:w?T:r}}}function rF(e,t,n,r,o){var s=e.setup.limitToBounds,c=e.wrapperComponent,u=e.bounds,f=e.transformState,p=f.scale,h=f.positionX,y=f.positionY;if(!(c===null||u===null||t===h&&n===y)){var x=Uc(t,n,u,s,r,o,c),S=x.x,C=x.y;e.setTransformState(p,S,C)}}var oF=function(e,t,n){var r=e.startCoords,o=e.transformState,s=e.setup.panning,c=s.lockAxisX,u=s.lockAxisY,f=o.positionX,p=o.positionY;if(!r)return{x:f,y:p};var h=t-r.x,y=n-r.y,x=c?f:h,S=u?p:y;return{x,y:S}},gc=function(e,t){var n=e.setup,r=e.transformState,o=r.scale,s=n.minScale,c=n.disablePadding;return t>0&&o>=s&&!c?t:0},iF=function(e){var t=e.mounted,n=e.setup,r=n.disabled,o=n.velocityAnimation,s=e.transformState.scale,c=o.disabled,u=!c||s>1||!r||t;return!!u},aF=function(e){var t=e.mounted,n=e.velocity,r=e.bounds,o=e.setup,s=o.disabled,c=o.velocityAnimation,u=e.transformState.scale,f=c.disabled,p=!f||u>1||!s||t;return!(!p||!n||!r)};function sF(e,t){var n=e.setup.velocityAnimation,r=n.equalToMove,o=n.animationTime,s=n.sensitivity;return r?o*t*s:o}function f1(e,t,n,r,o,s,c,u,f,p){if(o){if(t>c&&n>c){var h=c+(e-c)*p;return h>f?f:hs?s:h}}return r?t:Yf(e,s,c,o)}function lF(e,t){var n=1;return t?Math.min(n,e.offsetWidth/window.innerWidth):n}function cF(e,t){var n=iF(e);if(n){var r=e.lastMousePosition,o=e.velocityTime,s=e.setup,c=e.wrapperComponent,u=s.velocityAnimation.equalToMove,f=Date.now();if(r&&o&&c){var p=lF(c,u),h=t.x-r.x,y=t.y-r.y,x=h/p,S=y/p,C=f-o,k=h*h+y*y,w=Math.sqrt(k)/C;e.velocity={velocityX:x,velocityY:S,total:w}}e.lastMousePosition=t,e.velocityTime=f}}function uF(e){var t=e.velocity,n=e.bounds,r=e.setup,o=e.wrapperComponent,s=aF(e);if(!(!s||!t||!n||!o)){var c=t.velocityX,u=t.velocityY,f=t.total,p=n.maxPositionX,h=n.minPositionX,y=n.maxPositionY,x=n.minPositionY,S=r.limitToBounds,C=r.alignmentAnimation,k=r.zoomAnimation,w=r.panning,j=w.lockAxisY,I=w.lockAxisX,P=k.animationType,M=C.sizeX,T=C.sizeY,D=C.velocityAlignmentTime,_=D,R=sF(e,f),V=Math.max(R,_),F=gc(e,M),L=gc(e,T),Q=F*o.offsetWidth/100,U=L*o.offsetHeight/100,K=p+Q,te=h-Q,ne=y+U,$=x-U,Z=e.transformState,oe=new Date().getTime();ub(e,P,V,function(le){var Re=e.transformState,Ne=Re.scale,Ie=Re.positionX,pe=Re.positionY,ce=new Date().getTime()-oe,Fe=ce/_,Ve=lb[C.animationType],Ue=1-Ve(Math.min(1,Fe)),$e=1-le,Qe=Ie+c*$e,ge=pe+u*$e,Te=f1(Qe,Z.positionX,Ie,I,S,h,p,te,K,Ue),Ge=f1(ge,Z.positionY,pe,j,S,x,y,$,ne,Ue);(Ie!==Qe||pe!==ge)&&e.setTransformState(Ne,Te,Ge)})}}function h1(e,t){var n=e.transformState.scale;xr(e),Ji(e,n),window.TouchEvent!==void 0&&t instanceof TouchEvent?tF(e,t):eF(e,t)}function db(e){var t=e.transformState.scale,n=e.setup,r=n.minScale,o=n.alignmentAnimation,s=o.disabled,c=o.sizeX,u=o.sizeY,f=o.animationTime,p=o.animationType,h=s||t.1&&y;x?uF(e):db(e)}}function Fp(e,t,n,r){var o=e.setup,s=o.minScale,c=o.maxScale,u=o.limitToBounds,f=Ss(Hn(t,2),s,c,0,!1),p=Ji(e,f),h=$c(e,n,r,f,p,u),y=h.x,x=h.y;return{scale:f,positionX:y,positionY:x}}function fb(e,t,n){var r=e.transformState.scale,o=e.wrapperComponent,s=e.setup,c=s.minScale,u=s.limitToBounds,f=s.zoomAnimation,p=f.disabled,h=f.animationTime,y=f.animationType,x=p||r>=c;if((r>=1||u)&&db(e),!(x||!o||!e.mounted)){var S=t||o.offsetWidth/2,C=n||o.offsetHeight/2,k=Fp(e,c,S,C);k&&Co(e,k,h,y)}}var uo=function(){return uo=Object.assign||function(t){for(var n,r=1,o=arguments.length;rc||Math.sign(n.deltaY)!==Math.sign(t.deltaY)||n.deltaY>0&&n.deltaYt.deltaY||Math.sign(n.deltaY)!==Math.sign(t.deltaY):!1},PF=function(e,t){var n=e.setup.pinch,r=n.disabled,o=n.excluded,s=e.isInitialized,c=t.target,u=s&&!r&&c;if(!u)return!1;var f=Gc(c,o);return!f},IF=function(e){var t=e.setup.pinch.disabled,n=e.isInitialized,r=e.pinchStartDistance,o=n&&!t&&r;return!!o},MF=function(e,t,n){var r=n.getBoundingClientRect(),o=e.touches,s=Hn(o[0].clientX-r.left,5),c=Hn(o[0].clientY-r.top,5),u=Hn(o[1].clientX-r.left,5),f=Hn(o[1].clientY-r.top,5);return{x:(s+u)/2/t,y:(c+f)/2/t}},xb=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},TF=function(e,t){var n=e.pinchStartScale,r=e.pinchStartDistance,o=e.setup,s=o.maxScale,c=o.minScale,u=o.zoomAnimation,f=o.disablePadding,p=u.size,h=u.disabled;if(!n||r===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var y=t/r,x=y*n;return Ss(Hn(x,2),c,s,p,!h&&!f)},_F=160,DF=100,AF=function(e,t){var n=e.props,r=n.onWheelStart,o=n.onZoomStart;e.wheelStopEventTimer||(xr(e),Mt(dt(e),t,r),Mt(dt(e),t,o))},OF=function(e,t){var n=e.props,r=n.onWheel,o=n.onZoom,s=e.contentComponent,c=e.setup,u=e.transformState,f=u.scale,p=c.limitToBounds,h=c.centerZoomedOut,y=c.zoomAnimation,x=c.wheel,S=c.disablePadding,C=y.size,k=y.disabled,w=x.step;if(!s)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var j=kF(t,null),I=jF(e,j,w,!t.ctrlKey);if(f!==I){var P=Ji(e,I),M=yb(t,s,f),T=k||C===0||h||S,D=p&&T,_=$c(e,M.x,M.y,I,P,D),R=_.x,V=_.y;e.previousWheelEvent=t,e.setTransformState(I,R,V),Mt(dt(e),t,r),Mt(dt(e),t,o)}},zF=function(e,t){var n=e.props,r=n.onWheelStop,o=n.onZoomStop;Kf(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(fb(e,t.x,t.y),e.wheelAnimationTimer=null)},DF);var s=EF(e,t);s&&(Kf(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Mt(dt(e),t,r),Mt(dt(e),t,o))},_F))},RF=function(e,t){var n=xb(t);e.pinchStartDistance=n,e.lastDistance=n,e.pinchStartScale=e.transformState.scale,e.isPanning=!1,xr(e)},NF=function(e,t){var n=e.contentComponent,r=e.pinchStartDistance,o=e.transformState.scale,s=e.setup,c=s.limitToBounds,u=s.centerZoomedOut,f=s.zoomAnimation,p=f.disabled,h=f.size;if(!(r===null||!n)){var y=MF(t,o,n);if(!(!Number.isFinite(y.x)||!Number.isFinite(y.y))){var x=xb(t),S=TF(e,x);if(S!==o){var C=Ji(e,S),k=p||h===0||u,w=c&&k,j=$c(e,y.x,y.y,S,C,w),I=j.x,P=j.y;e.pinchMidpoint=y,e.lastDistance=x,e.setTransformState(S,I,P)}}}},FF=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,fb(e,t==null?void 0:t.x,t==null?void 0:t.y)},bb=function(e,t){var n=e.props.onZoomStop,r=e.setup.doubleClick.animationTime;Kf(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Mt(dt(e),t,n)},r)},LF=function(e,t){var n=e.props,r=n.onZoomStart,o=n.onZoom,s=e.setup.doubleClick,c=s.animationTime,u=s.animationType;Mt(dt(e),t,r),vb(e,c,u,function(){return Mt(dt(e),t,o)}),bb(e,t)};function BF(e,t){var n=e.setup,r=e.doubleClickStopEventTimer,o=e.transformState,s=e.contentComponent,c=o.scale,u=e.props,f=u.onZoomStart,p=u.onZoom,h=n.doubleClick,y=h.disabled,x=h.mode,S=h.step,C=h.animationTime,k=h.animationType;if(!y&&!r){if(x==="reset")return LF(e,t);if(!s)return console.error("No ContentComponent found");var w=x==="zoomOut"?-1:1,j=pb(e,w,S);if(c!==j){Mt(dt(e),t,f);var I=yb(t,s,c),P=Fp(e,j,I.x,I.y);if(!P)return console.error("Error during zoom event. New transformation state was not calculated.");Mt(dt(e),t,p),Co(e,P,C,k),bb(e,t)}}}var HF=function(e,t){var n=e.isInitialized,r=e.setup,o=e.wrapperComponent,s=r.doubleClick,c=s.disabled,u=s.excluded,f=t.target,p=o==null?void 0:o.contains(f),h=n&&f&&p&&!c;if(!h)return!1;var y=Gc(f,u);return!y},WF=function(){function e(t){var n=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){n.initializeWindowEvents()},this.unmount=function(){n.cleanupWindowEvents()},this.update=function(r){Ji(n,n.transformState.scale),n.setup=v1(r)},this.initializeWindowEvents=function(){var r,o=qd(),s=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,c=s==null?void 0:s.defaultView;c==null||c.addEventListener("mousedown",n.onPanningStart,o),c==null||c.addEventListener("mousemove",n.onPanning,o),c==null||c.addEventListener("mouseup",n.onPanningStop,o),s==null||s.addEventListener("mouseleave",n.clearPanning,o),c==null||c.addEventListener("keyup",n.setKeyUnPressed,o),c==null||c.addEventListener("keydown",n.setKeyPressed,o)},this.cleanupWindowEvents=function(){var r,o,s=qd(),c=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,u=c==null?void 0:c.defaultView;u==null||u.removeEventListener("mousedown",n.onPanningStart,s),u==null||u.removeEventListener("mousemove",n.onPanning,s),u==null||u.removeEventListener("mouseup",n.onPanningStop,s),c==null||c.removeEventListener("mouseleave",n.clearPanning,s),u==null||u.removeEventListener("keyup",n.setKeyUnPressed,s),u==null||u.removeEventListener("keydown",n.setKeyPressed,s),document.removeEventListener("mouseleave",n.clearPanning,s),xr(n),(o=n.observer)===null||o===void 0||o.disconnect()},this.handleInitializeWrapperEvents=function(r){var o=qd();r.addEventListener("wheel",n.onWheelZoom,o),r.addEventListener("dblclick",n.onDoubleClick,o),r.addEventListener("touchstart",n.onTouchPanningStart,o),r.addEventListener("touchmove",n.onTouchPanning,o),r.addEventListener("touchend",n.onTouchPanningStop,o)},this.handleInitialize=function(r){var o=n.setup.centerOnInit;n.applyTransformation(),o&&(n.setCenter(),n.observer=new ResizeObserver(function(){var s;n.setCenter(),(s=n.observer)===null||s===void 0||s.disconnect()}),n.observer.observe(r))},this.onWheelZoom=function(r){var o=n.setup.disabled;if(!o){var s=CF(n,r);if(s){var c=n.isPressingKeys(n.setup.wheel.activationKeys);c&&(AF(n,r),OF(n,r),zF(n,r))}}},this.onPanningStart=function(r){var o=n.setup.disabled,s=n.props.onPanningStart;if(!o){var c=u1(n,r);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),xr(n),h1(n,r),Mt(dt(n),r,s))}}},this.onPanning=function(r){var o=n.setup.disabled,s=n.props.onPanning;if(!o){var c=d1(n);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),p1(n,r.clientX,r.clientY),Mt(dt(n),r,s))}}},this.onPanningStop=function(r){var o=n.props.onPanningStop;n.isPanning&&(dF(n),Mt(dt(n),r,o))},this.onPinchStart=function(r){var o=n.setup.disabled,s=n.props,c=s.onPinchingStart,u=s.onZoomStart;if(!o){var f=PF(n,r);f&&(RF(n,r),xr(n),Mt(dt(n),r,c),Mt(dt(n),r,u))}},this.onPinch=function(r){var o=n.setup.disabled,s=n.props,c=s.onPinching,u=s.onZoom;if(!o){var f=IF(n);f&&(r.preventDefault(),r.stopPropagation(),NF(n,r),Mt(dt(n),r,c),Mt(dt(n),r,u))}},this.onPinchStop=function(r){var o=n.props,s=o.onPinchingStop,c=o.onZoomStop;n.pinchStartScale&&(FF(n),Mt(dt(n),r,s),Mt(dt(n),r,c))},this.onTouchPanningStart=function(r){var o=n.setup.disabled,s=n.props.onPanningStart;if(!o){var c=u1(n,r);if(c){var u=n.lastTouch&&+new Date-n.lastTouch<200;if(u&&r.touches.length===1)n.onDoubleClick(r);else{n.lastTouch=+new Date,xr(n);var f=r.touches,p=f.length===1,h=f.length===2;p&&(xr(n),h1(n,r),Mt(dt(n),r,s)),h&&n.onPinchStart(r)}}}},this.onTouchPanning=function(r){var o=n.setup.disabled,s=n.props.onPanning;if(n.isPanning&&r.touches.length===1){if(o)return;var c=d1(n);if(!c)return;r.preventDefault(),r.stopPropagation();var u=r.touches[0];p1(n,u.clientX,u.clientY),Mt(dt(n),r,s)}else r.touches.length>1&&n.onPinch(r)},this.onTouchPanningStop=function(r){n.onPanningStop(r),n.onPinchStop(r)},this.onDoubleClick=function(r){var o=n.setup.disabled;if(!o){var s=HF(n,r);s&&BF(n,r)}},this.clearPanning=function(r){n.isPanning&&n.onPanningStop(r)},this.setKeyPressed=function(r){n.pressedKeys[r.key]=!0},this.setKeyUnPressed=function(r){n.pressedKeys[r.key]=!1},this.isPressingKeys=function(r){return r.length?Boolean(r.find(function(o){return n.pressedKeys[o]})):!0},this.setTransformState=function(r,o,s){var c=n.props.onTransformed;if(!Number.isNaN(r)&&!Number.isNaN(o)&&!Number.isNaN(s)){r!==n.transformState.scale&&(n.transformState.previousScale=n.transformState.scale,n.transformState.scale=r),n.transformState.positionX=o,n.transformState.positionY=s;var u=dt(n);n.onChangeCallbacks.forEach(function(f){return f(u)}),Mt(u,{scale:r,positionX:o,positionY:s},c),n.applyTransformation()}else console.error("Detected NaN set state values")},this.setCenter=function(){if(n.wrapperComponent&&n.contentComponent){var r=gb(n.transformState.scale,n.wrapperComponent,n.contentComponent);n.setTransformState(r.scale,r.positionX,r.positionY)}},this.handleTransformStyles=function(r,o,s){return n.props.customTransform?n.props.customTransform(r,o,s):bF(r,o,s)},this.applyTransformation=function(){if(!(!n.mounted||!n.contentComponent)){var r=n.transformState,o=r.scale,s=r.positionX,c=r.positionY,u=n.handleTransformStyles(s,c,o);n.contentComponent.style.transform=u}},this.getContext=function(){return dt(n)},this.onChange=function(r){return n.onChangeCallbacks.has(r)||n.onChangeCallbacks.add(r),function(){n.onChangeCallbacks.delete(r)}},this.init=function(r,o){n.cleanupWindowEvents(),n.wrapperComponent=r,n.contentComponent=o,Ji(n,n.transformState.scale),n.handleInitializeWrapperEvents(r),n.handleInitialize(o),n.initializeWindowEvents(),n.isInitialized=!0,Mt(dt(n),void 0,n.props.onInit)},this.props=t,this.setup=v1(this.props),this.transformState=hb(this.props)}return e}(),qc=Me.createContext(null),VF=function(e,t){return typeof e=="function"?e(t):e},UF=Me.forwardRef(function(e,t){var n=g.useState(0),r=n[1],o=e.children,s=g.useRef(new WF(e)).current,c=VF(e.children,dt(s)),u=g.useCallback(function(){typeof o=="function"&&r(function(f){return f+1})},[o]);return g.useImperativeHandle(t,function(){return dt(s)},[s]),g.useEffect(function(){s.update(e)},[s,e]),g.useEffect(function(){return s.onChange(u)},[s,e,u]),Me.createElement(qc.Provider,{value:s},c)});function $F(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var GF=`.transform-component-module_wrapper__7HFJe { + position: relative; + width: -moz-fit-content; + width: fit-content; + height: -moz-fit-content; + height: fit-content; + overflow: hidden; + -webkit-touch-callout: none; /* iOS Safari */ + -webkit-user-select: none; /* Safari */ + -khtml-user-select: none; /* Konqueror HTML */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* Internet Explorer/Edge */ + user-select: none; + margin: 0; + padding: 0; +} +.transform-component-module_content__uCDPE { + display: flex; + flex-wrap: wrap; + width: -moz-fit-content; + width: fit-content; + height: -moz-fit-content; + height: fit-content; + margin: 0; + padding: 0; + transform-origin: 0% 0%; +} +.transform-component-module_content__uCDPE img { + pointer-events: none; +} +`,g1={wrapper:"transform-component-module_wrapper__7HFJe",content:"transform-component-module_content__uCDPE"};$F(GF);var qF=function(e){var t=e.children,n=e.wrapperClass,r=n===void 0?"":n,o=e.contentClass,s=o===void 0?"":o,c=e.wrapperStyle,u=e.contentStyle,f=e.wrapperProps,p=f===void 0?{}:f,h=e.contentProps,y=h===void 0?{}:h,x=g.useContext(qc).init,S=g.useRef(null),C=g.useRef(null);return g.useEffect(function(){var k=S.current,w=C.current;k!==null&&w!==null&&x&&x(k,w)},[]),Me.createElement("div",uo({},p,{ref:S,className:"react-transform-wrapper ".concat(g1.wrapper," ").concat(r),style:c}),Me.createElement("div",uo({},y,{ref:C,className:"react-transform-component ".concat(g1.content," ").concat(s),style:u}),t))},Sb=function(){var e=g.useContext(qc),t=g.useState(dt(e||{})),n=t[0],r=t[1];if(!e)throw new Error("Transform context mus be placed inside TransformWrapper");return g.useEffect(function(){e.onChange(function(o){r(o)})},[e]),n};Me.forwardRef(function(e,t){var n=g.useRef(null),r=g.useContext(qc);return g.useEffect(function(){return r.onChange(function(o){if(n.current){var s=0,c=0;n.current.style.transform=r.handleTransformStyles(s,c,1/o.state.scale)}})},[r]),Me.createElement("div",uo({},e,{ref:SF([n,t])}))});const YF=()=>{const[e,t]=g.useState(0),[n,r]=g.useState(1),[o,s]=g.useState(1);return{rotation:e,scaleX:n,scaleY:o,flipHorizontally:()=>{r(n*-1)},flipVertically:()=>{s(o*-1)},rotateCounterClockwise:()=>{t(e===-270?0:e-90)},rotateClockwise:()=>{t(e===270?0:e+90)},reset:()=>{t(0),r(1),s(1)}}},KF=({flipHorizontally:e,flipVertically:t,rotateCounterClockwise:n,rotateClockwise:r,reset:o})=>{const{zoomIn:s,zoomOut:c,resetTransform:u}=Sb(),{t:f}=X();return l.jsxs(Qt,{isAttached:!0,orientation:"vertical",children:[l.jsx(se,{icon:l.jsx(dD,{}),"aria-label":f("accessibility.zoomIn"),tooltip:"Zoom In",onClick:()=>s(),fontSize:20}),l.jsx(se,{icon:l.jsx(fD,{}),"aria-label":f("accessibility.zoomOut"),tooltip:"Zoom Out",onClick:()=>c(),fontSize:20}),l.jsx(se,{icon:l.jsx(cD,{}),"aria-label":f("accessibility.rotateCounterClockwise"),tooltip:"Rotate Counter-Clockwise",onClick:n,fontSize:20}),l.jsx(se,{icon:l.jsx(uD,{}),"aria-label":f("accessibility.rotateClockwise"),tooltip:"Rotate Clockwise",onClick:r,fontSize:20}),l.jsx(se,{icon:l.jsx(B0,{}),"aria-label":f("accessibility.flipHorizontally"),tooltip:"Flip Horizontally",onClick:e,fontSize:20}),l.jsx(se,{icon:l.jsx(B0,{style:{transform:"rotate(90deg)"}}),"aria-label":f("accessibility.flipVertically"),tooltip:"Flip Vertically",onClick:t,fontSize:20}),l.jsx(se,{icon:l.jsx(up,{}),"aria-label":f("accessibility.reset"),tooltip:"Reset",onClick:()=>{u(),o()},fontSize:20})]})};function XF({image:e,alt:t,ref:n,styleClass:r,rotation:o,scaleX:s,scaleY:c}){const{centerView:u}=Sb();return l.jsx(qF,{wrapperStyle:{width:"100%",height:"100%"},children:l.jsx("img",{style:{transform:`rotate(${o}deg) scaleX(${s}) scaleY(${c})`,width:"100%"},src:e.url,alt:t,ref:n,className:r||"",onLoad:()=>u(1,0,"easeOut")})})}const QF=me([Gr,Er],(e,t)=>{const{currentImage:n}=e,{shouldShowImageDetails:r}=t;return{viewerImageToDisplay:n,shouldShowImageDetails:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function ZF(){const e=Y(),t=A(x=>x.lightbox.isLightboxOpen),{rotation:n,scaleX:r,scaleY:o,flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:p}=YF(),{viewerImageToDisplay:h,shouldShowImageDetails:y}=A(QF);return de("Esc",()=>{t&&e(Vo(!1))},[t]),l.jsx(yo,{children:t&&l.jsx(ir.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,ease:"easeInOut"},style:{display:"flex",width:"100vw",height:`calc(100vh - ${dc*4}px)`,position:"fixed",top:`${dc*4}px`,background:"var(--invokeai-colors-base-900)",zIndex:99},children:l.jsxs(UF,{centerOnInit:!0,minScale:.1,initialPositionX:50,initialPositionY:50,children:[l.jsxs(B,{sx:{flexDir:"column",position:"absolute",insetInlineStart:4,gap:4,zIndex:3,top:4},children:[l.jsx(se,{icon:l.jsx(lD,{}),"aria-label":"Exit Viewer",className:"lightbox-close-btn",onClick:()=>{e(Vo(!1))},fontSize:20}),l.jsx(KF,{flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:p})]}),l.jsx(B,{sx:{position:"absolute",top:4,zIndex:3,insetInlineStart:"50%",transform:"translate(-50%, 0)"},children:l.jsx(D4,{})}),h&&l.jsxs(l.Fragment,{children:[l.jsx(XF,{rotation:n,scaleX:r,scaleY:o,image:h,styleClass:"lightbox-image"}),y&&l.jsx(yp,{image:h}),!y&&l.jsx(Ye,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"100vw",h:"100vh",px:16,pointerEvents:"none"},children:l.jsx(A4,{})})]})]})},"lightbox")})}jN();const rL=()=>{EN();const e=A(n=>n.ui.currentTheme),{setColorMode:t}=yC();return g.useEffect(()=>{t(["light"].includes(e)?"light":"dark")},[t,e]),l.jsxs(or,{w:"100vw",h:"100vh",children:[l.jsx(ZF,{}),l.jsxs(o9,{children:[l.jsx(rP,{}),l.jsxs(or,{gap:4,p:4,gridAutoRows:"min-content auto",w:Z9,h:J9,children:[l.jsx(P4,{}),l.jsxs(B,{gap:4,w:"full",h:"full",children:[l.jsx(kN,{}),l.jsx(zN,{})]})]}),l.jsx(Ye,{children:l.jsx(X9,{})})]}),l.jsx(Ua,{children:l.jsx(TN,{})}),l.jsx(Ua,{children:l.jsx(IN,{})})]})};export{rL as default}; diff --git a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-20e303dd.js b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-a1ea5622.js similarity index 53% rename from invokeai/frontend/web/dist/assets/ThemeLocaleProvider-20e303dd.js rename to invokeai/frontend/web/dist/assets/ThemeLocaleProvider-a1ea5622.js index 05dc4fc895..5a5f36623e 100644 --- a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-20e303dd.js +++ b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-a1ea5622.js @@ -1,4 +1,4 @@ -import{j as y,cM as Ie,r as _,cN as bt,q as Vr,cO as o,cP as b,cQ as v,cR as S,cS as Lr,cT as ut,cU as vt,cV as ft,cW as mt,n as ht,cX as gt,E as pt}from"./index-61f10aa8.js";import{d as yt,i as St,T as xt,j as $t,s as kt,g as _t}from"./scrollbar-7e342734.js";var Or=` +import{j as y,cN as Ie,r as _,cO as bt,q as Lr,cP as o,cQ as b,cR as v,cS as S,cT as Vr,cU as ut,cV as vt,cM as ft,cW as mt,n as gt,cX as ht,E as pt}from"./index-2ad84bef.js";import{d as yt,i as St,T as xt,j as $t,h as kt}from"./storeHooks-e63a2dc4.js";var Or=` :root { --chakra-vh: 100vh; } @@ -20,7 +20,7 @@ import{j as y,cM as Ie,r as _,cN as bt,q as Vr,cO as o,cP as b,cQ as v,cR as S,c --chakra-vh: 100dvh; } } -`,wt=()=>y.jsx(Ie,{styles:Or}),Ct=()=>y.jsx(Ie,{styles:` +`,_t=()=>y.jsx(Ie,{styles:Or}),wt=()=>y.jsx(Ie,{styles:` html { line-height: 1.5; -webkit-text-size-adjust: 100%; @@ -298,7 +298,7 @@ import{j as y,cM as Ie,r as _,cN as bt,q as Vr,cO as o,cP as b,cQ as v,cR as S,c } ${Or} - `}),pe={light:"chakra-ui-light",dark:"chakra-ui-dark"};function zt(e={}){const{preventTransition:r=!0}=e,t={setDataset:a=>{const n=r?t.preventTransition():void 0;document.documentElement.dataset.theme=a,document.documentElement.style.colorScheme=a,n==null||n()},setClassName(a){document.body.classList.add(a?pe.dark:pe.light),document.body.classList.remove(a?pe.light:pe.dark)},query(){return window.matchMedia("(prefers-color-scheme: dark)")},getSystemTheme(a){var n;return((n=t.query().matches)!=null?n:a==="dark")?"dark":"light"},addListener(a){const n=t.query(),i=l=>{a(l.matches?"dark":"light")};return typeof n.addListener=="function"?n.addListener(i):n.addEventListener("change",i),()=>{typeof n.removeListener=="function"?n.removeListener(i):n.removeEventListener("change",i)}},preventTransition(){const a=document.createElement("style");return a.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(a),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.head.removeChild(a)})})}}};return t}var At="chakra-ui-color-mode";function Pt(e){return{ssr:!1,type:"localStorage",get(r){if(!(globalThis!=null&&globalThis.document))return r;let t;try{t=localStorage.getItem(e)||r}catch{}return t||r},set(r){try{localStorage.setItem(e,r)}catch{}}}}var Tt=Pt(At),lr=()=>{};function sr(e,r){return e.type==="cookie"&&e.ssr?e.get(r):r}function qr(e){const{value:r,children:t,options:{useSystemColorMode:a,initialColorMode:n,disableTransitionOnChange:i}={},colorModeManager:l=Tt}=e,d=n==="dark"?"dark":"light",[c,$]=_.useState(()=>sr(l,d)),[h,g]=_.useState(()=>sr(l)),{getSystemTheme:k,setClassName:F,setDataset:me,addListener:nr}=_.useMemo(()=>zt({preventTransition:i}),[i]),he=n==="system"&&!c?h:c,I=_.useCallback(re=>{const ge=re==="system"?k():re;$(ge),F(ge==="dark"),me(ge),l.set(ge)},[l,k,F,me]);yt(()=>{n==="system"&&g(k())},[]),_.useEffect(()=>{const re=l.get();if(re){I(re);return}if(n==="system"){I("system");return}I(d)},[l,d,n,I]);const ir=_.useCallback(()=>{I(he==="dark"?"light":"dark")},[he,I]);_.useEffect(()=>{if(a)return nr(I)},[a,nr,I]);const ct=_.useMemo(()=>({colorMode:r??he,toggleColorMode:r?lr:ir,setColorMode:r?lr:I,forced:r!==void 0}),[he,ir,I,r]);return y.jsx(bt.Provider,{value:ct,children:t})}qr.displayName="ColorModeProvider";var Ft=["borders","breakpoints","colors","components","config","direction","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","shadows","sizes","space","styles","transition","zIndices"];function It(e){return Vr(e)?Ft.every(r=>Object.prototype.hasOwnProperty.call(e,r)):!1}var Bt={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},Mt=Bt,Et={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},Dt=Et,jt={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"}},Rt=jt,Wt={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},Ht=Wt,Vt={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"},Lt=Vt,Ot={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"},qt={"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)"},Nt={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},Gt={property:Ot,easing:qt,duration:Nt},Ut=Gt,Yt={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},Xt=Yt,Kt={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},Qt=Kt,Zt={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"}},Nr=Zt,Gr={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"},Jt={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"},eo={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},ro={...Gr,...Jt,container:eo},Ur=ro,to={breakpoints:Dt,zIndices:Mt,radii:Ht,blur:Xt,colors:Rt,...Nr,sizes:Ur,shadows:Lt,space:Gr,borders:Qt,transition:Ut};function f(e,r={}){let t=!1;function a(){if(!t){t=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function n(...h){a();for(const g of h)r[g]=c(g);return f(e,r)}function i(...h){for(const g of h)g in r||(r[g]=c(g));return f(e,r)}function l(){return Object.fromEntries(Object.entries(r).map(([g,k])=>[g,k.selector]))}function d(){return Object.fromEntries(Object.entries(r).map(([g,k])=>[g,k.className]))}function c(h){const F=`chakra-${(["container","root"].includes(h??"")?[e]:[e,h]).filter(Boolean).join("__")}`;return{className:F,selector:`.${F}`,toString:()=>h}}return{parts:n,toPart:c,extend:i,selectors:l,classnames:d,get keys(){return Object.keys(r)},__type:{}}}var oo=f("accordion").parts("root","container","button","panel").extend("icon"),ao=f("alert").parts("title","description","container").extend("icon","spinner"),no=f("avatar").parts("label","badge","container").extend("excessLabel","group"),io=f("breadcrumb").parts("link","item","container").extend("separator");f("button").parts();var lo=f("checkbox").parts("control","icon","container").extend("label");f("progress").parts("track","filledTrack").extend("label");var so=f("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),co=f("editable").parts("preview","input","textarea"),bo=f("form").parts("container","requiredIndicator","helperText"),uo=f("formError").parts("text","icon"),vo=f("input").parts("addon","field","element"),fo=f("list").parts("container","item","icon"),mo=f("menu").parts("button","list","item").extend("groupTitle","command","divider"),ho=f("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),go=f("numberinput").parts("root","field","stepperGroup","stepper");f("pininput").parts("field");var po=f("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),yo=f("progress").parts("label","filledTrack","track"),So=f("radio").parts("container","control","label"),xo=f("select").parts("field","icon"),$o=f("slider").parts("container","track","thumb","filledTrack","mark"),ko=f("stat").parts("container","label","helpText","number","icon"),_o=f("switch").parts("container","track","thumb"),wo=f("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),Co=f("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),zo=f("tag").parts("container","label","closeButton"),Ao=f("card").parts("container","header","body","footer");function q(e,r,t){return Math.min(Math.max(e,t),r)}class Po extends Error{constructor(r){super(`Failed to parse color: "${r}"`)}}var ae=Po;function Je(e){if(typeof e!="string")throw new ae(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let r=e.trim();r=jo.test(e)?Io(e):e;const t=Bo.exec(r);if(t){const l=Array.from(t).slice(1);return[...l.slice(0,3).map(d=>parseInt(be(d,2),16)),parseInt(be(l[3]||"f",2),16)/255]}const a=Mo.exec(r);if(a){const l=Array.from(a).slice(1);return[...l.slice(0,3).map(d=>parseInt(d,16)),parseInt(l[3]||"ff",16)/255]}const n=Eo.exec(r);if(n){const l=Array.from(n).slice(1);return[...l.slice(0,3).map(d=>parseInt(d,10)),parseFloat(l[3]||"1")]}const i=Do.exec(r);if(i){const[l,d,c,$]=Array.from(i).slice(1).map(parseFloat);if(q(0,100,d)!==d)throw new ae(e);if(q(0,100,c)!==c)throw new ae(e);return[...Ro(l,d,c),Number.isNaN($)?1:$]}throw new ae(e)}function To(e){let r=5381,t=e.length;for(;t;)r=r*33^e.charCodeAt(--t);return(r>>>0)%2341}const dr=e=>parseInt(e.replace(/_/g,""),36),Fo="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,r)=>{const t=dr(r.substring(0,3)),a=dr(r.substring(3)).toString(16);let n="";for(let i=0;i<6-a.length;i++)n+="0";return e[t]=`${n}${a}`,e},{});function Io(e){const r=e.toLowerCase().trim(),t=Fo[To(r)];if(!t)throw new ae(e);return`#${t}`}const be=(e,r)=>Array.from(Array(r)).map(()=>e).join(""),Bo=new RegExp(`^#${be("([a-f0-9])",3)}([a-f0-9])?$`,"i"),Mo=new RegExp(`^#${be("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),Eo=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${be(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),Do=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,jo=/^[a-z]+$/i,cr=e=>Math.round(e*255),Ro=(e,r,t)=>{let a=t/100;if(r===0)return[a,a,a].map(cr);const n=(e%360+360)%360/60,i=(1-Math.abs(2*a-1))*(r/100),l=i*(1-Math.abs(n%2-1));let d=0,c=0,$=0;n>=0&&n<1?(d=i,c=l):n>=1&&n<2?(d=l,c=i):n>=2&&n<3?(c=i,$=l):n>=3&&n<4?(c=l,$=i):n>=4&&n<5?(d=l,$=i):n>=5&&n<6&&(d=i,$=l);const h=a-i/2,g=d+h,k=c+h,F=$+h;return[g,k,F].map(cr)};function Wo(e,r,t,a){return`rgba(${q(0,255,e).toFixed()}, ${q(0,255,r).toFixed()}, ${q(0,255,t).toFixed()}, ${parseFloat(q(0,1,a).toFixed(3))})`}function Ho(e,r){const[t,a,n,i]=Je(e);return Wo(t,a,n,i-r)}function Vo(e){const[r,t,a,n]=Je(e);let i=l=>{const d=q(0,255,l).toString(16);return d.length===1?`0${d}`:d};return`#${i(r)}${i(t)}${i(a)}${n<1?i(Math.round(n*255)):""}`}function Lo(e,r,t,a,n){for(r=r.split?r.split("."):r,a=0;aObject.keys(e).length===0,w=(e,r,t)=>{const a=Lo(e,`colors.${r}`,r);try{return Vo(a),a}catch{return t??"#000000"}},qo=e=>{const[r,t,a]=Je(e);return(r*299+t*587+a*114)/1e3},No=e=>r=>{const t=w(r,e);return qo(t)<128?"dark":"light"},Go=e=>r=>No(e)(r)==="dark",ee=(e,r)=>t=>{const a=w(t,e);return Ho(a,1-r)};function br(e="1rem",r="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( + `}),pe={light:"chakra-ui-light",dark:"chakra-ui-dark"};function Ct(e={}){const{preventTransition:r=!0}=e,t={setDataset:a=>{const n=r?t.preventTransition():void 0;document.documentElement.dataset.theme=a,document.documentElement.style.colorScheme=a,n==null||n()},setClassName(a){document.body.classList.add(a?pe.dark:pe.light),document.body.classList.remove(a?pe.light:pe.dark)},query(){return window.matchMedia("(prefers-color-scheme: dark)")},getSystemTheme(a){var n;return((n=t.query().matches)!=null?n:a==="dark")?"dark":"light"},addListener(a){const n=t.query(),i=l=>{a(l.matches?"dark":"light")};return typeof n.addListener=="function"?n.addListener(i):n.addEventListener("change",i),()=>{typeof n.removeListener=="function"?n.removeListener(i):n.removeEventListener("change",i)}},preventTransition(){const a=document.createElement("style");return a.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(a),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.head.removeChild(a)})})}}};return t}var zt="chakra-ui-color-mode";function At(e){return{ssr:!1,type:"localStorage",get(r){if(!(globalThis!=null&&globalThis.document))return r;let t;try{t=localStorage.getItem(e)||r}catch{}return t||r},set(r){try{localStorage.setItem(e,r)}catch{}}}}var Pt=At(zt),lr=()=>{};function sr(e,r){return e.type==="cookie"&&e.ssr?e.get(r):r}function qr(e){const{value:r,children:t,options:{useSystemColorMode:a,initialColorMode:n,disableTransitionOnChange:i}={},colorModeManager:l=Pt}=e,d=n==="dark"?"dark":"light",[c,$]=_.useState(()=>sr(l,d)),[g,h]=_.useState(()=>sr(l)),{getSystemTheme:k,setClassName:F,setDataset:me,addListener:nr}=_.useMemo(()=>Ct({preventTransition:i}),[i]),ge=n==="system"&&!c?g:c,I=_.useCallback(re=>{const he=re==="system"?k():re;$(he),F(he==="dark"),me(he),l.set(he)},[l,k,F,me]);yt(()=>{n==="system"&&h(k())},[]),_.useEffect(()=>{const re=l.get();if(re){I(re);return}if(n==="system"){I("system");return}I(d)},[l,d,n,I]);const ir=_.useCallback(()=>{I(ge==="dark"?"light":"dark")},[ge,I]);_.useEffect(()=>{if(a)return nr(I)},[a,nr,I]);const ct=_.useMemo(()=>({colorMode:r??ge,toggleColorMode:r?lr:ir,setColorMode:r?lr:I,forced:r!==void 0}),[ge,ir,I,r]);return y.jsx(bt.Provider,{value:ct,children:t})}qr.displayName="ColorModeProvider";var Tt=["borders","breakpoints","colors","components","config","direction","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","shadows","sizes","space","styles","transition","zIndices"];function Ft(e){return Lr(e)?Tt.every(r=>Object.prototype.hasOwnProperty.call(e,r)):!1}var It={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},Bt=It,Mt={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},Et=Mt,Dt={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"}},jt=Dt,Rt={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},Wt=Rt,Ht={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"},Lt=Ht,Vt={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"},Ot={"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)"},qt={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},Nt={property:Vt,easing:Ot,duration:qt},Gt=Nt,Ut={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},Yt=Ut,Xt={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},Kt=Xt,Qt={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"}},Nr=Qt,Gr={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"},Zt={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"},Jt={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},eo={...Gr,...Zt,container:Jt},Ur=eo,ro={breakpoints:Et,zIndices:Bt,radii:Wt,blur:Yt,colors:jt,...Nr,sizes:Ur,shadows:Lt,space:Gr,borders:Kt,transition:Gt};function f(e,r={}){let t=!1;function a(){if(!t){t=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function n(...g){a();for(const h of g)r[h]=c(h);return f(e,r)}function i(...g){for(const h of g)h in r||(r[h]=c(h));return f(e,r)}function l(){return Object.fromEntries(Object.entries(r).map(([h,k])=>[h,k.selector]))}function d(){return Object.fromEntries(Object.entries(r).map(([h,k])=>[h,k.className]))}function c(g){const F=`chakra-${(["container","root"].includes(g??"")?[e]:[e,g]).filter(Boolean).join("__")}`;return{className:F,selector:`.${F}`,toString:()=>g}}return{parts:n,toPart:c,extend:i,selectors:l,classnames:d,get keys(){return Object.keys(r)},__type:{}}}var to=f("accordion").parts("root","container","button","panel").extend("icon"),oo=f("alert").parts("title","description","container").extend("icon","spinner"),ao=f("avatar").parts("label","badge","container").extend("excessLabel","group"),no=f("breadcrumb").parts("link","item","container").extend("separator");f("button").parts();var io=f("checkbox").parts("control","icon","container").extend("label");f("progress").parts("track","filledTrack").extend("label");var lo=f("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),so=f("editable").parts("preview","input","textarea"),co=f("form").parts("container","requiredIndicator","helperText"),bo=f("formError").parts("text","icon"),uo=f("input").parts("addon","field","element"),vo=f("list").parts("container","item","icon"),fo=f("menu").parts("button","list","item").extend("groupTitle","command","divider"),mo=f("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),go=f("numberinput").parts("root","field","stepperGroup","stepper");f("pininput").parts("field");var ho=f("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),po=f("progress").parts("label","filledTrack","track"),yo=f("radio").parts("container","control","label"),So=f("select").parts("field","icon"),xo=f("slider").parts("container","track","thumb","filledTrack","mark"),$o=f("stat").parts("container","label","helpText","number","icon"),ko=f("switch").parts("container","track","thumb"),_o=f("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),wo=f("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),Co=f("tag").parts("container","label","closeButton"),zo=f("card").parts("container","header","body","footer");function q(e,r,t){return Math.min(Math.max(e,t),r)}class Ao extends Error{constructor(r){super(`Failed to parse color: "${r}"`)}}var ae=Ao;function Je(e){if(typeof e!="string")throw new ae(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let r=e.trim();r=Do.test(e)?Fo(e):e;const t=Io.exec(r);if(t){const l=Array.from(t).slice(1);return[...l.slice(0,3).map(d=>parseInt(be(d,2),16)),parseInt(be(l[3]||"f",2),16)/255]}const a=Bo.exec(r);if(a){const l=Array.from(a).slice(1);return[...l.slice(0,3).map(d=>parseInt(d,16)),parseInt(l[3]||"ff",16)/255]}const n=Mo.exec(r);if(n){const l=Array.from(n).slice(1);return[...l.slice(0,3).map(d=>parseInt(d,10)),parseFloat(l[3]||"1")]}const i=Eo.exec(r);if(i){const[l,d,c,$]=Array.from(i).slice(1).map(parseFloat);if(q(0,100,d)!==d)throw new ae(e);if(q(0,100,c)!==c)throw new ae(e);return[...jo(l,d,c),Number.isNaN($)?1:$]}throw new ae(e)}function Po(e){let r=5381,t=e.length;for(;t;)r=r*33^e.charCodeAt(--t);return(r>>>0)%2341}const dr=e=>parseInt(e.replace(/_/g,""),36),To="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,r)=>{const t=dr(r.substring(0,3)),a=dr(r.substring(3)).toString(16);let n="";for(let i=0;i<6-a.length;i++)n+="0";return e[t]=`${n}${a}`,e},{});function Fo(e){const r=e.toLowerCase().trim(),t=To[Po(r)];if(!t)throw new ae(e);return`#${t}`}const be=(e,r)=>Array.from(Array(r)).map(()=>e).join(""),Io=new RegExp(`^#${be("([a-f0-9])",3)}([a-f0-9])?$`,"i"),Bo=new RegExp(`^#${be("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),Mo=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${be(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),Eo=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,Do=/^[a-z]+$/i,cr=e=>Math.round(e*255),jo=(e,r,t)=>{let a=t/100;if(r===0)return[a,a,a].map(cr);const n=(e%360+360)%360/60,i=(1-Math.abs(2*a-1))*(r/100),l=i*(1-Math.abs(n%2-1));let d=0,c=0,$=0;n>=0&&n<1?(d=i,c=l):n>=1&&n<2?(d=l,c=i):n>=2&&n<3?(c=i,$=l):n>=3&&n<4?(c=l,$=i):n>=4&&n<5?(d=l,$=i):n>=5&&n<6&&(d=i,$=l);const g=a-i/2,h=d+g,k=c+g,F=$+g;return[h,k,F].map(cr)};function Ro(e,r,t,a){return`rgba(${q(0,255,e).toFixed()}, ${q(0,255,r).toFixed()}, ${q(0,255,t).toFixed()}, ${parseFloat(q(0,1,a).toFixed(3))})`}function Wo(e,r){const[t,a,n,i]=Je(e);return Ro(t,a,n,i-r)}function Ho(e){const[r,t,a,n]=Je(e);let i=l=>{const d=q(0,255,l).toString(16);return d.length===1?`0${d}`:d};return`#${i(r)}${i(t)}${i(a)}${n<1?i(Math.round(n*255)):""}`}function Lo(e,r,t,a,n){for(r=r.split?r.split("."):r,a=0;aObject.keys(e).length===0,w=(e,r,t)=>{const a=Lo(e,`colors.${r}`,r);try{return Ho(a),a}catch{return t??"#000000"}},Oo=e=>{const[r,t,a]=Je(e);return(r*299+t*587+a*114)/1e3},qo=e=>r=>{const t=w(r,e);return Oo(t)<128?"dark":"light"},No=e=>r=>qo(e)(r)==="dark",ee=(e,r)=>t=>{const a=w(t,e);return Wo(a,1-r)};function br(e="1rem",r="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( 45deg, ${r} 25%, transparent 25%, @@ -307,9 +307,9 @@ import{j as y,cM as Ie,r as _,cN as bt,q as Vr,cO as o,cP as b,cQ as v,cR as S,c ${r} 75%, transparent 75%, transparent - )`,backgroundSize:`${e} ${e}`}}var Uo=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function Yo(e){const r=Uo();return!e||Oo(e)?r:e.string&&e.colors?Ko(e.string,e.colors):e.string&&!e.colors?Xo(e.string):e.colors&&!e.string?Qo(e.colors):r}function Xo(e){let r=0;if(e.length===0)return r.toString();for(let a=0;a>a*8&255;t+=`00${n.toString(16)}`.substr(-2)}return t}function Ko(e,r){let t=0;if(e.length===0)return r[0];for(let a=0;at.colorMode==="dark"?r:e}function er(e){const{orientation:r,vertical:t,horizontal:a}=e;return r?r==="vertical"?t:a:{}}function Yr(e){return Vr(e)&&e.reference?e.reference:String(e)}var Be=(e,...r)=>r.map(Yr).join(` ${e} `).replace(/calc/g,""),ur=(...e)=>`calc(${Be("+",...e)})`,vr=(...e)=>`calc(${Be("-",...e)})`,Xe=(...e)=>`calc(${Be("*",...e)})`,fr=(...e)=>`calc(${Be("/",...e)})`,mr=e=>{const r=Yr(e);return r!=null&&!Number.isNaN(parseFloat(r))?String(r).startsWith("-")?String(r).slice(1):`-${r}`:Xe(r,-1)},D=Object.assign(e=>({add:(...r)=>D(ur(e,...r)),subtract:(...r)=>D(vr(e,...r)),multiply:(...r)=>D(Xe(e,...r)),divide:(...r)=>D(fr(e,...r)),negate:()=>D(mr(e)),toString:()=>e.toString()}),{add:ur,subtract:vr,multiply:Xe,divide:fr,negate:mr});function Zo(e){return!Number.isInteger(parseFloat(e.toString()))}function Jo(e,r="-"){return e.replace(/\s+/g,r)}function Xr(e){const r=Jo(e.toString());return r.includes("\\.")?e:Zo(e)?r.replace(".","\\."):e}function ea(e,r=""){return[r,Xr(e)].filter(Boolean).join("-")}function ra(e,r){return`var(${Xr(e)}${r?`, ${r}`:""})`}function ta(e,r=""){return`--${ea(e,r)}`}function x(e,r){const t=ta(e,r==null?void 0:r.prefix);return{variable:t,reference:ra(t,oa(r==null?void 0:r.fallback))}}function oa(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:aa,definePartsStyle:we}=b(_o.keys),le=x("switch-track-width"),N=x("switch-track-height"),De=x("switch-track-diff"),na=D.subtract(le,N),Ke=x("switch-thumb-x"),te=x("switch-bg"),ia=o(e=>{const{colorScheme:r}=e;return{borderRadius:"full",p:"0.5",width:[le.reference],height:[N.reference],transitionProperty:"common",transitionDuration:"fast",[te.variable]:"colors.gray.300",_dark:{[te.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[te.variable]:`colors.${r}.500`,_dark:{[te.variable]:`colors.${r}.200`}},bg:te.reference}}),la=o({bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[N.reference],height:[N.reference],_checked:{transform:`translateX(${Ke.reference})`}}),sa=we(e=>({container:{[De.variable]:na,[Ke.variable]:De.reference,_rtl:{[Ke.variable]:D(De).negate().toString()}},track:ia(e),thumb:la})),da={sm:we({container:{[le.variable]:"1.375rem",[N.variable]:"sizes.3"}}),md:we({container:{[le.variable]:"1.875rem",[N.variable]:"sizes.4"}}),lg:we({container:{[le.variable]:"2.875rem",[N.variable]:"sizes.6"}})},ca=aa({baseStyle:sa,sizes:da,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:ba,definePartsStyle:X}=b(wo.keys),ua=X({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"}}),Pe=o({"&[data-is-numeric=true]":{textAlign:"end"}}),va=X(e=>{const{colorScheme:r}=e;return{th:{color:s("gray.600","gray.400")(e),borderBottom:"1px",borderColor:s(`${r}.100`,`${r}.700`)(e),...Pe},td:{borderBottom:"1px",borderColor:s(`${r}.100`,`${r}.700`)(e),...Pe},caption:{color:s("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),fa=X(e=>{const{colorScheme:r}=e;return{th:{color:s("gray.600","gray.400")(e),borderBottom:"1px",borderColor:s(`${r}.100`,`${r}.700`)(e),...Pe},td:{borderBottom:"1px",borderColor:s(`${r}.100`,`${r}.700`)(e),...Pe},caption:{color:s("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:s(`${r}.100`,`${r}.700`)(e)},td:{background:s(`${r}.100`,`${r}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),ma={simple:va,striped:fa,unstyled:o({})},ha={sm:X({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:X({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:X({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},ga=ba({baseStyle:ua,variants:ma,sizes:ha,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),z=v("tabs-color"),T=v("tabs-bg"),ye=v("tabs-border-color"),{defineMultiStyleConfig:pa,definePartsStyle:E}=b(Co.keys),ya=o(e=>{const{orientation:r}=e;return{display:r==="vertical"?"flex":"block"}}),Sa=o(e=>{const{isFitted:r}=e;return{flex:r?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}}),xa=o(e=>{const{align:r="start",orientation:t}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[r],flexDirection:t==="vertical"?"column":"row"}}),$a=o({p:4}),ka=E(e=>({root:ya(e),tab:Sa(e),tablist:xa(e),tabpanel:$a})),_a={sm:E({tab:{py:1,px:4,fontSize:"sm"}}),md:E({tab:{fontSize:"md",py:2,px:4}}),lg:E({tab:{fontSize:"lg",py:3,px:4}})},wa=E(e=>{const{colorScheme:r,orientation:t}=e,a=t==="vertical",n=t==="vertical"?"borderStart":"borderBottom",i=a?"marginStart":"marginBottom";return{tablist:{[n]:"2px solid",borderColor:"inherit"},tab:{[n]:"2px solid",borderColor:"transparent",[i]:"-2px",_selected:{[z.variable]:`colors.${r}.600`,_dark:{[z.variable]:`colors.${r}.300`},borderColor:"currentColor"},_active:{[T.variable]:"colors.gray.200",_dark:{[T.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:z.reference,bg:T.reference}}}),Ca=E(e=>{const{colorScheme:r}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[ye.variable]:"transparent",_selected:{[z.variable]:`colors.${r}.600`,[ye.variable]:"colors.white",_dark:{[z.variable]:`colors.${r}.300`,[ye.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:ye.reference},color:z.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),za=E(e=>{const{colorScheme:r}=e;return{tab:{border:"1px solid",borderColor:"inherit",[T.variable]:"colors.gray.50",_dark:{[T.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[T.variable]:"colors.white",[z.variable]:`colors.${r}.600`,_dark:{[T.variable]:"colors.gray.800",[z.variable]:`colors.${r}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:z.reference,bg:T.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),Aa=E(e=>{const{colorScheme:r,theme:t}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:w(t,`${r}.700`),bg:w(t,`${r}.100`)}}}}),Pa=E(e=>{const{colorScheme:r}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[z.variable]:"colors.gray.600",_dark:{[z.variable]:"inherit"},_selected:{[z.variable]:"colors.white",[T.variable]:`colors.${r}.600`,_dark:{[z.variable]:"colors.gray.800",[T.variable]:`colors.${r}.300`}},color:z.reference,bg:T.reference}}}),Ta=E({}),Fa={line:wa,enclosed:Ca,"enclosed-colored":za,"soft-rounded":Aa,"solid-rounded":Pa,unstyled:Ta},Ia=pa({baseStyle:ka,sizes:_a,variants:Fa,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),Ba=o({px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold"}),K=v("badge-bg"),M=v("badge-color"),Ma=o(e=>{const{colorScheme:r,theme:t}=e,a=ee(`${r}.500`,.6)(t);return{[K.variable]:`colors.${r}.500`,[M.variable]:"colors.white",_dark:{[K.variable]:a,[M.variable]:"colors.whiteAlpha.800"},bg:K.reference,color:M.reference}}),Ea=o(e=>{const{colorScheme:r,theme:t}=e,a=ee(`${r}.200`,.16)(t);return{[K.variable]:`colors.${r}.100`,[M.variable]:`colors.${r}.800`,_dark:{[K.variable]:a,[M.variable]:`colors.${r}.200`},bg:K.reference,color:M.reference}}),Da=o(e=>{const{colorScheme:r,theme:t}=e,a=ee(`${r}.200`,.8)(t);return{[M.variable]:`colors.${r}.500`,_dark:{[M.variable]:a},color:M.reference,boxShadow:`inset 0 0 0px 1px ${M.reference}`}}),ja={solid:Ma,subtle:Ea,outline:Da},se=S({baseStyle:Ba,variants:ja,defaultProps:{variant:"subtle",colorScheme:"gray"}}),{defineMultiStyleConfig:Ra,definePartsStyle:G}=b(zo.keys),Wa=o({fontWeight:"medium",lineHeight:1.2,outline:0,borderRadius:"md",_focusVisible:{boxShadow:"outline"}}),Ha=o({lineHeight:1.2,overflow:"visible"}),Va=o({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}}),La=G({container:Wa,label:Ha,closeButton:Va}),Oa={sm:G({container:{minH:"5",minW:"5",fontSize:"xs",px:"2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:G({container:{minH:"6",minW:"6",fontSize:"sm",px:"2"}}),lg:G({container:{minH:"8",minW:"8",fontSize:"md",px:"3"}})},qa={subtle:G(e=>{var r;return{container:(r=se.variants)==null?void 0:r.subtle(e)}}),solid:G(e=>{var r;return{container:(r=se.variants)==null?void 0:r.solid(e)}}),outline:G(e=>{var r;return{container:(r=se.variants)==null?void 0:r.outline(e)}})},Na=Ra({variants:qa,baseStyle:La,sizes:Oa,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:j,defineMultiStyleConfig:Ga}=b(vo.keys),Ua=j({field:{width:"100%",minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),H={lg:o({fontSize:"lg",px:"4",h:"12",borderRadius:"md"}),md:o({fontSize:"md",px:"4",h:"10",borderRadius:"md"}),sm:o({fontSize:"sm",px:"3",h:"8",borderRadius:"sm"}),xs:o({fontSize:"xs",px:"2",h:"6",borderRadius:"sm"})},Ya={lg:j({field:H.lg,addon:H.lg}),md:j({field:H.md,addon:H.md}),sm:j({field:H.sm,addon:H.sm}),xs:j({field:H.xs,addon:H.xs})};function rr(e){const{focusBorderColor:r,errorBorderColor:t}=e;return{focusBorderColor:r||s("blue.500","blue.300")(e),errorBorderColor:t||s("red.500","red.300")(e)}}var Xa=j(e=>{const{theme:r}=e,{focusBorderColor:t,errorBorderColor:a}=rr(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:s("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:w(r,a),boxShadow:`0 0 0 1px ${w(r,a)}`},_focusVisible:{zIndex:1,borderColor:w(r,t),boxShadow:`0 0 0 1px ${w(r,t)}`}},addon:{border:"1px solid",borderColor:s("inherit","whiteAlpha.50")(e),bg:s("gray.100","whiteAlpha.300")(e)}}}),Ka=j(e=>{const{theme:r}=e,{focusBorderColor:t,errorBorderColor:a}=rr(e);return{field:{border:"2px solid",borderColor:"transparent",bg:s("gray.100","whiteAlpha.50")(e),_hover:{bg:s("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:w(r,a)},_focusVisible:{bg:"transparent",borderColor:w(r,t)}},addon:{border:"2px solid",borderColor:"transparent",bg:s("gray.100","whiteAlpha.50")(e)}}}),Qa=j(e=>{const{theme:r}=e,{focusBorderColor:t,errorBorderColor:a}=rr(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:w(r,a),boxShadow:`0px 1px 0px 0px ${w(r,a)}`},_focusVisible:{borderColor:w(r,t),boxShadow:`0px 1px 0px 0px ${w(r,t)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),Za=j({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),Ja={outline:Xa,filled:Ka,flushed:Qa,unstyled:Za},u=Ga({baseStyle:Ua,sizes:Ya,variants:Ja,defaultProps:{size:"md",variant:"outline"}}),hr,en=o({...(hr=u.baseStyle)==null?void 0:hr.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"}),gr,pr,rn={outline:o(e=>{var r,t;return(t=(r=u.variants)==null?void 0:r.outline(e).field)!=null?t:{}}),flushed:o(e=>{var r,t;return(t=(r=u.variants)==null?void 0:r.flushed(e).field)!=null?t:{}}),filled:o(e=>{var r,t;return(t=(r=u.variants)==null?void 0:r.filled(e).field)!=null?t:{}}),unstyled:(pr=(gr=u.variants)==null?void 0:gr.unstyled.field)!=null?pr:{}},yr,Sr,xr,$r,kr,_r,wr,Cr,tn={xs:(Sr=(yr=u.sizes)==null?void 0:yr.xs.field)!=null?Sr:{},sm:($r=(xr=u.sizes)==null?void 0:xr.sm.field)!=null?$r:{},md:(_r=(kr=u.sizes)==null?void 0:kr.md.field)!=null?_r:{},lg:(Cr=(wr=u.sizes)==null?void 0:wr.lg.field)!=null?Cr:{}},on=S({baseStyle:en,sizes:tn,variants:rn,defaultProps:{size:"md",variant:"outline"}}),Se=x("tooltip-bg"),je=x("tooltip-fg"),an=x("popper-arrow-bg"),nn=o({bg:Se.reference,color:je.reference,[Se.variable]:"colors.gray.700",[je.variable]:"colors.whiteAlpha.900",_dark:{[Se.variable]:"colors.gray.300",[je.variable]:"colors.gray.900"},[an.variable]:Se.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"}),ln=S({baseStyle:nn}),{defineMultiStyleConfig:sn,definePartsStyle:ne}=b(yo.keys),dn=o(e=>{const{colorScheme:r,theme:t,isIndeterminate:a,hasStripe:n}=e,i=s(br(),br("1rem","rgba(0,0,0,0.1)"))(e),l=s(`${r}.500`,`${r}.200`)(e),d=`linear-gradient( + )`,backgroundSize:`${e} ${e}`}}var Go=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function Uo(e){const r=Go();return!e||Vo(e)?r:e.string&&e.colors?Xo(e.string,e.colors):e.string&&!e.colors?Yo(e.string):e.colors&&!e.string?Ko(e.colors):r}function Yo(e){let r=0;if(e.length===0)return r.toString();for(let a=0;a>a*8&255;t+=`00${n.toString(16)}`.substr(-2)}return t}function Xo(e,r){let t=0;if(e.length===0)return r[0];for(let a=0;at.colorMode==="dark"?r:e}function er(e){const{orientation:r,vertical:t,horizontal:a}=e;return r?r==="vertical"?t:a:{}}function Yr(e){return Lr(e)&&e.reference?e.reference:String(e)}var Be=(e,...r)=>r.map(Yr).join(` ${e} `).replace(/calc/g,""),ur=(...e)=>`calc(${Be("+",...e)})`,vr=(...e)=>`calc(${Be("-",...e)})`,Xe=(...e)=>`calc(${Be("*",...e)})`,fr=(...e)=>`calc(${Be("/",...e)})`,mr=e=>{const r=Yr(e);return r!=null&&!Number.isNaN(parseFloat(r))?String(r).startsWith("-")?String(r).slice(1):`-${r}`:Xe(r,-1)},D=Object.assign(e=>({add:(...r)=>D(ur(e,...r)),subtract:(...r)=>D(vr(e,...r)),multiply:(...r)=>D(Xe(e,...r)),divide:(...r)=>D(fr(e,...r)),negate:()=>D(mr(e)),toString:()=>e.toString()}),{add:ur,subtract:vr,multiply:Xe,divide:fr,negate:mr});function Qo(e){return!Number.isInteger(parseFloat(e.toString()))}function Zo(e,r="-"){return e.replace(/\s+/g,r)}function Xr(e){const r=Zo(e.toString());return r.includes("\\.")?e:Qo(e)?r.replace(".","\\."):e}function Jo(e,r=""){return[r,Xr(e)].filter(Boolean).join("-")}function ea(e,r){return`var(${Xr(e)}${r?`, ${r}`:""})`}function ra(e,r=""){return`--${Jo(e,r)}`}function x(e,r){const t=ra(e,r==null?void 0:r.prefix);return{variable:t,reference:ea(t,ta(r==null?void 0:r.fallback))}}function ta(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:oa,definePartsStyle:we}=b(ko.keys),le=x("switch-track-width"),N=x("switch-track-height"),De=x("switch-track-diff"),aa=D.subtract(le,N),Ke=x("switch-thumb-x"),te=x("switch-bg"),na=o(e=>{const{colorScheme:r}=e;return{borderRadius:"full",p:"0.5",width:[le.reference],height:[N.reference],transitionProperty:"common",transitionDuration:"fast",[te.variable]:"colors.gray.300",_dark:{[te.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[te.variable]:`colors.${r}.500`,_dark:{[te.variable]:`colors.${r}.200`}},bg:te.reference}}),ia=o({bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[N.reference],height:[N.reference],_checked:{transform:`translateX(${Ke.reference})`}}),la=we(e=>({container:{[De.variable]:aa,[Ke.variable]:De.reference,_rtl:{[Ke.variable]:D(De).negate().toString()}},track:na(e),thumb:ia})),sa={sm:we({container:{[le.variable]:"1.375rem",[N.variable]:"sizes.3"}}),md:we({container:{[le.variable]:"1.875rem",[N.variable]:"sizes.4"}}),lg:we({container:{[le.variable]:"2.875rem",[N.variable]:"sizes.6"}})},da=oa({baseStyle:la,sizes:sa,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:ca,definePartsStyle:X}=b(_o.keys),ba=X({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"}}),Pe=o({"&[data-is-numeric=true]":{textAlign:"end"}}),ua=X(e=>{const{colorScheme:r}=e;return{th:{color:s("gray.600","gray.400")(e),borderBottom:"1px",borderColor:s(`${r}.100`,`${r}.700`)(e),...Pe},td:{borderBottom:"1px",borderColor:s(`${r}.100`,`${r}.700`)(e),...Pe},caption:{color:s("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),va=X(e=>{const{colorScheme:r}=e;return{th:{color:s("gray.600","gray.400")(e),borderBottom:"1px",borderColor:s(`${r}.100`,`${r}.700`)(e),...Pe},td:{borderBottom:"1px",borderColor:s(`${r}.100`,`${r}.700`)(e),...Pe},caption:{color:s("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:s(`${r}.100`,`${r}.700`)(e)},td:{background:s(`${r}.100`,`${r}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),fa={simple:ua,striped:va,unstyled:o({})},ma={sm:X({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:X({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:X({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},ga=ca({baseStyle:ba,variants:fa,sizes:ma,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),z=v("tabs-color"),T=v("tabs-bg"),ye=v("tabs-border-color"),{defineMultiStyleConfig:ha,definePartsStyle:E}=b(wo.keys),pa=o(e=>{const{orientation:r}=e;return{display:r==="vertical"?"flex":"block"}}),ya=o(e=>{const{isFitted:r}=e;return{flex:r?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}}),Sa=o(e=>{const{align:r="start",orientation:t}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[r],flexDirection:t==="vertical"?"column":"row"}}),xa=o({p:4}),$a=E(e=>({root:pa(e),tab:ya(e),tablist:Sa(e),tabpanel:xa})),ka={sm:E({tab:{py:1,px:4,fontSize:"sm"}}),md:E({tab:{fontSize:"md",py:2,px:4}}),lg:E({tab:{fontSize:"lg",py:3,px:4}})},_a=E(e=>{const{colorScheme:r,orientation:t}=e,a=t==="vertical",n=t==="vertical"?"borderStart":"borderBottom",i=a?"marginStart":"marginBottom";return{tablist:{[n]:"2px solid",borderColor:"inherit"},tab:{[n]:"2px solid",borderColor:"transparent",[i]:"-2px",_selected:{[z.variable]:`colors.${r}.600`,_dark:{[z.variable]:`colors.${r}.300`},borderColor:"currentColor"},_active:{[T.variable]:"colors.gray.200",_dark:{[T.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:z.reference,bg:T.reference}}}),wa=E(e=>{const{colorScheme:r}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[ye.variable]:"transparent",_selected:{[z.variable]:`colors.${r}.600`,[ye.variable]:"colors.white",_dark:{[z.variable]:`colors.${r}.300`,[ye.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:ye.reference},color:z.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),Ca=E(e=>{const{colorScheme:r}=e;return{tab:{border:"1px solid",borderColor:"inherit",[T.variable]:"colors.gray.50",_dark:{[T.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[T.variable]:"colors.white",[z.variable]:`colors.${r}.600`,_dark:{[T.variable]:"colors.gray.800",[z.variable]:`colors.${r}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:z.reference,bg:T.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),za=E(e=>{const{colorScheme:r,theme:t}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:w(t,`${r}.700`),bg:w(t,`${r}.100`)}}}}),Aa=E(e=>{const{colorScheme:r}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[z.variable]:"colors.gray.600",_dark:{[z.variable]:"inherit"},_selected:{[z.variable]:"colors.white",[T.variable]:`colors.${r}.600`,_dark:{[z.variable]:"colors.gray.800",[T.variable]:`colors.${r}.300`}},color:z.reference,bg:T.reference}}}),Pa=E({}),Ta={line:_a,enclosed:wa,"enclosed-colored":Ca,"soft-rounded":za,"solid-rounded":Aa,unstyled:Pa},Fa=ha({baseStyle:$a,sizes:ka,variants:Ta,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),Ia=o({px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold"}),K=v("badge-bg"),M=v("badge-color"),Ba=o(e=>{const{colorScheme:r,theme:t}=e,a=ee(`${r}.500`,.6)(t);return{[K.variable]:`colors.${r}.500`,[M.variable]:"colors.white",_dark:{[K.variable]:a,[M.variable]:"colors.whiteAlpha.800"},bg:K.reference,color:M.reference}}),Ma=o(e=>{const{colorScheme:r,theme:t}=e,a=ee(`${r}.200`,.16)(t);return{[K.variable]:`colors.${r}.100`,[M.variable]:`colors.${r}.800`,_dark:{[K.variable]:a,[M.variable]:`colors.${r}.200`},bg:K.reference,color:M.reference}}),Ea=o(e=>{const{colorScheme:r,theme:t}=e,a=ee(`${r}.200`,.8)(t);return{[M.variable]:`colors.${r}.500`,_dark:{[M.variable]:a},color:M.reference,boxShadow:`inset 0 0 0px 1px ${M.reference}`}}),Da={solid:Ba,subtle:Ma,outline:Ea},se=S({baseStyle:Ia,variants:Da,defaultProps:{variant:"subtle",colorScheme:"gray"}}),{defineMultiStyleConfig:ja,definePartsStyle:G}=b(Co.keys),Ra=o({fontWeight:"medium",lineHeight:1.2,outline:0,borderRadius:"md",_focusVisible:{boxShadow:"outline"}}),Wa=o({lineHeight:1.2,overflow:"visible"}),Ha=o({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}}),La=G({container:Ra,label:Wa,closeButton:Ha}),Va={sm:G({container:{minH:"5",minW:"5",fontSize:"xs",px:"2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:G({container:{minH:"6",minW:"6",fontSize:"sm",px:"2"}}),lg:G({container:{minH:"8",minW:"8",fontSize:"md",px:"3"}})},Oa={subtle:G(e=>{var r;return{container:(r=se.variants)==null?void 0:r.subtle(e)}}),solid:G(e=>{var r;return{container:(r=se.variants)==null?void 0:r.solid(e)}}),outline:G(e=>{var r;return{container:(r=se.variants)==null?void 0:r.outline(e)}})},qa=ja({variants:Oa,baseStyle:La,sizes:Va,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:j,defineMultiStyleConfig:Na}=b(uo.keys),Ga=j({field:{width:"100%",minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),H={lg:o({fontSize:"lg",px:"4",h:"12",borderRadius:"md"}),md:o({fontSize:"md",px:"4",h:"10",borderRadius:"md"}),sm:o({fontSize:"sm",px:"3",h:"8",borderRadius:"sm"}),xs:o({fontSize:"xs",px:"2",h:"6",borderRadius:"sm"})},Ua={lg:j({field:H.lg,addon:H.lg}),md:j({field:H.md,addon:H.md}),sm:j({field:H.sm,addon:H.sm}),xs:j({field:H.xs,addon:H.xs})};function rr(e){const{focusBorderColor:r,errorBorderColor:t}=e;return{focusBorderColor:r||s("blue.500","blue.300")(e),errorBorderColor:t||s("red.500","red.300")(e)}}var Ya=j(e=>{const{theme:r}=e,{focusBorderColor:t,errorBorderColor:a}=rr(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:s("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:w(r,a),boxShadow:`0 0 0 1px ${w(r,a)}`},_focusVisible:{zIndex:1,borderColor:w(r,t),boxShadow:`0 0 0 1px ${w(r,t)}`}},addon:{border:"1px solid",borderColor:s("inherit","whiteAlpha.50")(e),bg:s("gray.100","whiteAlpha.300")(e)}}}),Xa=j(e=>{const{theme:r}=e,{focusBorderColor:t,errorBorderColor:a}=rr(e);return{field:{border:"2px solid",borderColor:"transparent",bg:s("gray.100","whiteAlpha.50")(e),_hover:{bg:s("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:w(r,a)},_focusVisible:{bg:"transparent",borderColor:w(r,t)}},addon:{border:"2px solid",borderColor:"transparent",bg:s("gray.100","whiteAlpha.50")(e)}}}),Ka=j(e=>{const{theme:r}=e,{focusBorderColor:t,errorBorderColor:a}=rr(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:w(r,a),boxShadow:`0px 1px 0px 0px ${w(r,a)}`},_focusVisible:{borderColor:w(r,t),boxShadow:`0px 1px 0px 0px ${w(r,t)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),Qa=j({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),Za={outline:Ya,filled:Xa,flushed:Ka,unstyled:Qa},u=Na({baseStyle:Ga,sizes:Ua,variants:Za,defaultProps:{size:"md",variant:"outline"}}),gr,Ja=o({...(gr=u.baseStyle)==null?void 0:gr.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"}),hr,pr,en={outline:o(e=>{var r,t;return(t=(r=u.variants)==null?void 0:r.outline(e).field)!=null?t:{}}),flushed:o(e=>{var r,t;return(t=(r=u.variants)==null?void 0:r.flushed(e).field)!=null?t:{}}),filled:o(e=>{var r,t;return(t=(r=u.variants)==null?void 0:r.filled(e).field)!=null?t:{}}),unstyled:(pr=(hr=u.variants)==null?void 0:hr.unstyled.field)!=null?pr:{}},yr,Sr,xr,$r,kr,_r,wr,Cr,rn={xs:(Sr=(yr=u.sizes)==null?void 0:yr.xs.field)!=null?Sr:{},sm:($r=(xr=u.sizes)==null?void 0:xr.sm.field)!=null?$r:{},md:(_r=(kr=u.sizes)==null?void 0:kr.md.field)!=null?_r:{},lg:(Cr=(wr=u.sizes)==null?void 0:wr.lg.field)!=null?Cr:{}},tn=S({baseStyle:Ja,sizes:rn,variants:en,defaultProps:{size:"md",variant:"outline"}}),Se=x("tooltip-bg"),je=x("tooltip-fg"),on=x("popper-arrow-bg"),an=o({bg:Se.reference,color:je.reference,[Se.variable]:"colors.gray.700",[je.variable]:"colors.whiteAlpha.900",_dark:{[Se.variable]:"colors.gray.300",[je.variable]:"colors.gray.900"},[on.variable]:Se.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"}),nn=S({baseStyle:an}),{defineMultiStyleConfig:ln,definePartsStyle:ne}=b(po.keys),sn=o(e=>{const{colorScheme:r,theme:t,isIndeterminate:a,hasStripe:n}=e,i=s(br(),br("1rem","rgba(0,0,0,0.1)"))(e),l=s(`${r}.500`,`${r}.200`)(e),d=`linear-gradient( to right, transparent 0%, ${w(t,l)} 50%, transparent 100% - )`;return{...!a&&n&&i,...a?{bgImage:d}:{bgColor:l}}}),cn=o({lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"}),bn=o(e=>({bg:s("gray.100","whiteAlpha.300")(e)})),un=o(e=>({transitionProperty:"common",transitionDuration:"slow",...dn(e)})),vn=ne(e=>({label:cn,filledTrack:un(e),track:bn(e)})),fn={xs:ne({track:{h:"1"}}),sm:ne({track:{h:"2"}}),md:ne({track:{h:"3"}}),lg:ne({track:{h:"4"}})},mn=sn({sizes:fn,baseStyle:vn,defaultProps:{size:"md",colorScheme:"blue"}}),hn=e=>typeof e=="function";function C(e,...r){return hn(e)?e(...r):e}var{definePartsStyle:Ce,defineMultiStyleConfig:gn}=b(lo.keys),de=v("checkbox-size"),pn=o(e=>{const{colorScheme:r}=e;return{w:de.reference,h:de.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:s(`${r}.500`,`${r}.200`)(e),borderColor:s(`${r}.500`,`${r}.200`)(e),color:s("white","gray.900")(e),_hover:{bg:s(`${r}.600`,`${r}.300`)(e),borderColor:s(`${r}.600`,`${r}.300`)(e)},_disabled:{borderColor:s("gray.200","transparent")(e),bg:s("gray.200","whiteAlpha.300")(e),color:s("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:s(`${r}.500`,`${r}.200`)(e),borderColor:s(`${r}.500`,`${r}.200`)(e),color:s("white","gray.900")(e)},_disabled:{bg:s("gray.100","whiteAlpha.100")(e),borderColor:s("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:s("red.500","red.300")(e)}}}),yn=o({_disabled:{cursor:"not-allowed"}}),Sn=o({userSelect:"none",_disabled:{opacity:.4}}),xn=o({transitionProperty:"transform",transitionDuration:"normal"}),$n=Ce(e=>({icon:xn,container:yn,control:C(pn,e),label:Sn})),kn={sm:Ce({control:{[de.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:Ce({control:{[de.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:Ce({control:{[de.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},Te=gn({baseStyle:$n,sizes:kn,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:_n,definePartsStyle:ze}=b(So.keys),wn=o(e=>{var r;const t=(r=C(Te.baseStyle,e))==null?void 0:r.control;return{...t,borderRadius:"full",_checked:{...t==null?void 0:t._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}}),Cn=ze(e=>{var r,t,a,n;return{label:(t=(r=Te).baseStyle)==null?void 0:t.call(r,e).label,container:(n=(a=Te).baseStyle)==null?void 0:n.call(a,e).container,control:wn(e)}}),zn={md:ze({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:ze({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:ze({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},An=_n({baseStyle:Cn,sizes:zn,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:Pn,definePartsStyle:Tn}=b(xo.keys),xe=v("select-bg"),zr,Fn=o({...(zr=u.baseStyle)==null?void 0:zr.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:xe.reference,[xe.variable]:"colors.white",_dark:{[xe.variable]:"colors.gray.700"},"> option, > optgroup":{bg:xe.reference}}),In=o({width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}}),Bn=Tn({field:Fn,icon:In}),$e=o({paddingInlineEnd:"8"}),Ar,Pr,Tr,Fr,Ir,Br,Mr,Er,Mn={lg:{...(Ar=u.sizes)==null?void 0:Ar.lg,field:{...(Pr=u.sizes)==null?void 0:Pr.lg.field,...$e}},md:{...(Tr=u.sizes)==null?void 0:Tr.md,field:{...(Fr=u.sizes)==null?void 0:Fr.md.field,...$e}},sm:{...(Ir=u.sizes)==null?void 0:Ir.sm,field:{...(Br=u.sizes)==null?void 0:Br.sm.field,...$e}},xs:{...(Mr=u.sizes)==null?void 0:Mr.xs,field:{...(Er=u.sizes)==null?void 0:Er.xs.field,...$e},icon:{insetEnd:"1"}}},En=Pn({baseStyle:Bn,sizes:Mn,variants:u.variants,defaultProps:u.defaultProps}),Re=v("skeleton-start-color"),We=v("skeleton-end-color"),Dn=o({[Re.variable]:"colors.gray.100",[We.variable]:"colors.gray.400",_dark:{[Re.variable]:"colors.gray.800",[We.variable]:"colors.gray.600"},background:Re.reference,borderColor:We.reference,opacity:.7,borderRadius:"sm"}),jn=S({baseStyle:Dn}),He=v("skip-link-bg"),Rn=o({borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[He.variable]:"colors.white",_dark:{[He.variable]:"colors.gray.700"},bg:He.reference}}),Wn=S({baseStyle:Rn}),{defineMultiStyleConfig:Hn,definePartsStyle:Me}=b($o.keys),ue=v("slider-thumb-size"),ve=v("slider-track-size"),L=v("slider-bg"),Vn=o(e=>{const{orientation:r}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...er({orientation:r,vertical:{h:"100%"},horizontal:{w:"100%"}})}}),Ln=o(e=>({...er({orientation:e.orientation,horizontal:{h:ve.reference},vertical:{w:ve.reference}}),overflow:"hidden",borderRadius:"sm",[L.variable]:"colors.gray.200",_dark:{[L.variable]:"colors.whiteAlpha.200"},_disabled:{[L.variable]:"colors.gray.300",_dark:{[L.variable]:"colors.whiteAlpha.300"}},bg:L.reference})),On=o(e=>{const{orientation:r}=e;return{...er({orientation:r,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:ue.reference,h:ue.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"}}}),qn=o(e=>{const{colorScheme:r}=e;return{width:"inherit",height:"inherit",[L.variable]:`colors.${r}.500`,_dark:{[L.variable]:`colors.${r}.200`},bg:L.reference}}),Nn=Me(e=>({container:Vn(e),track:Ln(e),thumb:On(e),filledTrack:qn(e)})),Gn=Me({container:{[ue.variable]:"sizes.4",[ve.variable]:"sizes.1"}}),Un=Me({container:{[ue.variable]:"sizes.3.5",[ve.variable]:"sizes.1"}}),Yn=Me({container:{[ue.variable]:"sizes.2.5",[ve.variable]:"sizes.0.5"}}),Xn={lg:Gn,md:Un,sm:Yn},Kn=Hn({baseStyle:Nn,sizes:Xn,defaultProps:{size:"md",colorScheme:"blue"}}),O=x("spinner-size"),Qn=o({width:[O.reference],height:[O.reference]}),Zn={xs:o({[O.variable]:"sizes.3"}),sm:o({[O.variable]:"sizes.4"}),md:o({[O.variable]:"sizes.6"}),lg:o({[O.variable]:"sizes.8"}),xl:o({[O.variable]:"sizes.12"})},Jn=S({baseStyle:Qn,sizes:Zn,defaultProps:{size:"md"}}),{defineMultiStyleConfig:ei,definePartsStyle:Kr}=b(ko.keys),ri=o({fontWeight:"medium"}),ti=o({opacity:.8,marginBottom:"2"}),oi=o({verticalAlign:"baseline",fontWeight:"semibold"}),ai=o({marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"}),ni=Kr({container:{},label:ri,helpText:ti,number:oi,icon:ai}),ii={md:Kr({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},li=ei({baseStyle:ni,sizes:ii,defaultProps:{size:"md"}}),Ve=v("kbd-bg"),si=o({[Ve.variable]:"colors.gray.100",_dark:{[Ve.variable]:"colors.whiteAlpha.100"},bg:Ve.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"}),di=S({baseStyle:si}),ci=o({transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}}),bi=S({baseStyle:ci}),{defineMultiStyleConfig:ui,definePartsStyle:vi}=b(fo.keys),fi=o({marginEnd:"2",display:"inline",verticalAlign:"text-bottom"}),mi=vi({icon:fi}),hi=ui({baseStyle:mi}),{defineMultiStyleConfig:gi,definePartsStyle:pi}=b(mo.keys),B=v("menu-bg"),Le=v("menu-shadow"),yi=o({[B.variable]:"#fff",[Le.variable]:"shadows.sm",_dark:{[B.variable]:"colors.gray.700",[Le.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:B.reference,boxShadow:Le.reference}),Si=o({py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[B.variable]:"colors.gray.100",_dark:{[B.variable]:"colors.whiteAlpha.100"}},_active:{[B.variable]:"colors.gray.200",_dark:{[B.variable]:"colors.whiteAlpha.200"}},_expanded:{[B.variable]:"colors.gray.100",_dark:{[B.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:B.reference}),xi=o({mx:4,my:2,fontWeight:"semibold",fontSize:"sm"}),$i=o({opacity:.6}),ki=o({border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6}),_i=o({transitionProperty:"common",transitionDuration:"normal"}),wi=pi({button:_i,list:yi,item:Si,groupTitle:xi,command:$i,divider:ki}),Ci=gi({baseStyle:wi}),{defineMultiStyleConfig:zi,definePartsStyle:Qe}=b(ho.keys),Ai=o({bg:"blackAlpha.600",zIndex:"modal"}),Pi=o(e=>{const{isCentered:r,scrollBehavior:t}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:r?"center":"flex-start",overflow:t==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}}),Ti=o(e=>{const{scrollBehavior:r}=e;return{borderRadius:"md",bg:s("white","gray.700")(e),color:"inherit",my:"16",zIndex:"modal",maxH:r==="inside"?"calc(100% - 7.5rem)":void 0,boxShadow:s("lg","dark-lg")(e)}}),Fi=o({px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"}),Ii=o({position:"absolute",top:"2",insetEnd:"3"}),Bi=o(e=>{const{scrollBehavior:r}=e;return{px:"6",py:"2",flex:"1",overflow:r==="inside"?"auto":void 0}}),Mi=o({px:"6",py:"4"}),Ei=Qe(e=>({overlay:Ai,dialogContainer:C(Pi,e),dialog:C(Ti,e),header:Fi,closeButton:Ii,body:C(Bi,e),footer:Mi}));function P(e){return Qe(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var Di={xs:P("xs"),sm:P("sm"),md:P("md"),lg:P("lg"),xl:P("xl"),"2xl":P("2xl"),"3xl":P("3xl"),"4xl":P("4xl"),"5xl":P("5xl"),"6xl":P("6xl"),full:P("full")},ji=zi({baseStyle:Ei,sizes:Di,defaultProps:{size:"md"}}),{defineMultiStyleConfig:Ri,definePartsStyle:Qr}=b(go.keys),tr=x("number-input-stepper-width"),Zr=x("number-input-input-padding"),Wi=D(tr).add("0.5rem").toString(),Oe=x("number-input-bg"),qe=x("number-input-color"),Ne=x("number-input-border-color"),Hi=o({[tr.variable]:"sizes.6",[Zr.variable]:Wi}),Vi=o(e=>{var r,t;return(t=(r=C(u.baseStyle,e))==null?void 0:r.field)!=null?t:{}}),Li=o({width:tr.reference}),Oi=o({borderStart:"1px solid",borderStartColor:Ne.reference,color:qe.reference,bg:Oe.reference,[qe.variable]:"colors.chakra-body-text",[Ne.variable]:"colors.chakra-border-color",_dark:{[qe.variable]:"colors.whiteAlpha.800",[Ne.variable]:"colors.whiteAlpha.300"},_active:{[Oe.variable]:"colors.gray.200",_dark:{[Oe.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}}),qi=Qr(e=>{var r;return{root:Hi,field:(r=C(Vi,e))!=null?r:{},stepperGroup:Li,stepper:Oi}});function ke(e){var r,t,a;const n=(r=u.sizes)==null?void 0:r[e],i={lg:"md",md:"md",sm:"sm",xs:"sm"},l=(a=(t=n.field)==null?void 0:t.fontSize)!=null?a:"md",d=Nr.fontSizes[l];return Qr({field:{...n.field,paddingInlineEnd:Zr.reference,verticalAlign:"top"},stepper:{fontSize:D(d).multiply(.75).toString(),_first:{borderTopEndRadius:i[e]},_last:{borderBottomEndRadius:i[e],mt:"-1px",borderTopWidth:1}}})}var Ni={xs:ke("xs"),sm:ke("sm"),md:ke("md"),lg:ke("lg")},Gi=Ri({baseStyle:qi,sizes:Ni,variants:u.variants,defaultProps:u.defaultProps}),Dr,Ui=o({...(Dr=u.baseStyle)==null?void 0:Dr.field,textAlign:"center"}),Yi={lg:o({fontSize:"lg",w:12,h:12,borderRadius:"md"}),md:o({fontSize:"md",w:10,h:10,borderRadius:"md"}),sm:o({fontSize:"sm",w:8,h:8,borderRadius:"sm"}),xs:o({fontSize:"xs",w:6,h:6,borderRadius:"sm"})},jr,Rr,Xi={outline:o(e=>{var r,t,a;return(a=(t=C((r=u.variants)==null?void 0:r.outline,e))==null?void 0:t.field)!=null?a:{}}),flushed:o(e=>{var r,t,a;return(a=(t=C((r=u.variants)==null?void 0:r.flushed,e))==null?void 0:t.field)!=null?a:{}}),filled:o(e=>{var r,t,a;return(a=(t=C((r=u.variants)==null?void 0:r.filled,e))==null?void 0:t.field)!=null?a:{}}),unstyled:(Rr=(jr=u.variants)==null?void 0:jr.unstyled.field)!=null?Rr:{}},Ki=S({baseStyle:Ui,sizes:Yi,variants:Xi,defaultProps:u.defaultProps}),{defineMultiStyleConfig:Qi,definePartsStyle:Zi}=b(po.keys),_e=x("popper-bg"),Ji=x("popper-arrow-bg"),Wr=x("popper-arrow-shadow-color"),el=o({zIndex:10}),rl=o({[_e.variable]:"colors.white",bg:_e.reference,[Ji.variable]:_e.reference,[Wr.variable]:"colors.gray.200",_dark:{[_e.variable]:"colors.gray.700",[Wr.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}}),tl=o({px:3,py:2,borderBottomWidth:"1px"}),ol=o({px:3,py:2}),al=o({px:3,py:2,borderTopWidth:"1px"}),nl=o({position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2}),il=Zi({popper:el,content:rl,header:tl,body:ol,footer:al,closeButton:nl}),ll=Qi({baseStyle:il}),{definePartsStyle:Ze,defineMultiStyleConfig:sl}=b(so.keys),Ge=v("drawer-bg"),Ue=v("drawer-box-shadow");function Y(e){return Ze(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var dl=o({bg:"blackAlpha.600",zIndex:"overlay"}),cl=o({display:"flex",zIndex:"modal",justifyContent:"center"}),bl=o(e=>{const{isFullHeight:r}=e;return{...r&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[Ge.variable]:"colors.white",[Ue.variable]:"shadows.lg",_dark:{[Ge.variable]:"colors.gray.700",[Ue.variable]:"shadows.dark-lg"},bg:Ge.reference,boxShadow:Ue.reference}}),ul=o({px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"}),vl=o({position:"absolute",top:"2",insetEnd:"3"}),fl=o({px:"6",py:"2",flex:"1",overflow:"auto"}),ml=o({px:"6",py:"4"}),hl=Ze(e=>({overlay:dl,dialogContainer:cl,dialog:C(bl,e),header:ul,closeButton:vl,body:fl,footer:ml})),gl={xs:Y("xs"),sm:Y("md"),md:Y("lg"),lg:Y("2xl"),xl:Y("4xl"),full:Y("full")},pl=sl({baseStyle:hl,sizes:gl,defaultProps:{size:"xs"}}),{definePartsStyle:yl,defineMultiStyleConfig:Sl}=b(co.keys),xl=o({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"}),$l=o({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}}),kl=o({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}}),_l=yl({preview:xl,input:$l,textarea:kl}),wl=Sl({baseStyle:_l}),{definePartsStyle:Cl,defineMultiStyleConfig:zl}=b(bo.keys),Q=v("form-control-color"),Al=o({marginStart:"1",[Q.variable]:"colors.red.500",_dark:{[Q.variable]:"colors.red.300"},color:Q.reference}),Pl=o({mt:"2",[Q.variable]:"colors.gray.600",_dark:{[Q.variable]:"colors.whiteAlpha.600"},color:Q.reference,lineHeight:"normal",fontSize:"sm"}),Tl=Cl({container:{width:"100%",position:"relative"},requiredIndicator:Al,helperText:Pl}),Fl=zl({baseStyle:Tl}),{definePartsStyle:Il,defineMultiStyleConfig:Bl}=b(uo.keys),Z=v("form-error-color"),Ml=o({[Z.variable]:"colors.red.500",_dark:{[Z.variable]:"colors.red.300"},color:Z.reference,mt:"2",fontSize:"sm",lineHeight:"normal"}),El=o({marginEnd:"0.5em",[Z.variable]:"colors.red.500",_dark:{[Z.variable]:"colors.red.300"},color:Z.reference}),Dl=Il({text:Ml,icon:El}),jl=Bl({baseStyle:Dl}),Rl=o({fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}}),Wl=S({baseStyle:Rl}),Hl=o({fontFamily:"heading",fontWeight:"bold"}),Vl={"4xl":o({fontSize:["6xl",null,"7xl"],lineHeight:1}),"3xl":o({fontSize:["5xl",null,"6xl"],lineHeight:1}),"2xl":o({fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]}),xl:o({fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]}),lg:o({fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]}),md:o({fontSize:"xl",lineHeight:1.2}),sm:o({fontSize:"md",lineHeight:1.2}),xs:o({fontSize:"sm",lineHeight:1.2})},Ll=S({baseStyle:Hl,sizes:Vl,defaultProps:{size:"xl"}}),{defineMultiStyleConfig:Ol,definePartsStyle:ql}=b(io.keys),Nl=o({transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}}),Gl=ql({link:Nl}),Ul=Ol({baseStyle:Gl}),Yl=o({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"}}}),Jr=o(e=>{const{colorScheme:r,theme:t}=e;if(r==="gray")return{color:s("inherit","whiteAlpha.900")(e),_hover:{bg:s("gray.100","whiteAlpha.200")(e)},_active:{bg:s("gray.200","whiteAlpha.300")(e)}};const a=ee(`${r}.200`,.12)(t),n=ee(`${r}.200`,.24)(t);return{color:s(`${r}.600`,`${r}.200`)(e),bg:"transparent",_hover:{bg:s(`${r}.50`,a)(e)},_active:{bg:s(`${r}.100`,n)(e)}}}),Xl=o(e=>{const{colorScheme:r}=e,t=s("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:r==="gray"?t:"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"},...C(Jr,e)}}),Kl={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},Ql=o(e=>{var r;const{colorScheme:t}=e;if(t==="gray"){const c=s("gray.100","whiteAlpha.200")(e);return{bg:c,_hover:{bg:s("gray.200","whiteAlpha.300")(e),_disabled:{bg:c}},_active:{bg:s("gray.300","whiteAlpha.400")(e)}}}const{bg:a=`${t}.500`,color:n="white",hoverBg:i=`${t}.600`,activeBg:l=`${t}.700`}=(r=Kl[t])!=null?r:{},d=s(a,`${t}.200`)(e);return{bg:d,color:s(n,"gray.800")(e),_hover:{bg:s(i,`${t}.300`)(e),_disabled:{bg:d}},_active:{bg:s(l,`${t}.400`)(e)}}}),Zl=o(e=>{const{colorScheme:r}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:s(`${r}.500`,`${r}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:s(`${r}.700`,`${r}.500`)(e)}}}),Jl=o({bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"}),es={ghost:Jr,outline:Xl,solid:Ql,link:Zl,unstyled:Jl},rs={lg:o({h:"12",minW:"12",fontSize:"lg",px:"6"}),md:o({h:"10",minW:"10",fontSize:"md",px:"4"}),sm:o({h:"8",minW:"8",fontSize:"sm",px:"3"}),xs:o({h:"6",minW:"6",fontSize:"xs",px:"2"})},ts=S({baseStyle:Yl,variants:es,sizes:rs,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}}),{definePartsStyle:U,defineMultiStyleConfig:os}=b(Ao.keys),Fe=v("card-bg"),R=v("card-padding"),et=v("card-shadow"),Ae=v("card-radius"),rt=v("card-border-width","0"),tt=v("card-border-color"),as=U({container:{[Fe.variable]:"colors.chakra-body-bg",backgroundColor:Fe.reference,boxShadow:et.reference,borderRadius:Ae.reference,color:"chakra-body-text",borderWidth:rt.reference,borderColor:tt.reference},body:{padding:R.reference,flex:"1 1 0%"},header:{padding:R.reference},footer:{padding:R.reference}}),ns={sm:U({container:{[Ae.variable]:"radii.base",[R.variable]:"space.3"}}),md:U({container:{[Ae.variable]:"radii.md",[R.variable]:"space.5"}}),lg:U({container:{[Ae.variable]:"radii.xl",[R.variable]:"space.7"}})},is={elevated:U({container:{[et.variable]:"shadows.base",_dark:{[Fe.variable]:"colors.gray.700"}}}),outline:U({container:{[rt.variable]:"1px",[tt.variable]:"colors.chakra-border-color"}}),filled:U({container:{[Fe.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[R.variable]:0},header:{[R.variable]:0},footer:{[R.variable]:0}}},ls=os({baseStyle:as,variants:is,sizes:ns,defaultProps:{variant:"elevated",size:"md"}}),ce=x("close-button-size"),oe=x("close-button-bg"),ss=o({w:[ce.reference],h:[ce.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[oe.variable]:"colors.blackAlpha.100",_dark:{[oe.variable]:"colors.whiteAlpha.100"}},_active:{[oe.variable]:"colors.blackAlpha.200",_dark:{[oe.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:oe.reference}),ds={lg:o({[ce.variable]:"sizes.10",fontSize:"md"}),md:o({[ce.variable]:"sizes.8",fontSize:"xs"}),sm:o({[ce.variable]:"sizes.6",fontSize:"2xs"})},cs=S({baseStyle:ss,sizes:ds,defaultProps:{size:"md"}}),{variants:bs,defaultProps:us}=se,vs=o({fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm"}),fs=S({baseStyle:vs,variants:bs,defaultProps:us}),ms=o({w:"100%",mx:"auto",maxW:"prose",px:"4"}),hs=S({baseStyle:ms}),gs=o({opacity:.6,borderColor:"inherit"}),ps=o({borderStyle:"solid"}),ys=o({borderStyle:"dashed"}),Ss={solid:ps,dashed:ys},xs=S({baseStyle:gs,variants:Ss,defaultProps:{variant:"solid"}}),{definePartsStyle:$s,defineMultiStyleConfig:ks}=b(oo.keys),_s=o({borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}}),ws=o({transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"}),Cs=o({pt:"2",px:"4",pb:"5"}),zs=o({fontSize:"1.25em"}),As=$s({container:_s,button:ws,panel:Cs,icon:zs}),Ps=ks({baseStyle:As}),{definePartsStyle:fe,defineMultiStyleConfig:Ts}=b(ao.keys),A=v("alert-fg"),W=v("alert-bg"),Fs=fe({container:{bg:W.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:A.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:A.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function or(e){const{theme:r,colorScheme:t}=e,a=ee(`${t}.200`,.16)(r);return{light:`colors.${t}.100`,dark:a}}var Is=fe(e=>{const{colorScheme:r}=e,t=or(e);return{container:{[A.variable]:`colors.${r}.500`,[W.variable]:t.light,_dark:{[A.variable]:`colors.${r}.200`,[W.variable]:t.dark}}}}),Bs=fe(e=>{const{colorScheme:r}=e,t=or(e);return{container:{[A.variable]:`colors.${r}.500`,[W.variable]:t.light,_dark:{[A.variable]:`colors.${r}.200`,[W.variable]:t.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:A.reference}}}),Ms=fe(e=>{const{colorScheme:r}=e,t=or(e);return{container:{[A.variable]:`colors.${r}.500`,[W.variable]:t.light,_dark:{[A.variable]:`colors.${r}.200`,[W.variable]:t.dark},pt:"2",borderTopWidth:"4px",borderTopColor:A.reference}}}),Es=fe(e=>{const{colorScheme:r}=e;return{container:{[A.variable]:"colors.white",[W.variable]:`colors.${r}.500`,_dark:{[A.variable]:"colors.gray.900",[W.variable]:`colors.${r}.200`},color:A.reference}}}),Ds={subtle:Is,"left-accent":Bs,"top-accent":Ms,solid:Es},js=Ts({baseStyle:Fs,variants:Ds,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:ot,defineMultiStyleConfig:Rs}=b(no.keys),J=v("avatar-border-color"),Ye=v("avatar-bg"),Ws=o({borderRadius:"full",border:"0.2em solid",[J.variable]:"white",_dark:{[J.variable]:"colors.gray.800"},borderColor:J.reference}),Hs=o({[Ye.variable]:"colors.gray.200",_dark:{[Ye.variable]:"colors.whiteAlpha.400"},bgColor:Ye.reference}),Hr=v("avatar-background"),Vs=o(e=>{const{name:r,theme:t}=e,a=r?Yo({string:r}):"colors.gray.400",n=Go(a)(t);let i="white";return n||(i="gray.800"),{bg:Hr.reference,"&:not([data-loaded])":{[Hr.variable]:a},color:i,[J.variable]:"colors.white",_dark:{[J.variable]:"colors.gray.800"},borderColor:J.reference,verticalAlign:"top"}}),Ls=ot(e=>({badge:C(Ws,e),excessLabel:C(Hs,e),container:C(Vs,e)}));function V(e){const r=e!=="100%"?Ur[e]:void 0;return ot({container:{width:e,height:e,fontSize:`calc(${r??e} / 2.5)`},excessLabel:{width:e,height:e},label:{fontSize:`calc(${r??e} / 2.5)`,lineHeight:e!=="100%"?r??e:void 0}})}var Os={"2xs":V(4),xs:V(6),sm:V(8),md:V(12),lg:V(16),xl:V(24),"2xl":V(32),full:V("100%")},qs=Rs({baseStyle:Ls,sizes:Os,defaultProps:{size:"md"}}),Ns={Accordion:Ps,Alert:js,Avatar:qs,Badge:se,Breadcrumb:Ul,Button:ts,Checkbox:Te,CloseButton:cs,Code:fs,Container:hs,Divider:xs,Drawer:pl,Editable:wl,Form:Fl,FormError:jl,FormLabel:Wl,Heading:Ll,Input:u,Kbd:di,Link:bi,List:hi,Menu:Ci,Modal:ji,NumberInput:Gi,PinInput:Ki,Popover:ll,Progress:mn,Radio:An,Select:En,Skeleton:jn,SkipLink:Wn,Slider:Kn,Spinner:Jn,Stat:li,Switch:ca,Table:ga,Tabs:Ia,Tag:Na,Textarea:on,Tooltip:ln,Card:ls},Gs={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-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},Us={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",wordWrap:"break-word"}}},Ys="ltr",Xs={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},at={semanticTokens:Gs,direction:Ys,...to,components:Ns,styles:Us,config:Xs};function ie(e){return typeof e=="function"}function Ks(...e){return r=>e.reduce((t,a)=>a(t),r)}var Qs=e=>function(...t){let a=[...t],n=t[t.length-1];return It(n)&&a.length>1?a=a.slice(0,a.length-1):n=e,Ks(...a.map(i=>l=>ie(i)?i(l):Js(l,i)))(n)},Zs=Qs(at);function Js(...e){return Lr({},...e,nt)}function nt(e,r,t,a){if((ie(e)||ie(r))&&Object.prototype.hasOwnProperty.call(a,t))return(...n)=>{const i=ie(e)?e(...n):e,l=ie(r)?r(...n):r;return Lr({},i,l,nt)}}function ed(e={}){const{strict:r=!0,errorMessage:t="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:a}=e,n=_.createContext(void 0);n.displayName=a;function i(){var l;const d=_.useContext(n);if(!d&&r){const c=new Error(t);throw c.name="ContextError",(l=Error.captureStackTrace)==null||l.call(Error,c,i),c}return d}return[n.Provider,i,n]}function rd(e){const{cssVarsRoot:r,theme:t,children:a}=e,n=_.useMemo(()=>ut(t),[t]);return y.jsxs(vt,{theme:n,children:[y.jsx(td,{root:r}),a]})}function td({root:e=":host, :root"}){const r=[e,"[data-theme]"].join(",");return y.jsx(Ie,{styles:t=>({[r]:t.__cssVars})})}ed({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function od(){const{colorMode:e}=ft();return y.jsx(Ie,{styles:r=>{const t=mt(r,"styles.global"),a=ht(t,{theme:r,colorMode:e});return a?gt(a)(r):void 0}})}var it=_.createContext({getDocument(){return document},getWindow(){return window}});it.displayName="EnvironmentContext";function lt(e){const{children:r,environment:t,disabled:a}=e,n=_.useRef(null),i=_.useMemo(()=>t||{getDocument:()=>{var d,c;return(c=(d=n.current)==null?void 0:d.ownerDocument)!=null?c:document},getWindow:()=>{var d,c;return(c=(d=n.current)==null?void 0:d.ownerDocument.defaultView)!=null?c:window}},[t]),l=!a||!t;return y.jsxs(it.Provider,{value:i,children:[r,l&&y.jsx("span",{id:"__chakra_env",hidden:!0,ref:n})]})}lt.displayName="EnvironmentProvider";var ad=e=>{const{children:r,colorModeManager:t,portalZIndex:a,resetCSS:n=!0,theme:i={},environment:l,cssVarsRoot:d,disableEnvironment:c}=e,$=y.jsx(lt,{environment:l,disabled:c,children:r});return y.jsx(rd,{theme:i,cssVarsRoot:d,children:y.jsxs(qr,{colorModeManager:t,options:i.config,children:[n?y.jsx(Ct,{}):y.jsx(wt,{}),y.jsx(od,{}),a?y.jsx(St,{zIndex:a,children:$}):$]})})},nd=e=>function({children:t,theme:a=e,toastOptions:n,...i}){return y.jsxs(ad,{theme:a,...i,children:[y.jsx(xt,{value:n==null?void 0:n.defaultOptions,children:t}),y.jsx($t,{...n})]})},id=nd(at);function p(e,r,t=!1){e=String(e),r=String(r);const a=Array.from({length:21},(d,c)=>c*50),n=["0","5","10","15","20","25","30","35","40","45","50","55","59","64","68","73","77","82","86","95","100"],i={},l={};return a.forEach((d,c)=>{i[d]=`hsl(${e}, ${r}%, ${n[a.length-1-c]}%)`,l[d]=`hsl(${e}, ${r}%, ${n[c]}%)`}),t?l:i}const st={base:p(225,15),accent:p(250,50),working:p(47,67),warning:p(28,75),ok:p(113,70),error:p(0,76)};function m(e,r={}){let t=!1;function a(){if(!t){t=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function n(...h){a();for(const g of h)r[g]=c(g);return m(e,r)}function i(...h){for(const g of h)g in r||(r[g]=c(g));return m(e,r)}function l(){return Object.fromEntries(Object.entries(r).map(([g,k])=>[g,k.selector]))}function d(){return Object.fromEntries(Object.entries(r).map(([g,k])=>[g,k.className]))}function c(h){const F=`chakra-${(["container","root"].includes(h??"")?[e]:[e,h]).filter(Boolean).join("__")}`;return{className:F,selector:`.${F}`,toString:()=>h}}return{parts:n,toPart:c,extend:i,selectors:l,classnames:d,get keys(){return Object.keys(r)},__type:{}}}var ld=m("accordion").parts("root","container","button","panel").extend("icon");m("alert").parts("title","description","container").extend("icon","spinner");m("avatar").parts("label","badge","container").extend("excessLabel","group");m("breadcrumb").parts("link","item","container").extend("separator");m("button").parts();var sd=m("checkbox").parts("control","icon","container").extend("label");m("progress").parts("track","filledTrack").extend("label");m("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer");m("editable").parts("preview","input","textarea");m("form").parts("container","requiredIndicator","helperText");m("formError").parts("text","icon");var dd=m("input").parts("addon","field","element");m("list").parts("container","item","icon");var cd=m("menu").parts("button","list","item").extend("groupTitle","command","divider"),bd=m("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),ud=m("numberinput").parts("root","field","stepperGroup","stepper");m("pininput").parts("field");var vd=m("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),fd=m("progress").parts("label","filledTrack","track");m("radio").parts("container","control","label");var md=m("select").parts("field","icon"),hd=m("slider").parts("container","track","thumb","filledTrack","mark");m("stat").parts("container","label","helpText","number","icon");var gd=m("switch").parts("container","track","thumb");m("table").parts("table","thead","tbody","tr","th","td","tfoot","caption");var pd=m("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator");m("tag").parts("container","label","closeButton");m("card").parts("container","header","body","footer");const{definePartsStyle:yd,defineMultiStyleConfig:Sd}=b(ld.keys),xd=o({border:"none",pt:2}),$d=o(e=>{const{colorScheme:r}=e;return{fontWeight:"600",fontSize:"sm",border:"none",borderRadius:"base",bg:`${r}.800`,color:"base.100",_hover:{bg:`${r}.700`},_expanded:{bg:`${r}.750`,borderBottomRadius:"none",_hover:{bg:`${r}.700`}}}}),kd=o(e=>{const{colorScheme:r}=e;return{bg:`${r}.800`,borderRadius:"base",borderTopRadius:"none",p:4}}),_d=o({}),wd=yd(e=>({container:xd,button:$d(e),panel:kd(e),icon:_d})),Cd=Sd({variants:{invokeAI:wd},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),zd=o(e=>{const{colorScheme:r}=e,t={bg:`${r}.600`,color:`${r}.100`,svg:{fill:`${r}.100`}};return{bg:`${r}.700`,color:`${r}.100`,borderRadius:"base",svg:{fill:`${r}.100`},_disabled:t,_hover:{bg:`${r}.650`,color:`${r}.50`,svg:{fill:`${r}.50`},_disabled:t},_checked:{bg:"accent.700",color:"accent.100",svg:{fill:"accent.100"},_disabled:t,_hover:{bg:"accent.600",color:"accent.50",svg:{fill:"accent.50"},_disabled:t}}}}),Ad=S({variants:{invokeAI:zd},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),{definePartsStyle:Pd,defineMultiStyleConfig:Td}=b(sd.keys),Fd=o(e=>{const{colorScheme:r}=e;return{_checked:{bg:`${r}.200`,borderColor:`${r}.200`,color:"base.900",_hover:{bg:`${r}.300`,borderColor:`${r}.300`},_disabled:{borderColor:"transparent",bg:"whiteAlpha.300",color:"whiteAlpha.500"}},_indeterminate:{bg:`${r}.200`,borderColor:`${r}.200`,color:"base.900"},_disabled:{bg:"whiteAlpha.100",borderColor:"transparent"},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:"red.300"}}}),Id=Pd(e=>({control:Fd(e)})),Bd=Td({variants:{invokeAI:Id},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),Md=o(e=>({fontSize:"sm",marginEnd:0,mb:1,fontWeight:"400",transitionProperty:"common",transitionDuration:"normal",whiteSpace:"nowrap",_disabled:{opacity:.4},color:"base.300"})),Ed=S({variants:{invokeAI:Md},defaultProps:{variant:"invokeAI"}}),Ee=e=>({outline:"none",borderWidth:2,borderStyle:"solid",borderColor:"base.800",bg:"base.900",borderRadius:"base",color:"base.100",boxShadow:"none",_hover:{borderColor:"base.600"},_focus:{borderColor:"accent.700",boxShadow:"none",_hover:{borderColor:"accent.600"}},_invalid:{borderColor:"error.700",boxShadow:"none",_hover:{borderColor:"error.600"}},_disabled:{borderColor:"base.700",bg:"base.700",color:"base.400",_hover:{borderColor:"base.700"}},_placeholder:{color:"base.400"}}),{definePartsStyle:Dd,defineMultiStyleConfig:jd}=b(dd.keys),Rd=Dd(e=>({field:Ee()})),Wd=jd({variants:{invokeAI:Rd},defaultProps:{size:"sm",variant:"invokeAI"}}),{definePartsStyle:Hd,defineMultiStyleConfig:Vd}=b(cd.keys),Ld=Hd({button:{fontWeight:"600",bg:"base.500",color:"base.200",_hover:{bg:"base.600",color:"white"}},list:{zIndex:9999,bg:"base.800"},item:{fontSize:"sm",bg:"base.800",_hover:{bg:"base.750"},_focus:{bg:"base.700"}}}),Od=Vd({variants:{invokeAI:Ld},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:qd,definePartsStyle:Nd}=b(bd.keys),Gd=o({bg:"blackAlpha.600"}),Ud=o({}),Yd=o(e=>({bg:"base.850",maxH:"80vh"})),Xd=o(e=>({fontWeight:"600",fontSize:"lg",color:"base.200"})),Kd=o({}),Qd=o({overflowY:"scroll"}),Zd=o({}),Jd=Nd(e=>({overlay:Gd,dialogContainer:Ud,dialog:Yd(e),header:Xd(e),closeButton:Kd,body:Qd,footer:Zd})),ec=qd({variants:{invokeAI:Jd},defaultProps:{variant:"invokeAI",size:"lg"}}),{defineMultiStyleConfig:rc,definePartsStyle:tc}=b(ud.keys),oc=o(e=>({height:8})),ac=o(e=>({border:"none",fontWeight:"600",height:"auto",py:1,ps:2,pe:6,...Ee()})),nc=o(e=>({display:"flex"})),ic=o(e=>({border:"none",px:2,py:0,mx:-2,my:0,svg:{color:"base.300",width:2.5,height:2.5,_hover:{color:"base.50"}}})),lc=tc(e=>({root:oc(e),field:ac(e),stepperGroup:nc(e),stepper:ic(e)})),sc=rc({variants:{invokeAI:lc},defaultProps:{size:"sm",variant:"invokeAI"}});function dc(e){return!Number.isInteger(parseFloat(e.toString()))}function cc(e,r="-"){return e.replace(/\s+/g,r)}function dt(e){const r=cc(e.toString());return r.includes("\\.")?e:dc(e)?r.replace(".","\\."):e}function bc(e,r=""){return[r,dt(e)].filter(Boolean).join("-")}function uc(e,r){return`var(${dt(e)}${r?`, ${r}`:""})`}function vc(e,r=""){return`--${bc(e,r)}`}function ar(e,r){const t=vc(e,r==null?void 0:r.prefix);return{variable:t,reference:uc(t,fc(r==null?void 0:r.fallback))}}function fc(e){return typeof e=="string"?e:e==null?void 0:e.reference}const{defineMultiStyleConfig:mc,definePartsStyle:hc}=b(vd.keys),gc=ar("popper-bg"),pc=ar("popper-arrow-bg"),yc=ar("popper-arrow-shadow-color"),Sc=o(e=>({[pc.variable]:"colors.base.800",[gc.variable]:"colors.base.800",[yc.variable]:"colors.base.600",minW:"unset",width:"unset",p:4,borderWidth:"2px",borderStyle:"solid",borderColor:"base.600",bg:"base.800"})),xc=hc(e=>({content:Sc(e)})),$c=mc({variants:{invokeAI:xc},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:kc,definePartsStyle:_c}=b(fd.keys),wc=o(e=>({bg:"accent.600",transition:"width 0.2s ease-in-out",_indeterminate:{bgGradient:"linear(to-r, transparent 0%, accent.600 50%, transparent 100%);"}})),Cc=o(e=>({bg:"base.800"})),zc=_c(e=>({filledTrack:wc(e),track:Cc(e)})),Ac=kc({variants:{invokeAI:zc},defaultProps:{variant:"invokeAI"}}),{definePartsStyle:Pc,defineMultiStyleConfig:Tc}=b(md.keys),Fc=o(e=>({color:"base.300"})),Ic=o(e=>({fontWeight:"600",...Ee()})),Bc=Pc(e=>({field:Ic(e),icon:Fc(e)})),Mc=Tc({variants:{invokeAI:Bc},defaultProps:{size:"sm",variant:"invokeAI"}}),{definePartsStyle:Ec,defineMultiStyleConfig:Dc}=b(hd.keys),jc=o(e=>({bg:"base.400",h:1.5})),Rc=o(e=>{const{colorScheme:r}=e;return{bg:`${r}.600`,h:1.5}}),Wc=o(e=>({w:2,h:4})),Hc=o(e=>({fontSize:"xs",fontWeight:"500",color:"base.200",mt:2,insetInlineStart:"unset"})),Vc=Ec(e=>({track:jc(e),filledTrack:Rc(e),thumb:Wc(e),mark:Hc(e)})),Lc=Dc({variants:{invokeAI:Vc},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:Oc,definePartsStyle:qc}=b(gd.keys),Nc=o(e=>{const{colorScheme:r}=e;return{bg:"base.600",_focusVisible:{boxShadow:"none"},_checked:{bg:`${r}.600`}}}),Gc=o(e=>{const{colorScheme:r}=e;return{bg:`${r}.50`}}),Uc=qc(e=>({container:{},track:Nc(e),thumb:Gc(e)})),Yc=Oc({variants:{invokeAI:Uc},defaultProps:{size:"md",variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:Xc,definePartsStyle:Kc}=b(pd.keys),Qc=o(e=>({display:"flex",columnGap:4})),Zc=o(e=>({})),Jc=o(e=>({display:"flex",flexDirection:"column",gap:1,color:"base.700",button:{fontSize:"sm",padding:2,borderRadius:"base",_selected:{bg:"accent.700",color:"accent.100",_hover:{bg:"accent.600",color:"accent.50"}},_hover:{bg:"base.600",color:"base.50"}}})),e0=o(e=>({padding:0,height:"100%"})),r0=Kc(e=>({root:Qc(e),tab:Zc(e),tablist:Jc(e),tabpanel:e0(e)})),t0=Xc({variants:{invokeAI:r0},defaultProps:{variant:"invokeAI"}}),o0=o(e=>({color:"base.400"})),a0=S({variants:{subtext:o0}}),n0=o(e=>Ee()),i0=S({variants:{invokeAI:n0},defaultProps:{size:"md",variant:"invokeAI"}}),l0={config:{cssVarPrefix:"invokeai"},styles:{global:e=>({body:{bg:"base.900",color:"base.50",overflow:"hidden"},...kt})},direction:"ltr",fonts:{body:"'Inter', 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)"}},colors:{...st},components:{Button:Ad,Input:Wd,Textarea:i0,Tabs:t0,Progress:Ac,Accordion:Cd,FormLabel:Ed,Switch:Yc,NumberInput:sc,Select:Mc,Slider:Lc,Popover:$c,Modal:ec,Checkbox:Bd,Menu:Od,Text:a0}},s0={base:p(223,10),accent:p(155,80),working:p(47,68),warning:p(28,75),ok:p(122,49),error:p(0,50)},d0={base:p(223,10,!0),accent:p(40,80,!0),working:p(47,68,!0),warning:p(28,75,!0),ok:p(122,49,!0),error:p(0,50,!0)},c0={base:p(220,30),accent:p(210,80),working:p(47,68),warning:p(28,75),ok:p(122,49),error:p(0,100)},b0={dark:st,light:d0,green:s0,ocean:c0};function f0({children:e}){const{i18n:r}=pt(),t=_t(i=>i.ui.currentTheme),a=r.dir(),n=Zs({...l0,colors:b0[t],direction:a});return _.useEffect(()=>{document.body.dir=a},[a]),y.jsx(id,{theme:n,children:e})}export{f0 as default}; + )`;return{...!a&&n&&i,...a?{bgImage:d}:{bgColor:l}}}),dn=o({lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"}),cn=o(e=>({bg:s("gray.100","whiteAlpha.300")(e)})),bn=o(e=>({transitionProperty:"common",transitionDuration:"slow",...sn(e)})),un=ne(e=>({label:dn,filledTrack:bn(e),track:cn(e)})),vn={xs:ne({track:{h:"1"}}),sm:ne({track:{h:"2"}}),md:ne({track:{h:"3"}}),lg:ne({track:{h:"4"}})},fn=ln({sizes:vn,baseStyle:un,defaultProps:{size:"md",colorScheme:"blue"}}),mn=e=>typeof e=="function";function C(e,...r){return mn(e)?e(...r):e}var{definePartsStyle:Ce,defineMultiStyleConfig:gn}=b(io.keys),de=v("checkbox-size"),hn=o(e=>{const{colorScheme:r}=e;return{w:de.reference,h:de.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:s(`${r}.500`,`${r}.200`)(e),borderColor:s(`${r}.500`,`${r}.200`)(e),color:s("white","gray.900")(e),_hover:{bg:s(`${r}.600`,`${r}.300`)(e),borderColor:s(`${r}.600`,`${r}.300`)(e)},_disabled:{borderColor:s("gray.200","transparent")(e),bg:s("gray.200","whiteAlpha.300")(e),color:s("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:s(`${r}.500`,`${r}.200`)(e),borderColor:s(`${r}.500`,`${r}.200`)(e),color:s("white","gray.900")(e)},_disabled:{bg:s("gray.100","whiteAlpha.100")(e),borderColor:s("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:s("red.500","red.300")(e)}}}),pn=o({_disabled:{cursor:"not-allowed"}}),yn=o({userSelect:"none",_disabled:{opacity:.4}}),Sn=o({transitionProperty:"transform",transitionDuration:"normal"}),xn=Ce(e=>({icon:Sn,container:pn,control:C(hn,e),label:yn})),$n={sm:Ce({control:{[de.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:Ce({control:{[de.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:Ce({control:{[de.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},Te=gn({baseStyle:xn,sizes:$n,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:kn,definePartsStyle:ze}=b(yo.keys),_n=o(e=>{var r;const t=(r=C(Te.baseStyle,e))==null?void 0:r.control;return{...t,borderRadius:"full",_checked:{...t==null?void 0:t._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}}),wn=ze(e=>{var r,t,a,n;return{label:(t=(r=Te).baseStyle)==null?void 0:t.call(r,e).label,container:(n=(a=Te).baseStyle)==null?void 0:n.call(a,e).container,control:_n(e)}}),Cn={md:ze({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:ze({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:ze({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},zn=kn({baseStyle:wn,sizes:Cn,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:An,definePartsStyle:Pn}=b(So.keys),xe=v("select-bg"),zr,Tn=o({...(zr=u.baseStyle)==null?void 0:zr.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:xe.reference,[xe.variable]:"colors.white",_dark:{[xe.variable]:"colors.gray.700"},"> option, > optgroup":{bg:xe.reference}}),Fn=o({width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}}),In=Pn({field:Tn,icon:Fn}),$e=o({paddingInlineEnd:"8"}),Ar,Pr,Tr,Fr,Ir,Br,Mr,Er,Bn={lg:{...(Ar=u.sizes)==null?void 0:Ar.lg,field:{...(Pr=u.sizes)==null?void 0:Pr.lg.field,...$e}},md:{...(Tr=u.sizes)==null?void 0:Tr.md,field:{...(Fr=u.sizes)==null?void 0:Fr.md.field,...$e}},sm:{...(Ir=u.sizes)==null?void 0:Ir.sm,field:{...(Br=u.sizes)==null?void 0:Br.sm.field,...$e}},xs:{...(Mr=u.sizes)==null?void 0:Mr.xs,field:{...(Er=u.sizes)==null?void 0:Er.xs.field,...$e},icon:{insetEnd:"1"}}},Mn=An({baseStyle:In,sizes:Bn,variants:u.variants,defaultProps:u.defaultProps}),Re=v("skeleton-start-color"),We=v("skeleton-end-color"),En=o({[Re.variable]:"colors.gray.100",[We.variable]:"colors.gray.400",_dark:{[Re.variable]:"colors.gray.800",[We.variable]:"colors.gray.600"},background:Re.reference,borderColor:We.reference,opacity:.7,borderRadius:"sm"}),Dn=S({baseStyle:En}),He=v("skip-link-bg"),jn=o({borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[He.variable]:"colors.white",_dark:{[He.variable]:"colors.gray.700"},bg:He.reference}}),Rn=S({baseStyle:jn}),{defineMultiStyleConfig:Wn,definePartsStyle:Me}=b(xo.keys),ue=v("slider-thumb-size"),ve=v("slider-track-size"),V=v("slider-bg"),Hn=o(e=>{const{orientation:r}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...er({orientation:r,vertical:{h:"100%"},horizontal:{w:"100%"}})}}),Ln=o(e=>({...er({orientation:e.orientation,horizontal:{h:ve.reference},vertical:{w:ve.reference}}),overflow:"hidden",borderRadius:"sm",[V.variable]:"colors.gray.200",_dark:{[V.variable]:"colors.whiteAlpha.200"},_disabled:{[V.variable]:"colors.gray.300",_dark:{[V.variable]:"colors.whiteAlpha.300"}},bg:V.reference})),Vn=o(e=>{const{orientation:r}=e;return{...er({orientation:r,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:ue.reference,h:ue.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"}}}),On=o(e=>{const{colorScheme:r}=e;return{width:"inherit",height:"inherit",[V.variable]:`colors.${r}.500`,_dark:{[V.variable]:`colors.${r}.200`},bg:V.reference}}),qn=Me(e=>({container:Hn(e),track:Ln(e),thumb:Vn(e),filledTrack:On(e)})),Nn=Me({container:{[ue.variable]:"sizes.4",[ve.variable]:"sizes.1"}}),Gn=Me({container:{[ue.variable]:"sizes.3.5",[ve.variable]:"sizes.1"}}),Un=Me({container:{[ue.variable]:"sizes.2.5",[ve.variable]:"sizes.0.5"}}),Yn={lg:Nn,md:Gn,sm:Un},Xn=Wn({baseStyle:qn,sizes:Yn,defaultProps:{size:"md",colorScheme:"blue"}}),O=x("spinner-size"),Kn=o({width:[O.reference],height:[O.reference]}),Qn={xs:o({[O.variable]:"sizes.3"}),sm:o({[O.variable]:"sizes.4"}),md:o({[O.variable]:"sizes.6"}),lg:o({[O.variable]:"sizes.8"}),xl:o({[O.variable]:"sizes.12"})},Zn=S({baseStyle:Kn,sizes:Qn,defaultProps:{size:"md"}}),{defineMultiStyleConfig:Jn,definePartsStyle:Kr}=b($o.keys),ei=o({fontWeight:"medium"}),ri=o({opacity:.8,marginBottom:"2"}),ti=o({verticalAlign:"baseline",fontWeight:"semibold"}),oi=o({marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"}),ai=Kr({container:{},label:ei,helpText:ri,number:ti,icon:oi}),ni={md:Kr({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},ii=Jn({baseStyle:ai,sizes:ni,defaultProps:{size:"md"}}),Le=v("kbd-bg"),li=o({[Le.variable]:"colors.gray.100",_dark:{[Le.variable]:"colors.whiteAlpha.100"},bg:Le.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"}),si=S({baseStyle:li}),di=o({transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}}),ci=S({baseStyle:di}),{defineMultiStyleConfig:bi,definePartsStyle:ui}=b(vo.keys),vi=o({marginEnd:"2",display:"inline",verticalAlign:"text-bottom"}),fi=ui({icon:vi}),mi=bi({baseStyle:fi}),{defineMultiStyleConfig:gi,definePartsStyle:hi}=b(fo.keys),B=v("menu-bg"),Ve=v("menu-shadow"),pi=o({[B.variable]:"#fff",[Ve.variable]:"shadows.sm",_dark:{[B.variable]:"colors.gray.700",[Ve.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:B.reference,boxShadow:Ve.reference}),yi=o({py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[B.variable]:"colors.gray.100",_dark:{[B.variable]:"colors.whiteAlpha.100"}},_active:{[B.variable]:"colors.gray.200",_dark:{[B.variable]:"colors.whiteAlpha.200"}},_expanded:{[B.variable]:"colors.gray.100",_dark:{[B.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:B.reference}),Si=o({mx:4,my:2,fontWeight:"semibold",fontSize:"sm"}),xi=o({opacity:.6}),$i=o({border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6}),ki=o({transitionProperty:"common",transitionDuration:"normal"}),_i=hi({button:ki,list:pi,item:yi,groupTitle:Si,command:xi,divider:$i}),wi=gi({baseStyle:_i}),{defineMultiStyleConfig:Ci,definePartsStyle:Qe}=b(mo.keys),zi=o({bg:"blackAlpha.600",zIndex:"modal"}),Ai=o(e=>{const{isCentered:r,scrollBehavior:t}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:r?"center":"flex-start",overflow:t==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}}),Pi=o(e=>{const{scrollBehavior:r}=e;return{borderRadius:"md",bg:s("white","gray.700")(e),color:"inherit",my:"16",zIndex:"modal",maxH:r==="inside"?"calc(100% - 7.5rem)":void 0,boxShadow:s("lg","dark-lg")(e)}}),Ti=o({px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"}),Fi=o({position:"absolute",top:"2",insetEnd:"3"}),Ii=o(e=>{const{scrollBehavior:r}=e;return{px:"6",py:"2",flex:"1",overflow:r==="inside"?"auto":void 0}}),Bi=o({px:"6",py:"4"}),Mi=Qe(e=>({overlay:zi,dialogContainer:C(Ai,e),dialog:C(Pi,e),header:Ti,closeButton:Fi,body:C(Ii,e),footer:Bi}));function P(e){return Qe(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var Ei={xs:P("xs"),sm:P("sm"),md:P("md"),lg:P("lg"),xl:P("xl"),"2xl":P("2xl"),"3xl":P("3xl"),"4xl":P("4xl"),"5xl":P("5xl"),"6xl":P("6xl"),full:P("full")},Di=Ci({baseStyle:Mi,sizes:Ei,defaultProps:{size:"md"}}),{defineMultiStyleConfig:ji,definePartsStyle:Qr}=b(go.keys),tr=x("number-input-stepper-width"),Zr=x("number-input-input-padding"),Ri=D(tr).add("0.5rem").toString(),Oe=x("number-input-bg"),qe=x("number-input-color"),Ne=x("number-input-border-color"),Wi=o({[tr.variable]:"sizes.6",[Zr.variable]:Ri}),Hi=o(e=>{var r,t;return(t=(r=C(u.baseStyle,e))==null?void 0:r.field)!=null?t:{}}),Li=o({width:tr.reference}),Vi=o({borderStart:"1px solid",borderStartColor:Ne.reference,color:qe.reference,bg:Oe.reference,[qe.variable]:"colors.chakra-body-text",[Ne.variable]:"colors.chakra-border-color",_dark:{[qe.variable]:"colors.whiteAlpha.800",[Ne.variable]:"colors.whiteAlpha.300"},_active:{[Oe.variable]:"colors.gray.200",_dark:{[Oe.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}}),Oi=Qr(e=>{var r;return{root:Wi,field:(r=C(Hi,e))!=null?r:{},stepperGroup:Li,stepper:Vi}});function ke(e){var r,t,a;const n=(r=u.sizes)==null?void 0:r[e],i={lg:"md",md:"md",sm:"sm",xs:"sm"},l=(a=(t=n.field)==null?void 0:t.fontSize)!=null?a:"md",d=Nr.fontSizes[l];return Qr({field:{...n.field,paddingInlineEnd:Zr.reference,verticalAlign:"top"},stepper:{fontSize:D(d).multiply(.75).toString(),_first:{borderTopEndRadius:i[e]},_last:{borderBottomEndRadius:i[e],mt:"-1px",borderTopWidth:1}}})}var qi={xs:ke("xs"),sm:ke("sm"),md:ke("md"),lg:ke("lg")},Ni=ji({baseStyle:Oi,sizes:qi,variants:u.variants,defaultProps:u.defaultProps}),Dr,Gi=o({...(Dr=u.baseStyle)==null?void 0:Dr.field,textAlign:"center"}),Ui={lg:o({fontSize:"lg",w:12,h:12,borderRadius:"md"}),md:o({fontSize:"md",w:10,h:10,borderRadius:"md"}),sm:o({fontSize:"sm",w:8,h:8,borderRadius:"sm"}),xs:o({fontSize:"xs",w:6,h:6,borderRadius:"sm"})},jr,Rr,Yi={outline:o(e=>{var r,t,a;return(a=(t=C((r=u.variants)==null?void 0:r.outline,e))==null?void 0:t.field)!=null?a:{}}),flushed:o(e=>{var r,t,a;return(a=(t=C((r=u.variants)==null?void 0:r.flushed,e))==null?void 0:t.field)!=null?a:{}}),filled:o(e=>{var r,t,a;return(a=(t=C((r=u.variants)==null?void 0:r.filled,e))==null?void 0:t.field)!=null?a:{}}),unstyled:(Rr=(jr=u.variants)==null?void 0:jr.unstyled.field)!=null?Rr:{}},Xi=S({baseStyle:Gi,sizes:Ui,variants:Yi,defaultProps:u.defaultProps}),{defineMultiStyleConfig:Ki,definePartsStyle:Qi}=b(ho.keys),_e=x("popper-bg"),Zi=x("popper-arrow-bg"),Wr=x("popper-arrow-shadow-color"),Ji=o({zIndex:10}),el=o({[_e.variable]:"colors.white",bg:_e.reference,[Zi.variable]:_e.reference,[Wr.variable]:"colors.gray.200",_dark:{[_e.variable]:"colors.gray.700",[Wr.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}}),rl=o({px:3,py:2,borderBottomWidth:"1px"}),tl=o({px:3,py:2}),ol=o({px:3,py:2,borderTopWidth:"1px"}),al=o({position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2}),nl=Qi({popper:Ji,content:el,header:rl,body:tl,footer:ol,closeButton:al}),il=Ki({baseStyle:nl}),{definePartsStyle:Ze,defineMultiStyleConfig:ll}=b(lo.keys),Ge=v("drawer-bg"),Ue=v("drawer-box-shadow");function Y(e){return Ze(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var sl=o({bg:"blackAlpha.600",zIndex:"overlay"}),dl=o({display:"flex",zIndex:"modal",justifyContent:"center"}),cl=o(e=>{const{isFullHeight:r}=e;return{...r&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[Ge.variable]:"colors.white",[Ue.variable]:"shadows.lg",_dark:{[Ge.variable]:"colors.gray.700",[Ue.variable]:"shadows.dark-lg"},bg:Ge.reference,boxShadow:Ue.reference}}),bl=o({px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"}),ul=o({position:"absolute",top:"2",insetEnd:"3"}),vl=o({px:"6",py:"2",flex:"1",overflow:"auto"}),fl=o({px:"6",py:"4"}),ml=Ze(e=>({overlay:sl,dialogContainer:dl,dialog:C(cl,e),header:bl,closeButton:ul,body:vl,footer:fl})),gl={xs:Y("xs"),sm:Y("md"),md:Y("lg"),lg:Y("2xl"),xl:Y("4xl"),full:Y("full")},hl=ll({baseStyle:ml,sizes:gl,defaultProps:{size:"xs"}}),{definePartsStyle:pl,defineMultiStyleConfig:yl}=b(so.keys),Sl=o({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"}),xl=o({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}}),$l=o({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}}),kl=pl({preview:Sl,input:xl,textarea:$l}),_l=yl({baseStyle:kl}),{definePartsStyle:wl,defineMultiStyleConfig:Cl}=b(co.keys),Q=v("form-control-color"),zl=o({marginStart:"1",[Q.variable]:"colors.red.500",_dark:{[Q.variable]:"colors.red.300"},color:Q.reference}),Al=o({mt:"2",[Q.variable]:"colors.gray.600",_dark:{[Q.variable]:"colors.whiteAlpha.600"},color:Q.reference,lineHeight:"normal",fontSize:"sm"}),Pl=wl({container:{width:"100%",position:"relative"},requiredIndicator:zl,helperText:Al}),Tl=Cl({baseStyle:Pl}),{definePartsStyle:Fl,defineMultiStyleConfig:Il}=b(bo.keys),Z=v("form-error-color"),Bl=o({[Z.variable]:"colors.red.500",_dark:{[Z.variable]:"colors.red.300"},color:Z.reference,mt:"2",fontSize:"sm",lineHeight:"normal"}),Ml=o({marginEnd:"0.5em",[Z.variable]:"colors.red.500",_dark:{[Z.variable]:"colors.red.300"},color:Z.reference}),El=Fl({text:Bl,icon:Ml}),Dl=Il({baseStyle:El}),jl=o({fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}}),Rl=S({baseStyle:jl}),Wl=o({fontFamily:"heading",fontWeight:"bold"}),Hl={"4xl":o({fontSize:["6xl",null,"7xl"],lineHeight:1}),"3xl":o({fontSize:["5xl",null,"6xl"],lineHeight:1}),"2xl":o({fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]}),xl:o({fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]}),lg:o({fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]}),md:o({fontSize:"xl",lineHeight:1.2}),sm:o({fontSize:"md",lineHeight:1.2}),xs:o({fontSize:"sm",lineHeight:1.2})},Ll=S({baseStyle:Wl,sizes:Hl,defaultProps:{size:"xl"}}),{defineMultiStyleConfig:Vl,definePartsStyle:Ol}=b(no.keys),ql=o({transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}}),Nl=Ol({link:ql}),Gl=Vl({baseStyle:Nl}),Ul=o({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"}}}),Jr=o(e=>{const{colorScheme:r,theme:t}=e;if(r==="gray")return{color:s("inherit","whiteAlpha.900")(e),_hover:{bg:s("gray.100","whiteAlpha.200")(e)},_active:{bg:s("gray.200","whiteAlpha.300")(e)}};const a=ee(`${r}.200`,.12)(t),n=ee(`${r}.200`,.24)(t);return{color:s(`${r}.600`,`${r}.200`)(e),bg:"transparent",_hover:{bg:s(`${r}.50`,a)(e)},_active:{bg:s(`${r}.100`,n)(e)}}}),Yl=o(e=>{const{colorScheme:r}=e,t=s("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:r==="gray"?t:"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"},...C(Jr,e)}}),Xl={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},Kl=o(e=>{var r;const{colorScheme:t}=e;if(t==="gray"){const c=s("gray.100","whiteAlpha.200")(e);return{bg:c,_hover:{bg:s("gray.200","whiteAlpha.300")(e),_disabled:{bg:c}},_active:{bg:s("gray.300","whiteAlpha.400")(e)}}}const{bg:a=`${t}.500`,color:n="white",hoverBg:i=`${t}.600`,activeBg:l=`${t}.700`}=(r=Xl[t])!=null?r:{},d=s(a,`${t}.200`)(e);return{bg:d,color:s(n,"gray.800")(e),_hover:{bg:s(i,`${t}.300`)(e),_disabled:{bg:d}},_active:{bg:s(l,`${t}.400`)(e)}}}),Ql=o(e=>{const{colorScheme:r}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:s(`${r}.500`,`${r}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:s(`${r}.700`,`${r}.500`)(e)}}}),Zl=o({bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"}),Jl={ghost:Jr,outline:Yl,solid:Kl,link:Ql,unstyled:Zl},es={lg:o({h:"12",minW:"12",fontSize:"lg",px:"6"}),md:o({h:"10",minW:"10",fontSize:"md",px:"4"}),sm:o({h:"8",minW:"8",fontSize:"sm",px:"3"}),xs:o({h:"6",minW:"6",fontSize:"xs",px:"2"})},rs=S({baseStyle:Ul,variants:Jl,sizes:es,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}}),{definePartsStyle:U,defineMultiStyleConfig:ts}=b(zo.keys),Fe=v("card-bg"),R=v("card-padding"),et=v("card-shadow"),Ae=v("card-radius"),rt=v("card-border-width","0"),tt=v("card-border-color"),os=U({container:{[Fe.variable]:"colors.chakra-body-bg",backgroundColor:Fe.reference,boxShadow:et.reference,borderRadius:Ae.reference,color:"chakra-body-text",borderWidth:rt.reference,borderColor:tt.reference},body:{padding:R.reference,flex:"1 1 0%"},header:{padding:R.reference},footer:{padding:R.reference}}),as={sm:U({container:{[Ae.variable]:"radii.base",[R.variable]:"space.3"}}),md:U({container:{[Ae.variable]:"radii.md",[R.variable]:"space.5"}}),lg:U({container:{[Ae.variable]:"radii.xl",[R.variable]:"space.7"}})},ns={elevated:U({container:{[et.variable]:"shadows.base",_dark:{[Fe.variable]:"colors.gray.700"}}}),outline:U({container:{[rt.variable]:"1px",[tt.variable]:"colors.chakra-border-color"}}),filled:U({container:{[Fe.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[R.variable]:0},header:{[R.variable]:0},footer:{[R.variable]:0}}},is=ts({baseStyle:os,variants:ns,sizes:as,defaultProps:{variant:"elevated",size:"md"}}),ce=x("close-button-size"),oe=x("close-button-bg"),ls=o({w:[ce.reference],h:[ce.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[oe.variable]:"colors.blackAlpha.100",_dark:{[oe.variable]:"colors.whiteAlpha.100"}},_active:{[oe.variable]:"colors.blackAlpha.200",_dark:{[oe.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:oe.reference}),ss={lg:o({[ce.variable]:"sizes.10",fontSize:"md"}),md:o({[ce.variable]:"sizes.8",fontSize:"xs"}),sm:o({[ce.variable]:"sizes.6",fontSize:"2xs"})},ds=S({baseStyle:ls,sizes:ss,defaultProps:{size:"md"}}),{variants:cs,defaultProps:bs}=se,us=o({fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm"}),vs=S({baseStyle:us,variants:cs,defaultProps:bs}),fs=o({w:"100%",mx:"auto",maxW:"prose",px:"4"}),ms=S({baseStyle:fs}),gs=o({opacity:.6,borderColor:"inherit"}),hs=o({borderStyle:"solid"}),ps=o({borderStyle:"dashed"}),ys={solid:hs,dashed:ps},Ss=S({baseStyle:gs,variants:ys,defaultProps:{variant:"solid"}}),{definePartsStyle:xs,defineMultiStyleConfig:$s}=b(to.keys),ks=o({borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}}),_s=o({transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"}),ws=o({pt:"2",px:"4",pb:"5"}),Cs=o({fontSize:"1.25em"}),zs=xs({container:ks,button:_s,panel:ws,icon:Cs}),As=$s({baseStyle:zs}),{definePartsStyle:fe,defineMultiStyleConfig:Ps}=b(oo.keys),A=v("alert-fg"),W=v("alert-bg"),Ts=fe({container:{bg:W.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:A.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:A.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function or(e){const{theme:r,colorScheme:t}=e,a=ee(`${t}.200`,.16)(r);return{light:`colors.${t}.100`,dark:a}}var Fs=fe(e=>{const{colorScheme:r}=e,t=or(e);return{container:{[A.variable]:`colors.${r}.500`,[W.variable]:t.light,_dark:{[A.variable]:`colors.${r}.200`,[W.variable]:t.dark}}}}),Is=fe(e=>{const{colorScheme:r}=e,t=or(e);return{container:{[A.variable]:`colors.${r}.500`,[W.variable]:t.light,_dark:{[A.variable]:`colors.${r}.200`,[W.variable]:t.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:A.reference}}}),Bs=fe(e=>{const{colorScheme:r}=e,t=or(e);return{container:{[A.variable]:`colors.${r}.500`,[W.variable]:t.light,_dark:{[A.variable]:`colors.${r}.200`,[W.variable]:t.dark},pt:"2",borderTopWidth:"4px",borderTopColor:A.reference}}}),Ms=fe(e=>{const{colorScheme:r}=e;return{container:{[A.variable]:"colors.white",[W.variable]:`colors.${r}.500`,_dark:{[A.variable]:"colors.gray.900",[W.variable]:`colors.${r}.200`},color:A.reference}}}),Es={subtle:Fs,"left-accent":Is,"top-accent":Bs,solid:Ms},Ds=Ps({baseStyle:Ts,variants:Es,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:ot,defineMultiStyleConfig:js}=b(ao.keys),J=v("avatar-border-color"),Ye=v("avatar-bg"),Rs=o({borderRadius:"full",border:"0.2em solid",[J.variable]:"white",_dark:{[J.variable]:"colors.gray.800"},borderColor:J.reference}),Ws=o({[Ye.variable]:"colors.gray.200",_dark:{[Ye.variable]:"colors.whiteAlpha.400"},bgColor:Ye.reference}),Hr=v("avatar-background"),Hs=o(e=>{const{name:r,theme:t}=e,a=r?Uo({string:r}):"colors.gray.400",n=No(a)(t);let i="white";return n||(i="gray.800"),{bg:Hr.reference,"&:not([data-loaded])":{[Hr.variable]:a},color:i,[J.variable]:"colors.white",_dark:{[J.variable]:"colors.gray.800"},borderColor:J.reference,verticalAlign:"top"}}),Ls=ot(e=>({badge:C(Rs,e),excessLabel:C(Ws,e),container:C(Hs,e)}));function L(e){const r=e!=="100%"?Ur[e]:void 0;return ot({container:{width:e,height:e,fontSize:`calc(${r??e} / 2.5)`},excessLabel:{width:e,height:e},label:{fontSize:`calc(${r??e} / 2.5)`,lineHeight:e!=="100%"?r??e:void 0}})}var Vs={"2xs":L(4),xs:L(6),sm:L(8),md:L(12),lg:L(16),xl:L(24),"2xl":L(32),full:L("100%")},Os=js({baseStyle:Ls,sizes:Vs,defaultProps:{size:"md"}}),qs={Accordion:As,Alert:Ds,Avatar:Os,Badge:se,Breadcrumb:Gl,Button:rs,Checkbox:Te,CloseButton:ds,Code:vs,Container:ms,Divider:Ss,Drawer:hl,Editable:_l,Form:Tl,FormError:Dl,FormLabel:Rl,Heading:Ll,Input:u,Kbd:si,Link:ci,List:mi,Menu:wi,Modal:Di,NumberInput:Ni,PinInput:Xi,Popover:il,Progress:fn,Radio:zn,Select:Mn,Skeleton:Dn,SkipLink:Rn,Slider:Xn,Spinner:Zn,Stat:ii,Switch:da,Table:ga,Tabs:Fa,Tag:qa,Textarea:tn,Tooltip:nn,Card:is},Ns={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-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},Gs={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",wordWrap:"break-word"}}},Us="ltr",Ys={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},at={semanticTokens:Ns,direction:Us,...ro,components:qs,styles:Gs,config:Ys};function ie(e){return typeof e=="function"}function Xs(...e){return r=>e.reduce((t,a)=>a(t),r)}var Ks=e=>function(...t){let a=[...t],n=t[t.length-1];return Ft(n)&&a.length>1?a=a.slice(0,a.length-1):n=e,Xs(...a.map(i=>l=>ie(i)?i(l):Zs(l,i)))(n)},Qs=Ks(at);function Zs(...e){return Vr({},...e,nt)}function nt(e,r,t,a){if((ie(e)||ie(r))&&Object.prototype.hasOwnProperty.call(a,t))return(...n)=>{const i=ie(e)?e(...n):e,l=ie(r)?r(...n):r;return Vr({},i,l,nt)}}function Js(e={}){const{strict:r=!0,errorMessage:t="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:a}=e,n=_.createContext(void 0);n.displayName=a;function i(){var l;const d=_.useContext(n);if(!d&&r){const c=new Error(t);throw c.name="ContextError",(l=Error.captureStackTrace)==null||l.call(Error,c,i),c}return d}return[n.Provider,i,n]}function ed(e){const{cssVarsRoot:r,theme:t,children:a}=e,n=_.useMemo(()=>ut(t),[t]);return y.jsxs(vt,{theme:n,children:[y.jsx(rd,{root:r}),a]})}function rd({root:e=":host, :root"}){const r=[e,"[data-theme]"].join(",");return y.jsx(Ie,{styles:t=>({[r]:t.__cssVars})})}Js({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function td(){const{colorMode:e}=ft();return y.jsx(Ie,{styles:r=>{const t=mt(r,"styles.global"),a=gt(t,{theme:r,colorMode:e});return a?ht(a)(r):void 0}})}var it=_.createContext({getDocument(){return document},getWindow(){return window}});it.displayName="EnvironmentContext";function lt(e){const{children:r,environment:t,disabled:a}=e,n=_.useRef(null),i=_.useMemo(()=>t||{getDocument:()=>{var d,c;return(c=(d=n.current)==null?void 0:d.ownerDocument)!=null?c:document},getWindow:()=>{var d,c;return(c=(d=n.current)==null?void 0:d.ownerDocument.defaultView)!=null?c:window}},[t]),l=!a||!t;return y.jsxs(it.Provider,{value:i,children:[r,l&&y.jsx("span",{id:"__chakra_env",hidden:!0,ref:n})]})}lt.displayName="EnvironmentProvider";var od=e=>{const{children:r,colorModeManager:t,portalZIndex:a,resetCSS:n=!0,theme:i={},environment:l,cssVarsRoot:d,disableEnvironment:c}=e,$=y.jsx(lt,{environment:l,disabled:c,children:r});return y.jsx(ed,{theme:i,cssVarsRoot:d,children:y.jsxs(qr,{colorModeManager:t,options:i.config,children:[n?y.jsx(wt,{}):y.jsx(_t,{}),y.jsx(td,{}),a?y.jsx(St,{zIndex:a,children:$}):$]})})},ad=e=>function({children:t,theme:a=e,toastOptions:n,...i}){return y.jsxs(od,{theme:a,...i,children:[y.jsx(xt,{value:n==null?void 0:n.defaultOptions,children:t}),y.jsx($t,{...n})]})},nd=ad(at);function p(e,r,t=!1){e=String(e),r=String(r);const a=Array.from({length:21},(d,c)=>c*50),n=["0","5","10","15","20","25","30","35","40","45","50","55","59","64","68","73","77","82","86","95","100"],i={},l={};return a.forEach((d,c)=>{i[d]=`hsl(${e}, ${r}%, ${n[a.length-1-c]}%)`,l[d]=`hsl(${e}, ${r}%, ${n[c]}%)`}),t?l:i}const st={base:p(225,15),accent:p(250,50),working:p(47,67),warning:p(28,75),ok:p(113,70),error:p(0,76),gridLineColor:"rgba(255, 255, 255, 0.2)"};function m(e,r={}){let t=!1;function a(){if(!t){t=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function n(...g){a();for(const h of g)r[h]=c(h);return m(e,r)}function i(...g){for(const h of g)h in r||(r[h]=c(h));return m(e,r)}function l(){return Object.fromEntries(Object.entries(r).map(([h,k])=>[h,k.selector]))}function d(){return Object.fromEntries(Object.entries(r).map(([h,k])=>[h,k.className]))}function c(g){const F=`chakra-${(["container","root"].includes(g??"")?[e]:[e,g]).filter(Boolean).join("__")}`;return{className:F,selector:`.${F}`,toString:()=>g}}return{parts:n,toPart:c,extend:i,selectors:l,classnames:d,get keys(){return Object.keys(r)},__type:{}}}var id=m("accordion").parts("root","container","button","panel").extend("icon");m("alert").parts("title","description","container").extend("icon","spinner");m("avatar").parts("label","badge","container").extend("excessLabel","group");m("breadcrumb").parts("link","item","container").extend("separator");m("button").parts();var ld=m("checkbox").parts("control","icon","container").extend("label");m("progress").parts("track","filledTrack").extend("label");m("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer");m("editable").parts("preview","input","textarea");m("form").parts("container","requiredIndicator","helperText");m("formError").parts("text","icon");var sd=m("input").parts("addon","field","element");m("list").parts("container","item","icon");var dd=m("menu").parts("button","list","item").extend("groupTitle","command","divider"),cd=m("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),bd=m("numberinput").parts("root","field","stepperGroup","stepper");m("pininput").parts("field");var ud=m("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),vd=m("progress").parts("label","filledTrack","track");m("radio").parts("container","control","label");var fd=m("select").parts("field","icon"),md=m("slider").parts("container","track","thumb","filledTrack","mark");m("stat").parts("container","label","helpText","number","icon");var gd=m("switch").parts("container","track","thumb");m("table").parts("table","thead","tbody","tr","th","td","tfoot","caption");var hd=m("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator");m("tag").parts("container","label","closeButton");m("card").parts("container","header","body","footer");const{definePartsStyle:pd,defineMultiStyleConfig:yd}=b(id.keys),Sd=o({border:"none"}),xd=o(e=>{const{colorScheme:r}=e;return{fontWeight:"600",fontSize:"sm",border:"none",borderRadius:"base",bg:`${r}.800`,color:"base.100",_hover:{bg:`${r}.700`},_expanded:{bg:`${r}.750`,borderBottomRadius:"none",_hover:{bg:`${r}.700`}}}}),$d=o(e=>{const{colorScheme:r}=e;return{bg:`${r}.800`,borderRadius:"base",borderTopRadius:"none"}}),kd=o({}),_d=pd(e=>({container:Sd,button:xd(e),panel:$d(e),icon:kd})),wd=yd({variants:{invokeAI:_d},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),Cd=o(e=>{const{colorScheme:r}=e,t={bg:`${r}.600`,color:`${r}.100`,svg:{fill:`${r}.100`}};return{bg:`${r}.700`,color:`${r}.100`,borderRadius:"base",svg:{fill:`${r}.100`},_disabled:t,_hover:{bg:`${r}.650`,color:`${r}.50`,svg:{fill:`${r}.50`},_disabled:t},_checked:{bg:"accent.700",color:"accent.100",svg:{fill:"accent.100"},_disabled:t,_hover:{bg:"accent.600",color:"accent.50",svg:{fill:"accent.50"},_disabled:t}}}}),zd=S({variants:{invokeAI:Cd},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),{definePartsStyle:Ad,defineMultiStyleConfig:Pd}=b(ld.keys),Td=o(e=>{const{colorScheme:r}=e;return{_checked:{bg:`${r}.200`,borderColor:`${r}.200`,color:"base.900",_hover:{bg:`${r}.300`,borderColor:`${r}.300`},_disabled:{borderColor:"transparent",bg:"whiteAlpha.300",color:"whiteAlpha.500"}},_indeterminate:{bg:`${r}.200`,borderColor:`${r}.200`,color:"base.900"},_disabled:{bg:"whiteAlpha.100",borderColor:"transparent"},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:"red.300"}}}),Fd=Ad(e=>({control:Td(e)})),Id=Pd({variants:{invokeAI:Fd},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),Bd=o(e=>({fontSize:"sm",marginEnd:0,mb:1,fontWeight:"400",transitionProperty:"common",transitionDuration:"normal",whiteSpace:"nowrap",_disabled:{opacity:.4},color:"base.300"})),Md=S({variants:{invokeAI:Bd},defaultProps:{variant:"invokeAI"}}),Ee=e=>({outline:"none",borderWidth:2,borderStyle:"solid",borderColor:"base.800",bg:"base.900",borderRadius:"base",color:"base.100",boxShadow:"none",_hover:{borderColor:"base.600"},_focus:{borderColor:"accent.700",boxShadow:"none",_hover:{borderColor:"accent.600"}},_invalid:{borderColor:"error.700",boxShadow:"none",_hover:{borderColor:"error.600"}},_disabled:{borderColor:"base.700",bg:"base.700",color:"base.400",_hover:{borderColor:"base.700"}},_placeholder:{color:"base.400"}}),{definePartsStyle:Ed,defineMultiStyleConfig:Dd}=b(sd.keys),jd=Ed(e=>({field:Ee()})),Rd=Dd({variants:{invokeAI:jd},defaultProps:{size:"sm",variant:"invokeAI"}}),{definePartsStyle:Wd,defineMultiStyleConfig:Hd}=b(dd.keys),Ld=Wd({button:{fontWeight:"600",bg:"base.500",color:"base.200",_hover:{bg:"base.600",color:"white"}},list:{zIndex:9999,bg:"base.800"},item:{fontSize:"sm",bg:"base.800",_hover:{bg:"base.750"},_focus:{bg:"base.700"}}}),Vd=Hd({variants:{invokeAI:Ld},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:Od,definePartsStyle:qd}=b(cd.keys),Nd=o({bg:"blackAlpha.600"}),Gd=o({}),Ud=o(e=>({bg:"base.850",maxH:"80vh"})),Yd=o(e=>({fontWeight:"600",fontSize:"lg",color:"base.200"})),Xd=o({}),Kd=o({overflowY:"scroll"}),Qd=o({}),Zd=qd(e=>({overlay:Nd,dialogContainer:Gd,dialog:Ud(e),header:Yd(e),closeButton:Xd,body:Kd,footer:Qd})),Jd=Od({variants:{invokeAI:Zd},defaultProps:{variant:"invokeAI",size:"lg"}}),{defineMultiStyleConfig:ec,definePartsStyle:rc}=b(bd.keys),tc=o(e=>({height:8})),oc=o(e=>({border:"none",fontWeight:"600",height:"auto",py:1,ps:2,pe:6,...Ee()})),ac=o(e=>({display:"flex"})),nc=o(e=>({border:"none",px:2,py:0,mx:-2,my:0,svg:{color:"base.300",width:2.5,height:2.5,_hover:{color:"base.50"}}})),ic=rc(e=>({root:tc(e),field:oc(e),stepperGroup:ac(e),stepper:nc(e)})),lc=ec({variants:{invokeAI:ic},defaultProps:{size:"sm",variant:"invokeAI"}});function sc(e){return!Number.isInteger(parseFloat(e.toString()))}function dc(e,r="-"){return e.replace(/\s+/g,r)}function dt(e){const r=dc(e.toString());return r.includes("\\.")?e:sc(e)?r.replace(".","\\."):e}function cc(e,r=""){return[r,dt(e)].filter(Boolean).join("-")}function bc(e,r){return`var(${dt(e)}${r?`, ${r}`:""})`}function uc(e,r=""){return`--${cc(e,r)}`}function ar(e,r){const t=uc(e,r==null?void 0:r.prefix);return{variable:t,reference:bc(t,vc(r==null?void 0:r.fallback))}}function vc(e){return typeof e=="string"?e:e==null?void 0:e.reference}const{defineMultiStyleConfig:fc,definePartsStyle:mc}=b(ud.keys),gc=ar("popper-bg"),hc=ar("popper-arrow-bg"),pc=ar("popper-arrow-shadow-color"),yc=o(e=>({[hc.variable]:"colors.base.800",[gc.variable]:"colors.base.800",[pc.variable]:"colors.base.600",minW:"unset",width:"unset",p:4,borderWidth:"2px",borderStyle:"solid",borderColor:"base.600",bg:"base.800"})),Sc=mc(e=>({content:yc(e)})),xc=fc({variants:{invokeAI:Sc},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:$c,definePartsStyle:kc}=b(vd.keys),_c=o(e=>({bg:"accent.600",transition:"width 0.2s ease-in-out",_indeterminate:{bgGradient:"linear(to-r, transparent 0%, accent.600 50%, transparent 100%);"}})),wc=o(e=>({bg:"base.800"})),Cc=kc(e=>({filledTrack:_c(e),track:wc(e)})),zc=$c({variants:{invokeAI:Cc},defaultProps:{variant:"invokeAI"}}),Ac={"::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},{definePartsStyle:Pc,defineMultiStyleConfig:Tc}=b(fd.keys),Fc=o(e=>({color:"base.300"})),Ic=o(e=>({fontWeight:"600",...Ee()})),Bc=Pc(e=>({field:Ic(e),icon:Fc(e)})),Mc=Tc({variants:{invokeAI:Bc},defaultProps:{size:"sm",variant:"invokeAI"}}),{definePartsStyle:Ec,defineMultiStyleConfig:Dc}=b(md.keys),jc=o(e=>({bg:"base.400",h:1.5})),Rc=o(e=>{const{colorScheme:r}=e;return{bg:`${r}.600`,h:1.5}}),Wc=o(e=>({w:2,h:4})),Hc=o(e=>({fontSize:"xs",fontWeight:"500",color:"base.200",mt:2,insetInlineStart:"unset"})),Lc=Ec(e=>({track:jc(e),filledTrack:Rc(e),thumb:Wc(e),mark:Hc(e)})),Vc=Dc({variants:{invokeAI:Lc},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:Oc,definePartsStyle:qc}=b(gd.keys),Nc=o(e=>{const{colorScheme:r}=e;return{bg:"base.600",_focusVisible:{boxShadow:"none"},_checked:{bg:`${r}.600`}}}),Gc=o(e=>{const{colorScheme:r}=e;return{bg:`${r}.50`}}),Uc=qc(e=>({container:{},track:Nc(e),thumb:Gc(e)})),Yc=Oc({variants:{invokeAI:Uc},defaultProps:{size:"md",variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:Xc,definePartsStyle:Kc}=b(hd.keys),Qc=o(e=>({display:"flex",columnGap:4})),Zc=o(e=>({})),Jc=o(e=>({display:"flex",flexDirection:"column",gap:1,color:"base.700",button:{fontSize:"sm",padding:2,borderRadius:"base",_selected:{bg:"accent.700",color:"accent.100",_hover:{bg:"accent.600",color:"accent.50"}},_hover:{bg:"base.600",color:"base.50"}}})),e0=o(e=>({padding:0,height:"100%"})),r0=Kc(e=>({root:Qc(e),tab:Zc(e),tablist:Jc(e),tabpanel:e0(e)})),t0=Xc({variants:{invokeAI:r0},defaultProps:{variant:"invokeAI"}}),o0=o(e=>({color:"base.400"})),a0=S({variants:{subtext:o0}}),n0=o(e=>Ee()),i0=S({variants:{invokeAI:n0},defaultProps:{size:"md",variant:"invokeAI"}}),l0={config:{cssVarPrefix:"invokeai"},styles:{global:e=>({body:{bg:"base.900",color:"base.50",overflow:"hidden"},"*":{...Ac}})},direction:"ltr",fonts:{body:"'Inter', 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)"}},colors:{...st},components:{Button:zd,Input:Rd,Textarea:i0,Tabs:t0,Progress:zc,Accordion:wd,FormLabel:Md,Switch:Yc,NumberInput:lc,Select:Mc,Slider:Vc,Popover:xc,Modal:Jd,Checkbox:Id,Menu:Vd,Text:a0}},s0={base:p(223,10),accent:p(155,80),working:p(47,68),warning:p(28,75),ok:p(122,49),error:p(0,50),gridLineColor:"rgba(255, 255, 255, 0.2)"},d0={base:p(223,10,!0),accent:p(40,80,!0),working:p(47,68,!0),warning:p(28,75,!0),ok:p(122,49,!0),error:p(0,50,!0),gridLineColor:"rgba(0, 0, 0, 0.2)"},c0={base:p(220,30),accent:p(210,80),working:p(47,68),warning:p(28,75),ok:p(122,49),error:p(0,100),gridLineColor:"rgba(136, 148, 184, 0.2)"},b0={dark:st,light:d0,green:s0,ocean:c0};function f0({children:e}){const{i18n:r}=pt(),t=kt(i=>i.ui.currentTheme),a=r.dir(),n=Qs({...l0,colors:b0[t],direction:a});return _.useEffect(()=>{document.body.dir=a},[a]),y.jsx(nd,{theme:n,children:e})}export{f0 as default}; diff --git a/invokeai/frontend/web/dist/assets/index-2ad84bef.js b/invokeai/frontend/web/dist/assets/index-2ad84bef.js new file mode 100644 index 0000000000..05b8946258 --- /dev/null +++ b/invokeai/frontend/web/dist/assets/index-2ad84bef.js @@ -0,0 +1,115 @@ +function h2(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var yn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function AL(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var jt={},IL={get exports(){return jt},set exports(t){jt=t}},hh={},be={},LL={get exports(){return be},set exports(t){be=t}},De={};/** + * @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 qu=Symbol.for("react.element"),ML=Symbol.for("react.portal"),DL=Symbol.for("react.fragment"),NL=Symbol.for("react.strict_mode"),BL=Symbol.for("react.profiler"),FL=Symbol.for("react.provider"),$L=Symbol.for("react.context"),zL=Symbol.for("react.forward_ref"),GL=Symbol.for("react.suspense"),UL=Symbol.for("react.memo"),jL=Symbol.for("react.lazy"),qS=Symbol.iterator;function WL(t){return t===null||typeof t!="object"?null:(t=qS&&t[qS]||t["@@iterator"],typeof t=="function"?t:null)}var p2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g2=Object.assign,m2={};function Us(t,e,n){this.props=t,this.context=e,this.refs=m2,this.updater=n||p2}Us.prototype.isReactComponent={};Us.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};Us.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function v2(){}v2.prototype=Us.prototype;function my(t,e,n){this.props=t,this.context=e,this.refs=m2,this.updater=n||p2}var vy=my.prototype=new v2;vy.constructor=my;g2(vy,Us.prototype);vy.isPureReactComponent=!0;var KS=Array.isArray,y2=Object.prototype.hasOwnProperty,yy={current:null},S2={key:!0,ref:!0,__self:!0,__source:!0};function _2(t,e,n){var r,i={},a=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(a=""+e.key),e)y2.call(e,r)&&!S2.hasOwnProperty(r)&&(i[r]=e[r]);var u=arguments.length-2;if(u===1)i.children=n;else if(1>>1,ve=W[oe];if(0>>1;oei(At,Q))mei(qt,At)?(W[oe]=qt,W[me]=Q,oe=me):(W[oe]=At,W[Ue]=Q,oe=Ue);else if(mei(qt,Q))W[oe]=qt,W[me]=Q,oe=me;else break e}}return Y}function i(W,Y){var Q=W.sortIndex-Y.sortIndex;return Q!==0?Q:W.id-Y.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var s=Date,u=s.now();t.unstable_now=function(){return s.now()-u}}var c=[],f=[],h=1,p=null,g=3,y=!1,v=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(W){for(var Y=n(f);Y!==null;){if(Y.callback===null)r(f);else if(Y.startTime<=W)r(f),Y.sortIndex=Y.expirationTime,e(c,Y);else break;Y=n(f)}}function O(W){if(w=!1,C(W),!v)if(n(c)!==null)v=!0,V(I);else{var Y=n(f);Y!==null&&ie(O,Y.startTime-W)}}function I(W,Y){v=!1,w&&(w=!1,_(U),U=-1),y=!0;var Q=g;try{for(C(Y),p=n(c);p!==null&&(!(p.expirationTime>Y)||W&&!te());){var oe=p.callback;if(typeof oe=="function"){p.callback=null,g=p.priorityLevel;var ve=oe(p.expirationTime<=Y);Y=t.unstable_now(),typeof ve=="function"?p.callback=ve:p===n(c)&&r(c),C(Y)}else r(c);p=n(c)}if(p!==null)var we=!0;else{var Ue=n(f);Ue!==null&&ie(O,Ue.startTime-Y),we=!1}return we}finally{p=null,g=Q,y=!1}}var L=!1,D=null,U=-1,X=5,K=-1;function te(){return!(t.unstable_now()-KW||125oe?(W.sortIndex=Q,e(f,W),n(c)===null&&W===n(f)&&(w?(_(U),U=-1):w=!0,ie(O,Q-oe))):(W.sortIndex=ve,e(c,W),v||y||(v=!0,V(I))),W},t.unstable_shouldYield=te,t.unstable_wrapCallback=function(W){var Y=g;return function(){var Q=g;g=Y;try{return W.apply(this,arguments)}finally{g=Q}}}})(b2);(function(t){t.exports=b2})(nM);/** + * @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 C2=be,Yn=$m;function ae(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zm=Object.prototype.hasOwnProperty,rM=/^[: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]*$/,QS={},JS={};function iM(t){return zm.call(JS,t)?!0:zm.call(QS,t)?!1:rM.test(t)?JS[t]=!0:(QS[t]=!0,!1)}function aM(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function oM(t,e,n,r){if(e===null||typeof e>"u"||aM(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function wn(t,e,n,r,i,a,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=a,this.removeEmptyString=s}var nn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){nn[t]=new wn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];nn[e]=new wn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){nn[t]=new wn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){nn[t]=new wn(t,2,!1,t,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(t){nn[t]=new wn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){nn[t]=new wn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){nn[t]=new wn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){nn[t]=new wn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){nn[t]=new wn(t,5,!1,t.toLowerCase(),null,!1,!1)});var _y=/[\-:]([a-z])/g;function wy(t){return t[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(t){var e=t.replace(_y,wy);nn[e]=new wn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(_y,wy);nn[e]=new wn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(_y,wy);nn[e]=new wn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){nn[t]=new wn(t,1,!1,t.toLowerCase(),null,!1,!1)});nn.xlinkHref=new wn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){nn[t]=new wn(t,1,!1,t.toLowerCase(),null,!0,!0)});function by(t,e,n,r){var i=nn.hasOwnProperty(e)?nn[e]:null;(i!==null?i.type!==0:r||!(2u||i[s]!==a[u]){var c=` +`+i[s].replace(" at new "," at ");return t.displayName&&c.includes("")&&(c=c.replace("",t.displayName)),c}while(1<=s&&0<=u);break}}}finally{Wg=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Kl(t):""}function sM(t){switch(t.tag){case 5:return Kl(t.type);case 16:return Kl("Lazy");case 13:return Kl("Suspense");case 19:return Kl("SuspenseList");case 0:case 2:case 15:return t=Hg(t.type,!1),t;case 11:return t=Hg(t.type.render,!1),t;case 1:return t=Hg(t.type,!0),t;default:return""}}function Wm(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ls:return"Fragment";case ss:return"Portal";case Gm:return"Profiler";case Cy:return"StrictMode";case Um:return"Suspense";case jm:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case P2:return(t.displayName||"Context")+".Consumer";case k2:return(t._context.displayName||"Context")+".Provider";case xy:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ky:return e=t.displayName||null,e!==null?e:Wm(t.type)||"Memo";case ca:e=t._payload,t=t._init;try{return Wm(t(e))}catch{}}return null}function lM(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Wm(e);case 8:return e===Cy?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Oa(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function O2(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function uM(t){var e=O2(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,a=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,a.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function df(t){t._valueTracker||(t._valueTracker=uM(t))}function T2(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=O2(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function kd(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Hm(t,e){var n=e.checked;return mt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function e_(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Oa(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function R2(t,e){e=e.checked,e!=null&&by(t,"checked",e,!1)}function Vm(t,e){R2(t,e);var n=Oa(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?qm(t,e.type,n):e.hasOwnProperty("defaultValue")&&qm(t,e.type,Oa(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function t_(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function qm(t,e,n){(e!=="number"||kd(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Yl=Array.isArray;function _s(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=hf.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function wu(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var ou={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},cM=["Webkit","ms","Moz","O"];Object.keys(ou).forEach(function(t){cM.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ou[e]=ou[t]})});function M2(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||ou.hasOwnProperty(t)&&ou[t]?(""+e).trim():e+"px"}function D2(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=M2(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var fM=mt({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 Xm(t,e){if(e){if(fM[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ae(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ae(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ae(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ae(62))}}function Qm(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 Jm=null;function Py(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Zm=null,ws=null,bs=null;function i_(t){if(t=Xu(t)){if(typeof Zm!="function")throw Error(ae(280));var e=t.stateNode;e&&(e=yh(e),Zm(t.stateNode,t.type,e))}}function N2(t){ws?bs?bs.push(t):bs=[t]:ws=t}function B2(){if(ws){var t=ws,e=bs;if(bs=ws=null,i_(t),e)for(t=0;t>>=0,t===0?32:31-(bM(t)/CM|0)|0}var pf=64,gf=4194304;function Xl(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Td(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,a=t.pingedLanes,s=n&268435455;if(s!==0){var u=s&~i;u!==0?r=Xl(u):(a&=s,a!==0&&(r=Xl(a)))}else s=n&~i,s!==0?r=Xl(s):a!==0&&(r=Xl(a));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,a=e&-e,i>=a||i===16&&(a&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Ku(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Fr(e),t[e]=n}function EM(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=lu),h_=String.fromCharCode(32),p_=!1;function rC(t,e){switch(t){case"keyup":return tD.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function iC(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var us=!1;function rD(t,e){switch(t){case"compositionend":return iC(e);case"keypress":return e.which!==32?null:(p_=!0,h_);case"textInput":return t=e.data,t===h_&&p_?null:t;default:return null}}function iD(t,e){if(us)return t==="compositionend"||!My&&rC(t,e)?(t=tC(),Jf=Ay=ga=null,us=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=y_(n)}}function lC(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?lC(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function uC(){for(var t=window,e=kd();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=kd(t.document)}return e}function Dy(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function hD(t){var e=uC(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&lC(n.ownerDocument.documentElement,n)){if(r!==null&&Dy(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!t.extend&&a>r&&(i=r,r=a,a=i),i=S_(n,a);var s=S_(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),a>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,cs=null,av=null,cu=null,ov=!1;function __(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ov||cs==null||cs!==kd(r)||(r=cs,"selectionStart"in r&&Dy(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}),cu&&Eu(cu,r)||(cu=r,r=Id(av,"onSelect"),0hs||(t.current=dv[hs],dv[hs]=null,hs--)}function at(t,e){hs++,dv[hs]=t.current,t.current=e}var Ta={},fn=La(Ta),Rn=La(!1),so=Ta;function Ls(t,e){var n=t.type.contextTypes;if(!n)return Ta;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=e[a];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function An(t){return t=t.childContextTypes,t!=null}function Md(){lt(Rn),lt(fn)}function E_(t,e,n){if(fn.current!==Ta)throw Error(ae(168));at(fn,e),at(Rn,n)}function yC(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(ae(108,lM(t)||"Unknown",i));return mt({},n,r)}function Dd(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Ta,so=fn.current,at(fn,t),at(Rn,Rn.current),!0}function O_(t,e,n){var r=t.stateNode;if(!r)throw Error(ae(169));n?(t=yC(t,e,so),r.__reactInternalMemoizedMergedChildContext=t,lt(Rn),lt(fn),at(fn,t)):lt(Rn),at(Rn,n)}var Mi=null,Sh=!1,am=!1;function SC(t){Mi===null?Mi=[t]:Mi.push(t)}function kD(t){Sh=!0,SC(t)}function Ma(){if(!am&&Mi!==null){am=!0;var t=0,e=Qe;try{var n=Mi;for(Qe=1;t>=s,i-=s,Di=1<<32-Fr(e)+i|n<U?(X=D,D=null):X=D.sibling;var K=g(_,D,C[U],O);if(K===null){D===null&&(D=X);break}t&&D&&K.alternate===null&&e(_,D),S=a(K,S,U),L===null?I=K:L.sibling=K,L=K,D=X}if(U===C.length)return n(_,D),ft&&Qa(_,U),I;if(D===null){for(;UU?(X=D,D=null):X=D.sibling;var te=g(_,D,K.value,O);if(te===null){D===null&&(D=X);break}t&&D&&te.alternate===null&&e(_,D),S=a(te,S,U),L===null?I=te:L.sibling=te,L=te,D=X}if(K.done)return n(_,D),ft&&Qa(_,U),I;if(D===null){for(;!K.done;U++,K=C.next())K=p(_,K.value,O),K!==null&&(S=a(K,S,U),L===null?I=K:L.sibling=K,L=K);return ft&&Qa(_,U),I}for(D=r(_,D);!K.done;U++,K=C.next())K=y(D,_,U,K.value,O),K!==null&&(t&&K.alternate!==null&&D.delete(K.key===null?U:K.key),S=a(K,S,U),L===null?I=K:L.sibling=K,L=K);return t&&D.forEach(function(ce){return e(_,ce)}),ft&&Qa(_,U),I}function x(_,S,C,O){if(typeof C=="object"&&C!==null&&C.type===ls&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case ff:e:{for(var I=C.key,L=S;L!==null;){if(L.key===I){if(I=C.type,I===ls){if(L.tag===7){n(_,L.sibling),S=i(L,C.props.children),S.return=_,_=S;break e}}else if(L.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===ca&&D_(I)===L.type){n(_,L.sibling),S=i(L,C.props),S.ref=Ll(_,L,C),S.return=_,_=S;break e}n(_,L);break}else e(_,L);L=L.sibling}C.type===ls?(S=oo(C.props.children,_.mode,O,C.key),S.return=_,_=S):(O=od(C.type,C.key,C.props,null,_.mode,O),O.ref=Ll(_,S,C),O.return=_,_=O)}return s(_);case ss:e:{for(L=C.key;S!==null;){if(S.key===L)if(S.tag===4&&S.stateNode.containerInfo===C.containerInfo&&S.stateNode.implementation===C.implementation){n(_,S.sibling),S=i(S,C.children||[]),S.return=_,_=S;break e}else{n(_,S);break}else e(_,S);S=S.sibling}S=hm(C,_.mode,O),S.return=_,_=S}return s(_);case ca:return L=C._init,x(_,S,L(C._payload),O)}if(Yl(C))return v(_,S,C,O);if(Ol(C))return w(_,S,C,O);bf(_,C)}return typeof C=="string"&&C!==""||typeof C=="number"?(C=""+C,S!==null&&S.tag===6?(n(_,S.sibling),S=i(S,C),S.return=_,_=S):(n(_,S),S=dm(C,_.mode,O),S.return=_,_=S),s(_)):n(_,S)}return x}var Ds=EC(!0),OC=EC(!1),Qu={},si=La(Qu),Au=La(Qu),Iu=La(Qu);function ro(t){if(t===Qu)throw Error(ae(174));return t}function Wy(t,e){switch(at(Iu,e),at(Au,t),at(si,Qu),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ym(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ym(e,t)}lt(si),at(si,e)}function Ns(){lt(si),lt(Au),lt(Iu)}function TC(t){ro(Iu.current);var e=ro(si.current),n=Ym(e,t.type);e!==n&&(at(Au,t),at(si,n))}function Hy(t){Au.current===t&&(lt(si),lt(Au))}var pt=La(0);function Gd(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var om=[];function Vy(){for(var t=0;tn?n:4,t(!0);var r=sm.transition;sm.transition={};try{t(!1),e()}finally{Qe=n,sm.transition=r}}function HC(){return vr().memoizedState}function TD(t,e,n){var r=xa(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},VC(t))qC(e,n);else if(n=CC(t,e,n,r),n!==null){var i=Sn();$r(n,t,r,i),KC(n,e,r)}}function RD(t,e,n){var r=xa(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(VC(t))qC(e,i);else{var a=t.alternate;if(t.lanes===0&&(a===null||a.lanes===0)&&(a=e.lastRenderedReducer,a!==null))try{var s=e.lastRenderedState,u=a(s,n);if(i.hasEagerState=!0,i.eagerState=u,Gr(u,s)){var c=e.interleaved;c===null?(i.next=i,Uy(e)):(i.next=c.next,c.next=i),e.interleaved=i;return}}catch{}finally{}n=CC(t,e,i,r),n!==null&&(i=Sn(),$r(n,t,r,i),KC(n,e,r))}}function VC(t){var e=t.alternate;return t===gt||e!==null&&e===gt}function qC(t,e){fu=Ud=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function KC(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Oy(t,n)}}var jd={readContext:mr,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useInsertionEffect:on,useLayoutEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useMutableSource:on,useSyncExternalStore:on,useId:on,unstable_isNewReconciler:!1},AD={readContext:mr,useCallback:function(t,e){return Zr().memoizedState=[t,e===void 0?null:e],t},useContext:mr,useEffect:B_,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,nd(4194308,4,zC.bind(null,e,t),n)},useLayoutEffect:function(t,e){return nd(4194308,4,t,e)},useInsertionEffect:function(t,e){return nd(4,2,t,e)},useMemo:function(t,e){var n=Zr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Zr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=TD.bind(null,gt,t),[r.memoizedState,t]},useRef:function(t){var e=Zr();return t={current:t},e.memoizedState=t},useState:N_,useDebugValue:Qy,useDeferredValue:function(t){return Zr().memoizedState=t},useTransition:function(){var t=N_(!1),e=t[0];return t=OD.bind(null,t[1]),Zr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=gt,i=Zr();if(ft){if(n===void 0)throw Error(ae(407));n=n()}else{if(n=e(),Ht===null)throw Error(ae(349));uo&30||IC(r,e,n)}i.memoizedState=n;var a={value:n,getSnapshot:e};return i.queue=a,B_(MC.bind(null,r,a,t),[t]),r.flags|=2048,Du(9,LC.bind(null,r,a,n,e),void 0,null),n},useId:function(){var t=Zr(),e=Ht.identifierPrefix;if(ft){var n=Ni,r=Di;n=(r&~(1<<32-Fr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Lu++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[ri]=e,t[Ru]=r,rx(t,e,!1,!1),e.stateNode=t;e:{switch(s=Qm(n,r),n){case"dialog":ot("cancel",t),ot("close",t),i=r;break;case"iframe":case"object":case"embed":ot("load",t),i=r;break;case"video":case"audio":for(i=0;iFs&&(e.flags|=128,r=!0,Ml(a,!1),e.lanes=4194304)}else{if(!r)if(t=Gd(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Ml(a,!0),a.tail===null&&a.tailMode==="hidden"&&!s.alternate&&!ft)return sn(e),null}else 2*Pt()-a.renderingStartTime>Fs&&n!==1073741824&&(e.flags|=128,r=!0,Ml(a,!1),e.lanes=4194304);a.isBackwards?(s.sibling=e.child,e.child=s):(n=a.last,n!==null?n.sibling=s:e.child=s,a.last=s)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=Pt(),e.sibling=null,n=pt.current,at(pt,r?n&1|2:n&1),e):(sn(e),null);case 22:case 23:return r0(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?jn&1073741824&&(sn(e),e.subtreeFlags&6&&(e.flags|=8192)):sn(e),null;case 24:return null;case 25:return null}throw Error(ae(156,e.tag))}function $D(t,e){switch(By(e),e.tag){case 1:return An(e.type)&&Md(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ns(),lt(Rn),lt(fn),Vy(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Hy(e),null;case 13:if(lt(pt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ae(340));Ms()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return lt(pt),null;case 4:return Ns(),null;case 10:return Gy(e.type._context),null;case 22:case 23:return r0(),null;case 24:return null;default:return null}}var xf=!1,cn=!1,zD=typeof WeakSet=="function"?WeakSet:Set,he=null;function vs(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){wt(t,e,r)}else n.current=null}function xv(t,e,n){try{n()}catch(r){wt(t,e,r)}}var V_=!1;function GD(t,e){if(sv=Rd,t=uC(),Dy(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var s=0,u=-1,c=-1,f=0,h=0,p=t,g=null;t:for(;;){for(var y;p!==n||i!==0&&p.nodeType!==3||(u=s+i),p!==a||r!==0&&p.nodeType!==3||(c=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(y=p.firstChild)!==null;)g=p,p=y;for(;;){if(p===t)break t;if(g===n&&++f===i&&(u=s),g===a&&++h===r&&(c=s),(y=p.nextSibling)!==null)break;p=g,g=p.parentNode}p=y}n=u===-1||c===-1?null:{start:u,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(lv={focusedElem:t,selectionRange:n},Rd=!1,he=e;he!==null;)if(e=he,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,he=t;else for(;he!==null;){e=he;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var w=v.memoizedProps,x=v.memoizedState,_=e.stateNode,S=_.getSnapshotBeforeUpdate(e.elementType===e.type?w:Lr(e.type,w),x);_.__reactInternalSnapshotBeforeUpdate=S}break;case 3:var C=e.stateNode.containerInfo;C.nodeType===1?C.textContent="":C.nodeType===9&&C.documentElement&&C.removeChild(C.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ae(163))}}catch(O){wt(e,e.return,O)}if(t=e.sibling,t!==null){t.return=e.return,he=t;break}he=e.return}return v=V_,V_=!1,v}function du(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var a=i.destroy;i.destroy=void 0,a!==void 0&&xv(e,n,a)}i=i.next}while(i!==r)}}function bh(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function kv(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function ox(t){var e=t.alternate;e!==null&&(t.alternate=null,ox(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ri],delete e[Ru],delete e[fv],delete e[CD],delete e[xD])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function sx(t){return t.tag===5||t.tag===3||t.tag===4}function q_(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||sx(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Pv(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Ld));else if(r!==4&&(t=t.child,t!==null))for(Pv(t,e,n),t=t.sibling;t!==null;)Pv(t,e,n),t=t.sibling}function Ev(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Ev(t,e,n),t=t.sibling;t!==null;)Ev(t,e,n),t=t.sibling}var Zt=null,Mr=!1;function sa(t,e,n){for(n=n.child;n!==null;)lx(t,e,n),n=n.sibling}function lx(t,e,n){if(oi&&typeof oi.onCommitFiberUnmount=="function")try{oi.onCommitFiberUnmount(ph,n)}catch{}switch(n.tag){case 5:cn||vs(n,e);case 6:var r=Zt,i=Mr;Zt=null,sa(t,e,n),Zt=r,Mr=i,Zt!==null&&(Mr?(t=Zt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Zt.removeChild(n.stateNode));break;case 18:Zt!==null&&(Mr?(t=Zt,n=n.stateNode,t.nodeType===8?im(t.parentNode,n):t.nodeType===1&&im(t,n),ku(t)):im(Zt,n.stateNode));break;case 4:r=Zt,i=Mr,Zt=n.stateNode.containerInfo,Mr=!0,sa(t,e,n),Zt=r,Mr=i;break;case 0:case 11:case 14:case 15:if(!cn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,s=a.destroy;a=a.tag,s!==void 0&&(a&2||a&4)&&xv(n,e,s),i=i.next}while(i!==r)}sa(t,e,n);break;case 1:if(!cn&&(vs(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){wt(n,e,u)}sa(t,e,n);break;case 21:sa(t,e,n);break;case 22:n.mode&1?(cn=(r=cn)||n.memoizedState!==null,sa(t,e,n),cn=r):sa(t,e,n);break;default:sa(t,e,n)}}function K_(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new zD),e.forEach(function(r){var i=XD.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Rr(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~a}if(r=i,r=Pt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*jD(r/1960))-r,10t?16:t,ma===null)var r=!1;else{if(t=ma,ma=null,Vd=0,$e&6)throw Error(ae(331));var i=$e;for($e|=4,he=t.current;he!==null;){var a=he,s=a.child;if(he.flags&16){var u=a.deletions;if(u!==null){for(var c=0;cPt()-t0?ao(t,0):e0|=n),In(t,e)}function mx(t,e){e===0&&(t.mode&1?(e=gf,gf<<=1,!(gf&130023424)&&(gf=4194304)):e=1);var n=Sn();t=Gi(t,e),t!==null&&(Ku(t,e,n),In(t,n))}function YD(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),mx(t,n)}function XD(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(ae(314))}r!==null&&r.delete(e),mx(t,n)}var vx;vx=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Rn.current)Tn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Tn=!1,BD(t,e,n);Tn=!!(t.flags&131072)}else Tn=!1,ft&&e.flags&1048576&&_C(e,Bd,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;rd(t,e),t=e.pendingProps;var i=Ls(e,fn.current);xs(e,n),i=Ky(null,e,r,t,i,n);var a=Yy();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,An(r)?(a=!0,Dd(e)):a=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,jy(e),i.updater=_h,e.stateNode=i,i._reactInternals=e,vv(e,r,t,n),e=_v(null,e,r,!0,a,n)):(e.tag=0,ft&&a&&Ny(e),vn(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(rd(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=JD(r),t=Lr(r,t),i){case 0:e=Sv(null,e,r,t,n);break e;case 1:e=j_(null,e,r,t,n);break e;case 11:e=G_(null,e,r,t,n);break e;case 14:e=U_(null,e,r,Lr(r.type,t),n);break e}throw Error(ae(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Lr(r,i),Sv(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Lr(r,i),j_(t,e,r,i,n);case 3:e:{if(ex(e),t===null)throw Error(ae(387));r=e.pendingProps,a=e.memoizedState,i=a.element,xC(t,e),zd(e,r,null,n);var s=e.memoizedState;if(r=s.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=a,e.memoizedState=a,e.flags&256){i=Bs(Error(ae(423)),e),e=W_(t,e,r,n,i);break e}else if(r!==i){i=Bs(Error(ae(424)),e),e=W_(t,e,r,n,i);break e}else for(Hn=wa(e.stateNode.containerInfo.firstChild),Vn=e,ft=!0,Nr=null,n=OC(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ms(),r===i){e=Ui(t,e,n);break e}vn(t,e,r,n)}e=e.child}return e;case 5:return TC(e),t===null&&pv(e),r=e.type,i=e.pendingProps,a=t!==null?t.memoizedProps:null,s=i.children,uv(r,i)?s=null:a!==null&&uv(r,a)&&(e.flags|=32),ZC(t,e),vn(t,e,s,n),e.child;case 6:return t===null&&pv(e),null;case 13:return tx(t,e,n);case 4:return Wy(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Ds(e,null,r,n):vn(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Lr(r,i),G_(t,e,r,i,n);case 7:return vn(t,e,e.pendingProps,n),e.child;case 8:return vn(t,e,e.pendingProps.children,n),e.child;case 12:return vn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,a=e.memoizedProps,s=i.value,at(Fd,r._currentValue),r._currentValue=s,a!==null)if(Gr(a.value,s)){if(a.children===i.children&&!Rn.current){e=Ui(t,e,n);break e}}else for(a=e.child,a!==null&&(a.return=e);a!==null;){var u=a.dependencies;if(u!==null){s=a.child;for(var c=u.firstContext;c!==null;){if(c.context===r){if(a.tag===1){c=Bi(-1,n&-n),c.tag=2;var f=a.updateQueue;if(f!==null){f=f.shared;var h=f.pending;h===null?c.next=c:(c.next=h.next,h.next=c),f.pending=c}}a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),gv(a.return,n,e),u.lanes|=n;break}c=c.next}}else if(a.tag===10)s=a.type===e.type?null:a.child;else if(a.tag===18){if(s=a.return,s===null)throw Error(ae(341));s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),gv(s,n,e),s=a.sibling}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}vn(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,xs(e,n),i=mr(i),r=r(i),e.flags|=1,vn(t,e,r,n),e.child;case 14:return r=e.type,i=Lr(r,e.pendingProps),i=Lr(r.type,i),U_(t,e,r,i,n);case 15:return QC(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Lr(r,i),rd(t,e),e.tag=1,An(r)?(t=!0,Dd(e)):t=!1,xs(e,n),PC(e,r,i),vv(e,r,i,n),_v(null,e,r,!0,t,n);case 19:return nx(t,e,n);case 22:return JC(t,e,n)}throw Error(ae(156,e.tag))};function yx(t,e){return W2(t,e)}function QD(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 hr(t,e,n,r){return new QD(t,e,n,r)}function a0(t){return t=t.prototype,!(!t||!t.isReactComponent)}function JD(t){if(typeof t=="function")return a0(t)?1:0;if(t!=null){if(t=t.$$typeof,t===xy)return 11;if(t===ky)return 14}return 2}function ka(t,e){var n=t.alternate;return n===null?(n=hr(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function od(t,e,n,r,i,a){var s=2;if(r=t,typeof t=="function")a0(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case ls:return oo(n.children,i,a,e);case Cy:s=8,i|=8;break;case Gm:return t=hr(12,n,e,i|2),t.elementType=Gm,t.lanes=a,t;case Um:return t=hr(13,n,e,i),t.elementType=Um,t.lanes=a,t;case jm:return t=hr(19,n,e,i),t.elementType=jm,t.lanes=a,t;case E2:return xh(n,i,a,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case k2:s=10;break e;case P2:s=9;break e;case xy:s=11;break e;case ky:s=14;break e;case ca:s=16,r=null;break e}throw Error(ae(130,t==null?t:typeof t,""))}return e=hr(s,n,e,i),e.elementType=t,e.type=r,e.lanes=a,e}function oo(t,e,n,r){return t=hr(7,t,r,e),t.lanes=n,t}function xh(t,e,n,r){return t=hr(22,t,r,e),t.elementType=E2,t.lanes=n,t.stateNode={isHidden:!1},t}function dm(t,e,n){return t=hr(6,t,null,e),t.lanes=n,t}function hm(t,e,n){return e=hr(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function ZD(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qg(0),this.expirationTimes=qg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qg(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function o0(t,e,n,r,i,a,s,u,c){return t=new ZD(t,e,n,u,c),e===1?(e=1,a===!0&&(e|=8)):e=0,a=hr(3,null,null,e),t.current=a,a.stateNode=t,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},jy(a),t}function e3(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}e(),t.exports=Qn})(tM);var nw=xd;Fm.createRoot=nw.createRoot,Fm.hydrateRoot=nw.hydrateRoot;const a3="modulepreload",o3=function(t,e){return new URL(t,e).href},rw={},bx=function(e,n,r){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(a=>{if(a=o3(a,r),a in rw)return;rw[a]=!0;const s=a.endsWith(".css"),u=s?'[rel="stylesheet"]':"";if(!!r)for(let h=i.length-1;h>=0;h--){const p=i[h];if(p.href===a&&(!s||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${u}`))return;const f=document.createElement("link");if(f.rel=s?"stylesheet":a3,s||(f.as="script",f.crossOrigin=""),f.href=a,document.head.appendChild(f),s)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${a}`)))})})).then(()=>e())};var Iv={},s3={get exports(){return Iv},set exports(t){Iv=t}},Cx={};/** + * @license React + * use-sync-external-store-shim.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 $s=be;function l3(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var u3=typeof Object.is=="function"?Object.is:l3,c3=$s.useState,f3=$s.useEffect,d3=$s.useLayoutEffect,h3=$s.useDebugValue;function p3(t,e){var n=e(),r=c3({inst:{value:n,getSnapshot:e}}),i=r[0].inst,a=r[1];return d3(function(){i.value=n,i.getSnapshot=e,pm(i)&&a({inst:i})},[t,n,e]),f3(function(){return pm(i)&&a({inst:i}),t(function(){pm(i)&&a({inst:i})})},[t]),h3(n),n}function pm(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!u3(t,n)}catch{return!0}}function g3(t,e){return e()}var m3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g3:p3;Cx.useSyncExternalStore=$s.useSyncExternalStore!==void 0?$s.useSyncExternalStore:m3;(function(t){t.exports=Cx})(s3);var Lv={},v3={get exports(){return Lv},set exports(t){Lv=t}},xx={};/** + * @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 Th=be,y3=Iv;function S3(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var _3=typeof Object.is=="function"?Object.is:S3,w3=y3.useSyncExternalStore,b3=Th.useRef,C3=Th.useEffect,x3=Th.useMemo,k3=Th.useDebugValue;xx.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var a=b3(null);if(a.current===null){var s={hasValue:!1,value:null};a.current=s}else s=a.current;a=x3(function(){function c(y){if(!f){if(f=!0,h=y,y=r(y),i!==void 0&&s.hasValue){var v=s.value;if(i(v,y))return p=v}return p=y}if(v=p,_3(h,y))return v;var w=r(y);return i!==void 0&&i(v,w)?v:(h=y,p=w)}var f=!1,h,p,g=n===void 0?null:n;return[function(){return c(e())},g===null?void 0:function(){return c(g())}]},[e,n,r,i]);var u=w3(t,a[0],a[1]);return C3(function(){s.hasValue=!0,s.value=u},[u]),k3(u),u};(function(t){t.exports=xx})(v3);function P3(t){t()}let kx=P3;const E3=t=>kx=t,O3=()=>kx,Yd=be.createContext(null);function T3(){return be.useContext(Yd)}const R3=()=>{throw new Error("uSES not initialized!")};let Px=R3;const A3=t=>{Px=t},I3=(t,e)=>t===e;function L3(t=Yd){const e=t===Yd?T3:()=>be.useContext(t);return function(r,i=I3){const{store:a,subscription:s,getServerState:u}=e(),c=Px(s.addNestedSub,a.getState,u||a.getState,r,i);return be.useDebugValue(c),c}}const IG=L3();function Xd(){return Xd=Object.assign?Object.assign.bind():function(t){for(var e=1;e{let r=e;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=e;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,a=n={callback:r,next:null,prev:n};return a.prev?a.prev.next=a:e=a,function(){!i||e===null||(i=!1,a.next?a.next.prev=a.prev:n=a.prev,a.prev?a.prev.next=a.next:e=a.next)}}}}const aw={notify(){},get:()=>[]};function V3(t,e){let n,r=aw;function i(p){return c(),r.subscribe(p)}function a(){r.notify()}function s(){h.onStateChange&&h.onStateChange()}function u(){return Boolean(n)}function c(){n||(n=e?e.addNestedSub(s):t.subscribe(s),r=H3())}function f(){n&&(n(),n=void 0,r.clear(),r=aw)}const h={addNestedSub:i,notifyNestedSubs:a,handleChangeWrapper:s,isSubscribed:u,trySubscribe:c,tryUnsubscribe:f,getListeners:()=>r};return h}const q3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",K3=q3?be.useLayoutEffect:be.useEffect;function Y3({store:t,context:e,children:n,serverState:r}){const i=be.useMemo(()=>{const u=V3(t);return{store:t,subscription:u,getServerState:r?()=>r:void 0}},[t,r]),a=be.useMemo(()=>t.getState(),[t]);K3(()=>{const{subscription:u}=i;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),a!==t.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[i,a]);const s=e||Yd;return As.createElement(s.Provider,{value:i},n)}A3(Lv.useSyncExternalStoreWithSelector);E3(xd.unstable_batchedUpdates);function sd(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?sd=function(n){return typeof n}:sd=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},sd(t)}function X3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ow(t,e){for(var n=0;n1?e-1:0),r=1;r3?e.i-4:e.i:Array.isArray(t)?1:g0(t)?2:m0(t)?3:0}function Ps(t,e){return Hs(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function eN(t,e){return Hs(t)===2?t.get(e):t[e]}function Ix(t,e,n){var r=Hs(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function Lx(t,e){return t===e?t!==0||1/t==1/e:t!=t&&e!=e}function g0(t){return oN&&t instanceof Map}function m0(t){return sN&&t instanceof Set}function Za(t){return t.o||t.t}function v0(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=Dx(t);delete e[ct];for(var n=Es(e),r=0;r1&&(t.set=t.add=t.clear=t.delete=tN),Object.freeze(t),e&&ho(t,function(n,r){return y0(r,!0)},!0)),t}function tN(){Br(2)}function S0(t){return t==null||typeof t!="object"||Object.isFrozen(t)}function li(t){var e=zv[t];return e||Br(18,t),e}function nN(t,e){zv[t]||(zv[t]=e)}function Bv(){return Bu}function gm(t,e){e&&(li("Patches"),t.u=[],t.s=[],t.v=e)}function Qd(t){Fv(t),t.p.forEach(rN),t.p=null}function Fv(t){t===Bu&&(Bu=t.l)}function sw(t){return Bu={p:[],l:Bu,h:t,m:!0,_:0}}function rN(t){var e=t[ct];e.i===0||e.i===1?e.j():e.O=!0}function mm(t,e){e._=e.p.length;var n=e.p[0],r=t!==void 0&&t!==n;return e.h.g||li("ES5").S(e,t,r),r?(n[ct].P&&(Qd(e),Br(4)),ji(t)&&(t=Jd(e,t),e.l||Zd(e,t)),e.u&&li("Patches").M(n[ct].t,t,e.u,e.s)):t=Jd(e,n,[]),Qd(e),e.u&&e.v(e.u,e.s),t!==Mx?t:void 0}function Jd(t,e,n){if(S0(e))return e;var r=e[ct];if(!r)return ho(e,function(u,c){return lw(t,r,e,u,c,n)},!0),e;if(r.A!==t)return e;if(!r.P)return Zd(t,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=v0(r.k):r.o,a=i,s=!1;r.i===3&&(a=new Set(i),i.clear(),s=!0),ho(a,function(u,c){return lw(t,r,i,u,c,n,s)}),Zd(t,i,!1),n&&t.u&&li("Patches").N(r,n,t.u,t.s)}return r.o}function lw(t,e,n,r,i,a,s){if(Ra(i)){var u=Jd(t,i,a&&e&&e.i!==3&&!Ps(e.R,r)?a.concat(r):void 0);if(Ix(n,r,u),!Ra(u))return;t.m=!1}else s&&n.add(i);if(ji(i)&&!S0(i)){if(!t.h.D&&t._<1)return;Jd(t,i),e&&e.A.l||Zd(t,i)}}function Zd(t,e,n){n===void 0&&(n=!1),!t.l&&t.h.D&&t.m&&y0(e,n)}function vm(t,e){var n=t[ct];return(n?Za(n):t)[e]}function uw(t,e){if(e in t)for(var n=Object.getPrototypeOf(t);n;){var r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function pa(t){t.P||(t.P=!0,t.l&&pa(t.l))}function ym(t){t.o||(t.o=v0(t.t))}function $v(t,e,n){var r=g0(e)?li("MapSet").F(e,n):m0(e)?li("MapSet").T(e,n):t.g?function(i,a){var s=Array.isArray(i),u={i:s?1:0,A:a?a.A:Bv(),P:!1,I:!1,R:{},l:a,t:i,k:null,o:null,j:null,C:!1},c=u,f=Fu;s&&(c=[u],f=Jl);var h=Proxy.revocable(c,f),p=h.revoke,g=h.proxy;return u.k=g,u.j=p,g}(e,n):li("ES5").J(e,n);return(n?n.A:Bv()).p.push(r),r}function iN(t){return Ra(t)||Br(22,t),function e(n){if(!ji(n))return n;var r,i=n[ct],a=Hs(n);if(i){if(!i.P&&(i.i<4||!li("ES5").K(i)))return i.t;i.I=!0,r=cw(n,a),i.I=!1}else r=cw(n,a);return ho(r,function(s,u){i&&eN(i.t,s)===u||Ix(r,s,e(u))}),a===3?new Set(r):r}(t)}function cw(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return v0(t)}function aN(){function t(a,s){var u=i[a];return u?u.enumerable=s:i[a]=u={configurable:!0,enumerable:s,get:function(){var c=this[ct];return Fu.get(c,a)},set:function(c){var f=this[ct];Fu.set(f,a,c)}},u}function e(a){for(var s=a.length-1;s>=0;s--){var u=a[s][ct];if(!u.P)switch(u.i){case 5:r(u)&&pa(u);break;case 4:n(u)&&pa(u)}}}function n(a){for(var s=a.t,u=a.k,c=Es(u),f=c.length-1;f>=0;f--){var h=c[f];if(h!==ct){var p=s[h];if(p===void 0&&!Ps(s,h))return!0;var g=u[h],y=g&&g[ct];if(y?y.t!==p:!Lx(g,p))return!0}}var v=!!s[ct];return c.length!==Es(s).length+(v?0:1)}function r(a){var s=a.k;if(s.length!==a.t.length)return!0;var u=Object.getOwnPropertyDescriptor(s,s.length-1);if(u&&!u.get)return!0;for(var c=0;c1?_-1:0),C=1;C<_;C++)S[C-1]=arguments[C];return c.produce(w,function(O){var I;return(I=a).call.apply(I,[x,O].concat(S))})}}var f;if(typeof a!="function"&&Br(6),s!==void 0&&typeof s!="function"&&Br(7),ji(i)){var h=sw(r),p=$v(r,i,void 0),g=!0;try{f=a(p),g=!1}finally{g?Qd(h):Fv(h)}return typeof Promise<"u"&&f instanceof Promise?f.then(function(w){return gm(h,s),mm(w,h)},function(w){throw Qd(h),w}):(gm(h,s),mm(f,h))}if(!i||typeof i!="object"){if((f=a(i))===void 0&&(f=i),f===Mx&&(f=void 0),r.D&&y0(f,!0),s){var y=[],v=[];li("Patches").M(i,f,y,v),s(y,v)}return f}Br(21,i)},this.produceWithPatches=function(i,a){if(typeof i=="function")return function(f){for(var h=arguments.length,p=Array(h>1?h-1:0),g=1;g=0;i--){var a=r[i];if(a.path.length===0&&a.op==="replace"){n=a.value;break}}i>-1&&(r=r.slice(i+1));var s=li("Patches").$;return Ra(n)?s(n,r):this.produce(n,function(u){return s(u,r)})},t}(),Xn=new uN,Nx=Xn.produce;Xn.produceWithPatches.bind(Xn);Xn.setAutoFreeze.bind(Xn);Xn.setUseProxies.bind(Xn);Xn.applyPatches.bind(Xn);Xn.createDraft.bind(Xn);Xn.finishDraft.bind(Xn);function gr(t){return gr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gr(t)}function cN(t,e){if(gr(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(gr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Bx(t){var e=cN(t,"string");return gr(e)==="symbol"?e:String(e)}function Ur(t,e,n){return e=Bx(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gw(t){for(var e=1;e"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(un(1));return n(w0)(t,e)}if(typeof t!="function")throw new Error(un(2));var i=t,a=e,s=[],u=s,c=!1;function f(){u===s&&(u=s.slice())}function h(){if(c)throw new Error(un(3));return a}function p(w){if(typeof w!="function")throw new Error(un(4));if(c)throw new Error(un(5));var x=!0;return f(),u.push(w),function(){if(x){if(c)throw new Error(un(6));x=!1,f();var S=u.indexOf(w);u.splice(S,1),s=null}}}function g(w){if(!fN(w))throw new Error(un(7));if(typeof w.type>"u")throw new Error(un(8));if(c)throw new Error(un(9));try{c=!0,a=i(a,w)}finally{c=!1}for(var x=s=u,_=0;_"u")throw new Error(un(12));if(typeof n(void 0,{type:eh.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(un(13))})}function Fx(t){for(var e=Object.keys(t),n={},r=0;r"u")throw f&&f.type,new Error(un(14));p[y]=x,h=h||x!==w}return h=h||a.length!==Object.keys(c).length,h?p:c}}function th(){for(var t=arguments.length,e=new Array(t),n=0;n0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]{Object.keys(L).forEach(function(D){C(D)&&h[D]!==L[D]&&g.indexOf(D)===-1&&g.push(D)}),Object.keys(h).forEach(function(D){L[D]===void 0&&C(D)&&g.indexOf(D)===-1&&h[D]!==void 0&&g.push(D)}),y===null&&(y=setInterval(_,i)),h=L},a)}function _(){if(g.length===0){y&&clearInterval(y),y=null;return}var L=g.shift(),D=r.reduce(function(U,X){return X.in(U,L,h)},h[L]);if(D!==void 0)try{p[L]=c(D)}catch(U){console.error("redux-persist/createPersistoid: error serializing state",U)}else delete p[L];g.length===0&&S()}function S(){Object.keys(p).forEach(function(L){h[L]===void 0&&delete p[L]}),v=u.setItem(s,c(p)).catch(O)}function C(L){return!(n&&n.indexOf(L)===-1&&L!=="_persist"||e&&e.indexOf(L)!==-1)}function O(L){f&&f(L)}var I=function(){for(;g.length!==0;)_();return v||Promise.resolve()};return{update:x,flush:I}}function WN(t){return JSON.stringify(t)}function HN(t){var e=t.transforms||[],n="".concat(t.keyPrefix!==void 0?t.keyPrefix:C0).concat(t.key),r=t.storage;t.debug;var i;return t.deserialize===!1?i=function(s){return s}:typeof t.deserialize=="function"?i=t.deserialize:i=VN,r.getItem(n).then(function(a){if(a)try{var s={},u=i(a);return Object.keys(u).forEach(function(c){s[c]=e.reduceRight(function(f,h){return h.out(f,c,u)},i(u[c]))}),s}catch(c){throw c}else return})}function VN(t){return JSON.parse(t)}function qN(t){var e=t.storage,n="".concat(t.keyPrefix!==void 0?t.keyPrefix:C0).concat(t.key);return e.removeItem(n,KN)}function KN(t){}function Cw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ti(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function QN(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,a;for(a=0;a=0)&&(n[i]=t[i]);return n}var JN=5e3;function ZN(t,e){var n=t.version!==void 0?t.version:$N;t.debug;var r=t.stateReconciler===void 0?UN:t.stateReconciler,i=t.getStoredState||HN,a=t.timeout!==void 0?t.timeout:JN,s=null,u=!1,c=!0,f=function(p){return p._persist.rehydrated&&s&&!c&&s.update(p),p};return function(h,p){var g=h||{},y=g._persist,v=XN(g,["_persist"]),w=v;if(p.type===Wx){var x=!1,_=function(U,X){x||(p.rehydrate(t.key,U,X),x=!0)};if(a&&setTimeout(function(){!x&&_(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(t.key,'"')))},a),c=!1,s||(s=jN(t)),y)return Ti({},e(w,p),{_persist:y});if(typeof p.rehydrate!="function"||typeof p.register!="function")throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return p.register(t.key),i(t).then(function(D){var U=t.migrate||function(X,K){return Promise.resolve(X)};U(D,n).then(function(X){_(X)},function(X){_(void 0,X)})},function(D){_(void 0,D)}),Ti({},e(w,p),{_persist:{version:n,rehydrated:!1}})}else{if(p.type===Hx)return u=!0,p.result(qN(t)),Ti({},e(w,p),{_persist:y});if(p.type===Ux)return p.result(s&&s.flush()),Ti({},e(w,p),{_persist:y});if(p.type===jx)c=!0;else if(p.type===x0){if(u)return Ti({},w,{_persist:Ti({},y,{rehydrated:!0})});if(p.key===t.key){var S=e(w,p),C=p.payload,O=r!==!1&&C!==void 0?r(C,h,S,t):S,I=Ti({},O,{_persist:Ti({},y,{rehydrated:!0})});return f(I)}}}if(!y)return e(h,p);var L=e(w,p);return L===w?h:f(Ti({},L,{_persist:y}))}}function xw(t){return n5(t)||t5(t)||e5()}function e5(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function t5(t){if(Symbol.iterator in Object(t)||Object.prototype.toString.call(t)==="[object Arguments]")return Array.from(t)}function n5(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&arguments[0]!==void 0?arguments[0]:qx,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case Vx:return Uv({},e,{registry:[].concat(xw(e.registry),[n.key])});case x0:var r=e.registry.indexOf(n.key),i=xw(e.registry);return i.splice(r,1),Uv({},e,{registry:i,bootstrapped:i.length===0});default:return e}};function a5(t,e,n){var r=n||!1,i=w0(i5,qx,e&&e.enhancer?e.enhancer:void 0),a=function(f){i.dispatch({type:Vx,key:f})},s=function(f,h,p){var g={type:x0,payload:h,err:p,key:f};t.dispatch(g),i.dispatch(g),r&&u.getState().bootstrapped&&(r(),r=!1)},u=Uv({},i,{purge:function(){var f=[];return t.dispatch({type:Hx,result:function(p){f.push(p)}}),Promise.all(f)},flush:function(){var f=[];return t.dispatch({type:Ux,result:function(p){f.push(p)}}),Promise.all(f)},pause:function(){t.dispatch({type:jx})},persist:function(){t.dispatch({type:Wx,register:a,rehydrate:s})}});return e&&e.manualPersist||u.persist(),u}var k0={},P0={};P0.__esModule=!0;P0.default=l5;function fd(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fd=function(n){return typeof n}:fd=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},fd(t)}function bm(){}var o5={getItem:bm,setItem:bm,removeItem:bm};function s5(t){if((typeof self>"u"?"undefined":fd(self))!=="object"||!(t in self))return!1;try{var e=self[t],n="redux-persist ".concat(t," test");e.setItem(n,"test"),e.getItem(n),e.removeItem(n)}catch{return!1}return!0}function l5(t){var e="".concat(t,"Storage");return s5(e)?self[e]:o5}k0.__esModule=!0;k0.default=f5;var u5=c5(P0);function c5(t){return t&&t.__esModule?t:{default:t}}function f5(t){var e=(0,u5.default)(t);return{getItem:function(r){return new Promise(function(i,a){i(e.getItem(r))})},setItem:function(r,i){return new Promise(function(a,s){a(e.setItem(r,i))})},removeItem:function(r){return new Promise(function(i,a){i(e.removeItem(r))})}}}var Kx=void 0,d5=h5(k0);function h5(t){return t&&t.__esModule?t:{default:t}}var p5=(0,d5.default)("local");Kx=p5;var Yx={},Xx={},po={};Object.defineProperty(po,"__esModule",{value:!0});po.PLACEHOLDER_UNDEFINED=po.PACKAGE_NAME=void 0;po.PACKAGE_NAME="redux-deep-persist";po.PLACEHOLDER_UNDEFINED="@@placeholder/undefined";var E0={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigType=void 0,function(e){e[e.WHITELIST=0]="WHITELIST",e[e.BLACKLIST=1]="BLACKLIST"}(t.ConfigType||(t.ConfigType={}))})(E0);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getRootKeysGroup=t.throwError=t.configValidator=t.transformsValidator=t.singleTransformValidator=t.findDuplicatesAndSubsets=t.unique=t.preserveUndefined=t.mergeDeep=t.dissocPath=t.assocPath=t.path=t.difference=t.cloneDeep=t._cloneDeep=t.getCircularPath=t.isEmpty=t.isDate=t.isString=t.isIntegerString=t.isPlainObject=t.isArray=t.isLength=t.isObjectLike=void 0;const e=po,n=E0,r=function(j){return typeof j=="object"&&j!==null};t.isObjectLike=r;const i=function(j){return typeof j=="number"&&j>-1&&j%1==0&&j<=Number.MAX_SAFE_INTEGER};t.isLength=i,t.isArray=Array.isArray||function(j){return(0,t.isLength)(j&&j.length)&&Object.prototype.toString.call(j)==="[object Array]"};const a=function(j){return!!j&&typeof j=="object"&&!(0,t.isArray)(j)};t.isPlainObject=a;const s=function(j){return String(~~j)===j&&Number(j)>=0};t.isIntegerString=s;const u=function(j){return Object.prototype.toString.call(j)==="[object String]"};t.isString=u;const c=function(j){return Object.prototype.toString.call(j)==="[object Date]"};t.isDate=c;const f=function(j){return Object.keys(j).length===0};t.isEmpty=f;const h=Object.prototype.hasOwnProperty,p=function(j,T,$){$||($=new Set([j])),T||(T="");for(const V in j){const ie=T?`${T}.${V}`:V,W=j[V];if((0,t.isObjectLike)(W))return $.has(W)?`${T}.${V}:`:($.add(W),(0,t.getCircularPath)(W,ie,$))}return null};t.getCircularPath=p;const g=function(j){if(!(0,t.isObjectLike)(j))return j;if((0,t.isDate)(j))return new Date(+j);const T=(0,t.isArray)(j)?[]:{};for(const $ in j){const V=j[$];T[$]=(0,t._cloneDeep)(V)}return T};t._cloneDeep=g;const y=function(j){const T=(0,t.getCircularPath)(j);if(T)throw new Error(`${e.PACKAGE_NAME}: circular dependency detected under the path '${T}' of object you're trying to persist: ${j}`);return(0,t._cloneDeep)(j)};t.cloneDeep=y;const v=function(j,T){if(j===T)return{};if(!(0,t.isObjectLike)(j)||!(0,t.isObjectLike)(T))return T;const $=(0,t.cloneDeep)(j),V=(0,t.cloneDeep)(T),ie=Object.keys($).reduce((Y,Q)=>(h.call(V,Q)||(Y[Q]=void 0),Y),{});if((0,t.isDate)($)||(0,t.isDate)(V))return $.valueOf()===V.valueOf()?{}:V;const W=Object.keys(V).reduce((Y,Q)=>{if(!h.call($,Q))return Y[Q]=V[Q],Y;const oe=(0,t.difference)($[Q],V[Q]);return(0,t.isObjectLike)(oe)&&(0,t.isEmpty)(oe)&&!(0,t.isDate)(oe)?(0,t.isArray)($)&&!(0,t.isArray)(V)||!(0,t.isArray)($)&&(0,t.isArray)(V)?V:Y:(Y[Q]=oe,Y)},ie);return delete W._persist,W};t.difference=v;const w=function(j,T){return T.reduce(($,V)=>{if($){const ie=parseInt(V,10),W=(0,t.isIntegerString)(V)&&ie<0?$.length+ie:V;return(0,t.isString)($)?$.charAt(W):$[W]}},j)};t.path=w;const x=function(j,T){return[...j].reverse().reduce((ie,W,Y)=>{const Q=(0,t.isIntegerString)(W)?[]:{};return Q[W]=Y===0?T:ie,Q},{})};t.assocPath=x;const _=function(j,T){const $=(0,t.cloneDeep)(j);return T.reduce((V,ie,W)=>(W===T.length-1&&V&&(0,t.isObjectLike)(V)&&delete V[ie],V&&V[ie]),$),$};t.dissocPath=_;const S=function(j,T,...$){if(!$||!$.length)return T;const V=$.shift(),{preservePlaceholder:ie,preserveUndefined:W}=j;if((0,t.isObjectLike)(T)&&(0,t.isObjectLike)(V))for(const Y in V)if((0,t.isObjectLike)(V[Y])&&(0,t.isObjectLike)(T[Y]))T[Y]||(T[Y]={}),S(j,T[Y],V[Y]);else if((0,t.isArray)(T)){let Q=V[Y];const oe=ie?e.PLACEHOLDER_UNDEFINED:void 0;W||(Q=typeof Q<"u"?Q:T[parseInt(Y,10)]),Q=Q!==e.PLACEHOLDER_UNDEFINED?Q:oe,T[parseInt(Y,10)]=Q}else{const Q=V[Y]!==e.PLACEHOLDER_UNDEFINED?V[Y]:void 0;T[Y]=Q}return S(j,T,...$)},C=function(j,T,$){return S({preservePlaceholder:$==null?void 0:$.preservePlaceholder,preserveUndefined:$==null?void 0:$.preserveUndefined},(0,t.cloneDeep)(j),(0,t.cloneDeep)(T))};t.mergeDeep=C;const O=function(j,T=[],$,V,ie){if(!(0,t.isObjectLike)(j))return j;for(const W in j){const Y=j[W],Q=(0,t.isArray)(j),oe=V?V+"."+W:W;Y===null&&($===n.ConfigType.WHITELIST&&T.indexOf(oe)===-1||$===n.ConfigType.BLACKLIST&&T.indexOf(oe)!==-1)&&Q&&(j[parseInt(W,10)]=void 0),Y===void 0&&ie&&$===n.ConfigType.BLACKLIST&&T.indexOf(oe)===-1&&Q&&(j[parseInt(W,10)]=e.PLACEHOLDER_UNDEFINED),O(Y,T,$,oe,ie)}},I=function(j,T,$,V){const ie=(0,t.cloneDeep)(j);return O(ie,T,$,"",V),ie};t.preserveUndefined=I;const L=function(j,T,$){return $.indexOf(j)===T};t.unique=L;const D=function(j){return j.reduce((T,$)=>{const V=j.filter(ve=>ve===$),ie=j.filter(ve=>($+".").indexOf(ve+".")===0),{duplicates:W,subsets:Y}=T,Q=V.length>1&&W.indexOf($)===-1,oe=ie.length>1;return{duplicates:[...W,...Q?V:[]],subsets:[...Y,...oe?ie:[]].filter(t.unique).sort()}},{duplicates:[],subsets:[]})};t.findDuplicatesAndSubsets=D;const U=function(j,T,$){const V=$===n.ConfigType.WHITELIST?"whitelist":"blacklist",ie=`${e.PACKAGE_NAME}: incorrect ${V} configuration.`,W=`Check your create${$===n.ConfigType.WHITELIST?"White":"Black"}list arguments. + +`;if(!(0,t.isString)(T)||T.length<1)throw new Error(`${ie} Name (key) of reducer is required. ${W}`);if(!j||!j.length)return;const{duplicates:Y,subsets:Q}=(0,t.findDuplicatesAndSubsets)(j);if(Y.length>1)throw new Error(`${ie} Duplicated paths. + + ${JSON.stringify(Y)} + + ${W}`);if(Q.length>1)throw new Error(`${ie} You are trying to persist an entire property and also some of its subset. + +${JSON.stringify(Q)} + + ${W}`)};t.singleTransformValidator=U;const X=function(j){if(!(0,t.isArray)(j))return;const T=(j==null?void 0:j.map($=>$.deepPersistKey).filter($=>$))||[];if(T.length){const $=T.filter((V,ie)=>T.indexOf(V)!==ie);if($.length)throw new Error(`${e.PACKAGE_NAME}: found duplicated keys in transforms creators. You can createWhitelist or createBlacklist for a specific root reducer key only once. Duplicated keys among createWhitelist and createBlacklist transforms are not allowed. + + Duplicates: ${JSON.stringify($)}`)}};t.transformsValidator=X;const K=function({whitelist:j,blacklist:T}){if(j&&j.length&&T&&T.length)throw new Error(`${e.PACKAGE_NAME}: you should not define a whitelist and blacklist in parallel. It is allowed to use only one of these lists per config.`);if(j){const{duplicates:$,subsets:V}=(0,t.findDuplicatesAndSubsets)(j);(0,t.throwError)({duplicates:$,subsets:V},"whitelist")}if(T){const{duplicates:$,subsets:V}=(0,t.findDuplicatesAndSubsets)(T);(0,t.throwError)({duplicates:$,subsets:V},"blacklist")}};t.configValidator=K;const te=function({duplicates:j,subsets:T},$){if(j.length)throw new Error(`${e.PACKAGE_NAME}: duplicates of paths found in your ${$}. + + ${JSON.stringify(j)}`);if(T.length)throw new Error(`${e.PACKAGE_NAME}: subsets of some parent keys found in your ${$}. You must decide if you want to persist an entire path or its specific subset. + + ${JSON.stringify(T)}`)};t.throwError=te;const ce=function(j){return(0,t.isArray)(j)?j.filter(t.unique).reduce((T,$)=>{const V=$.split("."),ie=V[0],W=V.slice(1).join(".")||void 0,Y=T.filter(oe=>Object.keys(oe)[0]===ie)[0],Q=Y?Object.values(Y)[0]:void 0;return Y||T.push({[ie]:W?[W]:void 0}),Y&&!Q&&W&&(Y[ie]=[W]),Y&&Q&&W&&Q.push(W),T},[]):[]};t.getRootKeysGroup=ce})(Xx);(function(t){var e=yn&&yn.__rest||function(p,g){var y={};for(var v in p)Object.prototype.hasOwnProperty.call(p,v)&&g.indexOf(v)<0&&(y[v]=p[v]);if(p!=null&&typeof Object.getOwnPropertySymbols=="function")for(var w=0,v=Object.getOwnPropertySymbols(p);w!x(S)&&p?p(_,S,C):_,out:(_,S,C)=>!x(S)&&g?g(_,S,C):_,deepPersistKey:v&&v[0]}},s=(p,g,y,{debug:v,whitelist:w,blacklist:x,transforms:_})=>{if(w||x)throw new Error("State reconciler autoMergeDeep uses custom transforms instead of old whitelist or blacklist config properties. Please use createWhitelist or createBlacklist transforms.");(0,n.transformsValidator)(_);const S=(0,n.cloneDeep)(y);let C=p;if(C&&(0,n.isObjectLike)(C)){const O=(0,n.difference)(g,y);(0,n.isEmpty)(O)||(C=(0,n.mergeDeep)(p,O,{preserveUndefined:!0}),v&&console.log(`${r.PACKAGE_NAME}/autoMergeDeep: sub state of your state was modified by reducer during rehydration. Values from reducer will be kept: ${JSON.stringify(O)}`)),Object.keys(C).forEach(I=>{if(I!=="_persist"){if((0,n.isObjectLike)(S[I])){S[I]=(0,n.mergeDeep)(S[I],C[I]);return}S[I]=C[I]}})}return v&&C&&(0,n.isObjectLike)(C)&&console.log(`${r.PACKAGE_NAME}/autoMergeDeep: rehydrated keys ${JSON.stringify(C)}`),S};t.autoMergeDeep=s;const u=(p,g)=>((0,n.singleTransformValidator)(g,p,i.ConfigType.WHITELIST),a(y=>{if(!g||!g.length)return y;let v=null,w;return g.forEach(x=>{const _=x.split(".");w=(0,n.path)(y,_),typeof w>"u"&&(0,n.isIntegerString)(_[_.length-1])&&(w=r.PLACEHOLDER_UNDEFINED);const S=(0,n.assocPath)(_,w),C=(0,n.isArray)(S)?[]:{};v=(0,n.mergeDeep)(v||C,S,{preservePlaceholder:!0})}),v||y},y=>(0,n.preserveUndefined)(y,g,i.ConfigType.WHITELIST),{whitelist:[p]}));t.createWhitelist=u;const c=(p,g)=>((0,n.singleTransformValidator)(g,p,i.ConfigType.BLACKLIST),a(y=>{if(!g||!g.length)return;const v=(0,n.preserveUndefined)(y,g,i.ConfigType.BLACKLIST,!0);return g.map(x=>x.split(".")).reduce((x,_)=>(0,n.dissocPath)(x,_),v)},y=>(0,n.preserveUndefined)(y,g,i.ConfigType.BLACKLIST),{whitelist:[p]}));t.createBlacklist=c;const f=function(p,g){return g.map(y=>{const v=Object.keys(y)[0],w=y[v];return p===i.ConfigType.WHITELIST?(0,t.createWhitelist)(v,w):(0,t.createBlacklist)(v,w)})};t.getTransforms=f;const h=p=>{var{key:g,whitelist:y,blacklist:v,storage:w,transforms:x,rootReducer:_}=p,S=e(p,["key","whitelist","blacklist","storage","transforms","rootReducer"]);(0,n.configValidator)({whitelist:y,blacklist:v});const C=(0,n.getRootKeysGroup)(y),O=(0,n.getRootKeysGroup)(v),I=Object.keys(_(void 0,{type:""})),L=C.map(ce=>Object.keys(ce)[0]),D=O.map(ce=>Object.keys(ce)[0]),U=I.filter(ce=>L.indexOf(ce)===-1&&D.indexOf(ce)===-1),X=(0,t.getTransforms)(i.ConfigType.WHITELIST,C),K=(0,t.getTransforms)(i.ConfigType.BLACKLIST,O),te=(0,n.isArray)(y)?U.map(ce=>(0,t.createBlacklist)(ce)):[];return Object.assign(Object.assign({},S),{key:g,storage:w,transforms:[...X,...K,...te,...x||[]],stateReconciler:t.autoMergeDeep})};t.getPersistConfig=h})(Yx);const Ef=(t,e)=>Math.floor(t/e)*e,va=(t,e)=>Math.round(t/e)*e;var _t={},g5={get exports(){return _t},set exports(t){_t=t}};/** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */(function(t,e){(function(){var n,r="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",u="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",f=500,h="__lodash_placeholder__",p=1,g=2,y=4,v=1,w=2,x=1,_=2,S=4,C=8,O=16,I=32,L=64,D=128,U=256,X=512,K=30,te="...",ce=800,j=16,T=1,$=2,V=3,ie=1/0,W=9007199254740991,Y=17976931348623157e292,Q=0/0,oe=4294967295,ve=oe-1,we=oe>>>1,Ue=[["ary",D],["bind",x],["bindKey",_],["curry",C],["curryRight",O],["flip",X],["partial",I],["partialRight",L],["rearg",U]],At="[object Arguments]",me="[object Array]",qt="[object AsyncFunction]",Bt="[object Boolean]",bn="[object Date]",wr="[object DOMException]",Ft="[object Error]",xe="[object Function]",Wr="[object GeneratorFunction]",Et="[object Map]",gi="[object Number]",Xs="[object Null]",Mn="[object Object]",Fa="[object Promise]",Qs="[object Proxy]",er="[object RegExp]",Kt="[object Set]",Dn="[object String]",bt="[object Symbol]",$a="[object Undefined]",Hr="[object WeakMap]",Co="[object WeakSet]",Vr="[object ArrayBuffer]",br="[object DataView]",xo="[object Float32Array]",ko="[object Float64Array]",Po="[object Int8Array]",Eo="[object Int16Array]",Oo="[object Int32Array]",Js="[object Uint8Array]",Zs="[object Uint8ClampedArray]",Cr="[object Uint16Array]",Ki="[object Uint32Array]",sp=/\b__p \+= '';/g,tc=/\b(__p \+=) '' \+/g,lp=/(__e\(.*?\)|\b__t\)) \+\n'';/g,el=/&(?:amp|lt|gt|quot|#39);/g,Yi=/[&<>"']/g,up=RegExp(el.source),mi=RegExp(Yi.source),cp=/<%-([\s\S]+?)%>/g,fp=/<%([\s\S]+?)%>/g,nc=/<%=([\s\S]+?)%>/g,dp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hp=/^\w*$/,xr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tl=/[\\^$.*+?()[\]{}|]/g,pp=RegExp(tl.source),nl=/^\s+/,gp=/\s/,mp=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Xi=/\{\n\/\* \[wrapped with (.+)\] \*/,vp=/,? & /,yp=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Sp=/[()=,{}\[\]\/\s]/,_p=/\\(\\)?/g,wp=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vi=/\w*$/,bp=/^[-+]0x[0-9a-f]+$/i,Cp=/^0b[01]+$/i,xp=/^\[object .+?Constructor\]$/,kp=/^0o[0-7]+$/i,Pp=/^(?:0|[1-9]\d*)$/,Ep=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qi=/($^)/,Op=/['\n\r\u2028\u2029\\]/g,yi="\\ud800-\\udfff",rl="\\u0300-\\u036f",Tp="\\ufe20-\\ufe2f",To="\\u20d0-\\u20ff",il=rl+Tp+To,rc="\\u2700-\\u27bf",ic="a-z\\xdf-\\xf6\\xf8-\\xff",Rp="\\xac\\xb1\\xd7\\xf7",ac="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ap="\\u2000-\\u206f",Ip=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",oc="A-Z\\xc0-\\xd6\\xd8-\\xde",sc="\\ufe0e\\ufe0f",lc=Rp+ac+Ap+Ip,al="['’]",Lp="["+yi+"]",uc="["+lc+"]",Ro="["+il+"]",cc="\\d+",Ao="["+rc+"]",Io="["+ic+"]",fc="[^"+yi+lc+cc+rc+ic+oc+"]",ol="\\ud83c[\\udffb-\\udfff]",dc="(?:"+Ro+"|"+ol+")",hc="[^"+yi+"]",sl="(?:\\ud83c[\\udde6-\\uddff]){2}",ll="[\\ud800-\\udbff][\\udc00-\\udfff]",Si="["+oc+"]",pc="\\u200d",gc="(?:"+Io+"|"+fc+")",Mp="(?:"+Si+"|"+fc+")",Lo="(?:"+al+"(?:d|ll|m|re|s|t|ve))?",mc="(?:"+al+"(?:D|LL|M|RE|S|T|VE))?",vc=dc+"?",yc="["+sc+"]?",Mo="(?:"+pc+"(?:"+[hc,sl,ll].join("|")+")"+yc+vc+")*",ul="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",cl="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Do=yc+vc+Mo,Dp="(?:"+[Ao,sl,ll].join("|")+")"+Do,Sc="(?:"+[hc+Ro+"?",Ro,sl,ll,Lp].join("|")+")",fl=RegExp(al,"g"),_c=RegExp(Ro,"g"),kr=RegExp(ol+"(?="+ol+")|"+Sc+Do,"g"),za=RegExp([Si+"?"+Io+"+"+Lo+"(?="+[uc,Si,"$"].join("|")+")",Mp+"+"+mc+"(?="+[uc,Si+gc,"$"].join("|")+")",Si+"?"+gc+"+"+Lo,Si+"+"+mc,cl,ul,cc,Dp].join("|"),"g"),Np=RegExp("["+pc+yi+il+sc+"]"),wc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Bp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],bc=-1,nt={};nt[xo]=nt[ko]=nt[Po]=nt[Eo]=nt[Oo]=nt[Js]=nt[Zs]=nt[Cr]=nt[Ki]=!0,nt[At]=nt[me]=nt[Vr]=nt[Bt]=nt[br]=nt[bn]=nt[Ft]=nt[xe]=nt[Et]=nt[gi]=nt[Mn]=nt[er]=nt[Kt]=nt[Dn]=nt[Hr]=!1;var et={};et[At]=et[me]=et[Vr]=et[br]=et[Bt]=et[bn]=et[xo]=et[ko]=et[Po]=et[Eo]=et[Oo]=et[Et]=et[gi]=et[Mn]=et[er]=et[Kt]=et[Dn]=et[bt]=et[Js]=et[Zs]=et[Cr]=et[Ki]=!0,et[Ft]=et[xe]=et[Hr]=!1;var Cc={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Fp={"&":"&","<":"<",">":">",'"':""","'":"'"},E={"&":"&","<":"<",">":">",""":'"',"'":"'"},N={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},H=parseFloat,fe=parseInt,Ie=typeof yn=="object"&&yn&&yn.Object===Object&&yn,Ye=typeof self=="object"&&self&&self.Object===Object&&self,Pe=Ie||Ye||Function("return this")(),Te=e&&!e.nodeType&&e,ze=Te&&!0&&t&&!t.nodeType&&t,dn=ze&&ze.exports===Te,Yt=dn&&Ie.process,$t=function(){try{var F=ze&&ze.require&&ze.require("util").types;return F||Yt&&Yt.binding&&Yt.binding("util")}catch{}}(),No=$t&&$t.isArrayBuffer,Bo=$t&&$t.isDate,dl=$t&&$t.isMap,H0=$t&&$t.isRegExp,V0=$t&&$t.isSet,q0=$t&&$t.isTypedArray;function Nn(F,J,q){switch(q.length){case 0:return F.call(J);case 1:return F.call(J,q[0]);case 2:return F.call(J,q[0],q[1]);case 3:return F.call(J,q[0],q[1],q[2])}return F.apply(J,q)}function eE(F,J,q,de){for(var Ce=-1,je=F==null?0:F.length;++Ce-1}function $p(F,J,q){for(var de=-1,Ce=F==null?0:F.length;++de-1;);return q}function t1(F,J){for(var q=F.length;q--&&Fo(J,F[q],0)>-1;);return q}function uE(F,J){for(var q=F.length,de=0;q--;)F[q]===J&&++de;return de}var cE=jp(Cc),fE=jp(Fp);function dE(F){return"\\"+N[F]}function hE(F,J){return F==null?n:F[J]}function $o(F){return Np.test(F)}function pE(F){return wc.test(F)}function gE(F){for(var J,q=[];!(J=F.next()).done;)q.push(J.value);return q}function qp(F){var J=-1,q=Array(F.size);return F.forEach(function(de,Ce){q[++J]=[Ce,de]}),q}function n1(F,J){return function(q){return F(J(q))}}function ea(F,J){for(var q=-1,de=F.length,Ce=0,je=[];++q-1}function nO(o,l){var d=this.__data__,m=Gc(d,o);return m<0?(++this.size,d.push([o,l])):d[m][1]=l,this}_i.prototype.clear=JE,_i.prototype.delete=ZE,_i.prototype.get=eO,_i.prototype.has=tO,_i.prototype.set=nO;function wi(o){var l=-1,d=o==null?0:o.length;for(this.clear();++l=l?o:l)),o}function ir(o,l,d,m,b,P){var R,M=l&p,z=l&g,Z=l&y;if(d&&(R=b?d(o,m,b,P):d(o)),R!==n)return R;if(!ht(o))return o;var ee=ke(o);if(ee){if(R=oT(o),!M)return Cn(o,R)}else{var ne=an(o),ue=ne==xe||ne==Wr;if(oa(o))return F1(o,M);if(ne==Mn||ne==At||ue&&!b){if(R=z||ue?{}:rS(o),!M)return z?YO(o,yO(R,o)):KO(o,p1(R,o))}else{if(!et[ne])return b?o:{};R=sT(o,ne,M)}}P||(P=new Er);var ge=P.get(o);if(ge)return ge;P.set(o,R),IS(o)?o.forEach(function(_e){R.add(ir(_e,l,d,_e,o,P))}):RS(o)&&o.forEach(function(_e,Le){R.set(Le,ir(_e,l,d,Le,o,P))});var Se=Z?z?Sg:yg:z?kn:zt,Oe=ee?n:Se(o);return tr(Oe||o,function(_e,Le){Oe&&(Le=_e,_e=o[Le]),Sl(R,Le,ir(_e,l,d,Le,o,P))}),R}function SO(o){var l=zt(o);return function(d){return g1(d,o,l)}}function g1(o,l,d){var m=d.length;if(o==null)return!m;for(o=rt(o);m--;){var b=d[m],P=l[b],R=o[b];if(R===n&&!(b in o)||!P(R))return!1}return!0}function m1(o,l,d){if(typeof o!="function")throw new nr(s);return Pl(function(){o.apply(n,d)},l)}function _l(o,l,d,m){var b=-1,P=xc,R=!0,M=o.length,z=[],Z=l.length;if(!M)return z;d&&(l=ut(l,Bn(d))),m?(P=$p,R=!1):l.length>=i&&(P=hl,R=!1,l=new ja(l));e:for(;++bb?0:b+d),m=m===n||m>b?b:Ee(m),m<0&&(m+=b),m=d>m?0:MS(m);d0&&d(M)?l>1?Xt(M,l-1,d,m,b):Zi(b,M):m||(b[b.length]=M)}return b}var eg=W1(),S1=W1(!0);function qr(o,l){return o&&eg(o,l,zt)}function tg(o,l){return o&&S1(o,l,zt)}function jc(o,l){return Ji(l,function(d){return Pi(o[d])})}function Ha(o,l){l=ia(l,o);for(var d=0,m=l.length;o!=null&&dl}function bO(o,l){return o!=null&&Xe.call(o,l)}function CO(o,l){return o!=null&&l in rt(o)}function xO(o,l,d){return o>=rn(l,d)&&o=120&&ee.length>=120)?new ja(R&&ee):n}ee=o[0];var ne=-1,ue=M[0];e:for(;++ne-1;)M!==o&&Mc.call(M,z,1),Mc.call(o,z,1);return o}function R1(o,l){for(var d=o?l.length:0,m=d-1;d--;){var b=l[d];if(d==m||b!==P){var P=b;ki(b)?Mc.call(o,b,1):fg(o,b)}}return o}function lg(o,l){return o+Bc(c1()*(l-o+1))}function BO(o,l,d,m){for(var b=-1,P=Lt(Nc((l-o)/(d||1)),0),R=q(P);P--;)R[m?P:++b]=o,o+=d;return R}function ug(o,l){var d="";if(!o||l<1||l>W)return d;do l%2&&(d+=o),l=Bc(l/2),l&&(o+=o);while(l);return d}function Re(o,l){return Pg(oS(o,l,Pn),o+"")}function FO(o){return h1(Xo(o))}function $O(o,l){var d=Xo(o);return ef(d,Wa(l,0,d.length))}function Cl(o,l,d,m){if(!ht(o))return o;l=ia(l,o);for(var b=-1,P=l.length,R=P-1,M=o;M!=null&&++bb?0:b+l),d=d>b?b:d,d<0&&(d+=b),b=l>d?0:d-l>>>0,l>>>=0;for(var P=q(b);++m>>1,R=o[P];R!==null&&!$n(R)&&(d?R<=l:R=i){var Z=l?null:ZO(o);if(Z)return Pc(Z);R=!1,b=hl,z=new ja}else z=l?[]:M;e:for(;++m=m?o:ar(o,l,d)}var B1=RE||function(o){return Pe.clearTimeout(o)};function F1(o,l){if(l)return o.slice();var d=o.length,m=a1?a1(d):new o.constructor(d);return o.copy(m),m}function gg(o){var l=new o.constructor(o.byteLength);return new Ic(l).set(new Ic(o)),l}function WO(o,l){var d=l?gg(o.buffer):o.buffer;return new o.constructor(d,o.byteOffset,o.byteLength)}function HO(o){var l=new o.constructor(o.source,vi.exec(o));return l.lastIndex=o.lastIndex,l}function VO(o){return yl?rt(yl.call(o)):{}}function $1(o,l){var d=l?gg(o.buffer):o.buffer;return new o.constructor(d,o.byteOffset,o.length)}function z1(o,l){if(o!==l){var d=o!==n,m=o===null,b=o===o,P=$n(o),R=l!==n,M=l===null,z=l===l,Z=$n(l);if(!M&&!Z&&!P&&o>l||P&&R&&z&&!M&&!Z||m&&R&&z||!d&&z||!b)return 1;if(!m&&!P&&!Z&&o=M)return z;var Z=d[m];return z*(Z=="desc"?-1:1)}}return o.index-l.index}function G1(o,l,d,m){for(var b=-1,P=o.length,R=d.length,M=-1,z=l.length,Z=Lt(P-R,0),ee=q(z+Z),ne=!m;++M1?d[b-1]:n,R=b>2?d[2]:n;for(P=o.length>3&&typeof P=="function"?(b--,P):n,R&&pn(d[0],d[1],R)&&(P=b<3?n:P,b=1),l=rt(l);++m-1?b[P?l[R]:R]:n}}function q1(o){return xi(function(l){var d=l.length,m=d,b=rr.prototype.thru;for(o&&l.reverse();m--;){var P=l[m];if(typeof P!="function")throw new nr(s);if(b&&!R&&Jc(P)=="wrapper")var R=new rr([],!0)}for(m=R?m:d;++m1&&Ne.reverse(),ee&&zM))return!1;var Z=P.get(o),ee=P.get(l);if(Z&&ee)return Z==l&&ee==o;var ne=-1,ue=!0,ge=d&w?new ja:n;for(P.set(o,l),P.set(l,o);++ne1?"& ":"")+l[m],l=l.join(d>2?", ":" "),o.replace(mp,`{ +/* [wrapped with `+l+`] */ +`)}function uT(o){return ke(o)||Ka(o)||!!(l1&&o&&o[l1])}function ki(o,l){var d=typeof o;return l=l??W,!!l&&(d=="number"||d!="symbol"&&Pp.test(o))&&o>-1&&o%1==0&&o0){if(++l>=ce)return arguments[0]}else l=0;return o.apply(n,arguments)}}function ef(o,l){var d=-1,m=o.length,b=m-1;for(l=l===n?m:l;++d1?o[l-1]:n;return d=typeof d=="function"?(o.pop(),d):n,yS(o,d)});function SS(o){var l=k(o);return l.__chain__=!0,l}function _R(o,l){return l(o),o}function tf(o,l){return l(o)}var wR=xi(function(o){var l=o.length,d=l?o[0]:0,m=this.__wrapped__,b=function(P){return Zp(P,o)};return l>1||this.__actions__.length||!(m instanceof Me)||!ki(d)?this.thru(b):(m=m.slice(d,+d+(l?1:0)),m.__actions__.push({func:tf,args:[b],thisArg:n}),new rr(m,this.__chain__).thru(function(P){return l&&!P.length&&P.push(n),P}))});function bR(){return SS(this)}function CR(){return new rr(this.value(),this.__chain__)}function xR(){this.__values__===n&&(this.__values__=LS(this.value()));var o=this.__index__>=this.__values__.length,l=o?n:this.__values__[this.__index__++];return{done:o,value:l}}function kR(){return this}function PR(o){for(var l,d=this;d instanceof zc;){var m=dS(d);m.__index__=0,m.__values__=n,l?b.__wrapped__=m:l=m;var b=m;d=d.__wrapped__}return b.__wrapped__=o,l}function ER(){var o=this.__wrapped__;if(o instanceof Me){var l=o;return this.__actions__.length&&(l=new Me(this)),l=l.reverse(),l.__actions__.push({func:tf,args:[Eg],thisArg:n}),new rr(l,this.__chain__)}return this.thru(Eg)}function OR(){return D1(this.__wrapped__,this.__actions__)}var TR=qc(function(o,l,d){Xe.call(o,d)?++o[d]:bi(o,d,1)});function RR(o,l,d){var m=ke(o)?K0:_O;return d&&pn(o,l,d)&&(l=n),m(o,ye(l,3))}function AR(o,l){var d=ke(o)?Ji:y1;return d(o,ye(l,3))}var IR=V1(hS),LR=V1(pS);function MR(o,l){return Xt(nf(o,l),1)}function DR(o,l){return Xt(nf(o,l),ie)}function NR(o,l,d){return d=d===n?1:Ee(d),Xt(nf(o,l),d)}function _S(o,l){var d=ke(o)?tr:na;return d(o,ye(l,3))}function wS(o,l){var d=ke(o)?tE:v1;return d(o,ye(l,3))}var BR=qc(function(o,l,d){Xe.call(o,d)?o[d].push(l):bi(o,d,[l])});function FR(o,l,d,m){o=xn(o)?o:Xo(o),d=d&&!m?Ee(d):0;var b=o.length;return d<0&&(d=Lt(b+d,0)),lf(o)?d<=b&&o.indexOf(l,d)>-1:!!b&&Fo(o,l,d)>-1}var $R=Re(function(o,l,d){var m=-1,b=typeof l=="function",P=xn(o)?q(o.length):[];return na(o,function(R){P[++m]=b?Nn(l,R,d):wl(R,l,d)}),P}),zR=qc(function(o,l,d){bi(o,d,l)});function nf(o,l){var d=ke(o)?ut:x1;return d(o,ye(l,3))}function GR(o,l,d,m){return o==null?[]:(ke(l)||(l=l==null?[]:[l]),d=m?n:d,ke(d)||(d=d==null?[]:[d]),O1(o,l,d))}var UR=qc(function(o,l,d){o[d?0:1].push(l)},function(){return[[],[]]});function jR(o,l,d){var m=ke(o)?zp:J0,b=arguments.length<3;return m(o,ye(l,4),d,b,na)}function WR(o,l,d){var m=ke(o)?nE:J0,b=arguments.length<3;return m(o,ye(l,4),d,b,v1)}function HR(o,l){var d=ke(o)?Ji:y1;return d(o,of(ye(l,3)))}function VR(o){var l=ke(o)?h1:FO;return l(o)}function qR(o,l,d){(d?pn(o,l,d):l===n)?l=1:l=Ee(l);var m=ke(o)?gO:$O;return m(o,l)}function KR(o){var l=ke(o)?mO:GO;return l(o)}function YR(o){if(o==null)return 0;if(xn(o))return lf(o)?zo(o):o.length;var l=an(o);return l==Et||l==Kt?o.size:ag(o).length}function XR(o,l,d){var m=ke(o)?Gp:UO;return d&&pn(o,l,d)&&(l=n),m(o,ye(l,3))}var QR=Re(function(o,l){if(o==null)return[];var d=l.length;return d>1&&pn(o,l[0],l[1])?l=[]:d>2&&pn(l[0],l[1],l[2])&&(l=[l[0]]),O1(o,Xt(l,1),[])}),rf=AE||function(){return Pe.Date.now()};function JR(o,l){if(typeof l!="function")throw new nr(s);return o=Ee(o),function(){if(--o<1)return l.apply(this,arguments)}}function bS(o,l,d){return l=d?n:l,l=o&&l==null?o.length:l,Ci(o,D,n,n,n,n,l)}function CS(o,l){var d;if(typeof l!="function")throw new nr(s);return o=Ee(o),function(){return--o>0&&(d=l.apply(this,arguments)),o<=1&&(l=n),d}}var Tg=Re(function(o,l,d){var m=x;if(d.length){var b=ea(d,Ko(Tg));m|=I}return Ci(o,m,l,d,b)}),xS=Re(function(o,l,d){var m=x|_;if(d.length){var b=ea(d,Ko(xS));m|=I}return Ci(l,m,o,d,b)});function kS(o,l,d){l=d?n:l;var m=Ci(o,C,n,n,n,n,n,l);return m.placeholder=kS.placeholder,m}function PS(o,l,d){l=d?n:l;var m=Ci(o,O,n,n,n,n,n,l);return m.placeholder=PS.placeholder,m}function ES(o,l,d){var m,b,P,R,M,z,Z=0,ee=!1,ne=!1,ue=!0;if(typeof o!="function")throw new nr(s);l=sr(l)||0,ht(d)&&(ee=!!d.leading,ne="maxWait"in d,P=ne?Lt(sr(d.maxWait)||0,l):P,ue="trailing"in d?!!d.trailing:ue);function ge(xt){var Tr=m,Oi=b;return m=b=n,Z=xt,R=o.apply(Oi,Tr),R}function Se(xt){return Z=xt,M=Pl(Le,l),ee?ge(xt):R}function Oe(xt){var Tr=xt-z,Oi=xt-Z,VS=l-Tr;return ne?rn(VS,P-Oi):VS}function _e(xt){var Tr=xt-z,Oi=xt-Z;return z===n||Tr>=l||Tr<0||ne&&Oi>=P}function Le(){var xt=rf();if(_e(xt))return Ne(xt);M=Pl(Le,Oe(xt))}function Ne(xt){return M=n,ue&&m?ge(xt):(m=b=n,R)}function zn(){M!==n&&B1(M),Z=0,m=z=b=M=n}function gn(){return M===n?R:Ne(rf())}function Gn(){var xt=rf(),Tr=_e(xt);if(m=arguments,b=this,z=xt,Tr){if(M===n)return Se(z);if(ne)return B1(M),M=Pl(Le,l),ge(z)}return M===n&&(M=Pl(Le,l)),R}return Gn.cancel=zn,Gn.flush=gn,Gn}var ZR=Re(function(o,l){return m1(o,1,l)}),eA=Re(function(o,l,d){return m1(o,sr(l)||0,d)});function tA(o){return Ci(o,X)}function af(o,l){if(typeof o!="function"||l!=null&&typeof l!="function")throw new nr(s);var d=function(){var m=arguments,b=l?l.apply(this,m):m[0],P=d.cache;if(P.has(b))return P.get(b);var R=o.apply(this,m);return d.cache=P.set(b,R)||P,R};return d.cache=new(af.Cache||wi),d}af.Cache=wi;function of(o){if(typeof o!="function")throw new nr(s);return function(){var l=arguments;switch(l.length){case 0:return!o.call(this);case 1:return!o.call(this,l[0]);case 2:return!o.call(this,l[0],l[1]);case 3:return!o.call(this,l[0],l[1],l[2])}return!o.apply(this,l)}}function nA(o){return CS(2,o)}var rA=jO(function(o,l){l=l.length==1&&ke(l[0])?ut(l[0],Bn(ye())):ut(Xt(l,1),Bn(ye()));var d=l.length;return Re(function(m){for(var b=-1,P=rn(m.length,d);++b=l}),Ka=w1(function(){return arguments}())?w1:function(o){return St(o)&&Xe.call(o,"callee")&&!s1.call(o,"callee")},ke=q.isArray,yA=No?Bn(No):PO;function xn(o){return o!=null&&sf(o.length)&&!Pi(o)}function Ct(o){return St(o)&&xn(o)}function SA(o){return o===!0||o===!1||St(o)&&hn(o)==Bt}var oa=LE||Gg,_A=Bo?Bn(Bo):EO;function wA(o){return St(o)&&o.nodeType===1&&!El(o)}function bA(o){if(o==null)return!0;if(xn(o)&&(ke(o)||typeof o=="string"||typeof o.splice=="function"||oa(o)||Yo(o)||Ka(o)))return!o.length;var l=an(o);if(l==Et||l==Kt)return!o.size;if(kl(o))return!ag(o).length;for(var d in o)if(Xe.call(o,d))return!1;return!0}function CA(o,l){return bl(o,l)}function xA(o,l,d){d=typeof d=="function"?d:n;var m=d?d(o,l):n;return m===n?bl(o,l,n,d):!!m}function Ag(o){if(!St(o))return!1;var l=hn(o);return l==Ft||l==wr||typeof o.message=="string"&&typeof o.name=="string"&&!El(o)}function kA(o){return typeof o=="number"&&u1(o)}function Pi(o){if(!ht(o))return!1;var l=hn(o);return l==xe||l==Wr||l==qt||l==Qs}function TS(o){return typeof o=="number"&&o==Ee(o)}function sf(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=W}function ht(o){var l=typeof o;return o!=null&&(l=="object"||l=="function")}function St(o){return o!=null&&typeof o=="object"}var RS=dl?Bn(dl):TO;function PA(o,l){return o===l||ig(o,l,wg(l))}function EA(o,l,d){return d=typeof d=="function"?d:n,ig(o,l,wg(l),d)}function OA(o){return AS(o)&&o!=+o}function TA(o){if(dT(o))throw new Ce(a);return b1(o)}function RA(o){return o===null}function AA(o){return o==null}function AS(o){return typeof o=="number"||St(o)&&hn(o)==gi}function El(o){if(!St(o)||hn(o)!=Mn)return!1;var l=Lc(o);if(l===null)return!0;var d=Xe.call(l,"constructor")&&l.constructor;return typeof d=="function"&&d instanceof d&&Tc.call(d)==EE}var Ig=H0?Bn(H0):RO;function IA(o){return TS(o)&&o>=-W&&o<=W}var IS=V0?Bn(V0):AO;function lf(o){return typeof o=="string"||!ke(o)&&St(o)&&hn(o)==Dn}function $n(o){return typeof o=="symbol"||St(o)&&hn(o)==bt}var Yo=q0?Bn(q0):IO;function LA(o){return o===n}function MA(o){return St(o)&&an(o)==Hr}function DA(o){return St(o)&&hn(o)==Co}var NA=Qc(og),BA=Qc(function(o,l){return o<=l});function LS(o){if(!o)return[];if(xn(o))return lf(o)?Pr(o):Cn(o);if(pl&&o[pl])return gE(o[pl]());var l=an(o),d=l==Et?qp:l==Kt?Pc:Xo;return d(o)}function Ei(o){if(!o)return o===0?o:0;if(o=sr(o),o===ie||o===-ie){var l=o<0?-1:1;return l*Y}return o===o?o:0}function Ee(o){var l=Ei(o),d=l%1;return l===l?d?l-d:l:0}function MS(o){return o?Wa(Ee(o),0,oe):0}function sr(o){if(typeof o=="number")return o;if($n(o))return Q;if(ht(o)){var l=typeof o.valueOf=="function"?o.valueOf():o;o=ht(l)?l+"":l}if(typeof o!="string")return o===0?o:+o;o=Z0(o);var d=Cp.test(o);return d||kp.test(o)?fe(o.slice(2),d?2:8):bp.test(o)?Q:+o}function DS(o){return Kr(o,kn(o))}function FA(o){return o?Wa(Ee(o),-W,W):o===0?o:0}function Ve(o){return o==null?"":Fn(o)}var $A=Vo(function(o,l){if(kl(l)||xn(l)){Kr(l,zt(l),o);return}for(var d in l)Xe.call(l,d)&&Sl(o,d,l[d])}),NS=Vo(function(o,l){Kr(l,kn(l),o)}),uf=Vo(function(o,l,d,m){Kr(l,kn(l),o,m)}),zA=Vo(function(o,l,d,m){Kr(l,zt(l),o,m)}),GA=xi(Zp);function UA(o,l){var d=Ho(o);return l==null?d:p1(d,l)}var jA=Re(function(o,l){o=rt(o);var d=-1,m=l.length,b=m>2?l[2]:n;for(b&&pn(l[0],l[1],b)&&(m=1);++d1),P}),Kr(o,Sg(o),d),m&&(d=ir(d,p|g|y,eT));for(var b=l.length;b--;)fg(d,l[b]);return d});function sI(o,l){return FS(o,of(ye(l)))}var lI=xi(function(o,l){return o==null?{}:DO(o,l)});function FS(o,l){if(o==null)return{};var d=ut(Sg(o),function(m){return[m]});return l=ye(l),T1(o,d,function(m,b){return l(m,b[0])})}function uI(o,l,d){l=ia(l,o);var m=-1,b=l.length;for(b||(b=1,o=n);++ml){var m=o;o=l,l=m}if(d||o%1||l%1){var b=c1();return rn(o+b*(l-o+H("1e-"+((b+"").length-1))),l)}return lg(o,l)}var _I=qo(function(o,l,d){return l=l.toLowerCase(),o+(d?GS(l):l)});function GS(o){return Dg(Ve(o).toLowerCase())}function US(o){return o=Ve(o),o&&o.replace(Ep,cE).replace(_c,"")}function wI(o,l,d){o=Ve(o),l=Fn(l);var m=o.length;d=d===n?m:Wa(Ee(d),0,m);var b=d;return d-=l.length,d>=0&&o.slice(d,b)==l}function bI(o){return o=Ve(o),o&&mi.test(o)?o.replace(Yi,fE):o}function CI(o){return o=Ve(o),o&&pp.test(o)?o.replace(tl,"\\$&"):o}var xI=qo(function(o,l,d){return o+(d?"-":"")+l.toLowerCase()}),kI=qo(function(o,l,d){return o+(d?" ":"")+l.toLowerCase()}),PI=H1("toLowerCase");function EI(o,l,d){o=Ve(o),l=Ee(l);var m=l?zo(o):0;if(!l||m>=l)return o;var b=(l-m)/2;return Xc(Bc(b),d)+o+Xc(Nc(b),d)}function OI(o,l,d){o=Ve(o),l=Ee(l);var m=l?zo(o):0;return l&&m>>0,d?(o=Ve(o),o&&(typeof l=="string"||l!=null&&!Ig(l))&&(l=Fn(l),!l&&$o(o))?aa(Pr(o),0,d):o.split(l,d)):[]}var DI=qo(function(o,l,d){return o+(d?" ":"")+Dg(l)});function NI(o,l,d){return o=Ve(o),d=d==null?0:Wa(Ee(d),0,o.length),l=Fn(l),o.slice(d,d+l.length)==l}function BI(o,l,d){var m=k.templateSettings;d&&pn(o,l,d)&&(l=n),o=Ve(o),l=uf({},l,m,J1);var b=uf({},l.imports,m.imports,J1),P=zt(b),R=Vp(b,P),M,z,Z=0,ee=l.interpolate||Qi,ne="__p += '",ue=Kp((l.escape||Qi).source+"|"+ee.source+"|"+(ee===nc?wp:Qi).source+"|"+(l.evaluate||Qi).source+"|$","g"),ge="//# sourceURL="+(Xe.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++bc+"]")+` +`;o.replace(ue,function(_e,Le,Ne,zn,gn,Gn){return Ne||(Ne=zn),ne+=o.slice(Z,Gn).replace(Op,dE),Le&&(M=!0,ne+=`' + +__e(`+Le+`) + +'`),gn&&(z=!0,ne+=`'; +`+gn+`; +__p += '`),Ne&&(ne+=`' + +((__t = (`+Ne+`)) == null ? '' : __t) + +'`),Z=Gn+_e.length,_e}),ne+=`'; +`;var Se=Xe.call(l,"variable")&&l.variable;if(!Se)ne=`with (obj) { +`+ne+` +} +`;else if(Sp.test(Se))throw new Ce(u);ne=(z?ne.replace(sp,""):ne).replace(tc,"$1").replace(lp,"$1;"),ne="function("+(Se||"obj")+`) { +`+(Se?"":`obj || (obj = {}); +`)+"var __t, __p = ''"+(M?", __e = _.escape":"")+(z?`, __j = Array.prototype.join; +function print() { __p += __j.call(arguments, '') } +`:`; +`)+ne+`return __p +}`;var Oe=WS(function(){return je(P,ge+"return "+ne).apply(n,R)});if(Oe.source=ne,Ag(Oe))throw Oe;return Oe}function FI(o){return Ve(o).toLowerCase()}function $I(o){return Ve(o).toUpperCase()}function zI(o,l,d){if(o=Ve(o),o&&(d||l===n))return Z0(o);if(!o||!(l=Fn(l)))return o;var m=Pr(o),b=Pr(l),P=e1(m,b),R=t1(m,b)+1;return aa(m,P,R).join("")}function GI(o,l,d){if(o=Ve(o),o&&(d||l===n))return o.slice(0,r1(o)+1);if(!o||!(l=Fn(l)))return o;var m=Pr(o),b=t1(m,Pr(l))+1;return aa(m,0,b).join("")}function UI(o,l,d){if(o=Ve(o),o&&(d||l===n))return o.replace(nl,"");if(!o||!(l=Fn(l)))return o;var m=Pr(o),b=e1(m,Pr(l));return aa(m,b).join("")}function jI(o,l){var d=K,m=te;if(ht(l)){var b="separator"in l?l.separator:b;d="length"in l?Ee(l.length):d,m="omission"in l?Fn(l.omission):m}o=Ve(o);var P=o.length;if($o(o)){var R=Pr(o);P=R.length}if(d>=P)return o;var M=d-zo(m);if(M<1)return m;var z=R?aa(R,0,M).join(""):o.slice(0,M);if(b===n)return z+m;if(R&&(M+=z.length-M),Ig(b)){if(o.slice(M).search(b)){var Z,ee=z;for(b.global||(b=Kp(b.source,Ve(vi.exec(b))+"g")),b.lastIndex=0;Z=b.exec(ee);)var ne=Z.index;z=z.slice(0,ne===n?M:ne)}}else if(o.indexOf(Fn(b),M)!=M){var ue=z.lastIndexOf(b);ue>-1&&(z=z.slice(0,ue))}return z+m}function WI(o){return o=Ve(o),o&&up.test(o)?o.replace(el,SE):o}var HI=qo(function(o,l,d){return o+(d?" ":"")+l.toUpperCase()}),Dg=H1("toUpperCase");function jS(o,l,d){return o=Ve(o),l=d?n:l,l===n?pE(o)?bE(o):aE(o):o.match(l)||[]}var WS=Re(function(o,l){try{return Nn(o,n,l)}catch(d){return Ag(d)?d:new Ce(d)}}),VI=xi(function(o,l){return tr(l,function(d){d=Yr(d),bi(o,d,Tg(o[d],o))}),o});function qI(o){var l=o==null?0:o.length,d=ye();return o=l?ut(o,function(m){if(typeof m[1]!="function")throw new nr(s);return[d(m[0]),m[1]]}):[],Re(function(m){for(var b=-1;++bW)return[];var d=oe,m=rn(o,oe);l=ye(l),o-=oe;for(var b=Hp(m,l);++d0||l<0)?new Me(d):(o<0?d=d.takeRight(-o):o&&(d=d.drop(o)),l!==n&&(l=Ee(l),d=l<0?d.dropRight(-l):d.take(l-o)),d)},Me.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Me.prototype.toArray=function(){return this.take(oe)},qr(Me.prototype,function(o,l){var d=/^(?:filter|find|map|reject)|While$/.test(l),m=/^(?:head|last)$/.test(l),b=k[m?"take"+(l=="last"?"Right":""):l],P=m||/^find/.test(l);b&&(k.prototype[l]=function(){var R=this.__wrapped__,M=m?[1]:arguments,z=R instanceof Me,Z=M[0],ee=z||ke(R),ne=function(Le){var Ne=b.apply(k,Zi([Le],M));return m&&ue?Ne[0]:Ne};ee&&d&&typeof Z=="function"&&Z.length!=1&&(z=ee=!1);var ue=this.__chain__,ge=!!this.__actions__.length,Se=P&&!ue,Oe=z&&!ge;if(!P&&ee){R=Oe?R:new Me(this);var _e=o.apply(R,M);return _e.__actions__.push({func:tf,args:[ne],thisArg:n}),new rr(_e,ue)}return Se&&Oe?o.apply(this,M):(_e=this.thru(ne),Se?m?_e.value()[0]:_e.value():_e)})}),tr(["pop","push","shift","sort","splice","unshift"],function(o){var l=Ec[o],d=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",m=/^(?:pop|shift)$/.test(o);k.prototype[o]=function(){var b=arguments;if(m&&!this.__chain__){var P=this.value();return l.apply(ke(P)?P:[],b)}return this[d](function(R){return l.apply(ke(R)?R:[],b)})}}),qr(Me.prototype,function(o,l){var d=k[l];if(d){var m=d.name+"";Xe.call(Wo,m)||(Wo[m]=[]),Wo[m].push({name:l,func:d})}}),Wo[Kc(n,_).name]=[{name:"wrapper",func:n}],Me.prototype.clone=WE,Me.prototype.reverse=HE,Me.prototype.value=VE,k.prototype.at=wR,k.prototype.chain=bR,k.prototype.commit=CR,k.prototype.next=xR,k.prototype.plant=PR,k.prototype.reverse=ER,k.prototype.toJSON=k.prototype.valueOf=k.prototype.value=OR,k.prototype.first=k.prototype.head,pl&&(k.prototype[pl]=kR),k},Go=CE();ze?((ze.exports=Go)._=Go,Te._=Go):Pe._=Go}).call(yn)})(g5,_t);const Jo=(t,e,n,r,i,a,s)=>{const u=t/2-(n+i/2)*s,c=e/2-(r+a/2)*s;return{x:u,y:c}},Zo=(t,e,n,r,i=.95)=>{const a=t*i/n,s=e*i/r;return Math.min(1,Math.min(a,s))},LG=.999,MG=.1,DG=20,Nl=.95,NG=30,BG=10,Pw=t=>({x:Math.floor(t.x),y:Math.floor(t.y)}),Ya=t=>{const{width:e,height:n}=t,r={width:e,height:n},i=512*512,a=e/n;let s=e*n,u=448;for(;s1?(r.width=u,r.height=va(u/a,64)):a<1&&(r.height=u,r.width=va(u*a,64)),s=r.width*r.height;return r},m5=t=>({width:va(t.width,64),height:va(t.height,64)}),FG=[{key:"Base",value:"base"},{key:"Mask",value:"mask"}],$G=[{key:"Auto",value:"auto"},{key:"Manual",value:"manual"},{key:"None",value:"none"}],Qx=t=>t.kind==="line"&&t.layer==="mask",zG=t=>t.kind==="line"&&t.layer==="base",Ew=t=>t.kind==="image"&&t.layer==="base",GG=t=>t.kind==="fillRect"&&t.layer==="base",UG=t=>t.kind==="eraseRect"&&t.layer==="base",v5=t=>t.kind==="line",Zl={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},y5={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"auto",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,canvasContainerDimensions:{width:0,height:0},colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,doesCanvasNeedScaling:!1,futureLayerStates:[],isCanvasInitialized:!1,isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:Zl,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},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"},Jx=vo({name:"canvas",initialState:y5,reducers:{setTool:(t,e)=>{const n=e.payload;t.tool=e.payload,n!=="move"&&(t.isTransformingBoundingBox=!1,t.isMouseOverBoundingBox=!1,t.isMovingBoundingBox=!1,t.isMovingStage=!1)},setLayer:(t,e)=>{t.layer=e.payload},toggleTool:t=>{const e=t.tool;e!=="move"&&(t.tool=e==="brush"?"eraser":"brush")},setMaskColor:(t,e)=>{t.maskColor=e.payload},setBrushColor:(t,e)=>{t.brushColor=e.payload},setBrushSize:(t,e)=>{t.brushSize=e.payload},clearMask:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState.objects=t.layerState.objects.filter(e=>!Qx(e)),t.futureLayerStates=[],t.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:t=>{t.shouldPreserveMaskedArea=!t.shouldPreserveMaskedArea},toggleShouldShowMask:t=>{t.isMaskEnabled=!t.isMaskEnabled},setShouldPreserveMaskedArea:(t,e)=>{t.shouldPreserveMaskedArea=e.payload},setIsMaskEnabled:(t,e)=>{t.isMaskEnabled=e.payload,t.layer=e.payload?"mask":"base"},setShouldShowCheckboardTransparency:(t,e)=>{t.shouldShowCheckboardTransparency=e.payload},setShouldShowBrushPreview:(t,e)=>{t.shouldShowBrushPreview=e.payload},setShouldShowBrush:(t,e)=>{t.shouldShowBrush=e.payload},setCursorPosition:(t,e)=>{t.cursorPosition=e.payload},setInitialCanvasImage:(t,e)=>{const n=e.payload,{stageDimensions:r}=t,i={width:Ef(_t.clamp(n.width,64,512),64),height:Ef(_t.clamp(n.height,64,512),64)},a={x:va(n.width/2-i.width/2,64),y:va(n.height/2-i.height/2,64)};if(t.boundingBoxScaleMethod==="auto"){const c=Ya(i);t.scaledBoundingBoxDimensions=c}t.boundingBoxDimensions=i,t.boundingBoxCoordinates=a,t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState={...Zl,objects:[{kind:"image",layer:"base",x:0,y:0,width:n.width,height:n.height,image:n}]},t.futureLayerStates=[],t.isCanvasInitialized=!1;const s=Zo(r.width,r.height,n.width,n.height,Nl),u=Jo(r.width,r.height,0,0,n.width,n.height,s);t.stageScale=s,t.stageCoordinates=u,t.doesCanvasNeedScaling=!0},setBoundingBoxDimensions:(t,e)=>{const n=m5(e.payload);if(t.boundingBoxDimensions=n,t.boundingBoxScaleMethod==="auto"){const r=Ya(n);t.scaledBoundingBoxDimensions=r}},setBoundingBoxCoordinates:(t,e)=>{t.boundingBoxCoordinates=Pw(e.payload)},setStageCoordinates:(t,e)=>{t.stageCoordinates=e.payload},setBoundingBoxPreviewFill:(t,e)=>{t.boundingBoxPreviewFill=e.payload},setDoesCanvasNeedScaling:(t,e)=>{t.doesCanvasNeedScaling=e.payload},setStageScale:(t,e)=>{t.stageScale=e.payload},setShouldDarkenOutsideBoundingBox:(t,e)=>{t.shouldDarkenOutsideBoundingBox=e.payload},setIsDrawing:(t,e)=>{t.isDrawing=e.payload},clearCanvasHistory:t=>{t.pastLayerStates=[],t.futureLayerStates=[]},setShouldLockBoundingBox:(t,e)=>{t.shouldLockBoundingBox=e.payload},toggleShouldLockBoundingBox:t=>{t.shouldLockBoundingBox=!t.shouldLockBoundingBox},setShouldShowBoundingBox:(t,e)=>{t.shouldShowBoundingBox=e.payload},setIsTransformingBoundingBox:(t,e)=>{t.isTransformingBoundingBox=e.payload},setIsMovingBoundingBox:(t,e)=>{t.isMovingBoundingBox=e.payload},setIsMouseOverBoundingBox:(t,e)=>{t.isMouseOverBoundingBox=e.payload},setIsMoveBoundingBoxKeyHeld:(t,e)=>{t.isMoveBoundingBoxKeyHeld=e.payload},setIsMoveStageKeyHeld:(t,e)=>{t.isMoveStageKeyHeld=e.payload},addImageToStagingArea:(t,e)=>{const{boundingBox:n,image:r}=e.payload;!n||!r||(t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.stagingArea.images.push({kind:"image",layer:"base",...n,image:r}),t.layerState.stagingArea.selectedImageIndex=t.layerState.stagingArea.images.length-1,t.futureLayerStates=[])},discardStagedImages:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.stagingArea={...Zl.stagingArea},t.futureLayerStates=[],t.shouldShowStagingOutline=!0,t.shouldShowStagingOutline=!0},addFillRect:t=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:n,brushColor:r}=t;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({kind:"fillRect",layer:"base",...e,...n,color:r}),t.futureLayerStates=[]},addEraseRect:t=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:n}=t;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({kind:"eraseRect",layer:"base",...e,...n}),t.futureLayerStates=[]},addLine:(t,e)=>{const{tool:n,layer:r,brushColor:i,brushSize:a,shouldRestrictStrokesToBox:s}=t;if(n==="move"||n==="colorPicker")return;const u=a/2,c=r==="base"&&n==="brush"?{color:i}:{};t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift();const f={kind:"line",layer:r,tool:n,strokeWidth:u,points:e.payload,...c};s&&(f.clip={...t.boundingBoxCoordinates,...t.boundingBoxDimensions}),t.layerState.objects.push(f),t.futureLayerStates=[]},addPointToCurrentLine:(t,e)=>{const n=t.layerState.objects.findLast(v5);n&&n.points.push(...e.payload)},undo:t=>{const e=t.pastLayerStates.pop();e&&(t.futureLayerStates.unshift(_t.cloneDeep(t.layerState)),t.futureLayerStates.length>t.maxHistory&&t.futureLayerStates.pop(),t.layerState=e)},redo:t=>{const e=t.futureLayerStates.shift();e&&(t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState=e)},setShouldShowGrid:(t,e)=>{t.shouldShowGrid=e.payload},setIsMovingStage:(t,e)=>{t.isMovingStage=e.payload},setShouldSnapToGrid:(t,e)=>{t.shouldSnapToGrid=e.payload},setShouldAutoSave:(t,e)=>{t.shouldAutoSave=e.payload},setShouldShowIntermediates:(t,e)=>{t.shouldShowIntermediates=e.payload},resetCanvas:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState=Zl,t.futureLayerStates=[]},setCanvasContainerDimensions:(t,e)=>{t.canvasContainerDimensions=e.payload},resizeAndScaleCanvas:t=>{const{width:e,height:n}=t.canvasContainerDimensions,r=t.layerState.objects.find(Ew),i={width:Math.floor(e),height:Math.floor(n)};if(!r){const h=Zo(i.width,i.height,512,512,Nl),p=Jo(i.width,i.height,0,0,512,512,h),g={width:512,height:512};if(t.stageScale=h,t.stageCoordinates=p,t.stageDimensions=i,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=g,t.boundingBoxScaleMethod==="auto"){const y=Ya(g);t.scaledBoundingBoxDimensions=y}return}const{width:a,height:s}=r,c=Zo(e,n,a,s,.95),f=Jo(i.width,i.height,0,0,a,s,c);t.minimumStageScale=c,t.stageScale=c,t.stageCoordinates=Pw(f),t.stageDimensions=i,t.isCanvasInitialized=!0},resizeCanvas:t=>{const{width:e,height:n}=t.canvasContainerDimensions,r={width:Math.floor(e),height:Math.floor(n)};if(t.stageDimensions=r,!t.layerState.objects.find(Ew)){const i=Zo(r.width,r.height,512,512,Nl),a=Jo(r.width,r.height,0,0,512,512,i),s={width:512,height:512};if(t.stageScale=i,t.stageCoordinates=a,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=s,t.boundingBoxScaleMethod==="auto"){const u=Ya(s);t.scaledBoundingBoxDimensions=u}}},resetCanvasView:(t,e)=>{const{contentRect:n,shouldScaleTo1:r}=e.payload,{stageDimensions:{width:i,height:a}}=t,{x:s,y:u,width:c,height:f}=n;if(c!==0&&f!==0){const h=r?1:Zo(i,a,c,f,Nl),p=Jo(i,a,s,u,c,f,h);t.stageScale=h,t.stageCoordinates=p}else{const h=Zo(i,a,512,512,Nl),p=Jo(i,a,0,0,512,512,h),g={width:512,height:512};if(t.stageScale=h,t.stageCoordinates=p,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=g,t.boundingBoxScaleMethod==="auto"){const y=Ya(g);t.scaledBoundingBoxDimensions=y}}},nextStagingAreaImage:t=>{const e=t.layerState.stagingArea.selectedImageIndex,n=t.layerState.stagingArea.images.length;t.layerState.stagingArea.selectedImageIndex=Math.min(e+1,n-1)},prevStagingAreaImage:t=>{const e=t.layerState.stagingArea.selectedImageIndex;t.layerState.stagingArea.selectedImageIndex=Math.max(e-1,0)},commitStagingAreaImage:t=>{const{images:e,selectedImageIndex:n}=t.layerState.stagingArea;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({...e[n]}),t.layerState.stagingArea={...Zl.stagingArea},t.futureLayerStates=[],t.shouldShowStagingOutline=!0,t.shouldShowStagingImage=!0},fitBoundingBoxToStage:t=>{const{boundingBoxDimensions:e,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=t,a=r.width/i,s=r.height/i;if(n.x<0||n.x+e.width>a||n.y<0||n.y+e.height>s){const u={width:Ef(_t.clamp(a,64,512),64),height:Ef(_t.clamp(s,64,512),64)},c={x:va(a/2-u.width/2,64),y:va(s/2-u.height/2,64)};if(t.boundingBoxDimensions=u,t.boundingBoxCoordinates=c,t.boundingBoxScaleMethod==="auto"){const f=Ya(u);t.scaledBoundingBoxDimensions=f}}},setBoundingBoxScaleMethod:(t,e)=>{if(t.boundingBoxScaleMethod=e.payload,e.payload==="auto"){const n=Ya(t.boundingBoxDimensions);t.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(t,e)=>{t.scaledBoundingBoxDimensions=e.payload},setShouldShowStagingImage:(t,e)=>{t.shouldShowStagingImage=e.payload},setShouldShowStagingOutline:(t,e)=>{t.shouldShowStagingOutline=e.payload},setShouldShowCanvasDebugInfo:(t,e)=>{t.shouldShowCanvasDebugInfo=e.payload},setShouldRestrictStrokesToBox:(t,e)=>{t.shouldRestrictStrokesToBox=e.payload},setShouldCropToBoundingBoxOnSave:(t,e)=>{t.shouldCropToBoundingBoxOnSave=e.payload},setColorPickerColor:(t,e)=>{t.colorPickerColor=e.payload},commitColorPickerColor:t=>{t.brushColor={...t.colorPickerColor,a:t.brushColor.a},t.tool="brush"},setMergedCanvas:(t,e)=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.futureLayerStates=[],t.layerState.objects=[e.payload]},resetCanvasInteractionState:t=>{t.cursorPosition=null,t.isDrawing=!1,t.isMouseOverBoundingBox=!1,t.isMoveBoundingBoxKeyHeld=!1,t.isMoveStageKeyHeld=!1,t.isMovingBoundingBox=!1,t.isMovingStage=!1,t.isTransformingBoundingBox=!1},mouseLeftCanvas:t=>{t.cursorPosition=null,t.isDrawing=!1,t.isMouseOverBoundingBox=!1,t.isMovingBoundingBox=!1,t.isTransformingBoundingBox=!1}}}),{addEraseRect:jG,addFillRect:WG,addImageToStagingArea:S5,addLine:HG,addPointToCurrentLine:VG,clearCanvasHistory:qG,clearMask:KG,commitColorPickerColor:YG,commitStagingAreaImage:XG,discardStagedImages:QG,fitBoundingBoxToStage:JG,mouseLeftCanvas:ZG,nextStagingAreaImage:eU,prevStagingAreaImage:tU,redo:nU,resetCanvas:rU,resetCanvasInteractionState:iU,resetCanvasView:aU,resizeAndScaleCanvas:oU,resizeCanvas:sU,setBoundingBoxCoordinates:lU,setBoundingBoxDimensions:uU,setBoundingBoxPreviewFill:cU,setBoundingBoxScaleMethod:fU,setBrushColor:dU,setBrushSize:hU,setCanvasContainerDimensions:pU,setColorPickerColor:gU,setCursorPosition:mU,setDoesCanvasNeedScaling:vU,setInitialCanvasImage:yU,setIsDrawing:SU,setIsMaskEnabled:_U,setIsMouseOverBoundingBox:wU,setIsMoveBoundingBoxKeyHeld:bU,setIsMoveStageKeyHeld:CU,setIsMovingBoundingBox:xU,setIsMovingStage:kU,setIsTransformingBoundingBox:PU,setLayer:EU,setMaskColor:OU,setMergedCanvas:TU,setShouldAutoSave:RU,setShouldCropToBoundingBoxOnSave:AU,setShouldDarkenOutsideBoundingBox:IU,setShouldLockBoundingBox:LU,setShouldPreserveMaskedArea:MU,setShouldShowBoundingBox:DU,setShouldShowBrush:NU,setShouldShowBrushPreview:BU,setShouldShowCanvasDebugInfo:FU,setShouldShowCheckboardTransparency:$U,setShouldShowGrid:zU,setShouldShowIntermediates:GU,setShouldShowStagingImage:UU,setShouldShowStagingOutline:jU,setShouldSnapToGrid:WU,setStageCoordinates:HU,setStageScale:VU,setTool:qU,toggleShouldLockBoundingBox:KU,toggleTool:YU,undo:XU,setScaledBoundingBoxDimensions:QU,setShouldRestrictStrokesToBox:JU}=Jx.actions,_5=Jx.reducer,w5={currentImageUuid:"",galleryImageMinimumWidth:64,galleryImageObjectFit:"cover",shouldAutoSwitchToNewImages:!0,currentCategory:"result",categories:{user:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0},result:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0}},galleryWidth:300,shouldUseSingleGalleryColumn:!1},Zx=vo({name:"gallery",initialState:w5,reducers:{setCurrentImage:(t,e)=>{t.currentImage=e.payload,t.currentImageUuid=e.payload.uuid},removeImage:(t,e)=>{const{uuid:n,category:r}=e.payload,i=t.categories[r].images,a=i.filter(s=>s.uuid!==n);if(n===t.currentImageUuid){const s=i.findIndex(c=>c.uuid===n),u=_t.clamp(s,0,a.length-1);t.currentImage=a.length?a[u]:void 0,t.currentImageUuid=a.length?a[u].uuid:""}t.categories[r].images=a},addImage:(t,e)=>{const{image:n,category:r}=e.payload,{uuid:i,url:a,mtime:s}=n,u=t.categories[r];u.images.find(c=>c.url===a&&c.mtime===s)||(u.images.unshift(n),t.shouldAutoSwitchToNewImages&&(t.currentImageUuid=i,t.currentImage=n,t.currentCategory=r),t.intermediateImage=void 0,u.latest_mtime=s)},setIntermediateImage:(t,e)=>{t.intermediateImage=e.payload},clearIntermediateImage:t=>{t.intermediateImage=void 0},selectNextImage:t=>{const{currentImage:e}=t;if(!e)return;const n=t.categories[e.category].images;if(e){const r=n.findIndex(i=>i.uuid===e.uuid);if(r{const{currentImage:e}=t;if(!e)return;const n=t.categories[e.category].images;if(e){const r=n.findIndex(i=>i.uuid===e.uuid);if(r>0){const i=n[r-1];t.currentImage=i,t.currentImageUuid=i.uuid}}},addGalleryImages:(t,e)=>{const{images:n,areMoreImagesAvailable:r,category:i}=e.payload,a=t.categories[i].images;if(n.length>0){const s=n.filter(u=>!a.find(c=>c.url===u.url&&c.mtime===u.mtime));if(t.categories[i].images=a.concat(s).sort((u,c)=>c.mtime-u.mtime),!t.currentImage){const u=n[0];t.currentImage=u,t.currentImageUuid=u.uuid}t.categories[i].latest_mtime=n[0].mtime,t.categories[i].earliest_mtime=n[n.length-1].mtime}r!==void 0&&(t.categories[i].areMoreImagesAvailable=r)},setGalleryImageMinimumWidth:(t,e)=>{t.galleryImageMinimumWidth=e.payload},setGalleryImageObjectFit:(t,e)=>{t.galleryImageObjectFit=e.payload},setShouldAutoSwitchToNewImages:(t,e)=>{t.shouldAutoSwitchToNewImages=e.payload},setCurrentCategory:(t,e)=>{t.currentCategory=e.payload},setGalleryWidth:(t,e)=>{t.galleryWidth=e.payload},setShouldUseSingleGalleryColumn:(t,e)=>{t.shouldUseSingleGalleryColumn=e.payload}}}),{addImage:Of,clearIntermediateImage:Cm,removeImage:ek,setCurrentImage:ZU,addGalleryImages:b5,setIntermediateImage:C5,selectNextImage:ej,selectPrevImage:tj,setGalleryImageMinimumWidth:nj,setGalleryImageObjectFit:rj,setShouldAutoSwitchToNewImages:ij,setCurrentCategory:aj,setGalleryWidth:oj,setShouldUseSingleGalleryColumn:sj}=Zx.actions,x5=Zx.reducer,k5={isLightboxOpen:!1},P5=k5,tk=vo({name:"lightbox",initialState:P5,reducers:{setIsLightboxOpen:(t,e)=>{t.isLightboxOpen=e.payload}}}),{setIsLightboxOpen:lj}=tk.actions,E5=tk.reducer,dd=t=>typeof t=="string"?t:t.length===1?t[0].prompt:t.map(e=>`${e.prompt}:${e.weight}`).join(" ");function O5(t){let e=typeof t=="string"?t:dd(t),n="";const r=new RegExp(/\[([^\][]*)]/,"gi"),i=[...e.matchAll(r)].map(a=>a[1]);return i.length&&(n=i.join(" "),i.forEach(a=>{e=e.replace(`[${a}]`,"").replaceAll("[]","").trim()})),[e,n]}const T5=t=>{const r=t.split(",").map(i=>i.split(":")).map(i=>({seed:Number(i[0]),weight:Number(i[1])}));return R5(r)?r:!1},R5=t=>Boolean(typeof t=="string"?T5(t):t.length&&!t.some(e=>{const{seed:n,weight:r}=e,i=!isNaN(parseInt(n.toString(),10)),a=!isNaN(parseInt(r.toString(),10))&&r>=0&&r<=1;return!(i&&a)})),Ow=t=>t.reduce((e,n,r,i)=>{const{seed:a,weight:s}=n;return e+=`${a}:${s}`,r!==i.length-1&&(e+=","),e},""),A5=t=>t.split(",").map(r=>r.split(":")).map(r=>[parseInt(r[0],10),parseFloat(r[1])]),nk={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,maskPath:"",perlin:0,prompt:"",negativePrompt:"",sampler:"k_lms",seamBlur:16,seamless:!1,seamSize:96,seamSteps:30,seamStrength:.7,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,tileSize:32,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0},I5=nk,rk=vo({name:"generation",initialState:I5,reducers:{setPrompt:(t,e)=>{const n=e.payload;typeof n=="string"?t.prompt=n:t.prompt=dd(n)},setNegativePrompt:(t,e)=>{const n=e.payload;typeof n=="string"?t.negativePrompt=n:t.negativePrompt=dd(n)},setIterations:(t,e)=>{t.iterations=e.payload},setSteps:(t,e)=>{t.steps=e.payload},clampSymmetrySteps:t=>{t.horizontalSymmetrySteps=_t.clamp(t.horizontalSymmetrySteps,0,t.steps),t.verticalSymmetrySteps=_t.clamp(t.verticalSymmetrySteps,0,t.steps)},setCfgScale:(t,e)=>{t.cfgScale=e.payload},setThreshold:(t,e)=>{t.threshold=e.payload},setPerlin:(t,e)=>{t.perlin=e.payload},setHeight:(t,e)=>{t.height=e.payload},setWidth:(t,e)=>{t.width=e.payload},setSampler:(t,e)=>{t.sampler=e.payload},setSeed:(t,e)=>{t.seed=e.payload,t.shouldRandomizeSeed=!1},setImg2imgStrength:(t,e)=>{t.img2imgStrength=e.payload},setMaskPath:(t,e)=>{t.maskPath=e.payload},setSeamless:(t,e)=>{t.seamless=e.payload},setShouldFitToWidthHeight:(t,e)=>{t.shouldFitToWidthHeight=e.payload},resetSeed:t=>{t.seed=-1},setParameter:(t,e)=>{const{key:n,value:r}=e.payload,i={...t,[n]:r};return n==="seed"&&(i.shouldRandomizeSeed=!1),i},setShouldGenerateVariations:(t,e)=>{t.shouldGenerateVariations=e.payload},setVariationAmount:(t,e)=>{t.variationAmount=e.payload},setSeedWeights:(t,e)=>{t.seedWeights=e.payload,t.shouldGenerateVariations=!0,t.variationAmount=0},setAllTextToImageParameters:(t,e)=>{const{sampler:n,prompt:r,seed:i,variations:a,steps:s,cfg_scale:u,threshold:c,perlin:f,seamless:h,_hires_fix:p,width:g,height:y}=e.payload.image;a&&a.length>0?(t.seedWeights=Ow(a),t.shouldGenerateVariations=!0,t.variationAmount=0):t.shouldGenerateVariations=!1,i&&(t.seed=i,t.shouldRandomizeSeed=!1),r&&(t.prompt=dd(r)),n&&(t.sampler=n),s&&(t.steps=s),u&&(t.cfgScale=u),typeof c>"u"?t.threshold=0:t.threshold=c,typeof f>"u"?t.perlin=0:t.perlin=f,typeof h=="boolean"&&(t.seamless=h),g&&(t.width=g),y&&(t.height=y)},setAllImageToImageParameters:(t,e)=>{const{type:n,strength:r,fit:i,init_image_path:a,mask_image_path:s}=e.payload.image;n==="img2img"&&(a&&(t.initialImage=a),s&&(t.maskPath=s),r&&(t.img2imgStrength=r),typeof i=="boolean"&&(t.shouldFitToWidthHeight=i))},setAllParameters:(t,e)=>{const{type:n,sampler:r,prompt:i,seed:a,variations:s,steps:u,cfg_scale:c,threshold:f,perlin:h,seamless:p,_hires_fix:g,width:y,height:v,strength:w,fit:x,init_image_path:_,mask_image_path:S}=e.payload.image;if(n==="img2img"&&(_&&(t.initialImage=_),S&&(t.maskPath=S),w&&(t.img2imgStrength=w),typeof x=="boolean"&&(t.shouldFitToWidthHeight=x)),s&&s.length>0?(t.seedWeights=Ow(s),t.shouldGenerateVariations=!0,t.variationAmount=0):t.shouldGenerateVariations=!1,a&&(t.seed=a,t.shouldRandomizeSeed=!1),i){const[C,O]=O5(i);C&&(t.prompt=C),O?t.negativePrompt=O:t.negativePrompt=""}r&&(t.sampler=r),u&&(t.steps=u),c&&(t.cfgScale=c),typeof f>"u"?t.threshold=0:t.threshold=f,typeof h>"u"?t.perlin=0:t.perlin=h,typeof p=="boolean"&&(t.seamless=p),y&&(t.width=y),v&&(t.height=v)},resetParametersState:t=>({...t,...nk}),setShouldRandomizeSeed:(t,e)=>{t.shouldRandomizeSeed=e.payload},setInitialImage:(t,e)=>{t.initialImage=e.payload},clearInitialImage:t=>{t.initialImage=void 0},setSeamSize:(t,e)=>{t.seamSize=e.payload},setSeamBlur:(t,e)=>{t.seamBlur=e.payload},setSeamStrength:(t,e)=>{t.seamStrength=e.payload},setSeamSteps:(t,e)=>{t.seamSteps=e.payload},setTileSize:(t,e)=>{t.tileSize=e.payload},setInfillMethod:(t,e)=>{t.infillMethod=e.payload},setShouldUseSymmetry:(t,e)=>{t.shouldUseSymmetry=e.payload},setHorizontalSymmetrySteps:(t,e)=>{t.horizontalSymmetrySteps=e.payload},setVerticalSymmetrySteps:(t,e)=>{t.verticalSymmetrySteps=e.payload}}}),{clampSymmetrySteps:uj,clearInitialImage:L5,resetParametersState:cj,resetSeed:fj,setAllImageToImageParameters:dj,setAllParameters:hj,setAllTextToImageParameters:pj,setCfgScale:gj,setHeight:mj,setImg2imgStrength:vj,setInfillMethod:M5,setInitialImage:D5,setIterations:yj,setMaskPath:N5,setParameter:Sj,setPerlin:_j,setPrompt:wj,setNegativePrompt:bj,setSampler:Cj,setSeamBlur:xj,setSeamless:kj,setSeamSize:Pj,setSeamSteps:Ej,setSeamStrength:Oj,setSeed:Tj,setSeedWeights:Rj,setShouldFitToWidthHeight:Aj,setShouldGenerateVariations:Ij,setShouldRandomizeSeed:Lj,setSteps:Mj,setThreshold:Dj,setTileSize:Nj,setVariationAmount:Bj,setWidth:Fj,setShouldUseSymmetry:$j,setHorizontalSymmetrySteps:zj,setVerticalSymmetrySteps:Gj}=rk.actions,B5=rk.reducer,ik={codeformerFidelity:.75,facetoolStrength:.75,facetoolType:"gfpgan",hiresFix:!1,hiresStrength:.75,shouldLoopback:!1,shouldRunESRGAN:!1,shouldRunFacetool:!1,upscalingLevel:4,upscalingDenoising:.75,upscalingStrength:.75},F5=ik,ak=vo({name:"postprocessing",initialState:F5,reducers:{setFacetoolStrength:(t,e)=>{t.facetoolStrength=e.payload},setCodeformerFidelity:(t,e)=>{t.codeformerFidelity=e.payload},setUpscalingLevel:(t,e)=>{t.upscalingLevel=e.payload},setUpscalingDenoising:(t,e)=>{t.upscalingDenoising=e.payload},setUpscalingStrength:(t,e)=>{t.upscalingStrength=e.payload},setHiresFix:(t,e)=>{t.hiresFix=e.payload},setHiresStrength:(t,e)=>{t.hiresStrength=e.payload},resetPostprocessingState:t=>({...t,...ik}),setShouldRunFacetool:(t,e)=>{t.shouldRunFacetool=e.payload},setFacetoolType:(t,e)=>{t.facetoolType=e.payload},setShouldRunESRGAN:(t,e)=>{t.shouldRunESRGAN=e.payload},setShouldLoopback:(t,e)=>{t.shouldLoopback=e.payload}}}),{resetPostprocessingState:Uj,setCodeformerFidelity:jj,setFacetoolStrength:Wj,setFacetoolType:Hj,setHiresFix:Vj,setHiresStrength:qj,setShouldLoopback:Kj,setShouldRunESRGAN:Yj,setShouldRunFacetool:Xj,setUpscalingLevel:Qj,setUpscalingDenoising:Jj,setUpscalingStrength:Zj}=ak.actions,$5=ak.reducer;function Sr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tw(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.init(e,n)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=n||U5,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(n){this.debug=n}},{key:"log",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i1?r-1:0),a=1;a-1?u.replace(/###/g,"."):u}function i(){return!t||typeof t=="string"}for(var a=typeof e!="string"?[].concat(e):e.split(".");a.length>1;){if(i())return{};var s=r(a.shift());!t[s]&&n&&(t[s]=new n),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={}}return i()?{}:{obj:t,k:r(a.shift())}}function Mw(t,e,n){var r=O0(t,e,Object),i=r.obj,a=r.k;i[a]=n}function H5(t,e,n,r){var i=O0(t,e,Object),a=i.obj,s=i.k;a[s]=a[s]||[],r&&(a[s]=a[s].concat(n)),r||a[s].push(n)}function rh(t,e){var n=O0(t,e),r=n.obj,i=n.k;if(r)return r[i]}function Dw(t,e,n){var r=rh(t,n);return r!==void 0?r:rh(e,n)}function uk(t,e,n){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?typeof t[r]=="string"||t[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?n&&(t[r]=e[r]):uk(t[r],e[r],n):t[r]=e[r]);return t}function es(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var V5={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function q5(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,function(e){return V5[e]}):t}var Qh=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,K5=[" ",",","?","!",";"];function Y5(t,e,n){e=e||"",n=n||"";var r=K5.filter(function(u){return e.indexOf(u)<0&&n.indexOf(u)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(u){return u==="?"?"\\?":u}).join("|"),")")),a=!i.test(t);if(!a){var s=t.indexOf(n);s>0&&!i.test(t.substring(0,s))&&(a=!0)}return a}function Nw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Tf(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ck(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(t){if(t[e])return t[e];for(var r=e.split(n),i=t,a=0;aa+s;)s++,u=r.slice(a,a+s).join(n),c=i[u];if(c===void 0)return;if(c===null)return null;if(e.endsWith(u)){if(typeof c=="string")return c;if(u&&typeof c[u]=="string")return c[u]}var f=r.slice(a+s).join(n);return f?ck(c,f,n):void 0}i=i[r[a]]}return i}}var J5=function(t){Xh(n,t);var e=X5(n);function n(r){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Sr(this,n),i=e.call(this),Qh&&Aa.call(Ea(i)),i.data=r||{},i.options=a,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return _r(n,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var a=this.options.ns.indexOf(i);a>-1&&this.options.ns.splice(a,1)}},{key:"getResource",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},c=u.keySeparator!==void 0?u.keySeparator:this.options.keySeparator,f=u.ignoreJSONStructure!==void 0?u.ignoreJSONStructure:this.options.ignoreJSONStructure,h=[i,a];s&&typeof s!="string"&&(h=h.concat(s)),s&&typeof s=="string"&&(h=h.concat(c?s.split(c):s)),i.indexOf(".")>-1&&(h=i.split("."));var p=rh(this.data,h);return p||!f||typeof s!="string"?p:ck(this.data&&this.data[i]&&this.data[i][a],s,c)}},{key:"addResource",value:function(i,a,s,u){var c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},f=this.options.keySeparator;f===void 0&&(f=".");var h=[i,a];s&&(h=h.concat(f?s.split(f):s)),i.indexOf(".")>-1&&(h=i.split("."),u=a,a=h[1]),this.addNamespaces(a),Mw(this.data,h,u),c.silent||this.emit("added",i,a,s,u)}},{key:"addResources",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var c in s)(typeof s[c]=="string"||Object.prototype.toString.apply(s[c])==="[object Array]")&&this.addResource(i,a,c,s[c],{silent:!0});u.silent||this.emit("added",i,a,s)}},{key:"addResourceBundle",value:function(i,a,s,u,c){var f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},h=[i,a];i.indexOf(".")>-1&&(h=i.split("."),u=s,s=a,a=h[1]),this.addNamespaces(a);var p=rh(this.data,h)||{};u?uk(p,s,c):p=Tf(Tf({},p),s),Mw(this.data,h,p),f.silent||this.emit("added",i,a,s)}},{key:"removeResourceBundle",value:function(i,a){this.hasResourceBundle(i,a)&&delete this.data[i][a],this.removeNamespaces(a),this.emit("removed",i,a)}},{key:"hasResourceBundle",value:function(i,a){return this.getResource(i,a)!==void 0}},{key:"getResourceBundle",value:function(i,a){return a||(a=this.options.defaultNS),this.options.compatibilityAPI==="v1"?Tf(Tf({},{}),this.getResource(i,a)):this.getResource(i,a)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var a=this.getDataByLanguage(i),s=a&&Object.keys(a)||[];return!!s.find(function(u){return a[u]&&Object.keys(a[u]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),n}(Aa),fk={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,n,r,i,a){var s=this;return e.forEach(function(u){s.processors[u]&&(n=s.processors[u].process(n,r,i,a))}),n}};function Bw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mn(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Fw={},$w=function(t){Xh(n,t);var e=Z5(n);function n(r){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Sr(this,n),i=e.call(this),Qh&&Aa.call(Ea(i)),W5(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,Ea(i)),i.options=a,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=ii.create("translator"),i}return _r(n,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var s=this.resolve(i,a);return s&&s.res!==void 0}},{key:"extractFromKey",value:function(i,a){var s=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");var u=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=a.ns||this.options.defaultNS||[],f=s&&i.indexOf(s)>-1,h=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!Y5(i,s,u);if(f&&!h){var p=i.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:i,namespaces:c};var g=i.split(s);(s!==u||s===u&&this.options.ns.indexOf(g[0])>-1)&&(c=g.shift()),i=g.join(u)}return typeof c=="string"&&(c=[c]),{key:i,namespaces:c}}},{key:"translate",value:function(i,a,s){var u=this;if(gr(a)!=="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),a||(a={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var c=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,f=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,h=this.extractFromKey(i[i.length-1],a),p=h.key,g=h.namespaces,y=g[g.length-1],v=a.lng||this.language,w=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(v&&v.toLowerCase()==="cimode"){if(w){var x=a.nsSeparator||this.options.nsSeparator;return c?{res:"".concat(y).concat(x).concat(p),usedKey:p,exactUsedKey:p,usedLng:v,usedNS:y}:"".concat(y).concat(x).concat(p)}return c?{res:p,usedKey:p,exactUsedKey:p,usedLng:v,usedNS:y}:p}var _=this.resolve(i,a),S=_&&_.res,C=_&&_.usedKey||p,O=_&&_.exactUsedKey||p,I=Object.prototype.toString.apply(S),L=["[object Number]","[object Function]","[object RegExp]"],D=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,U=!this.i18nFormat||this.i18nFormat.handleAsObject,X=typeof S!="string"&&typeof S!="boolean"&&typeof S!="number";if(U&&S&&X&&L.indexOf(I)<0&&!(typeof D=="string"&&I==="[object Array]")){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var K=this.options.returnedObjectHandler?this.options.returnedObjectHandler(C,S,mn(mn({},a),{},{ns:g})):"key '".concat(p," (").concat(this.language,")' returned an object instead of string.");return c?(_.res=K,_):K}if(f){var te=I==="[object Array]",ce=te?[]:{},j=te?O:C;for(var T in S)if(Object.prototype.hasOwnProperty.call(S,T)){var $="".concat(j).concat(f).concat(T);ce[T]=this.translate($,mn(mn({},a),{joinArrays:!1,ns:g})),ce[T]===$&&(ce[T]=S[T])}S=ce}}else if(U&&typeof D=="string"&&I==="[object Array]")S=S.join(D),S&&(S=this.extendTranslation(S,i,a,s));else{var V=!1,ie=!1,W=a.count!==void 0&&typeof a.count!="string",Y=n.hasDefaultValue(a),Q=W?this.pluralResolver.getSuffix(v,a.count,a):"",oe=a["defaultValue".concat(Q)]||a.defaultValue;!this.isValidLookup(S)&&Y&&(V=!0,S=oe),this.isValidLookup(S)||(ie=!0,S=p);var ve=a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,we=ve&&ie?void 0:S,Ue=Y&&oe!==S&&this.options.updateMissing;if(ie||V||Ue){if(this.logger.log(Ue?"updateKey":"missingKey",v,y,p,Ue?oe:S),f){var At=this.resolve(p,mn(mn({},a),{},{keySeparator:!1}));At&&At.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.")}var me=[],qt=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&qt&&qt[0])for(var Bt=0;Bt1&&arguments[1]!==void 0?arguments[1]:{},u,c,f,h,p;return typeof i=="string"&&(i=[i]),i.forEach(function(g){if(!a.isValidLookup(u)){var y=a.extractFromKey(g,s),v=y.key;c=v;var w=y.namespaces;a.options.fallbackNS&&(w=w.concat(a.options.fallbackNS));var x=s.count!==void 0&&typeof s.count!="string",_=x&&!s.ordinal&&s.count===0&&a.pluralResolver.shouldUseIntlApi(),S=s.context!==void 0&&(typeof s.context=="string"||typeof s.context=="number")&&s.context!=="",C=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);w.forEach(function(O){a.isValidLookup(u)||(p=O,!Fw["".concat(C[0],"-").concat(O)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(p)&&(Fw["".concat(C[0],"-").concat(O)]=!0,a.logger.warn('key "'.concat(c,'" for languages "').concat(C.join(", "),`" won't get resolved as namespace "`).concat(p,'" 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!!!")),C.forEach(function(I){if(!a.isValidLookup(u)){h=I;var L=[v];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(L,v,I,O,s);else{var D;x&&(D=a.pluralResolver.getSuffix(I,s.count,s));var U="".concat(a.options.pluralSeparator,"zero");if(x&&(L.push(v+D),_&&L.push(v+U)),S){var X="".concat(v).concat(a.options.contextSeparator).concat(s.context);L.push(X),x&&(L.push(X+D),_&&L.push(X+U))}}for(var K;K=L.pop();)a.isValidLookup(u)||(f=K,u=a.getResource(I,O,K,s))}}))})}}),{res:u,usedKey:c,exactUsedKey:f,usedLng:h,usedNS:p}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,a,s,u):this.resourceStore.getResource(i,a,s,u)}}],[{key:"hasDefaultValue",value:function(i){var a="defaultValue";for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&a===s.substring(0,a.length)&&i[s]!==void 0)return!0;return!1}}]),n}(Aa);function xm(t){return t.charAt(0).toUpperCase()+t.slice(1)}var zw=function(){function t(e){Sr(this,t),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ii.create("languageUtils")}return _r(t,[{key:"getScriptPartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return null;var r=n.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return n;var r=n.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(n){if(typeof n=="string"&&n.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=n.split("-");return this.options.lowerCaseLng?i=i.map(function(a){return a.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=xm(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=xm(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=xm(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}},{key:"isSupportedCode",value:function(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}},{key:"getBestMatchFromCodes",value:function(n){var r=this;if(!n)return null;var i;return n.forEach(function(a){if(!i){var s=r.formatLanguageCode(a);(!r.options.supportedLngs||r.isSupportedCode(s))&&(i=s)}}),!i&&this.options.supportedLngs&&n.forEach(function(a){if(!i){var s=r.getLanguagePartFromCode(a);if(r.isSupportedCode(s))return i=s;i=r.options.supportedLngs.find(function(u){if(u.indexOf(s)===0)return u})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(n,r){if(!n)return[];if(typeof n=="function"&&(n=n(r)),typeof n=="string"&&(n=[n]),Object.prototype.toString.apply(n)==="[object Array]")return n;if(!r)return n.default||[];var i=n[r];return i||(i=n[this.getScriptPartFromCode(r)]),i||(i=n[this.formatLanguageCode(r)]),i||(i=n[this.getLanguagePartFromCode(r)]),i||(i=n.default),i||[]}},{key:"toResolveHierarchy",value:function(n,r){var i=this,a=this.getFallbackCodes(r||this.options.fallbackLng||[],n),s=[],u=function(f){f&&(i.isSupportedCode(f)?s.push(f):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(f)))};return typeof n=="string"&&n.indexOf("-")>-1?(this.options.load!=="languageOnly"&&u(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&u(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&u(this.getLanguagePartFromCode(n))):typeof n=="string"&&u(this.formatLanguageCode(n)),a.forEach(function(c){s.indexOf(c)<0&&u(i.formatLanguageCode(c))}),s}}]),t}(),t4=[{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}],n4={1:function(e){return Number(e>1)},2:function(e){return Number(e!=1)},3:function(e){return 0},4:function(e){return Number(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 Number(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 Number(e==1?0:e>=2&&e<=4?1:2)},7:function(e){return Number(e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(e==1?0:e==2?1:e!=8&&e!=11?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(e==1?0:e==2?1:e<7?2:e<11?3:4)},11:function(e){return Number(e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(e!==0)},14:function(e){return Number(e==1?0:e==2?1:e==3?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:e!==0?1:2)},17:function(e){return Number(e==1||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(e==0?0:e==1?1:2)},19:function(e){return Number(e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(e==1?0:e==0||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3)}},r4=["v1","v2","v3"],Gw={zero:0,one:1,two:2,few:3,many:4,other:5};function i4(){var t={};return t4.forEach(function(e){e.lngs.forEach(function(n){t[n]={numbers:e.nr,plurals:n4[e.fc]}})}),t}var a4=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.languageUtils=e,this.options=n,this.logger=ii.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(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=i4()}return _r(t,[{key:"addRule",value:function(n,r){this.rules[n]=r}},{key:"getRule",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(n,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[n]||this.rules[this.languageUtils.getLanguagePartFromCode(n)]}},{key:"needsPlural",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(n,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(n,i).map(function(a){return"".concat(r).concat(a)})}},{key:"getSuffixes",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.getRule(n,i);return a?this.shouldUseIntlApi()?a.resolvedOptions().pluralCategories.sort(function(s,u){return Gw[s]-Gw[u]}).map(function(s){return"".concat(r.options.prepend).concat(s)}):a.numbers.map(function(s){return r.getSuffix(n,s,i)}):[]}},{key:"getSuffix",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=this.getRule(n,i);return a?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(a.select(r)):this.getSuffixRetroCompatible(a,r):(this.logger.warn("no plural rule found for: ".concat(n)),"")}},{key:"getSuffixRetroCompatible",value:function(n,r){var i=this,a=n.noAbs?n.plurals(r):n.plurals(Math.abs(r)),s=n.numbers[a];this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));var u=function(){return i.options.prepend&&s.toString()?i.options.prepend+s.toString():s.toString()};return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?"_plural_".concat(s.toString()):u():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1?u():this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString()}},{key:"shouldUseIntlApi",value:function(){return!r4.includes(this.options.compatibilityJSON)}}]),t}();function Uw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ar(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Sr(this,t),this.logger=ii.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(n){return n},this.init(e)}return _r(t,[{key:"init",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n.interpolation||(n.interpolation={escapeValue:!0});var r=n.interpolation;this.escape=r.escape!==void 0?r.escape:q5,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?es(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?es(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?es(r.nestingPrefix):r.nestingPrefixEscaped||es("$t("),this.nestingSuffix=r.nestingSuffix?es(r.nestingSuffix):r.nestingSuffixEscaped||es(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var n="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(n,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(n,r,i,a){var s=this,u,c,f,h=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function p(x){return x.replace(/\$/g,"$$$$")}var g=function(_){if(_.indexOf(s.formatSeparator)<0){var S=Dw(r,h,_);return s.alwaysFormat?s.format(S,void 0,i,Ar(Ar(Ar({},a),r),{},{interpolationkey:_})):S}var C=_.split(s.formatSeparator),O=C.shift().trim(),I=C.join(s.formatSeparator).trim();return s.format(Dw(r,h,O),I,i,Ar(Ar(Ar({},a),r),{},{interpolationkey:O}))};this.resetRegExp();var y=a&&a.missingInterpolationHandler||this.options.missingInterpolationHandler,v=a&&a.interpolation&&a.interpolation.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,w=[{regex:this.regexpUnescape,safeValue:function(_){return p(_)}},{regex:this.regexp,safeValue:function(_){return s.escapeValue?p(s.escape(_)):p(_)}}];return w.forEach(function(x){for(f=0;u=x.regex.exec(n);){var _=u[1].trim();if(c=g(_),c===void 0)if(typeof y=="function"){var S=y(n,u,a);c=typeof S=="string"?S:""}else if(a&&Object.prototype.hasOwnProperty.call(a,_))c="";else if(v){c=u[0];continue}else s.logger.warn("missed to pass in variable ".concat(_," for interpolating ").concat(n)),c="";else typeof c!="string"&&!s.useRawValueToEscape&&(c=Lw(c));var C=x.safeValue(c);if(n=n.replace(u[0],C),v?(x.regex.lastIndex+=c.length,x.regex.lastIndex-=u[0].length):x.regex.lastIndex=0,f++,f>=s.maxReplaces)break}}),n}},{key:"nest",value:function(n,r){var i=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,u,c;function f(y,v){var w=this.nestingOptionsSeparator;if(y.indexOf(w)<0)return y;var x=y.split(new RegExp("".concat(w,"[ ]*{"))),_="{".concat(x[1]);y=x[0],_=this.interpolate(_,c);var S=_.match(/'/g),C=_.match(/"/g);(S&&S.length%2===0&&!C||C.length%2!==0)&&(_=_.replace(/'/g,'"'));try{c=JSON.parse(_),v&&(c=Ar(Ar({},v),c))}catch(O){return this.logger.warn("failed parsing options string in nesting for key ".concat(y),O),"".concat(y).concat(w).concat(_)}return delete c.defaultValue,y}for(;s=this.nestingRegexp.exec(n);){var h=[];c=Ar({},a),c=c.replace&&typeof c.replace!="string"?c.replace:c,c.applyPostProcessor=!1,delete c.defaultValue;var p=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){var g=s[1].split(this.formatSeparator).map(function(y){return y.trim()});s[1]=g.shift(),h=g,p=!0}if(u=r(f.call(this,s[1].trim(),c),c),u&&s[0]===n&&typeof u!="string")return u;typeof u!="string"&&(u=Lw(u)),u||(this.logger.warn("missed to resolve ".concat(s[1]," for nesting ").concat(n)),u=""),p&&(u=h.reduce(function(y,v){return i.format(y,v,a.lng,Ar(Ar({},a),{},{interpolationkey:s[1].trim()}))},u.trim())),n=n.replace(s[0],u),this.regexp.lastIndex=0}return n}}]),t}();function jw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ri(t){for(var e=1;e-1){var r=t.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)n.currency||(n.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)n.range||(n.range=i.trim());else{var a=i.split(";");a.forEach(function(s){if(s){var u=s.split(":"),c=G5(u),f=c[0],h=c.slice(1),p=h.join(":").trim().replace(/^'+|'+$/g,"");n[f.trim()]||(n[f.trim()]=p),p==="false"&&(n[f.trim()]=!1),p==="true"&&(n[f.trim()]=!0),isNaN(p)||(n[f.trim()]=parseInt(p,10))}})}}return{formatName:e,formatOptions:n}}function ts(t){var e={};return function(r,i,a){var s=i+JSON.stringify(a),u=e[s];return u||(u=t(i,a),e[s]=u),u(r)}}var l4=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Sr(this,t),this.logger=ii.create("formatter"),this.options=e,this.formats={number:ts(function(n,r){var i=new Intl.NumberFormat(n,Ri({},r));return function(a){return i.format(a)}}),currency:ts(function(n,r){var i=new Intl.NumberFormat(n,Ri(Ri({},r),{},{style:"currency"}));return function(a){return i.format(a)}}),datetime:ts(function(n,r){var i=new Intl.DateTimeFormat(n,Ri({},r));return function(a){return i.format(a)}}),relativetime:ts(function(n,r){var i=new Intl.RelativeTimeFormat(n,Ri({},r));return function(a){return i.format(a,r.range||"day")}}),list:ts(function(n,r){var i=new Intl.ListFormat(n,Ri({},r));return function(a){return i.format(a)}})},this.init(e)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(n,r){this.formats[n.toLowerCase().trim()]=r}},{key:"addCached",value:function(n,r){this.formats[n.toLowerCase().trim()]=ts(r)}},{key:"format",value:function(n,r,i){var a=this,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},u=r.split(this.formatSeparator),c=u.reduce(function(f,h){var p=s4(h),g=p.formatName,y=p.formatOptions;if(a.formats[g]){var v=f;try{var w=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},x=w.locale||w.lng||s.locale||s.lng||i;v=a.formats[g](f,x,Ri(Ri(Ri({},y),s),w))}catch(_){a.logger.warn(_)}return v}else a.logger.warn("there was no format function for ".concat(g));return f},n);return c}}]),t}();function Ww(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Hw(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function f4(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}var d4=function(t){Xh(n,t);var e=u4(n);function n(r,i,a){var s,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Sr(this,n),s=e.call(this),Qh&&Aa.call(Ea(s)),s.backend=r,s.store=i,s.services=a,s.languageUtils=a.languageUtils,s.options=u,s.logger=ii.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=u.maxParallelReads||10,s.readingCalls=0,s.maxRetries=u.maxRetries>=0?u.maxRetries:5,s.retryTimeout=u.retryTimeout>=1?u.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(a,u.backend,u),s}return _r(n,[{key:"queueLoad",value:function(i,a,s,u){var c=this,f={},h={},p={},g={};return i.forEach(function(y){var v=!0;a.forEach(function(w){var x="".concat(y,"|").concat(w);!s.reload&&c.store.hasResourceBundle(y,w)?c.state[x]=2:c.state[x]<0||(c.state[x]===1?h[x]===void 0&&(h[x]=!0):(c.state[x]=1,v=!1,h[x]===void 0&&(h[x]=!0),f[x]===void 0&&(f[x]=!0),g[w]===void 0&&(g[w]=!0)))}),v||(p[y]=!0)}),(Object.keys(f).length||Object.keys(h).length)&&this.queue.push({pending:h,pendingCount:Object.keys(h).length,loaded:{},errors:[],callback:u}),{toLoad:Object.keys(f),pending:Object.keys(h),toLoadLanguages:Object.keys(p),toLoadNamespaces:Object.keys(g)}}},{key:"loaded",value:function(i,a,s){var u=i.split("|"),c=u[0],f=u[1];a&&this.emit("failedLoading",c,f,a),s&&this.store.addResourceBundle(c,f,s),this.state[i]=a?-1:2;var h={};this.queue.forEach(function(p){H5(p.loaded,[c],f),f4(p,i),a&&p.errors.push(a),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(function(g){h[g]||(h[g]={});var y=p.loaded[g];y.length&&y.forEach(function(v){h[g][v]===void 0&&(h[g][v]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",h),this.queue=this.queue.filter(function(p){return!p.done})}},{key:"read",value:function(i,a,s){var u=this,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,h=arguments.length>5?arguments[5]:void 0;if(!i.length)return h(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:a,fcName:s,tried:c,wait:f,callback:h});return}this.readingCalls++;var p=function(w,x){if(u.readingCalls--,u.waitingReads.length>0){var _=u.waitingReads.shift();u.read(_.lng,_.ns,_.fcName,_.tried,_.wait,_.callback)}if(w&&x&&c2&&arguments[2]!==void 0?arguments[2]:{},c=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."),c&&c();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof a=="string"&&(a=[a]);var f=this.queueLoad(i,a,u,c);if(!f.toLoad.length)return f.pending.length||c(),null;f.toLoad.forEach(function(h){s.loadOne(h)})}},{key:"load",value:function(i,a,s){this.prepareLoading(i,a,{},s)}},{key:"reload",value:function(i,a,s){this.prepareLoading(i,a,{reload:!0},s)}},{key:"loadOne",value:function(i){var a=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",u=i.split("|"),c=u[0],f=u[1];this.read(c,f,"read",void 0,void 0,function(h,p){h&&a.logger.warn("".concat(s,"loading namespace ").concat(f," for language ").concat(c," failed"),h),!h&&p&&a.logger.log("".concat(s,"loaded namespace ").concat(f," for language ").concat(c),p),a.loaded(i,h,p)})}},{key:"saveMissing",value:function(i,a,s,u,c){var f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(a)){this.logger.warn('did not save key "'.concat(s,'" as the namespace "').concat(a,'" 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(!(s==null||s==="")){if(this.backend&&this.backend.create){var p=Hw(Hw({},f),{},{isUpdate:c}),g=this.backend.create.bind(this.backend);if(g.length<6)try{var y;g.length===5?y=g(i,a,s,u,p):y=g(i,a,s,u),y&&typeof y.then=="function"?y.then(function(v){return h(null,v)}).catch(h):h(null,y)}catch(v){h(v)}else g(i,a,s,u,h,p)}!i||!i[0]||this.store.addResource(i[0],a,s,u)}}}]),n}(Aa);function Vw(){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:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var n={};if(gr(e[1])==="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),gr(e[2])==="object"||gr(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:function(e,n,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function qw(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function Kw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Qr(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Rf(){}function g4(t){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(t));e.forEach(function(n){typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}var ih=function(t){Xh(n,t);var e=h4(n);function n(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;if(Sr(this,n),r=e.call(this),Qh&&Aa.call(Ea(r)),r.options=qw(i),r.services={},r.logger=ii,r.modules={external:[]},g4(Ea(r)),a&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,a),Ju(r,Ea(r));setTimeout(function(){r.init(i,a)},0)}return r}return _r(n,[{key:"init",value:function(){var i=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;typeof a=="function"&&(s=a,a={}),!a.defaultNS&&a.defaultNS!==!1&&a.ns&&(typeof a.ns=="string"?a.defaultNS=a.ns:a.ns.indexOf("translation")<0&&(a.defaultNS=a.ns[0]));var u=Vw();this.options=Qr(Qr(Qr({},u),this.options),qw(a)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Qr(Qr({},u.interpolation),this.options.interpolation)),a.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=a.keySeparator),a.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=a.nsSeparator);function c(_){return _?typeof _=="function"?new _:_:null}if(!this.options.isClone){this.modules.logger?ii.init(c(this.modules.logger),this.options):ii.init(null,this.options);var f;this.modules.formatter?f=this.modules.formatter:typeof Intl<"u"&&(f=l4);var h=new zw(this.options);this.store=new J5(this.options.resources,this.options);var p=this.services;p.logger=ii,p.resourceStore=this.store,p.languageUtils=h,p.pluralResolver=new a4(h,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),f&&(!this.options.interpolation.format||this.options.interpolation.format===u.interpolation.format)&&(p.formatter=c(f),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new o4(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new d4(c(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(_){for(var S=arguments.length,C=new Array(S>1?S-1:0),O=1;O1?S-1:0),O=1;O0&&g[0]!=="dev"&&(this.options.lng=g[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var y=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];y.forEach(function(_){i[_]=function(){var S;return(S=i.store)[_].apply(S,arguments)}});var v=["addResource","addResources","addResourceBundle","removeResourceBundle"];v.forEach(function(_){i[_]=function(){var S;return(S=i.store)[_].apply(S,arguments),i}});var w=Bl(),x=function(){var S=function(O,I){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),w.resolve(I),s(O,I)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return S(null,i.t.bind(i));i.changeLanguage(i.options.lng,S)};return this.options.resources||!this.options.initImmediate?x():setTimeout(x,0),w}},{key:"loadResources",value:function(i){var a=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rf,u=s,c=typeof i=="string"?i:this.language;if(typeof i=="function"&&(u=i),!this.options.resources||this.options.partialBundledLanguages){if(c&&c.toLowerCase()==="cimode")return u();var f=[],h=function(y){if(y){var v=a.services.languageUtils.toResolveHierarchy(y);v.forEach(function(w){f.indexOf(w)<0&&f.push(w)})}};if(c)h(c);else{var p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.forEach(function(g){return h(g)})}this.options.preload&&this.options.preload.forEach(function(g){return h(g)}),this.services.backendConnector.load(f,this.options.ns,function(g){!g&&!a.resolvedLanguage&&a.language&&a.setResolvedLanguage(a.language),u(g)})}else u(null)}},{key:"reloadResources",value:function(i,a,s){var u=Bl();return i||(i=this.languages),a||(a=this.options.ns),s||(s=Rf),this.services.backendConnector.reload(i,a,function(c){u.resolve(),s(c)}),u}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&fk.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var a=0;a-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}},{key:"changeLanguage",value:function(i,a){var s=this;this.isLanguageChangingTo=i;var u=Bl();this.emit("languageChanging",i);var c=function(g){s.language=g,s.languages=s.services.languageUtils.toResolveHierarchy(g),s.resolvedLanguage=void 0,s.setResolvedLanguage(g)},f=function(g,y){y?(c(y),s.translator.changeLanguage(y),s.isLanguageChangingTo=void 0,s.emit("languageChanged",y),s.logger.log("languageChanged",y)):s.isLanguageChangingTo=void 0,u.resolve(function(){return s.t.apply(s,arguments)}),a&&a(g,function(){return s.t.apply(s,arguments)})},h=function(g){!i&&!g&&s.services.languageDetector&&(g=[]);var y=typeof g=="string"?g:s.services.languageUtils.getBestMatchFromCodes(g);y&&(s.language||c(y),s.translator.language||s.translator.changeLanguage(y),s.services.languageDetector&&s.services.languageDetector.cacheUserLanguage&&s.services.languageDetector.cacheUserLanguage(y)),s.loadResources(y,function(v){f(v,y)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?h(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(h):this.services.languageDetector.detect(h):h(i),u}},{key:"getFixedT",value:function(i,a,s){var u=this,c=function f(h,p){var g;if(gr(p)!=="object"){for(var y=arguments.length,v=new Array(y>2?y-2:0),w=2;w1&&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;var u=this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,f=this.languages[this.languages.length-1];if(u.toLowerCase()==="cimode")return!0;var h=function(y,v){var w=a.services.backendConnector.state["".concat(y,"|").concat(v)];return w===-1||w===2};if(s.precheck){var p=s.precheck(this,h);if(p!==void 0)return p}return!!(this.hasResourceBundle(u,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||h(u,i)&&(!c||h(f,i)))}},{key:"loadNamespaces",value:function(i,a){var s=this,u=Bl();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(c){s.options.ns.indexOf(c)<0&&s.options.ns.push(c)}),this.loadResources(function(c){u.resolve(),a&&a(c)}),u):(a&&a(),Promise.resolve())}},{key:"loadLanguages",value:function(i,a){var s=Bl();typeof i=="string"&&(i=[i]);var u=this.options.preload||[],c=i.filter(function(f){return u.indexOf(f)<0});return c.length?(this.options.preload=u.concat(c),this.loadResources(function(f){s.resolve(),a&&a(f)}),s):(a&&a(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var a=["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"],s=this.services&&this.services.languageUtils||new zw(Vw());return a.indexOf(s.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rf,u=Qr(Qr(Qr({},this.options),a),{isClone:!0}),c=new n(u);(a.debug!==void 0||a.prefix!==void 0)&&(c.logger=c.logger.clone(a));var f=["store","services","language"];return f.forEach(function(h){c[h]=i[h]}),c.services=Qr({},this.services),c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c.translator=new $w(c.services,c.options),c.translator.on("*",function(h){for(var p=arguments.length,g=new Array(p>1?p-1:0),y=1;y0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new ih(t,e)});var Ae=ih.createInstance();Ae.createInstance=ih.createInstance;Ae.createInstance;Ae.dir;Ae.init;Ae.loadResources;Ae.reloadResources;Ae.use;Ae.changeLanguage;Ae.getFixedT;Ae.t;Ae.exists;Ae.setDefaultNamespace;Ae.hasLoadedNamespace;Ae.loadNamespaces;Ae.loadLanguages;var dk=[],m4=dk.forEach,v4=dk.slice;function y4(t){return m4.call(v4.call(arguments,1),function(e){if(e)for(var n in e)t[n]===void 0&&(t[n]=e[n])}),t}var Yw=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,S4=function(e,n,r){var i=r||{};i.path=i.path||"/";var a=encodeURIComponent(n),s="".concat(e,"=").concat(a);if(i.maxAge>0){var u=i.maxAge-0;if(Number.isNaN(u))throw new Error("maxAge should be a Number");s+="; Max-Age=".concat(Math.floor(u))}if(i.domain){if(!Yw.test(i.domain))throw new TypeError("option domain is invalid");s+="; Domain=".concat(i.domain)}if(i.path){if(!Yw.test(i.path))throw new TypeError("option path is invalid");s+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(s+="; HttpOnly"),i.secure&&(s+="; Secure"),i.sameSite){var c=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(c){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return s},Xw={create:function(e,n,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+r*60*1e3)),i&&(a.domain=i),document.cookie=S4(e,encodeURIComponent(n),a)},read:function(e){for(var n="".concat(e,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),a=i.split("&"),s=0;s0){var c=a[s].substring(0,u);c===e.lookupQuerystring&&(n=a[s].substring(u+1))}}}return n}},Fl=null,Qw=function(){if(Fl!==null)return Fl;try{Fl=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Fl=!1}return Fl},b4={name:"localStorage",lookup:function(e){var n;if(e.lookupLocalStorage&&Qw()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(e,n){n.lookupLocalStorage&&Qw()&&window.localStorage.setItem(n.lookupLocalStorage,e)}},$l=null,Jw=function(){if($l!==null)return $l;try{$l=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{$l=!1}return $l},C4={name:"sessionStorage",lookup:function(e){var n;if(e.lookupSessionStorage&&Jw()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(e,n){n.lookupSessionStorage&&Jw()&&window.sessionStorage.setItem(n.lookupSessionStorage,e)}},x4={name:"navigator",lookup:function(e){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?n:void 0}},k4={name:"htmlTag",lookup:function(e){var n,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},P4={name:"path",lookup:function(e){var n;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;n=r[e.lookupFromPathIndex].replace("/","")}else n=r[0].replace("/","")}return n}},E4={name:"subdomain",lookup:function(e){var n=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};function O4(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var hk=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.type="languageDetector",this.detectors={},this.init(e,n)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=y4(r,this.options||{},O4()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(_4),this.addDetector(w4),this.addDetector(b4),this.addDetector(C4),this.addDetector(x4),this.addDetector(k4),this.addDetector(P4),this.addDetector(E4)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var i=[];return n.forEach(function(a){if(r.detectors[a]){var s=r.detectors[a].lookup(r.options);s&&typeof s=="string"&&(s=[s]),s&&(i=i.concat(s))}}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(a){i.detectors[a]&&i.detectors[a].cacheUserLanguage(n,i.options)}))}}]),t}();hk.type="languageDetector";function Wv(t){return Wv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wv(t)}var pk=[],T4=pk.forEach,R4=pk.slice;function Hv(t){return T4.call(R4.call(arguments,1),function(e){if(e)for(var n in e)t[n]===void 0&&(t[n]=e[n])}),t}function gk(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Wv(XMLHttpRequest))==="object"}function A4(t){return!!t&&typeof t.then=="function"}function I4(t){return A4(t)?t:Promise.resolve(t)}function L4(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var $u={},M4={get exports(){return $u},set exports(t){$u=t}},gu={},D4={get exports(){return gu},set exports(t){gu=t}},Zw;function N4(){return Zw||(Zw=1,function(t,e){var n=typeof self<"u"?self:yn,r=function(){function a(){this.fetch=!1,this.DOMException=n.DOMException}return a.prototype=n,new a}();(function(a){(function(s){var u={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function c(T){return T&&DataView.prototype.isPrototypeOf(T)}if(u.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(T){return T&&f.indexOf(Object.prototype.toString.call(T))>-1};function p(T){if(typeof T!="string"&&(T=String(T)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(T))throw new TypeError("Invalid character in header field name");return T.toLowerCase()}function g(T){return typeof T!="string"&&(T=String(T)),T}function y(T){var $={next:function(){var V=T.shift();return{done:V===void 0,value:V}}};return u.iterable&&($[Symbol.iterator]=function(){return $}),$}function v(T){this.map={},T instanceof v?T.forEach(function($,V){this.append(V,$)},this):Array.isArray(T)?T.forEach(function($){this.append($[0],$[1])},this):T&&Object.getOwnPropertyNames(T).forEach(function($){this.append($,T[$])},this)}v.prototype.append=function(T,$){T=p(T),$=g($);var V=this.map[T];this.map[T]=V?V+", "+$:$},v.prototype.delete=function(T){delete this.map[p(T)]},v.prototype.get=function(T){return T=p(T),this.has(T)?this.map[T]:null},v.prototype.has=function(T){return this.map.hasOwnProperty(p(T))},v.prototype.set=function(T,$){this.map[p(T)]=g($)},v.prototype.forEach=function(T,$){for(var V in this.map)this.map.hasOwnProperty(V)&&T.call($,this.map[V],V,this)},v.prototype.keys=function(){var T=[];return this.forEach(function($,V){T.push(V)}),y(T)},v.prototype.values=function(){var T=[];return this.forEach(function($){T.push($)}),y(T)},v.prototype.entries=function(){var T=[];return this.forEach(function($,V){T.push([V,$])}),y(T)},u.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function w(T){if(T.bodyUsed)return Promise.reject(new TypeError("Already read"));T.bodyUsed=!0}function x(T){return new Promise(function($,V){T.onload=function(){$(T.result)},T.onerror=function(){V(T.error)}})}function _(T){var $=new FileReader,V=x($);return $.readAsArrayBuffer(T),V}function S(T){var $=new FileReader,V=x($);return $.readAsText(T),V}function C(T){for(var $=new Uint8Array(T),V=new Array($.length),ie=0;ie<$.length;ie++)V[ie]=String.fromCharCode($[ie]);return V.join("")}function O(T){if(T.slice)return T.slice(0);var $=new Uint8Array(T.byteLength);return $.set(new Uint8Array(T)),$.buffer}function I(){return this.bodyUsed=!1,this._initBody=function(T){this._bodyInit=T,T?typeof T=="string"?this._bodyText=T:u.blob&&Blob.prototype.isPrototypeOf(T)?this._bodyBlob=T:u.formData&&FormData.prototype.isPrototypeOf(T)?this._bodyFormData=T:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)?this._bodyText=T.toString():u.arrayBuffer&&u.blob&&c(T)?(this._bodyArrayBuffer=O(T.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(T)||h(T))?this._bodyArrayBuffer=O(T):this._bodyText=T=Object.prototype.toString.call(T):this._bodyText="",this.headers.get("content-type")||(typeof T=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var T=w(this);if(T)return T;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?w(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(_)}),this.text=function(){var T=w(this);if(T)return T;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(X)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function D(T){var $=T.toUpperCase();return L.indexOf($)>-1?$:T}function U(T,$){$=$||{};var V=$.body;if(T instanceof U){if(T.bodyUsed)throw new TypeError("Already read");this.url=T.url,this.credentials=T.credentials,$.headers||(this.headers=new v(T.headers)),this.method=T.method,this.mode=T.mode,this.signal=T.signal,!V&&T._bodyInit!=null&&(V=T._bodyInit,T.bodyUsed=!0)}else this.url=String(T);if(this.credentials=$.credentials||this.credentials||"same-origin",($.headers||!this.headers)&&(this.headers=new v($.headers)),this.method=D($.method||this.method||"GET"),this.mode=$.mode||this.mode||null,this.signal=$.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&V)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(V)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function X(T){var $=new FormData;return T.trim().split("&").forEach(function(V){if(V){var ie=V.split("="),W=ie.shift().replace(/\+/g," "),Y=ie.join("=").replace(/\+/g," ");$.append(decodeURIComponent(W),decodeURIComponent(Y))}}),$}function K(T){var $=new v,V=T.replace(/\r?\n[\t ]+/g," ");return V.split(/\r?\n/).forEach(function(ie){var W=ie.split(":"),Y=W.shift().trim();if(Y){var Q=W.join(":").trim();$.append(Y,Q)}}),$}I.call(U.prototype);function te(T,$){$||($={}),this.type="default",this.status=$.status===void 0?200:$.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in $?$.statusText:"OK",this.headers=new v($.headers),this.url=$.url||"",this._initBody(T)}I.call(te.prototype),te.prototype.clone=function(){return new te(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},te.error=function(){var T=new te(null,{status:0,statusText:""});return T.type="error",T};var ce=[301,302,303,307,308];te.redirect=function(T,$){if(ce.indexOf($)===-1)throw new RangeError("Invalid status code");return new te(null,{status:$,headers:{location:T}})},s.DOMException=a.DOMException;try{new s.DOMException}catch{s.DOMException=function($,V){this.message=$,this.name=V;var ie=Error($);this.stack=ie.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function j(T,$){return new Promise(function(V,ie){var W=new U(T,$);if(W.signal&&W.signal.aborted)return ie(new s.DOMException("Aborted","AbortError"));var Y=new XMLHttpRequest;function Q(){Y.abort()}Y.onload=function(){var oe={status:Y.status,statusText:Y.statusText,headers:K(Y.getAllResponseHeaders()||"")};oe.url="responseURL"in Y?Y.responseURL:oe.headers.get("X-Request-URL");var ve="response"in Y?Y.response:Y.responseText;V(new te(ve,oe))},Y.onerror=function(){ie(new TypeError("Network request failed"))},Y.ontimeout=function(){ie(new TypeError("Network request failed"))},Y.onabort=function(){ie(new s.DOMException("Aborted","AbortError"))},Y.open(W.method,W.url,!0),W.credentials==="include"?Y.withCredentials=!0:W.credentials==="omit"&&(Y.withCredentials=!1),"responseType"in Y&&u.blob&&(Y.responseType="blob"),W.headers.forEach(function(oe,ve){Y.setRequestHeader(ve,oe)}),W.signal&&(W.signal.addEventListener("abort",Q),Y.onreadystatechange=function(){Y.readyState===4&&W.signal.removeEventListener("abort",Q)}),Y.send(typeof W._bodyInit>"u"?null:W._bodyInit)})}return j.polyfill=!0,a.fetch||(a.fetch=j,a.Headers=v,a.Request=U,a.Response=te),s.Headers=v,s.Request=U,s.Response=te,s.fetch=j,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e}(D4,gu)),gu}(function(t,e){var n;if(typeof fetch=="function"&&(typeof yn<"u"&&yn.fetch?n=yn.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof L4<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||N4();r.default&&(r=r.default),e.default=r,t.exports=e.default}})(M4,$u);const mk=$u,eb=h2({__proto__:null,default:mk},[$u]);function ah(t){return ah=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ah(t)}var Fi;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?Fi=global.fetch:typeof window<"u"&&window.fetch?Fi=window.fetch:Fi=fetch);var zu;gk()&&(typeof global<"u"&&global.XMLHttpRequest?zu=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(zu=window.XMLHttpRequest));var oh;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?oh=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(oh=window.ActiveXObject));!Fi&&eb&&!zu&&!oh&&(Fi=mk||eb);typeof Fi!="function"&&(Fi=void 0);var Vv=function(e,n){if(n&&ah(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+r.slice(1)}return e},tb=function(e,n,r){Fi(e,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(a){r(null,{status:i.status,data:a})}).catch(r)}).catch(r)},nb=!1,B4=function(e,n,r,i){e.queryStringParams&&(n=Vv(n,e.queryStringParams));var a=Hv({},typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders);r&&(a["Content-Type"]="application/json");var s=typeof e.requestOptions=="function"?e.requestOptions(r):e.requestOptions,u=Hv({method:r?"POST":"GET",body:r?e.stringify(r):void 0,headers:a},nb?{}:s);try{tb(n,u,i)}catch(c){if(!s||Object.keys(s).length===0||!c.message||c.message.indexOf("not implemented")<0)return i(c);try{Object.keys(s).forEach(function(f){delete u[f]}),tb(n,u,i),nb=!0}catch(f){i(f)}}},F4=function(e,n,r,i){r&&ah(r)==="object"&&(r=Vv("",r).slice(1)),e.queryStringParams&&(n=Vv(n,e.queryStringParams));try{var a;zu?a=new zu:a=new oh("MSXML2.XMLHTTP.3.0"),a.open(r?"POST":"GET",n,1),e.crossDomain||a.setRequestHeader("X-Requested-With","XMLHttpRequest"),a.withCredentials=!!e.withCredentials,r&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.overrideMimeType&&a.overrideMimeType("application/json");var s=e.customHeaders;if(s=typeof s=="function"?s():s,s)for(var u in s)a.setRequestHeader(u,s[u]);a.onreadystatechange=function(){a.readyState>3&&i(a.status>=400?a.statusText:null,{status:a.status,data:a.responseText})},a.send(r)}catch(c){console&&console.log(c)}},$4=function(e,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},Fi&&n.indexOf("file:")!==0)return B4(e,n,r,i);if(gk()||typeof ActiveXObject=="function")return F4(e,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function Gu(t){return Gu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gu(t)}function z4(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rb(t,e){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};z4(this,t),this.services=e,this.options=n,this.allOptions=r,this.type="backend",this.init(e,n,r)}return G4(t,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=Hv(i,this.options||{},W4()),this.allOptions=a,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,a,s){var u=this,c=this.options.loadPath;typeof this.options.loadPath=="function"&&(c=this.options.loadPath(n,i)),c=I4(c),c.then(function(f){if(!f)return s(null,{});var h=u.services.interpolator.interpolate(f,{lng:n.join("+"),ns:i.join("+")});u.loadUrl(h,s,r,a)})}},{key:"loadUrl",value:function(n,r,i,a){var s=this;this.options.request(this.options,n,void 0,function(u,c){if(c&&(c.status>=500&&c.status<600||!c.status))return r("failed loading "+n+"; status code: "+c.status,!0);if(c&&c.status>=400&&c.status<500)return r("failed loading "+n+"; status code: "+c.status,!1);if(!c&&u&&u.message&&u.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+u.message,!0);if(u)return r(u,!1);var f,h;try{typeof c.data=="string"?f=s.options.parse(c.data,i,a):f=c.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{key:"create",value:function(n,r,i,a,s){var u=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var c=this.options.parsePayload(r,i,a),f=0,h=[],p=[];n.forEach(function(g){var y=u.options.addPath;typeof u.options.addPath=="function"&&(y=u.options.addPath(g,r));var v=u.services.interpolator.interpolate(y,{lng:g,ns:r});u.options.request(u.options,v,c,function(w,x){f+=1,h.push(w),p.push(x),f===n.length&&typeof s=="function"&&s(h,p)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,a=r.languageUtils,s=r.logger,u=i.language;if(!(u&&u.toLowerCase()==="cimode")){var c=[],f=function(p){var g=a.toResolveHierarchy(p);g.forEach(function(y){c.indexOf(y)<0&&c.push(y)})};f(u),this.allOptions.preload&&this.allOptions.preload.forEach(function(h){return f(h)}),c.forEach(function(h){n.allOptions.ns.forEach(function(p){i.read(h,p,"read",null,null,function(g,y){g&&s.warn("loading namespace ".concat(p," for language ").concat(h," failed"),g),!g&&y&&s.log("loaded namespace ".concat(p," for language ").concat(h),y),i.loaded("".concat(h,"|").concat(p),g,y)})})})}}}]),t}();yk.type="backend";function H4(){if(console&&console.warn){for(var t,e=arguments.length,n=new Array(e),r=0;r2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,a=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var s=function(c,f){var h=e.services.backendConnector.state["".concat(c,"|").concat(f)];return h===-1||h===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!s(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(r,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||s(r,t)&&(!i||s(a,t)))}function q4(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return qv("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(t,{precheck:function(a,s){if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!s(a.isLanguageChangingTo,t))return!1}}):V4(t,e,n)}var K4=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Y4={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},X4=function(e){return Y4[e]},Q4=function(e){return e.replace(K4,X4)};function ob(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function sb(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Kv=sb(sb({},Kv),t)}function Z4(){return Kv}var Sk;function eB(t){Sk=t}function tB(){return Sk}var nB={type:"3rdParty",init:function(e){J4(e.options.react),eB(e)}},rB=be.createContext(),iB=function(){function t(){Sr(this,t),this.usedNamespaces={}}return _r(t,[{key:"addUsedNamespaces",value:function(n){var r=this;n.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),t}();function aB(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,u=[],c=!0,f=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(h){f=!0,i=h}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(f)throw i}}return u}}function oB(t,e){return ok(t)||aB(t,e)||sk(t,e)||lk()}function lb(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function km(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},n=e.i18n,r=be.useContext(rB)||{},i=r.i18n,a=r.defaultNS,s=n||i||tB();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new iB),!s){qv("You will need to pass in an i18next instance by using initReactI18next");var u=function(X,K){return typeof K=="string"?K:K&&gr(K)==="object"&&typeof K.defaultValue=="string"?K.defaultValue:Array.isArray(X)?X[X.length-1]:X},c=[u,{},!1];return c.t=u,c.i18n={},c.ready=!1,c}s.options.react&&s.options.react.wait!==void 0&&qv("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var f=km(km(km({},Z4()),s.options.react),e),h=f.useSuspense,p=f.keyPrefix,g=t||a||s.options&&s.options.defaultNS;g=typeof g=="string"?[g]:g||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(g);var y=(s.isInitialized||s.initializedStoreOnce)&&g.every(function(U){return q4(U,s,f)});function v(){return s.getFixedT(null,f.nsMode==="fallback"?g:g[0],p)}var w=be.useState(v),x=oB(w,2),_=x[0],S=x[1],C=g.join(),O=sB(C),I=be.useRef(!0);be.useEffect(function(){var U=f.bindI18n,X=f.bindI18nStore;I.current=!0,!y&&!h&&ab(s,g,function(){I.current&&S(v)}),y&&O&&O!==C&&I.current&&S(v);function K(){I.current&&S(v)}return U&&s&&s.on(U,K),X&&s&&s.store.on(X,K),function(){I.current=!1,U&&s&&U.split(" ").forEach(function(te){return s.off(te,K)}),X&&s&&X.split(" ").forEach(function(te){return s.store.off(te,K)})}},[s,C]);var L=be.useRef(!0);be.useEffect(function(){I.current&&!L.current&&S(v),L.current=!1},[s,p]);var D=[_,s,y];if(D.t=_,D.i18n=s,D.ready=y,y||!y&&!h)return D;throw new Promise(function(U){ab(s,g,function(){U()})})}Ae.use(yk).use(hk).use(nB).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const uB={isConnected:!1,isProcessing:!1,log:[],shouldShowLogViewer:!1,shouldDisplayInProgressType:"latents",shouldDisplayGuides:!0,isGFPGANAvailable:!0,isESRGANAvailable:!0,socketId:"",shouldConfirmOnDelete:!0,openAccordions:[0],currentStep:0,totalSteps:0,currentIteration:0,totalIterations:0,currentStatus:Ae.isInitialized?Ae.t("common.statusDisconnected"):"Disconnected",currentStatusHasSteps:!1,model:"",model_id:"",model_hash:"",app_id:"",app_version:"",model_list:{},infill_methods:[],hasError:!1,wasErrorSeen:!0,isCancelable:!0,saveIntermediatesInterval:5,enableImageDebugging:!1,toastQueue:[],searchFolder:null,foundModels:null,openModel:null,cancelOptions:{cancelType:"immediate",cancelAfter:null}},_k=vo({name:"system",initialState:uB,reducers:{setShouldDisplayInProgressType:(t,e)=>{t.shouldDisplayInProgressType=e.payload},setIsProcessing:(t,e)=>{t.isProcessing=e.payload},setCurrentStatus:(t,e)=>{t.currentStatus=e.payload},setSystemStatus:(t,e)=>({...t,...e.payload}),errorOccurred:t=>{t.hasError=!0,t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusError"),t.wasErrorSeen=!1},errorSeen:t=>{t.hasError=!1,t.wasErrorSeen=!0,t.currentStatus=t.isConnected?Ae.t("common.statusConnected"):Ae.t("common.statusDisconnected")},addLogEntry:(t,e)=>{const{timestamp:n,message:r,level:i}=e.payload,s={timestamp:n,message:r,level:i||"info"};t.log.push(s)},setShouldShowLogViewer:(t,e)=>{t.shouldShowLogViewer=e.payload},setIsConnected:(t,e)=>{t.isConnected=e.payload,t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.hasError=!1},setSocketId:(t,e)=>{t.socketId=e.payload},setShouldConfirmOnDelete:(t,e)=>{t.shouldConfirmOnDelete=e.payload},setOpenAccordions:(t,e)=>{t.openAccordions=e.payload},setSystemConfig:(t,e)=>({...t,...e.payload}),setShouldDisplayGuides:(t,e)=>{t.shouldDisplayGuides=e.payload},processingCanceled:t=>{t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusProcessingCanceled")},generationRequested:t=>{t.isProcessing=!0,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusPreparing")},setModelList:(t,e)=>{t.model_list=e.payload},setIsCancelable:(t,e)=>{t.isCancelable=e.payload},modelChangeRequested:t=>{t.currentStatus=Ae.t("common.statusLoadingModel"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},modelConvertRequested:t=>{t.currentStatus=Ae.t("common.statusConvertingModel"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},modelMergingRequested:t=>{t.currentStatus=Ae.t("common.statusMergingModels"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},setSaveIntermediatesInterval:(t,e)=>{t.saveIntermediatesInterval=e.payload},setEnableImageDebugging:(t,e)=>{t.enableImageDebugging=e.payload},addToast:(t,e)=>{t.toastQueue.push(e.payload)},clearToastQueue:t=>{t.toastQueue=[]},setProcessingIndeterminateTask:(t,e)=>{t.isProcessing=!0,t.currentStatus=e.payload,t.currentStatusHasSteps=!1},setSearchFolder:(t,e)=>{t.searchFolder=e.payload},setFoundModels:(t,e)=>{t.foundModels=e.payload},setOpenModel:(t,e)=>{t.openModel=e.payload},setCancelType:(t,e)=>{t.cancelOptions.cancelType=e.payload},setCancelAfter:(t,e)=>{t.cancelOptions.cancelAfter=e.payload}}}),{setShouldDisplayInProgressType:eW,setIsProcessing:ei,addLogEntry:Gt,setShouldShowLogViewer:tW,setIsConnected:ub,setSocketId:nW,setShouldConfirmOnDelete:rW,setOpenAccordions:iW,setSystemStatus:cB,setCurrentStatus:ns,setSystemConfig:fB,setShouldDisplayGuides:aW,processingCanceled:dB,errorOccurred:cb,errorSeen:oW,setModelList:rs,setIsCancelable:Af,modelChangeRequested:hB,modelConvertRequested:pB,modelMergingRequested:gB,setSaveIntermediatesInterval:sW,setEnableImageDebugging:lW,generationRequested:mB,addToast:zl,clearToastQueue:uW,setProcessingIndeterminateTask:cW,setSearchFolder:vB,setFoundModels:yB,setOpenModel:fW,setCancelType:dW,setCancelAfter:hW}=_k.actions,SB=_k.reducer,wk=["txt2img","img2img","unifiedCanvas","nodes","postprocessing","training"],_B={activeTab:0,currentTheme:"dark",parametersPanelScrollPosition:0,shouldPinParametersPanel:!0,shouldShowParametersPanel:!0,shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,addNewModelUIOption:null,shouldPinGallery:!0,shouldShowGallery:!0},wB=_B,bk=vo({name:"ui",initialState:wB,reducers:{setActiveTab:(t,e)=>{typeof e.payload=="number"?t.activeTab=e.payload:t.activeTab=wk.indexOf(e.payload)},setCurrentTheme:(t,e)=>{t.currentTheme=e.payload},setParametersPanelScrollPosition:(t,e)=>{t.parametersPanelScrollPosition=e.payload},setShouldPinParametersPanel:(t,e)=>{t.shouldPinParametersPanel=e.payload,t.shouldShowParametersPanel=!0},setShouldShowParametersPanel:(t,e)=>{t.shouldShowParametersPanel=e.payload},setShouldShowImageDetails:(t,e)=>{t.shouldShowImageDetails=e.payload},setShouldUseCanvasBetaLayout:(t,e)=>{t.shouldUseCanvasBetaLayout=e.payload},setShouldShowExistingModelsInSearch:(t,e)=>{t.shouldShowExistingModelsInSearch=e.payload},setShouldUseSliders:(t,e)=>{t.shouldUseSliders=e.payload},setAddNewModelUIOption:(t,e)=>{t.addNewModelUIOption=e.payload},setShouldPinGallery:(t,e)=>{t.shouldPinGallery=e.payload},setShouldShowGallery:(t,e)=>{t.shouldShowGallery=e.payload},togglePinGalleryPanel:t=>{t.shouldPinGallery=!t.shouldPinGallery},togglePinParametersPanel:t=>{t.shouldPinParametersPanel=!t.shouldPinParametersPanel},toggleParametersPanel:t=>{t.shouldShowParametersPanel=!t.shouldShowParametersPanel},toggleGalleryPanel:t=>{t.shouldShowGallery=!t.shouldShowGallery},togglePanels:t=>{t.shouldShowGallery||t.shouldShowParametersPanel?(t.shouldShowGallery=!1,t.shouldShowParametersPanel=!1):(t.shouldShowGallery=!0,t.shouldShowParametersPanel=!0)}}}),{setActiveTab:pW,setCurrentTheme:gW,setParametersPanelScrollPosition:mW,setShouldPinParametersPanel:vW,setShouldShowParametersPanel:yW,setShouldShowImageDetails:SW,setShouldUseCanvasBetaLayout:_W,setShouldShowExistingModelsInSearch:wW,setShouldUseSliders:bW,setAddNewModelUIOption:CW,setShouldPinGallery:xW,setShouldShowGallery:kW,togglePanels:PW,togglePinGalleryPanel:EW,togglePinParametersPanel:OW,toggleParametersPanel:TW,toggleGalleryPanel:RW}=bk.actions,bB=bk.reducer,di=Object.create(null);di.open="0";di.close="1";di.ping="2";di.pong="3";di.message="4";di.upgrade="5";di.noop="6";const hd=Object.create(null);Object.keys(di).forEach(t=>{hd[di[t]]=t});const CB={type:"error",data:"parser error"},xB=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",kB=typeof ArrayBuffer=="function",PB=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Ck=({type:t,data:e},n,r)=>xB&&e instanceof Blob?n?r(e):fb(e,r):kB&&(e instanceof ArrayBuffer||PB(e))?n?r(e):fb(new Blob([e]),r):r(di[t]+(e||"")),fb=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)},db="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eu=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t{let e=t.length*.75,n=t.length,r,i=0,a,s,u,c;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const f=new ArrayBuffer(e),h=new Uint8Array(f);for(r=0;r>4,h[i++]=(s&15)<<4|u>>2,h[i++]=(u&3)<<6|c&63;return f},OB=typeof ArrayBuffer=="function",xk=(t,e)=>{if(typeof t!="string")return{type:"message",data:kk(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:TB(t.substring(1),e)}:hd[n]?t.length>1?{type:hd[n],data:t.substring(1)}:{type:hd[n]}:CB},TB=(t,e)=>{if(OB){const n=EB(t);return kk(n,e)}else return{base64:!0,data:t}},kk=(t,e)=>{switch(e){case"blob":return t instanceof ArrayBuffer?new Blob([t]):t;case"arraybuffer":default:return t}},Pk=String.fromCharCode(30),RB=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((a,s)=>{Ck(a,!1,u=>{r[s]=u,++i===n&&e(r.join(Pk))})})},AB=(t,e)=>{const n=t.split(Pk),r=[];for(let i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function Ok(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const LB=fr.setTimeout,MB=fr.clearTimeout;function Jh(t,e){e.useNativeTimers?(t.setTimeoutFn=LB.bind(fr),t.clearTimeoutFn=MB.bind(fr)):(t.setTimeoutFn=fr.setTimeout.bind(fr),t.clearTimeoutFn=fr.clearTimeout.bind(fr))}const DB=1.33;function NB(t){return typeof t=="string"?BB(t):Math.ceil((t.byteLength||t.size)*DB)}function BB(t){let e=0,n=0;for(let r=0,i=t.length;r=57344?n+=3:(r++,n+=4);return n}class FB extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Tk extends Rt{constructor(e){super(),this.writable=!1,Jh(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,n,r){return super.emitReserved("error",new FB(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=xk(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}}const Rk="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Yv=64,$B={};let hb=0,If=0,pb;function gb(t){let e="";do e=Rk[t%Yv]+e,t=Math.floor(t/Yv);while(t>0);return e}function Ak(){const t=gb(+new Date);return t!==pb?(hb=0,pb=t):t+"."+gb(hb++)}for(;If{this.readyState="paused",e()};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(e){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)};AB(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,RB(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const n=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Ak()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(n==="https"&&Number(this.opts.port)!==443||n==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const i=Ik(e),a=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(a?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new ui(this.uri(),e)}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class ui extends Rt{constructor(e,n){super(),Jh(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.async=n.async!==!1,this.data=n.data!==void 0?n.data:null,this.create()}create(){const e=Ok(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const n=this.xhr=new Mk(e);try{n.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{n.readyState===4&&(n.status===200||n.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof n.status=="number"?n.status:0)},0))},n.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=ui.requestsCount++,ui.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=UB,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ui.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}ui.requestsCount=0;ui.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",mb);else if(typeof addEventListener=="function"){const t="onpagehide"in fr?"pagehide":"unload";addEventListener(t,mb,!1)}}function mb(){for(let t in ui.requests)ui.requests.hasOwnProperty(t)&&ui.requests[t].abort()}const Dk=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0))(),Lf=fr.WebSocket||fr.MozWebSocket,vb=!0,HB="arraybuffer",yb=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class VB extends Tk{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),n=this.opts.protocols,r=yb?{}:Ok(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=vb&&!yb?n?new Lf(e,n):new Lf(e):new Lf(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||HB,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n{const s={};try{vb&&this.ws.send(a)}catch{}i&&Dk(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const n=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(n==="wss"&&Number(this.opts.port)!==443||n==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=Ak()),this.supportsBinary||(e.b64=1);const i=Ik(e),a=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(a?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}check(){return!!Lf}}const qB={websocket:VB,polling:WB},KB=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,YB=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Xv(t){const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=KB.exec(t||""),a={},s=14;for(;s--;)a[YB[s]]=i[s]||"";return n!=-1&&r!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=XB(a,a.path),a.queryKey=QB(a,a.query),a}function XB(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function QB(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}let Nk=class os extends Rt{constructor(e,n={}){super(),this.writeBuffer=[],e&&typeof e=="object"&&(n=e,e=null),e?(e=Xv(e),n.hostname=e.host,n.secure=e.protocol==="https"||e.protocol==="wss",n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=Xv(n.host).host),Jh(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"],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:!0},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=zB(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(e){const n=Object.assign({},this.opts.query);n.EIO=Ek,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts.transportOptions[e],this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new qB[e](r)}open(){let e;if(this.opts.rememberUpgrade&&os.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.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(e){let n=this.createTransport(e),r=!1;os.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!r)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;os.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(h(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const g=new Error("probe error");g.transport=n.name,this.emitReserved("upgradeError",g)}}))};function a(){r||(r=!0,h(),n.close(),n=null)}const s=p=>{const g=new Error("probe error: "+p);g.transport=n.name,a(),this.emitReserved("upgradeError",g)};function u(){s("transport closed")}function c(){s("socket closed")}function f(p){n&&p.name!==n.name&&a()}const h=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",u),this.off("close",c),this.off("upgrading",f)};n.once("open",i),n.once("error",s),n.once("close",u),this.once("close",c),this.once("upgrading",f),n.open()}onOpen(){if(this.readyState="open",os.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const n=this.upgrades.length;for(;e{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 e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.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(e,n,r){return this.sendPacket("message",e,n,r),this}send(e,n,r){return this.sendPacket("message",e,n,r),this}sendPacket(e,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 a={type:e,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},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():e()}):this.upgrading?r():e()),this}onError(e){os.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,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",e,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const n=[];let r=0;const i=e.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,Bk=Object.prototype.toString,tF=typeof Blob=="function"||typeof Blob<"u"&&Bk.call(Blob)==="[object BlobConstructor]",nF=typeof File=="function"||typeof File<"u"&&Bk.call(File)==="[object FileConstructor]";function T0(t){return ZB&&(t instanceof ArrayBuffer||eF(t))||tF&&t instanceof Blob||nF&&t instanceof File}function pd(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n=0&&t.num0;case Be.ACK:case Be.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class sF{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=iF(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const lF=Object.freeze(Object.defineProperty({__proto__:null,Decoder:R0,Encoder:oF,get PacketType(){return Be},protocol:aF},Symbol.toStringTag,{value:"Module"}));function Dr(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const uF=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Fk extends Rt{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Dr(e,"open",this.onopen.bind(this)),Dr(e,"packet",this.onpacket.bind(this)),Dr(e,"error",this.onerror.bind(this)),Dr(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){if(uF.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const r={type:Be.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const s=this.ids++,u=n.pop();this._registerAckCallback(s,u),r.id=s}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[e]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let s=0;s{this.io.clearTimeoutFn(a),n.apply(this,[null,...s])}}emitWithAck(e,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,a)=>{n.push((s,u)=>r?s?a(s):i(u):i(s)),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...a)=>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,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Be.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Be.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 Be.EVENT:case Be.BINARY_EVENT:this.onevent(e);break;case Be.ACK:case Be.BINARY_ACK:this.onack(e);break;case Be.DISCONNECT:this.ondisconnect();break;case Be.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Be.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(n.apply(this,e.data),delete this.acks[e.id])}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Be.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r0&&t.jitter<=1?t.jitter:0,this.attempts=0}Vs.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};Vs.prototype.reset=function(){this.attempts=0};Vs.prototype.setMin=function(t){this.ms=t};Vs.prototype.setMax=function(t){this.max=t};Vs.prototype.setJitter=function(t){this.jitter=t};class Zv extends Rt{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Jh(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 Vs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||lF;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Nk(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Dr(n,"open",function(){r.onopen(),e&&e()}),a=Dr(n,"error",s=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",s),e?e(s):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const s=this._timeout;s===0&&i();const u=this.setTimeoutFn(()=>{i(),n.close(),n.emit("error",new Error("timeout"))},s);this.opts.autoUnref&&u.unref(),this.subs.push(function(){clearTimeout(u)})}return this.subs.push(i),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Dr(e,"ping",this.onping.bind(this)),Dr(e,"data",this.ondata.bind(this)),Dr(e,"error",this.onerror.bind(this)),Dr(e,"close",this.onclose.bind(this)),Dr(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Dk(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new Fk(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;re()),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(e,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=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(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Gl={};function gd(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=JB(t,e.path||"/socket.io"),r=n.source,i=n.id,a=n.path,s=Gl[i]&&a in Gl[i].nsps,u=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let c;return u?c=new Zv(r,e):(Gl[i]||(Gl[i]=new Zv(r,e)),c=Gl[i]),n.query&&!e.query&&(e.query=n.queryKey),c.socket(n.path,e)}Object.assign(gd,{Manager:Zv,Socket:Fk,io:gd,connect:gd});const AW=["ddim","plms","k_lms","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_dpmpp_2_a","k_euler","k_euler_a","k_heun"],IW=["ddim","plms","k_lms","dpmpp_2","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_euler","k_euler_a","k_heun"],LW=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],MW=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],DW=[{key:"2x",value:2},{key:"4x",value:4}],cF=0,fF=4294967295,NW=["gfpgan","codeformer"],BW=[{key:"None",value:"none"},{key:"Fast",value:"latents"},{key:"Accurate",value:"full-res"}];var dF=Math.PI/180;function hF(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const Os=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},pe={_global:Os,version:"8.4.2",isBrowser:hF(),isUnminified:/param/.test(function(t){}.toString()),dblClickWindow:400,getAngle(t){return pe.angleDeg?t*dF:t},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 pe.DD.isDragging},isDragReady(){return!!pe.DD.node},releaseCanvasOnDestroy:!0,document:Os.document,_injectGlobal(t){Os.Konva=t}},yt=t=>{pe[t.prototype.getClassName()]=t};pe._injectGlobal(pe);class Wn{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.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 Wn(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var n=this.m;return{x:n[0]*e.x+n[2]*e.y+n[4],y:n[1]*e.x+n[3]*e.y+n[5]}}translate(e,n){return this.m[4]+=this.m[0]*e+this.m[2]*n,this.m[5]+=this.m[1]*e+this.m[3]*n,this}scale(e,n){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=n,this.m[3]*=n,this}rotate(e){var n=Math.cos(e),r=Math.sin(e),i=this.m[0]*n+this.m[2]*r,a=this.m[1]*n+this.m[3]*r,s=this.m[0]*-r+this.m[2]*n,u=this.m[1]*-r+this.m[3]*n;return this.m[0]=i,this.m[1]=a,this.m[2]=s,this.m[3]=u,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,n){var r=this.m[0]+this.m[2]*n,i=this.m[1]+this.m[3]*n,a=this.m[2]+this.m[0]*e,s=this.m[3]+this.m[1]*e;return this.m[0]=r,this.m[1]=i,this.m[2]=a,this.m[3]=s,this}multiply(e){var n=this.m[0]*e.m[0]+this.m[2]*e.m[1],r=this.m[1]*e.m[0]+this.m[3]*e.m[1],i=this.m[0]*e.m[2]+this.m[2]*e.m[3],a=this.m[1]*e.m[2]+this.m[3]*e.m[3],s=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],u=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=s,this.m[5]=u,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*e,r=-this.m[1]*e,i=-this.m[2]*e,a=this.m[0]*e,s=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),u=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=s,this.m[5]=u,this}getMatrix(){return this.m}decompose(){var e=this.m[0],n=this.m[1],r=this.m[2],i=this.m[3],a=this.m[4],s=this.m[5],u=e*i-n*r;let c={x:a,y:s,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||n!=0){var f=Math.sqrt(e*e+n*n);c.rotation=n>0?Math.acos(e/f):-Math.acos(e/f),c.scaleX=f,c.scaleY=u/f,c.skewX=(e*r+n*i)/u,c.skewY=0}else if(r!=0||i!=0){var h=Math.sqrt(r*r+i*i);c.rotation=Math.PI/2-(i>0?Math.acos(-r/h):-Math.acos(r/h)),c.scaleX=u/h,c.scaleY=h,c.skewX=0,c.skewY=(e*r+n*i)/u}return c.rotation=G._getRotation(c.rotation),c}}var pF="[object Array]",gF="[object Number]",mF="[object String]",vF="[object Boolean]",yF=Math.PI/180,SF=180/Math.PI,Pm="#",_F="",wF="0",bF="Konva warning: ",Sb="Konva error: ",CF="rgb(",Em={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]},xF=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Mf=[];const kF=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(t){setTimeout(t,60)},G={_isElement(t){return!!(t&&t.nodeType==1)},_isFunction(t){return!!(t&&t.constructor&&t.call&&t.apply)},_isPlainObject(t){return!!t&&t.constructor===Object},_isArray(t){return Object.prototype.toString.call(t)===pF},_isNumber(t){return Object.prototype.toString.call(t)===gF&&!isNaN(t)&&isFinite(t)},_isString(t){return Object.prototype.toString.call(t)===mF},_isBoolean(t){return Object.prototype.toString.call(t)===vF},isObject(t){return t instanceof Object},isValidSelector(t){if(typeof t!="string")return!1;var e=t[0];return e==="#"||e==="."||e===e.toUpperCase()},_sign(t){return t===0||t>0?1:-1},requestAnimFrame(t){Mf.push(t),Mf.length===1&&kF(function(){const e=Mf;Mf=[],e.forEach(function(n){n()})})},createCanvasElement(){var t=document.createElement("canvas");try{t.style=t.style||{}}catch{}return t},createImageElement(){return document.createElement("img")},_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(t,e){var n=G.createImageElement();n.onload=function(){e(n)},n.src=t},_rgbToHex(t,e,n){return((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)},_hexToRgb(t){t=t.replace(Pm,_F);var e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:e&255}},getRandomColor(){for(var t=(Math.random()*16777215<<0).toString(16);t.length<6;)t=wF+t;return Pm+t},getRGB(t){var e;return t in Em?(e=Em[t],{r:e[0],g:e[1],b:e[2]}):t[0]===Pm?this._hexToRgb(t.substring(1)):t.substr(0,4)===CF?(e=xF.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA(t){return t=t||"black",G._namedColorToRBA(t)||G._hex3ColorToRGBA(t)||G._hex4ColorToRGBA(t)||G._hex6ColorToRGBA(t)||G._hex8ColorToRGBA(t)||G._rgbColorToRGBA(t)||G._rgbaColorToRGBA(t)||G._hslColorToRGBA(t)},_namedColorToRBA(t){var e=Em[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(t.indexOf("rgb(")===0){t=t.match(/rgb\(([^)]+)\)/)[1];var e=t.split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(t.indexOf("rgba(")===0){t=t.match(/rgba\(([^)]+)\)/)[1];var e=t.split(/ *, */).map((n,r)=>n.slice(-1)==="%"?r===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if(t[0]==="#"&&t.length===9)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if(t[0]==="#"&&t.length===7)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if(t[0]==="#"&&t.length===5)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if(t[0]==="#"&&t.length===4)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){const[e,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),r=Number(n[0])/360,i=Number(n[1])/100,a=Number(n[2])/100;let s,u,c;if(i===0)return c=a*255,{r:Math.round(c),g:Math.round(c),b:Math.round(c),a:1};a<.5?s=a*(1+i):s=a+i-a*i;const f=2*a-s,h=[0,0,0];for(let p=0;p<3;p++)u=r+1/3*-(p-1),u<0&&u++,u>1&&u--,6*u<1?c=f+(s-f)*6*u:2*u<1?c=s:3*u<2?c=f+(s-f)*(2/3-u)*6:c=f,h[p]=c*255;return{r:Math.round(h[0]),g:Math.round(h[1]),b:Math.round(h[2]),a:1}}},haveIntersection(t,e){return!(e.x>t.x+t.width||e.x+e.widtht.y+t.height||e.y+e.height1?(s=n,u=r,c=(n-i)*(n-i)+(r-a)*(r-a)):(s=t+h*(n-t),u=e+h*(r-e),c=(s-i)*(s-i)+(u-a)*(u-a))}return[s,u,c]},_getProjectionToLine(t,e,n){var r=G.cloneObject(t),i=Number.MAX_VALUE;return e.forEach(function(a,s){if(!(!n&&s===e.length-1)){var u=e[(s+1)%e.length],c=G._getProjectionToSegment(a.x,a.y,u.x,u.y,t.x,t.y),f=c[0],h=c[1],p=c[2];pe.length){var s=e;e=t,t=s}for(r=0;r{e.width=0,e.height=0})},drawRoundedRectPath(t,e,n,r){let i=0,a=0,s=0,u=0;typeof r=="number"?i=a=s=u=Math.min(r,e/2,n/2):(i=Math.min(r[0]||0,e/2,n/2),a=Math.min(r[1]||0,e/2,n/2),u=Math.min(r[2]||0,e/2,n/2),s=Math.min(r[3]||0,e/2,n/2)),t.moveTo(i,0),t.lineTo(e-a,0),t.arc(e-a,a,a,Math.PI*3/2,0,!1),t.lineTo(e,n-u),t.arc(e-u,n-u,u,0,Math.PI/2,!1),t.lineTo(s,n),t.arc(s,n-s,s,Math.PI/2,Math.PI,!1),t.lineTo(0,i),t.arc(i,i,i,Math.PI,Math.PI*3/2,!1)}};function Da(t){return G._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||G._isBoolean(t)?t:Object.prototype.toString.call(t)}function $k(t){return t>255?255:t<0?0:Math.round(t)}function le(){if(pe.isUnminified)return function(t,e){return G._isNumber(t)||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function A0(t){if(pe.isUnminified)return function(e,n){let r=G._isNumber(e),i=G._isArray(e)&&e.length==t;return!r&&!i&&G.warn(Da(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+t+")"),e}}function I0(){if(pe.isUnminified)return function(t,e){var n=G._isNumber(t),r=t==="auto";return n||r||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function qs(){if(pe.isUnminified)return function(t,e){return G._isString(t)||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function zk(){if(pe.isUnminified)return function(t,e){const n=G._isString(t),r=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return n||r||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function PF(){if(pe.isUnminified)return function(t,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&t instanceof n||(G._isArray(t)?t.forEach(function(r){G._isNumber(r)||G.warn('"'+e+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function jr(){if(pe.isUnminified)return function(t,e){var n=t===!0||t===!1;return n||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function EF(t){if(pe.isUnminified)return function(e,n){return e==null||G.isObject(e)||G.warn(Da(e)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+t),e}}var Ul="get",jl="set";const A={addGetterSetter(t,e,n,r,i){A.addGetter(t,e,n),A.addSetter(t,e,r,i),A.addOverloadedGetterSetter(t,e)},addGetter(t,e,n){var r=Ul+G._capitalize(e);t.prototype[r]=t.prototype[r]||function(){var i=this.attrs[e];return i===void 0?n:i}},addSetter(t,e,n,r){var i=jl+G._capitalize(e);t.prototype[i]||A.overWriteSetter(t,e,n,r)},overWriteSetter(t,e,n,r){var i=jl+G._capitalize(e);t.prototype[i]=function(a){return n&&a!==void 0&&a!==null&&(a=n.call(this,a,e)),this._setAttr(e,a),r&&r.call(this),this}},addComponentsGetterSetter(t,e,n,r,i){var a=n.length,s=G._capitalize,u=Ul+s(e),c=jl+s(e),f,h;t.prototype[u]=function(){var g={};for(f=0;f{this._setAttr(e+s(w),void 0)}),this._fireChangeEvent(e,y,g),i&&i.call(this),this},A.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){var n=G._capitalize(e),r=jl+n,i=Ul+n;t.prototype[e]=function(){return arguments.length?(this[r](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(t,e,n,r){G.error("Adding deprecated "+e);var i=Ul+G._capitalize(e),a=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[i]=function(){G.error(a);var s=this.attrs[e];return s===void 0?n:s},A.addSetter(t,e,r,function(){G.error(a)}),A.addOverloadedGetterSetter(t,e)},backCompat(t,e){G.each(e,function(n,r){var i=t.prototype[r],a=Ul+G._capitalize(n),s=jl+G._capitalize(n);function u(){i.apply(this,arguments),G.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+r+'" instead.')}t.prototype[n]=u,t.prototype[a]=u,t.prototype[s]=u})},afterSetFilter(){this._filterUpToDate=!1}};function OF(t){var e=[],n=t.length,r=G,i,a;for(i=0;itypeof h=="number"?Math.floor(h):h)),a+=TF+f.join(_b)+RF)):(a+=u.property,e||(a+=DF+u.val)),a+=LF;return a}clearTrace(){this.traceArr=[]}_trace(e){var n=this.traceArr,r;n.push(e),r=n.length,r>=BF&&n.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var n=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){var n=e.getLineCap();n&&this.setAttr("lineCap",n)}_applyOpacity(e){var n=e.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(e){var n=e.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(e,n){this._context[e]=n}arc(e,n,r,i,a,s){this._context.arc(e,n,r,i,a,s)}arcTo(e,n,r,i,a){this._context.arcTo(e,n,r,i,a)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,r,i,a,s){this._context.bezierCurveTo(e,n,r,i,a,s)}clearRect(e,n,r,i){this._context.clearRect(e,n,r,i)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(e,n){var r=arguments;if(r.length===2)return this._context.createImageData(e,n);if(r.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,r,i){return this._context.createLinearGradient(e,n,r,i)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,r,i,a,s){return this._context.createRadialGradient(e,n,r,i,a,s)}drawImage(e,n,r,i,a,s,u,c,f){var h=arguments,p=this._context;h.length===3?p.drawImage(e,n,r):h.length===5?p.drawImage(e,n,r,i,a):h.length===9&&p.drawImage(e,n,r,i,a,s,u,c,f)}ellipse(e,n,r,i,a,s,u,c){this._context.ellipse(e,n,r,i,a,s,u,c)}isPointInPath(e,n,r,i){return r?this._context.isPointInPath(r,e,n,i):this._context.isPointInPath(e,n,i)}fill(e){e?this._context.fill(e):this._context.fill()}fillRect(e,n,r,i){this._context.fillRect(e,n,r,i)}strokeRect(e,n,r,i){this._context.strokeRect(e,n,r,i)}fillText(e,n,r,i){i?this._context.fillText(e,n,r,i):this._context.fillText(e,n,r)}measureText(e){return this._context.measureText(e)}getImageData(e,n,r,i){return this._context.getImageData(e,n,r,i)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,r,i){this._context.rect(e,n,r,i)}putImageData(e,n,r){this._context.putImageData(e,n,r)}quadraticCurveTo(e,n,r,i){this._context.quadraticCurveTo(e,n,r,i)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,n,r,i,a,s){this._context.setTransform(e,n,r,i,a,s)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,n,r,i){this._context.strokeText(e,n,r,i)}transform(e,n,r,i,a,s){this._context.transform(e,n,r,i,a,s)}translate(e,n){this._context.translate(e,n)}_enableTrace(){var e=this,n=wb.length,r=this.setAttr,i,a,s=function(u){var c=e[u],f;e[u]=function(){return a=OF(Array.prototype.slice.call(arguments,0)),f=c.apply(e,arguments),e._trace({method:u,args:a}),f}};for(i=0;i{e.dragStatus==="dragging"&&(t=!0)}),t},justDragged:!1,get node(){var t;return Ge._dragElements.forEach(e=>{t=e.node}),t},_dragElements:new Map,_drag(t){const e=[];Ge._dragElements.forEach((n,r)=>{const{node:i}=n,a=i.getStage();a.setPointersPositions(t),n.pointerId===void 0&&(n.pointerId=G._getFirstPointerId(t));const s=a._changedPointerPositions.find(f=>f.id===n.pointerId);if(s){if(n.dragStatus!=="dragging"){var u=i.dragDistance(),c=Math.max(Math.abs(s.x-n.startPointerPos.x),Math.abs(s.y-n.startPointerPos.y));if(c{n.fire("dragmove",{type:"dragmove",target:n,evt:t},!0)})},_endDragBefore(t){const e=[];Ge._dragElements.forEach(n=>{const{node:r}=n,i=r.getStage();if(t&&i.setPointersPositions(t),!i._changedPointerPositions.find(u=>u.id===n.pointerId))return;(n.dragStatus==="dragging"||n.dragStatus==="stopped")&&(Ge.justDragged=!0,pe._mouseListenClick=!1,pe._touchListenClick=!1,pe._pointerListenClick=!1,n.dragStatus="stopped");const s=n.node.getLayer()||n.node instanceof pe.Stage&&n.node;s&&e.indexOf(s)===-1&&e.push(s)}),e.forEach(n=>{n.draw()})},_endDragAfter(t){Ge._dragElements.forEach((e,n)=>{e.dragStatus==="stopped"&&e.node.fire("dragend",{type:"dragend",target:e.node,evt:t},!0),e.dragStatus!=="dragging"&&Ge._dragElements.delete(n)})}};pe.isBrowser&&(window.addEventListener("mouseup",Ge._endDragBefore,!0),window.addEventListener("touchend",Ge._endDragBefore,!0),window.addEventListener("mousemove",Ge._drag),window.addEventListener("touchmove",Ge._drag),window.addEventListener("mouseup",Ge._endDragAfter,!1),window.addEventListener("touchend",Ge._endDragAfter,!1));var md="absoluteOpacity",Nf="allEventListeners",Ii="absoluteTransform",bb="absoluteScale",Xa="canvas",GF="Change",UF="children",jF="konva",ey="listening",Cb="mouseenter",xb="mouseleave",kb="set",Pb="Shape",vd=" ",Eb="stage",ua="transform",WF="Stage",ty="visible",HF=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(vd);let VF=1;class se{constructor(e){this._id=VF++,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(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===ua||e===Ii)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,n){var r=this._cache.get(e),i=e===ua||e===Ii,a=r===void 0||i&&r.dirty===!0;return a&&(r=n.call(this),this._cache.set(e,r)),r}_calculate(e,n,r){if(!this._attachedDepsListeners.get(e)){const i=n.map(a=>a+"Change.konva").join(vd);this.on(i,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,r)}_getCanvasCache(){return this._cache.get(Xa)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Ii&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Xa)){const{scene:e,filter:n,hit:r}=this._cache.get(Xa);G.releaseCanvas(e,n,r),this._cache.delete(Xa)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var n=e||{},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),a=Math.ceil(n.height||r.height),s=n.pixelRatio,u=n.x===void 0?Math.floor(r.x):n.x,c=n.y===void 0?Math.floor(r.y):n.y,f=n.offset||0,h=n.drawBorder||!1,p=n.hitCanvasPixelRatio||1;if(!i||!a){G.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=f*2+1,a+=f*2+1,u-=f,c-=f;var g=new Ts({pixelRatio:s,width:i,height:a}),y=new Ts({pixelRatio:s,width:0,height:0}),v=new L0({pixelRatio:p,width:i,height:a}),w=g.getContext(),x=v.getContext();return v.isCache=!0,g.isCache=!0,this._cache.delete(Xa),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(g.getContext()._context.imageSmoothingEnabled=!1,y.getContext()._context.imageSmoothingEnabled=!1),w.save(),x.save(),w.translate(-u,-c),x.translate(-u,-c),this._isUnderCache=!0,this._clearSelfAndDescendantCache(md),this._clearSelfAndDescendantCache(bb),this.drawScene(g,this),this.drawHit(v,this),this._isUnderCache=!1,w.restore(),x.restore(),h&&(w.save(),w.beginPath(),w.rect(0,0,i,a),w.closePath(),w.setAttr("strokeStyle","red"),w.setAttr("lineWidth",5),w.stroke(),w.restore()),this._cache.set(Xa,{scene:g,filter:y,hit:v,x:u,y:c}),this._requestDraw(),this}isCached(){return this._cache.has(Xa)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,n){var r=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],i,a,s,u,c=this.getAbsoluteTransform(n);return r.forEach(function(f){var h=c.point(f);i===void 0&&(i=s=h.x,a=u=h.y),i=Math.min(i,h.x),a=Math.min(a,h.y),s=Math.max(s,h.x),u=Math.max(u,h.y)}),{x:i,y:a,width:s-i,height:u-a}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;e.drawImage(r._canvas,0,0,r.width/i,r.height/i),e.restore()}_drawCachedHitCanvas(e){var n=this._getCanvasCache(),r=n.hit;e.save(),e.translate(n.x,n.y),e.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,a=i.getContext(),s,u,c,f;if(e){if(!this._filterUpToDate){var h=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(s=e.length,a.clear(),a.drawImage(r._canvas,0,0,r.getWidth()/h,r.getHeight()/h),u=a.getImageData(0,0,i.getWidth(),i.getHeight()),c=0;c{var n,r;if(!e)return this;for(n in e)n!==UF&&(r=kb+G._capitalize(n),G._isFunction(this[r])?this[r](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(ey,this._isListening)}_isListening(e){if(!this.listening())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isListening(e):!0}isVisible(){return this._getCache(ty,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isVisible(e):!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);var r=this.getLayer(),i=!1;Ge._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(i=!0)});var a=!n&&!pe.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e=this.getDepth(),n=this,r=0,i,a,s,u;function c(f){for(i=[],a=f.length,s=0;s0&&i[0].getDepth()<=e&&c(i)}return n.nodeType!==WF&&c(n.getStage().getChildren()),r}getDepth(){for(var e=0,n=this.parent;n;)e++,n=n.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(ua),this._clearSelfAndDescendantCache(Ii)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(e)}getAbsolutePosition(e){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!e&&(e=!0);var i=this.getAbsoluteTransform(e).getMatrix(),a=new Wn,s=this.offset();return a.m=i.slice(),a.translate(s.x,s.y),a.getTranslation()}setAbsolutePosition(e){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(ua);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(e.x,e.y),e={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:e.x,y:e.y}),this._clearCache(ua),this._clearSelfAndDescendantCache(Ii),this}_setTransform(e){var n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){var e={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,e}move(e){var n=e.x,r=e.y,i=this.x(),a=this.y();return n!==void 0&&(i+=n),r!==void 0&&(a+=r),this.setPosition({x:i,y:a}),this}_eachAncestorReverse(e,n){var r=[],i=this.getParent(),a,s;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(a=r.length,s=0;s0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return G.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return G.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&G.warn("Unexpected value "+e+" 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(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(md,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(e*=n.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e={},n=this.getAttrs(),r,i,a,s,u;e.attrs={};for(r in n)i=n[r],u=G.isObject(i)&&!G._isPlainObject(i)&&!G._isArray(i),!u&&(a=typeof this[r]=="function"&&this[r],delete n[r],s=a?a.call(this):null,n[r]=i,s!==i&&(e.attrs[r]=i));return e.className=this.getClassName(),G._prepareToStringify(e)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,r){var i=[];n&&this._isMatch(e)&&i.push(this);for(var a=this.parent;a;){if(a===r)return i;a._isMatch(e)&&i.push(a),a=a.parent}return i}isAncestorOf(e){return!1}findAncestor(e,n,r){return this.findAncestors(e,n,r)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);var n=e.replace(/ /g,"").split(","),r=n.length,i,a;for(i=0;i{try{const i=e==null?void 0:e.callback;i&&delete e.callback,G._urlToImage(this.toDataURL(e),function(a){n(a),i==null||i(a)})}catch(i){r(i)}})}toBlob(e){return new Promise((n,r)=>{try{const i=e==null?void 0:e.callback;i&&delete e.callback,this.toCanvas(e).toBlob(a=>{n(a),i==null||i(a)})}catch(i){r(i)}})}setSize(e){return this.width(e.width),this.height(e.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():pe.dragDistance}_off(e,n,r){var i=this.eventListeners[e],a,s,u;for(a=0;a=0;if(r&&!this.isDragging()){var i=!1;Ge._dragElements.forEach(a=>{this.isAncestorOf(a.node)&&(i=!0)}),i||this._createDragElement(e)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var e=this.getStage();if(!e)return;const n=Ge._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Ge._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return G.haveIntersection(r,this.getClientRect())}static create(e,n){return G._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){var r=se.prototype.getClassName.call(e),i=e.children,a,s,u;n&&(e.attrs.container=n),pe[r]||(G.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const c=pe[r];if(a=new c(e.attrs),i)for(s=i.length,u=0;u0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(e,n){var r=[];return this._descendants(i=>{const a=i._isMatch(e);return a&&r.push(i),!!(a&&n)}),r}_descendants(e){let n=!1;const r=this.getChildren();for(const i of r){if(n=e(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(e),n))return!0}return!1}toObject(){var e=se.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(n=>{e.children.push(n.toObject())}),e}isAncestorOf(e){for(var n=e.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){var n=se.prototype.clone.call(this,e);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(e){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(e)&&n.push(r)}),n}_clearSelfAndDescendantCache(e){var n;super._clearSelfAndDescendantCache(e),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(e,n){var r=this.getLayer(),i=e||r&&r.getCanvas(),a=i&&i.getContext(),s=this._getCanvasCache(),u=s&&s.scene,c=i&&i.isCache;if(!this.isVisible()&&!c)return this;if(u){a.save();var f=this.getAbsoluteTransform(n).getMatrix();a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=e||r&&r.hitCanvas,a=i&&i.getContext(),s=this._getCanvasCache(),u=s&&s.hit;if(u){a.save();var c=this.getAbsoluteTransform(n).getMatrix();a.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedHitCanvas(a),a.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(e,n,r){var i,a=n&&n.getContext(),s=this.clipWidth(),u=this.clipHeight(),c=this.clipFunc(),f=s&&u||c;const h=r===this;if(f){a.save();var p=this.getAbsoluteTransform(r),g=p.getMatrix();if(a.transform(g[0],g[1],g[2],g[3],g[4],g[5]),a.beginPath(),c)c.call(this,a,this);else{var y=this.clipX(),v=this.clipY();a.rect(y,v,s,u)}a.clip(),g=p.copy().invert().getMatrix(),a.transform(g[0],g[1],g[2],g[3],g[4],g[5])}var w=!h&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";w&&(a.save(),a._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(x){x[e](n,r)}),w&&a.restore(),f&&a.restore()}getClientRect(e){var n;e=e||{};var r=e.skipTransform,i=e.relativeTo,a,s,u,c,f={x:1/0,y:1/0,width:0,height:0},h=this;(n=this.children)===null||n===void 0||n.forEach(function(w){if(w.visible()){var x=w.getClientRect({relativeTo:h,skipShadow:e.skipShadow,skipStroke:e.skipStroke});x.width===0&&x.height===0||(a===void 0?(a=x.x,s=x.y,u=x.x+x.width,c=x.y+x.height):(a=Math.min(a,x.x),s=Math.min(s,x.y),u=Math.max(u,x.x+x.width),c=Math.max(c,x.y+x.height)))}});for(var p=this.find("Shape"),g=!1,y=0;yt.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",is=t=>{const e=iu(t);if(e==="pointer")return pe.pointerEventsEnabled&&Tm.pointer;if(e==="touch")return Tm.touch;if(e==="mouse")return Tm.mouse};function Tb(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&G.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}const ZF="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);",yd=[];class tp extends qn{constructor(e){super(Tb(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),yd.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{Tb(this.attrs)}),this._checkVisibility()}_validateAdd(e){const n=e.getType()==="Layer",r=e.getType()==="FastLayer";n||r||G.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if(typeof e===KF){if(e.charAt(0)==="."){var n=e.slice(1);e=document.getElementsByClassName(n)[0]}else{var r;e.charAt(0)!=="#"?r=e:r=e.slice(1),e=document.getElementById(r)}if(!e)throw"Can not find container in document with id "+r}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var e=this.children,n=e.length,r;for(r=0;r-1&&yd.splice(n,1),G.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(G.warn(ZF),null)}_getPointerById(e){return this._pointerPositions.find(n=>n.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e=e||{},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var n=new Ts({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),r=n.getContext()._context,i=this.children;return(e.x||e.y)&&r.translate(-1*e.x,-1*e.y),i.forEach(function(a){if(a.isVisible()){var s=a._toKonvaCanvas(e);r.drawImage(s._canvas,e.x,e.y,s.getWidth()/s.getPixelRatio(),s.getHeight()/s.getPixelRatio())}}),n}getIntersection(e){if(!e)return null;var n=this.children,r=n.length,i=r-1,a;for(a=i;a>=0;a--){const s=n[a].getIntersection(e);if(s)return s}return null}_resizeDOM(){var e=this.width(),n=this.height();this.content&&(this.content.style.width=e+Ob,this.content.style.height=n+Ob),this.bufferCanvas.setSize(e,n),this.bufferHitCanvas.setSize(e,n),this.children.forEach(r=>{r.setSize({width:e,height:n}),r.draw()})}add(e,...n){if(arguments.length>1){for(var r=0;rQF&&G.warn("The stage has "+i+" 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."),e.setSize({width:this.width(),height:this.height()}),e.draw(),pe.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return Uk(e,this)}setPointerCapture(e){jk(e,this)}releaseCapture(e){mu(e)}getLayers(){return this.children}_bindContentEvents(){pe.isBrowser&&JF.forEach(([e,n])=>{this.content.addEventListener(e,r=>{this[n](r)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const n=is(e.type);this._fire(n.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const n=is(e.type);this._fire(n.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let n=this[e+"targetShape"];return n&&!n.getStage()&&(n=null),n}_pointerleave(e){const n=is(e.type),r=iu(e.type);if(n){this.setPointersPositions(e);var i=this._getTargetShape(r),a=!Ge.isDragging||pe.hitOnDragEnabled;i&&a?(i._fireAndBubble(n.pointerout,{evt:e}),i._fireAndBubble(n.pointerleave,{evt:e}),this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this[r+"targetShape"]=null):a&&(this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(n.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(e){const n=is(e.type),r=iu(e.type);if(n){this.setPointersPositions(e);var i=!1;this._changedPointerPositions.forEach(a=>{var s=this.getIntersection(a);if(Ge.justDragged=!1,pe["_"+r+"ListenClick"]=!0,!(s&&s.isListening()))return;pe.capturePointerEventsEnabled&&s.setPointerCapture(a.id),this[r+"ClickStartShape"]=s,s._fireAndBubble(n.pointerdown,{evt:e,pointerId:a.id}),i=!0;const c=e.type.indexOf("touch")>=0;s.preventDefault()&&e.cancelable&&c&&e.preventDefault()}),i||this._fire(n.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const n=is(e.type),r=iu(e.type);if(!n)return;Ge.isDragging&&Ge.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e);var i=!Ge.isDragging||pe.hitOnDragEnabled;if(!i)return;var a={};let s=!1;var u=this._getTargetShape(r);this._changedPointerPositions.forEach(c=>{const f=Om(c.id)||this.getIntersection(c),h=c.id,p={evt:e,pointerId:h};var g=u!==f;if(g&&u&&(u._fireAndBubble(n.pointerout,Object.assign({},p),f),u._fireAndBubble(n.pointerleave,Object.assign({},p),f)),f){if(a[f._id])return;a[f._id]=!0}f&&f.isListening()?(s=!0,g&&(f._fireAndBubble(n.pointerover,Object.assign({},p),u),f._fireAndBubble(n.pointerenter,Object.assign({},p),u),this[r+"targetShape"]=f),f._fireAndBubble(n.pointermove,Object.assign({},p))):u&&(this._fire(n.pointerover,{evt:e,target:this,currentTarget:this,pointerId:h}),this[r+"targetShape"]=null)}),s||this._fire(n.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const n=is(e.type),r=iu(e.type);if(!n)return;this.setPointersPositions(e);const i=this[r+"ClickStartShape"],a=this[r+"ClickEndShape"];var s={};let u=!1;this._changedPointerPositions.forEach(c=>{const f=Om(c.id)||this.getIntersection(c);if(f){if(f.releaseCapture(c.id),s[f._id])return;s[f._id]=!0}const h=c.id,p={evt:e,pointerId:h};let g=!1;pe["_"+r+"InDblClickWindow"]?(g=!0,clearTimeout(this[r+"DblTimeout"])):Ge.justDragged||(pe["_"+r+"InDblClickWindow"]=!0,clearTimeout(this[r+"DblTimeout"])),this[r+"DblTimeout"]=setTimeout(function(){pe["_"+r+"InDblClickWindow"]=!1},pe.dblClickWindow),f&&f.isListening()?(u=!0,this[r+"ClickEndShape"]=f,f._fireAndBubble(n.pointerup,Object.assign({},p)),pe["_"+r+"ListenClick"]&&i&&i===f&&(f._fireAndBubble(n.pointerclick,Object.assign({},p)),g&&a&&a===f&&f._fireAndBubble(n.pointerdblclick,Object.assign({},p)))):(this[r+"ClickEndShape"]=null,pe["_"+r+"ListenClick"]&&this._fire(n.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:h}),g&&this._fire(n.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:h}))}),u||this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),pe["_"+r+"ListenClick"]=!1,e.cancelable&&r!=="touch"&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(ny,{evt:e}):this._fire(ny,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(ry,{evt:e}):this._fire(ry,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const n=Om(e.pointerId)||this.getIntersection(this.getPointerPosition());n&&n._fireAndBubble(Ss,M0(e)),mu(e.pointerId)}_lostpointercapture(e){mu(e.pointerId)}setPointersPositions(e){var n=this._getContentPosition(),r=null,i=null;e=e||window.event,e.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,a=>{this._pointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,a=>{this._changedPointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})})):(r=(e.clientX-n.left)/n.scaleX,i=(e.clientY-n.top)/n.scaleY,this.pointerPos={x:r,y:i},this._pointerPositions=[{x:r,y:i,id:G._getFirstPointerId(e)}],this._changedPointerPositions=[{x:r,y:i,id:G._getFirstPointerId(e)}])}_setPointerPosition(e){G.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Ts({width:this.width(),height:this.height()}),this.bufferHitCanvas=new L0({pixelRatio:1,width:this.width(),height:this.height()}),!!pe.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.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"),e.appendChild(this.content),this._resizeDOM()}}cache(){return G.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(e){e.batchDraw()}),this}}tp.prototype.nodeType=qF;yt(tp);A.addGetterSetter(tp,"container");var eP="hasShadow",tP="shadowRGBA",nP="patternImage",rP="linearGradient",iP="radialGradient";let Gf;function Rm(){return Gf||(Gf=G.createCanvasElement().getContext("2d"),Gf)}const vu={};function e$(t){t.fill()}function t$(t){t.stroke()}function n$(t){t.fill()}function r$(t){t.stroke()}function i$(){this._clearCache(eP)}function a$(){this._clearCache(tP)}function o$(){this._clearCache(nP)}function s$(){this._clearCache(rP)}function l$(){this._clearCache(iP)}class re extends se{constructor(e){super(e);let n;for(;n=G.getRandomColor(),!(n&&!(n in vu)););this.colorKey=n,vu[n]=this}getContext(){return G.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return G.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(eP,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(nP,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var e=Rm();const n=e.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(n&&n.setTransform){const r=new Wn;r.translate(this.fillPatternX(),this.fillPatternY()),r.rotate(pe.getAngle(this.fillPatternRotation())),r.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),r.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const i=r.getMatrix(),a=typeof DOMMatrix>"u"?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);n.setTransform(a)}return n}}_getLinearGradient(){return this._getCache(rP,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var n=Rm(),r=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),a=n.createLinearGradient(r.x,r.y,i.x,i.y),s=0;sthis.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 e=this.hitStrokeWidth();return e==="auto"?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){var n=this.getStage(),r=n.bufferHitCanvas,i;return r.getContext().clear(),this.drawHit(r,null,!0),i=r.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data,i[3]>0}destroy(){return se.prototype.destroy.call(this),delete vu[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var n;if(!this.getStage()||!((n=this.attrs.perfectDrawEnabled)!==null&&n!==void 0?n:!0))return!1;const i=e||this.hasFill(),a=this.hasStroke(),s=this.getAbsoluteOpacity()!==1;if(i&&a&&s)return!0;const u=this.hasShadow(),c=this.shadowForStrokeEnabled();return!!(i&&a&&u&&c)}setStrokeHitEnabled(e){G.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){const n=e.skipTransform,r=e.relativeTo,i=this.getSelfRect(),s=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,u=i.width+s,c=i.height+s,f=!e.skipShadow&&this.hasShadow(),h=f?this.shadowOffsetX():0,p=f?this.shadowOffsetY():0,g=u+Math.abs(h),y=c+Math.abs(p),v=f&&this.shadowBlur()||0,w=g+v*2,x=y+v*2,_={width:w,height:x,x:-(s/2+v)+Math.min(h,0)+i.x,y:-(s/2+v)+Math.min(p,0)+i.y};return n?_:this._transformedRect(_,r)}drawScene(e,n){var r=this.getLayer(),i=e||r.getCanvas(),a=i.getContext(),s=this._getCanvasCache(),u=this.getSceneFunc(),c=this.hasShadow(),f,h,p,g=i.isCache,y=n===this;if(!this.isVisible()&&!y)return this;if(s){a.save();var v=this.getAbsoluteTransform(n).getMatrix();return a.transform(v[0],v[1],v[2],v[3],v[4],v[5]),this._drawCachedSceneCanvas(a),a.restore(),this}if(!u)return this;if(a.save(),this._useBufferCanvas()&&!g){f=this.getStage(),h=f.bufferCanvas,p=h.getContext(),p.clear(),p.save(),p._applyLineJoin(this);var w=this.getAbsoluteTransform(n).getMatrix();p.transform(w[0],w[1],w[2],w[3],w[4],w[5]),u.call(this,p,this),p.restore();var x=h.pixelRatio;c&&a._applyShadow(this),a._applyOpacity(this),a._applyGlobalCompositeOperation(this),a.drawImage(h._canvas,0,0,h.width/x,h.height/x)}else{if(a._applyLineJoin(this),!y){var w=this.getAbsoluteTransform(n).getMatrix();a.transform(w[0],w[1],w[2],w[3],w[4],w[5]),a._applyOpacity(this),a._applyGlobalCompositeOperation(this)}c&&a._applyShadow(this),u.call(this,a,this)}return a.restore(),this}drawHit(e,n,r=!1){if(!this.shouldDrawHit(n,r))return this;var i=this.getLayer(),a=e||i.hitCanvas,s=a&&a.getContext(),u=this.hitFunc()||this.sceneFunc(),c=this._getCanvasCache(),f=c&&c.hit;if(this.colorKey||G.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()"),f){s.save();var h=this.getAbsoluteTransform(n).getMatrix();return s.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(s),s.restore(),this}if(!u)return this;if(s.save(),s._applyLineJoin(this),!(this===n)){var g=this.getAbsoluteTransform(n).getMatrix();s.transform(g[0],g[1],g[2],g[3],g[4],g[5])}return u.call(this,s,this),s.restore(),this}drawHitFromCache(e=0){var n=this._getCanvasCache(),r=this._getCachedSceneCanvas(),i=n.hit,a=i.getContext(),s=i.getWidth(),u=i.getHeight(),c,f,h,p,g,y;a.clear(),a.drawImage(r._canvas,0,0,s,u);try{for(c=a.getImageData(0,0,s,u),f=c.data,h=f.length,p=G._hexToRgb(this.colorKey),g=0;ge?(f[g]=p.r,f[g+1]=p.g,f[g+2]=p.b,f[g+3]=255):f[g+3]=0;a.putImageData(c,0,0)}catch(v){G.error("Unable to draw hit graph from cached scene canvas. "+v.message)}return this}hasPointerCapture(e){return Uk(e,this)}setPointerCapture(e){jk(e,this)}releaseCapture(e){mu(e)}}re.prototype._fillFunc=e$;re.prototype._strokeFunc=t$;re.prototype._fillFuncHit=n$;re.prototype._strokeFuncHit=r$;re.prototype._centroid=!1;re.prototype.nodeType="Shape";yt(re);re.prototype.eventListeners={};re.prototype.on.call(re.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",i$);re.prototype.on.call(re.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",a$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",o$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",s$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",l$);A.addGetterSetter(re,"stroke",void 0,zk());A.addGetterSetter(re,"strokeWidth",2,le());A.addGetterSetter(re,"fillAfterStrokeEnabled",!1);A.addGetterSetter(re,"hitStrokeWidth","auto",I0());A.addGetterSetter(re,"strokeHitEnabled",!0,jr());A.addGetterSetter(re,"perfectDrawEnabled",!0,jr());A.addGetterSetter(re,"shadowForStrokeEnabled",!0,jr());A.addGetterSetter(re,"lineJoin");A.addGetterSetter(re,"lineCap");A.addGetterSetter(re,"sceneFunc");A.addGetterSetter(re,"hitFunc");A.addGetterSetter(re,"dash");A.addGetterSetter(re,"dashOffset",0,le());A.addGetterSetter(re,"shadowColor",void 0,qs());A.addGetterSetter(re,"shadowBlur",0,le());A.addGetterSetter(re,"shadowOpacity",1,le());A.addComponentsGetterSetter(re,"shadowOffset",["x","y"]);A.addGetterSetter(re,"shadowOffsetX",0,le());A.addGetterSetter(re,"shadowOffsetY",0,le());A.addGetterSetter(re,"fillPatternImage");A.addGetterSetter(re,"fill",void 0,zk());A.addGetterSetter(re,"fillPatternX",0,le());A.addGetterSetter(re,"fillPatternY",0,le());A.addGetterSetter(re,"fillLinearGradientColorStops");A.addGetterSetter(re,"strokeLinearGradientColorStops");A.addGetterSetter(re,"fillRadialGradientStartRadius",0);A.addGetterSetter(re,"fillRadialGradientEndRadius",0);A.addGetterSetter(re,"fillRadialGradientColorStops");A.addGetterSetter(re,"fillPatternRepeat","repeat");A.addGetterSetter(re,"fillEnabled",!0);A.addGetterSetter(re,"strokeEnabled",!0);A.addGetterSetter(re,"shadowEnabled",!0);A.addGetterSetter(re,"dashEnabled",!0);A.addGetterSetter(re,"strokeScaleEnabled",!0);A.addGetterSetter(re,"fillPriority","color");A.addComponentsGetterSetter(re,"fillPatternOffset",["x","y"]);A.addGetterSetter(re,"fillPatternOffsetX",0,le());A.addGetterSetter(re,"fillPatternOffsetY",0,le());A.addComponentsGetterSetter(re,"fillPatternScale",["x","y"]);A.addGetterSetter(re,"fillPatternScaleX",1,le());A.addGetterSetter(re,"fillPatternScaleY",1,le());A.addComponentsGetterSetter(re,"fillLinearGradientStartPoint",["x","y"]);A.addComponentsGetterSetter(re,"strokeLinearGradientStartPoint",["x","y"]);A.addGetterSetter(re,"fillLinearGradientStartPointX",0);A.addGetterSetter(re,"strokeLinearGradientStartPointX",0);A.addGetterSetter(re,"fillLinearGradientStartPointY",0);A.addGetterSetter(re,"strokeLinearGradientStartPointY",0);A.addComponentsGetterSetter(re,"fillLinearGradientEndPoint",["x","y"]);A.addComponentsGetterSetter(re,"strokeLinearGradientEndPoint",["x","y"]);A.addGetterSetter(re,"fillLinearGradientEndPointX",0);A.addGetterSetter(re,"strokeLinearGradientEndPointX",0);A.addGetterSetter(re,"fillLinearGradientEndPointY",0);A.addGetterSetter(re,"strokeLinearGradientEndPointY",0);A.addComponentsGetterSetter(re,"fillRadialGradientStartPoint",["x","y"]);A.addGetterSetter(re,"fillRadialGradientStartPointX",0);A.addGetterSetter(re,"fillRadialGradientStartPointY",0);A.addComponentsGetterSetter(re,"fillRadialGradientEndPoint",["x","y"]);A.addGetterSetter(re,"fillRadialGradientEndPointX",0);A.addGetterSetter(re,"fillRadialGradientEndPointY",0);A.addGetterSetter(re,"fillPatternRotation",0);A.backCompat(re,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var u$="#",c$="beforeDraw",f$="draw",aP=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],d$=aP.length;class yo extends qn{constructor(e){super(e),this.canvas=new Ts,this.hitCanvas=new L0({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(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(e,n){var r=this.getLayer(),i=e||r&&r.getCanvas();return this._fire(c$,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),qn.prototype.drawScene.call(this,i,n),this._fire(f$,{node:this}),this}drawHit(e,n){var r=this.getLayer(),i=e||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),qn.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){G.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return G.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var e=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return G.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}yo.prototype.nodeType="Layer";yt(yo);A.addGetterSetter(yo,"imageSmoothingEnabled",!0);A.addGetterSetter(yo,"clearBeforeDraw",!0);A.addGetterSetter(yo,"hitGraphEnabled",!0,jr());class D0 extends yo{constructor(e){super(e),this.listening(!1),G.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}D0.prototype.nodeType="FastLayer";yt(D0);class zs extends qn{_validateAdd(e){var n=e.getType();n!=="Group"&&n!=="Shape"&&G.throw("You may only add groups and shapes to groups.")}}zs.prototype.nodeType="Group";yt(zs);var Am=function(){return Os.performance&&Os.performance.now?function(){return Os.performance.now()}:function(){return new Date().getTime()}}();class dr{constructor(e,n){this.id=dr.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Am(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){var n=[];return e?e.length>0?n=e:n=[e]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(e){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=Rb,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=Ab,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,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 e=this.getTimer()-this._startTime;this.state===Rb?this.setTime(e):this.state===Ab&&this.setTime(this.duration-e)}pause(){this.state=p$,this.fire("onPause")}getTimer(){return new Date().getTime()}}class kt{constructor(e){var n=this,r=e.node,i=r._id,a,s=e.easing||yu.Linear,u=!!e.yoyo,c;typeof e.duration>"u"?a=.3:e.duration===0?a=.001:a=e.duration,this.node=r,this._id=g$++;var f=r.getLayer()||(r instanceof pe.Stage?r.getLayers():null);f||G.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new dr(function(){n.tween.onEnterFrame()},f),this.tween=new m$(c,function(h){n._tweenFunc(h)},s,0,1,a*1e3,u),this._addListeners(),kt.attrs[i]||(kt.attrs[i]={}),kt.attrs[i][this._id]||(kt.attrs[i][this._id]={}),kt.tweens[i]||(kt.tweens[i]={});for(c in e)h$[c]===void 0&&this._addAttr(c,e[c]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,n){var r=this.node,i=r._id,a,s,u,c,f,h,p,g;if(u=kt.tweens[i][e],u&&delete kt.attrs[i][u][e],a=r.getAttr(e),G._isArray(n))if(s=[],f=Math.max(n.length,a.length),e==="points"&&n.length!==a.length&&(n.length>a.length?(p=a,a=G._prepareArrayForTween(a,n,r.closed())):(h=n,n=G._prepareArrayForTween(n,a,r.closed()))),e.indexOf("fill")===0)for(c=0;c{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,n=kt.attrs[e._id][this._id];n.points&&n.points.trueEnd&&e.setAttr("points",n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,n=kt.attrs[e._id][this._id];n.points&&n.points.trueStart&&e.points(n.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(e){return this.tween.seek(e*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e=this.node._id,n=this._id,r=kt.tweens[e],i;this.pause();for(i in r)delete kt.tweens[e][i];delete kt.attrs[e][n]}}kt.attrs={};kt.tweens={};se.prototype.to=function(t){var e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()};var n=new kt(t);n.play()};const yu={BackEaseIn(t,e,n,r){var i=1.70158;return n*(t/=r)*t*((i+1)*t-i)+e},BackEaseOut(t,e,n,r){var i=1.70158;return n*((t=t/r-1)*t*((i+1)*t+i)+1)+e},BackEaseInOut(t,e,n,r){var i=1.70158;return(t/=r/2)<1?n/2*(t*t*(((i*=1.525)+1)*t-i))+e:n/2*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)+e},ElasticEaseIn(t,e,n,r,i,a){var s=0;return t===0?e:(t/=r)===1?e+n:(a||(a=r*.3),!i||i0?e:n),h=s*n,p=u*(u>0?e:n),g=c*(c>0?n:e);return{x:f,y:r?-1*g:p,width:h-f,height:g-p}}}Hi.prototype._centroid=!0;Hi.prototype.className="Arc";Hi.prototype._attrsAffectingSize=["innerRadius","outerRadius"];yt(Hi);A.addGetterSetter(Hi,"innerRadius",0,le());A.addGetterSetter(Hi,"outerRadius",0,le());A.addGetterSetter(Hi,"angle",0,le());A.addGetterSetter(Hi,"clockwise",!1,jr());function iy(t,e,n,r,i,a,s){var u=Math.sqrt(Math.pow(n-t,2)+Math.pow(r-e,2)),c=Math.sqrt(Math.pow(i-n,2)+Math.pow(a-r,2)),f=s*u/(u+c),h=s*c/(u+c),p=n-f*(i-t),g=r-f*(a-e),y=n+h*(i-t),v=r+h*(a-e);return[p,g,y,v]}function Mb(t,e){var n=t.length,r=[],i,a;for(i=2;i4){for(u=this.getTensionPoints(),c=u.length,f=a?0:4,a||e.quadraticCurveTo(u[0],u[1],u[2],u[3]);fh?f:h,x=f>h?1:f/h,_=f>h?h/f:1;e.translate(u,c),e.rotate(y),e.scale(x,_),e.arc(0,0,w,p,p+g,1-v),e.scale(1/x,1/_),e.rotate(-y),e.translate(-u,-c);break;case"z":r=!0,e.closePath();break}}!r&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach(function(f){if(f.command==="A"){var h=f.points[4],p=f.points[5],g=f.points[4]+p,y=Math.PI/180;if(Math.abs(h-g)g;v-=y){const w=tt.getPointOnEllipticalArc(f.points[0],f.points[1],f.points[2],f.points[3],v,0);e.push(w.x,w.y)}else for(let v=h+y;vthis.dataArray[r].pathLength;)e-=this.dataArray[r].pathLength,++r;if(r===i)return n=this.dataArray[r-1].points.slice(-2),{x:n[0],y:n[1]};if(e<.01)return n=this.dataArray[r].points.slice(0,2),{x:n[0],y:n[1]};var a=this.dataArray[r],s=a.points;switch(a.command){case"L":return tt.getPointOnLine(e,a.start.x,a.start.y,s[0],s[1]);case"C":return tt.getPointOnCubicBezier(e/a.pathLength,a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return tt.getPointOnQuadraticBezier(e/a.pathLength,a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":var u=s[0],c=s[1],f=s[2],h=s[3],p=s[4],g=s[5],y=s[6];return p+=g*e/a.pathLength,tt.getPointOnEllipticalArc(u,c,f,h,p,y)}return null}static getLineLength(e,n,r,i){return Math.sqrt((r-e)*(r-e)+(i-n)*(i-n))}static getPointOnLine(e,n,r,i,a,s,u){s===void 0&&(s=n),u===void 0&&(u=r);var c=(a-r)/(i-n+1e-8),f=Math.sqrt(e*e/(1+c*c));i0&&!isNaN(v[0]);){var S=null,C=[],O=c,I=f,L,D,U,X,K,te,ce,j,T,$;switch(y){case"l":c+=v.shift(),f+=v.shift(),S="L",C.push(c,f);break;case"L":c=v.shift(),f=v.shift(),C.push(c,f);break;case"m":var V=v.shift(),ie=v.shift();if(c+=V,f+=ie,S="M",s.length>2&&s[s.length-1].command==="z"){for(var W=s.length-2;W>=0;W--)if(s[W].command==="M"){c=s[W].points[0]+V,f=s[W].points[1]+ie;break}}C.push(c,f),y="l";break;case"M":c=v.shift(),f=v.shift(),S="M",C.push(c,f),y="L";break;case"h":c+=v.shift(),S="L",C.push(c,f);break;case"H":c=v.shift(),S="L",C.push(c,f);break;case"v":f+=v.shift(),S="L",C.push(c,f);break;case"V":f=v.shift(),S="L",C.push(c,f);break;case"C":C.push(v.shift(),v.shift(),v.shift(),v.shift()),c=v.shift(),f=v.shift(),C.push(c,f);break;case"c":C.push(c+v.shift(),f+v.shift(),c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="C",C.push(c,f);break;case"S":D=c,U=f,L=s[s.length-1],L.command==="C"&&(D=c+(c-L.points[2]),U=f+(f-L.points[3])),C.push(D,U,v.shift(),v.shift()),c=v.shift(),f=v.shift(),S="C",C.push(c,f);break;case"s":D=c,U=f,L=s[s.length-1],L.command==="C"&&(D=c+(c-L.points[2]),U=f+(f-L.points[3])),C.push(D,U,c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="C",C.push(c,f);break;case"Q":C.push(v.shift(),v.shift()),c=v.shift(),f=v.shift(),C.push(c,f);break;case"q":C.push(c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="Q",C.push(c,f);break;case"T":D=c,U=f,L=s[s.length-1],L.command==="Q"&&(D=c+(c-L.points[0]),U=f+(f-L.points[1])),c=v.shift(),f=v.shift(),S="Q",C.push(D,U,c,f);break;case"t":D=c,U=f,L=s[s.length-1],L.command==="Q"&&(D=c+(c-L.points[0]),U=f+(f-L.points[1])),c+=v.shift(),f+=v.shift(),S="Q",C.push(D,U,c,f);break;case"A":X=v.shift(),K=v.shift(),te=v.shift(),ce=v.shift(),j=v.shift(),T=c,$=f,c=v.shift(),f=v.shift(),S="A",C=this.convertEndpointToCenterParameterization(T,$,c,f,ce,j,X,K,te);break;case"a":X=v.shift(),K=v.shift(),te=v.shift(),ce=v.shift(),j=v.shift(),T=c,$=f,c+=v.shift(),f+=v.shift(),S="A",C=this.convertEndpointToCenterParameterization(T,$,c,f,ce,j,X,K,te);break}s.push({command:S||y,points:C,start:{x:O,y:I},pathLength:this.calcLength(O,I,S||y,C)})}(y==="z"||y==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(e,n,r,i){var a,s,u,c,f=tt;switch(r){case"L":return f.getLineLength(e,n,i[0],i[1]);case"C":for(a=0,s=f.getPointOnCubicBezier(0,e,n,i[0],i[1],i[2],i[3],i[4],i[5]),c=.01;c<=1;c+=.01)u=f.getPointOnCubicBezier(c,e,n,i[0],i[1],i[2],i[3],i[4],i[5]),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;return a;case"Q":for(a=0,s=f.getPointOnQuadraticBezier(0,e,n,i[0],i[1],i[2],i[3]),c=.01;c<=1;c+=.01)u=f.getPointOnQuadraticBezier(c,e,n,i[0],i[1],i[2],i[3]),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;return a;case"A":a=0;var h=i[4],p=i[5],g=i[4]+p,y=Math.PI/180;if(Math.abs(h-g)g;c-=y)u=f.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],c,0),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;else for(c=h+y;c1&&(u*=Math.sqrt(y),c*=Math.sqrt(y));var v=Math.sqrt((u*u*(c*c)-u*u*(g*g)-c*c*(p*p))/(u*u*(g*g)+c*c*(p*p)));a===s&&(v*=-1),isNaN(v)&&(v=0);var w=v*u*g/c,x=v*-c*p/u,_=(e+r)/2+Math.cos(h)*w-Math.sin(h)*x,S=(n+i)/2+Math.sin(h)*w+Math.cos(h)*x,C=function(K){return Math.sqrt(K[0]*K[0]+K[1]*K[1])},O=function(K,te){return(K[0]*te[0]+K[1]*te[1])/(C(K)*C(te))},I=function(K,te){return(K[0]*te[1]=1&&(X=0),s===0&&X>0&&(X=X-2*Math.PI),s===1&&X<0&&(X=X+2*Math.PI),[_,S,u,c,L,X,h,s]}}tt.prototype.className="Path";tt.prototype._attrsAffectingSize=["data"];yt(tt);A.addGetterSetter(tt,"data");class So extends Vi{_sceneFunc(e){super._sceneFunc(e);var n=Math.PI*2,r=this.points(),i=r,a=this.tension()!==0&&r.length>4;a&&(i=this.getTensionPoints());var s=this.pointerLength(),u=r.length,c,f;if(a){const g=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[u-2],r[u-1]],y=tt.calcLength(i[i.length-4],i[i.length-3],"C",g),v=tt.getPointOnQuadraticBezier(Math.min(1,1-s/y),g[0],g[1],g[2],g[3],g[4],g[5]);c=r[u-2]-v.x,f=r[u-1]-v.y}else c=r[u-2]-r[u-4],f=r[u-1]-r[u-3];var h=(Math.atan2(f,c)+n)%n,p=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(r[u-2],r[u-1]),e.rotate(h),e.moveTo(0,0),e.lineTo(-s,p/2),e.lineTo(-s,-p/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(r[0],r[1]),a?(c=(i[0]+i[2])/2-r[0],f=(i[1]+i[3])/2-r[1]):(c=r[2]-r[0],f=r[3]-r[1]),e.rotate((Math.atan2(-f,-c)+n)%n),e.moveTo(0,0),e.lineTo(-s,p/2),e.lineTo(-s,-p/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x-n,y:e.y-n,width:e.width+n*2,height:e.height+n*2}}}So.prototype.className="Arrow";yt(So);A.addGetterSetter(So,"pointerLength",10,le());A.addGetterSetter(So,"pointerWidth",10,le());A.addGetterSetter(So,"pointerAtBeginning",!1);A.addGetterSetter(So,"pointerAtEnding",!0);class Ks extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Ks.prototype._centroid=!0;Ks.prototype.className="Circle";Ks.prototype._attrsAffectingSize=["radius"];yt(Ks);A.addGetterSetter(Ks,"radius",0,le());class Na extends re{_sceneFunc(e){var n=this.radiusX(),r=this.radiusY();e.beginPath(),e.save(),n!==r&&e.scale(1,r/n),e.arc(0,0,n,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Na.prototype.className="Ellipse";Na.prototype._centroid=!0;Na.prototype._attrsAffectingSize=["radiusX","radiusY"];yt(Na);A.addComponentsGetterSetter(Na,"radius",["x","y"]);A.addGetterSetter(Na,"radiusX",0,le());A.addGetterSetter(Na,"radiusY",0,le());let hi=class oP extends re{constructor(e){super(e),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),a=this.attrs.image;let s;if(a){const u=this.attrs.cropWidth,c=this.attrs.cropHeight;u&&c?s=[a,this.cropX(),this.cropY(),u,c,0,0,n,r]:s=[a,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(e.beginPath(),i?G.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)),a&&(i&&e.clip(),e.drawImage.apply(e,s))}_hitFunc(e){var n=this.width(),r=this.height(),i=this.cornerRadius();e.beginPath(),i?G.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n;return(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var e,n;return(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(e,n,r=null){var i=G.createImageElement();i.onload=function(){var a=new oP({image:i});n(a)},i.onerror=r,i.crossOrigin="Anonymous",i.src=e}};hi.prototype.className="Image";yt(hi);A.addGetterSetter(hi,"cornerRadius",0,A0(4));A.addGetterSetter(hi,"image");A.addComponentsGetterSetter(hi,"crop",["x","y","width","height"]);A.addGetterSetter(hi,"cropX",0,le());A.addGetterSetter(hi,"cropY",0,le());A.addGetterSetter(hi,"cropWidth",0,le());A.addGetterSetter(hi,"cropHeight",0,le());var sP=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],v$="Change.konva",y$="none",ay="up",oy="right",sy="down",ly="left",S$=sP.length;class N0 extends zs{constructor(e){super(e),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(e){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,s.x),r=Math.max(r,s.x),i=Math.min(i,s.y),a=Math.max(a,s.y)}),{x:n,y:i,width:r-n,height:a-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}wo.prototype.className="RegularPolygon";wo.prototype._centroid=!0;wo.prototype._attrsAffectingSize=["radius"];yt(wo);A.addGetterSetter(wo,"radius",0,le());A.addGetterSetter(wo,"sides",0,le());var Db=Math.PI*2;class bo extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,Db,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),Db,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}bo.prototype.className="Ring";bo.prototype._centroid=!0;bo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];yt(bo);A.addGetterSetter(bo,"innerRadius",0,le());A.addGetterSetter(bo,"outerRadius",0,le());class pi extends re{constructor(e){super(e),this._updated=!0,this.anim=new dr(()=>{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(e){var n=this.animation(),r=this.frameIndex(),i=r*4,a=this.animations()[n],s=this.frameOffsets(),u=a[i+0],c=a[i+1],f=a[i+2],h=a[i+3],p=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,f,h),e.closePath(),e.fillStrokeShape(this)),p)if(s){var g=s[n],y=r*2;e.drawImage(p,u,c,f,h,g[y+0],g[y+1],f,h)}else e.drawImage(p,u,c,f,h,0,0,f,h)}_hitFunc(e){var n=this.animation(),r=this.frameIndex(),i=r*4,a=this.animations()[n],s=this.frameOffsets(),u=a[i+2],c=a[i+3];if(e.beginPath(),s){var f=s[n],h=r*2;e.rect(f[h+0],f[h+1],u,c)}else e.rect(0,0,u,c);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],a=i.length/4;e{e=e.trim();const n=e.indexOf(" ")>=0,r=e.indexOf('"')>=0||e.indexOf("'")>=0;return n&&!r&&(e=`"${e}"`),e}).join(", ")}var jf;function Lm(){return jf||(jf=G.createCanvasElement().getContext(b$),jf)}function L$(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function M$(t){t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function D$(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let vt=class extends re{constructor(e){super(D$(e)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(_+=s)}}}_hitFunc(e){var n=this.getWidth(),r=this.getHeight();e.beginPath(),e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}setText(e){var n=G._isString(e)?e:e==null?"":e+"";return this._setAttr(C$,n),this}getWidth(){var e=this.attrs.width===as||this.attrs.width===void 0;return e?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var e=this.attrs.height===as||this.attrs.height===void 0;return e?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return G.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n=Lm(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(e),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+Uf+this.fontVariant()+Uf+(this.fontSize()+E$)+I$(this.fontFamily())}_addTextLine(e){this.align()===Wl&&(e=e.trim());var r=this._getTextWidth(e);return this.textArr.push({text:e,width:r,lastInParagraph:!1})}_getTextWidth(e){var n=this.letterSpacing(),r=e.length;return Lm().measureText(e).width+(r?n*(r-1):0)}_setTextData(){var e=this.text().split(` +`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,a=this.attrs.width,s=this.attrs.height,u=a!==as&&a!==void 0,c=s!==as&&s!==void 0,f=this.padding(),h=a-f*2,p=s-f*2,g=0,y=this.wrap(),v=y!==Fb,w=y!==R$&&v,x=this.ellipsis();this.textArr=[],Lm().font=this._getContextFont();for(var _=x?this._getTextWidth(Im):0,S=0,C=e.length;Sh)for(;O.length>0;){for(var L=0,D=O.length,U="",X=0;L>>1,te=O.slice(0,K+1),ce=this._getTextWidth(te)+_;ce<=h?(L=K+1,U=te,X=ce):D=K}if(U){if(w){var j,T=O[U.length],$=T===Uf||T===Nb;$&&X<=h?j=U.length:j=Math.max(U.lastIndexOf(Uf),U.lastIndexOf(Nb))+1,j>0&&(L=j,U=U.slice(0,L),X=this._getTextWidth(U))}U=U.trimRight(),this._addTextLine(U),r=Math.max(r,X),g+=i;var V=this._shouldHandleEllipsis(g);if(V){this._tryToAddEllipsisToLastLine();break}if(O=O.slice(L),O=O.trimLeft(),O.length>0&&(I=this._getTextWidth(O),I<=h)){this._addTextLine(O),g+=i,r=Math.max(r,I);break}}else break}else this._addTextLine(O),g+=i,r=Math.max(r,I),this._shouldHandleEllipsis(g)&&Sp)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(e){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,a=i!==as&&i!==void 0,s=this.padding(),u=i-s*2,c=this.wrap(),f=c!==Fb;return!f||a&&e+r>u}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,n=e!==as&&e!==void 0,r=this.padding(),i=e-r*2,a=this.ellipsis(),s=this.textArr[this.textArr.length-1];if(!(!s||!a)){if(n){var u=this._getTextWidth(s.text+Im)=1){var r=n[0].p0;e.moveTo(r.x,r.y)}for(var i=0;i0&&(u+=e.dataArray[c].pathLength);var f=0;i==="center"&&(f=Math.max(0,u/2-s/2)),i==="right"&&(f=Math.max(0,u-s));for(var h=lP(this.text()),p=this.text().split(" ").length-1,g,y,v,w=-1,x=0,_=function(){x=0;for(var ce=e.dataArray,j=w+1;j0)return w=j,ce[j];ce[j].command==="M"&&(g={x:ce[j].points[0],y:ce[j].points[1]})}return{}},S=function(ce){var j=e._getTextSize(ce).width+r;ce===" "&&i==="justify"&&(j+=(u-s)/p);var T=0,$=0;for(y=void 0;Math.abs(j-T)/j>.01&&$<20;){$++;for(var V=T;v===void 0;)v=_(),v&&V+v.pathLengthj?y=tt.getPointOnLine(j,g.x,g.y,v.points[0],v.points[1],g.x,g.y):v=void 0;break;case"A":var W=v.points[4],Y=v.points[5],Q=v.points[4]+Y;x===0?x=W+1e-8:j>T?x+=Math.PI/180*Y/Math.abs(Y):x-=Math.PI/360*Y/Math.abs(Y),(Y<0&&x=0&&x>Q)&&(x=Q,ie=!0),y=tt.getPointOnEllipticalArc(v.points[0],v.points[1],v.points[2],v.points[3],x,v.points[6]);break;case"C":x===0?j>v.pathLength?x=1e-8:x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength/2:x=Math.max(x-(T-j)/v.pathLength/2,0),x>1&&(x=1,ie=!0),y=tt.getPointOnCubicBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3],v.points[4],v.points[5]);break;case"Q":x===0?x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength:x-=(T-j)/v.pathLength,x>1&&(x=1,ie=!0),y=tt.getPointOnQuadraticBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3]);break}y!==void 0&&(T=tt.getLineLength(g.x,g.y,y.x,y.y)),ie&&(ie=!1,v=void 0)}},C="C",O=e._getTextSize(C).width+r,I=f/O-1,L=0;Lt+`.${gP}`).join(" "),$b="nodesRect",F$=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],$$={"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 z$="ontouchstart"in pe._global;function G$(t,e){if(t==="rotater")return"crosshair";e+=G.degToRad($$[t]||0);var n=(G.radToDeg(e)%360+360)%360;return G._inRange(n,315+22.5,360)||G._inRange(n,0,22.5)?"ns-resize":G._inRange(n,45-22.5,45+22.5)?"nesw-resize":G._inRange(n,90-22.5,90+22.5)?"ew-resize":G._inRange(n,135-22.5,135+22.5)?"nwse-resize":G._inRange(n,180-22.5,180+22.5)?"ns-resize":G._inRange(n,225-22.5,225+22.5)?"nesw-resize":G._inRange(n,270-22.5,270+22.5)?"ew-resize":G._inRange(n,315-22.5,315+22.5)?"nwse-resize":(G.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var sh=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],zb=1e8;function U$(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function mP(t,e,n){const r=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),i=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return Object.assign(Object.assign({},t),{rotation:t.rotation+e,x:r,y:i})}function j$(t,e){const n=U$(t);return mP(t,e,n)}function W$(t,e,n){let r=e;for(let i=0;i{const i=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=r._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");r.on(a,i),r.on(F$.map(s=>s+`.${this._getEventNamespace()}`).join(" "),i),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,i),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,r=>{n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(r,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=e.getAbsolutePosition(),a=i.x-n.x,s=i.y-n.y;this.nodes().forEach(u=>{if(u===e||u.isDragging())return;const c=u.getAbsolutePosition();u.setAbsolutePosition({x:c.x+a,y:c.y+s}),u.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache($b),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache($b,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),r){var i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(r),s=e.getAbsolutePosition(r),u=i.x*a.x-e.offsetX()*a.x,c=i.y*a.y-e.offsetY()*a.y;const f=(pe.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),h={x:s.x+u*Math.cos(f)+c*Math.sin(-f),y:s.y+c*Math.cos(f)+u*Math.sin(f),width:i.width*a.x,height:i.height*a.y,rotation:f};return mP(h,-pe.getAngle(n),{x:0,y:0})}__getNodeRect(){var e=this.getNode();if(!e)return{x:-zb,y:-zb,width:0,height:0,rotation:0};const n=[];this.nodes().map(f=>{const h=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var p=[{x:h.x,y:h.y},{x:h.x+h.width,y:h.y},{x:h.x+h.width,y:h.y+h.height},{x:h.x,y:h.y+h.height}],g=f.getAbsoluteTransform();p.forEach(function(y){var v=g.point(y);n.push(v)})});const r=new Wn;r.rotate(-pe.getAngle(this.rotation()));var i,a,s,u;n.forEach(function(f){var h=r.point(f);i===void 0&&(i=s=h.x,a=u=h.y),i=Math.min(i,h.x),a=Math.min(a,h.y),s=Math.max(s,h.x),u=Math.max(u,h.y)}),r.invert();const c=r.point({x:i,y:a});return{x:c.x,y:c.y,width:s-i,height:u-a,rotation:pe.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(),sh.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var n=new Zu({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:z$?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=pe.getAngle(this.rotation()),a=G$(e,i);n.getStage().content&&(n.getStage().content.style.cursor=a),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var e=new re({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()*G._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(e),this._proxyDrag(e),e.on("dragstart",n=>{n.cancelBubble=!0}),e.on("dragmove",n=>{n.cancelBubble=!0}),e.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,a=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/a),this.cos=Math.abs(r/a),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 s=e.target.getAbsolutePosition(),u=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:u.x-s.x,y:u.y-s.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(c=>{c._fire("transformstart",{evt:e.evt,target:c})})}_handleMouseMove(e){var n,r,i,a=this.findOne("."+this._movingAnchorName),s=a.getStage();s.setPointersPositions(e);const u=s.getPointerPosition();let c={x:u.x-this._anchorDragOffset.x,y:u.y-this._anchorDragOffset.y};const f=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(c=this.anchorDragBoundFunc()(f,c,e)),a.setAbsolutePosition(c);const h=a.getAbsolutePosition();if(!(f.x===h.x&&f.y===h.y)){if(this._movingAnchorName==="rotater"){var p=this._getNodeRect();n=a.x()-p.width/2,r=-a.y()+p.height/2;let ce=Math.atan2(-r,n)+Math.PI/2;p.height<0&&(ce-=Math.PI);var g=pe.getAngle(this.rotation());const j=g+ce,T=pe.getAngle(this.rotationSnapTolerance()),V=W$(this.rotationSnaps(),j,T)-p.rotation,ie=j$(p,V);this._fitNodesInto(ie,e);return}var y=this.keepRatio()||e.shiftKey,S=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(y){var v=S?{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(v.x-a.x(),2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-left").x()>v.x?-1:1,x=this.findOne(".top-left").y()>v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-left").x(v.x-n),this.findOne(".top-left").y(v.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(a.y());else if(this._movingAnchorName==="top-right"){if(y){var v=S?{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(a.x()-v.x,2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-right").x()v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-right").x(v.x+n),this.findOne(".top-right").y(v.y-r)}var _=a.position();this.findOne(".top-left").y(_.y),this.findOne(".bottom-right").x(_.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(a.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(a.x());else if(this._movingAnchorName==="bottom-left"){if(y){var v=S?{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(v.x-a.x(),2)+Math.pow(a.y()-v.y,2));var w=v.x{r._fire("transformend",{evt:e,target:r})}),this._movingAnchorName=null}}_fitNodesInto(e,n){var r=this._getNodeRect();const i=1;if(G._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(G._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const a=this.flipEnabled();var s=new Wn;if(s.rotate(pe.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const p=s.point({x:-this.padding()*2,y:0});if(e.x+=p.x,e.y+=p.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,!a){this.update();return}}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const p=s.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.width+=this.padding()*2,!a){this.update();return}}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const p=s.point({x:0,y:-this.padding()*2});if(e.x+=p.x,e.y+=p.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const p=s.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}if(this.boundBoxFunc()){const p=this.boundBoxFunc()(r,e);p?e=p:G.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const u=1e7,c=new Wn;c.translate(r.x,r.y),c.rotate(r.rotation),c.scale(r.width/u,r.height/u);const f=new Wn;f.translate(e.x,e.y),f.rotate(e.rotation),f.scale(e.width/u,e.height/u);const h=f.multiply(c.invert());this._nodes.forEach(p=>{var g;const y=p.getParent().getAbsoluteTransform(),v=p.getTransform().copy();v.translate(p.offsetX(),p.offsetY());const w=new Wn;w.multiply(y.copy().invert()).multiply(h).multiply(y).multiply(v);const x=w.decompose();p.setAttrs(x),this._fire("transform",{evt:n,target:p}),p._fire("transform",{evt:n,target:p}),(g=p.getLayer())===null||g===void 0||g.batchDraw()}),this.rotation(G._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e,n=this._getNodeRect();this.rotation(G._getRotation(n.rotation));var r=n.width,i=n.height,a=this.enabledAnchors(),s=this.resizeEnabled(),u=this.padding(),c=this.anchorSize();this.find("._anchor").forEach(f=>{f.setAttrs({width:c,height:c,offsetX:c/2,offsetY:c/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:c/2+u,offsetY:c/2+u,visible:s&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:c/2+u,visible:s&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:c/2-u,offsetY:c/2+u,visible:s&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:c/2+u,visible:s&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:c/2-u,visible:s&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:c/2+u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:c/2-u,visible:s&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:c/2-u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*G._sign(i)-u,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}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),zs.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return se.prototype.toObject.call(this)}clone(e){var n=se.prototype.clone.call(this,e);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}function H$(t){return t instanceof Array||G.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){sh.indexOf(e)===-1&&G.warn("Unknown anchor name: "+e+". Available names are: "+sh.join(", "))}),t||[]}Ke.prototype.className="Transformer";yt(Ke);A.addGetterSetter(Ke,"enabledAnchors",sh,H$);A.addGetterSetter(Ke,"flipEnabled",!0,jr());A.addGetterSetter(Ke,"resizeEnabled",!0);A.addGetterSetter(Ke,"anchorSize",10,le());A.addGetterSetter(Ke,"rotateEnabled",!0);A.addGetterSetter(Ke,"rotationSnaps",[]);A.addGetterSetter(Ke,"rotateAnchorOffset",50,le());A.addGetterSetter(Ke,"rotationSnapTolerance",5,le());A.addGetterSetter(Ke,"borderEnabled",!0);A.addGetterSetter(Ke,"anchorStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"anchorStrokeWidth",1,le());A.addGetterSetter(Ke,"anchorFill","white");A.addGetterSetter(Ke,"anchorCornerRadius",0,le());A.addGetterSetter(Ke,"borderStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"borderStrokeWidth",1,le());A.addGetterSetter(Ke,"borderDash");A.addGetterSetter(Ke,"keepRatio",!0);A.addGetterSetter(Ke,"centeredScaling",!1);A.addGetterSetter(Ke,"ignoreStroke",!1);A.addGetterSetter(Ke,"padding",0,le());A.addGetterSetter(Ke,"node");A.addGetterSetter(Ke,"nodes");A.addGetterSetter(Ke,"boundBoxFunc");A.addGetterSetter(Ke,"anchorDragBoundFunc");A.addGetterSetter(Ke,"shouldOverdrawWholeArea",!1);A.addGetterSetter(Ke,"useSingleNodeRotation",!0);A.backCompat(Ke,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class qi extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,pe.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}qi.prototype.className="Wedge";qi.prototype._centroid=!0;qi.prototype._attrsAffectingSize=["radius"];yt(qi);A.addGetterSetter(qi,"radius",0,le());A.addGetterSetter(qi,"angle",0,le());A.addGetterSetter(qi,"clockwise",!1);A.backCompat(qi,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function Gb(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var V$=[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],q$=[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 K$(t,e){var n=t.data,r=t.width,i=t.height,a,s,u,c,f,h,p,g,y,v,w,x,_,S,C,O,I,L,D,U,X,K,te,ce,j=e+e+1,T=r-1,$=i-1,V=e+1,ie=V*(V+1)/2,W=new Gb,Y=null,Q=W,oe=null,ve=null,we=V$[e],Ue=q$[e];for(u=1;u>Ue,te!==0?(te=255/te,n[h]=(g*we>>Ue)*te,n[h+1]=(y*we>>Ue)*te,n[h+2]=(v*we>>Ue)*te):n[h]=n[h+1]=n[h+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=p+((c=a+e+1)>Ue,te>0?(te=255/te,n[c]=(g*we>>Ue)*te,n[c+1]=(y*we>>Ue)*te,n[c+2]=(v*we>>Ue)*te):n[c]=n[c+1]=n[c+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=a+((c=s+V)<$?c:$)*r<<2,g+=O+=oe.r=n[c],y+=I+=oe.g=n[c+1],v+=L+=oe.b=n[c+2],w+=D+=oe.a=n[c+3],oe=oe.next,x+=U=ve.r,_+=X=ve.g,S+=K=ve.b,C+=te=ve.a,O-=U,I-=X,L-=K,D-=te,ve=ve.next,h+=r}}const Y$=function(e){var n=Math.round(this.blurRadius());n>0&&K$(e,n)};A.addGetterSetter(se,"blurRadius",0,le(),A.afterSetFilter);const X$=function(t){var e=this.brightness()*255,n=t.data,r=n.length,i;for(i=0;i255?255:i,a=a<0?0:a>255?255:a,s=s<0?0:s>255?255:s,n[u]=i,n[u+1]=a,n[u+2]=s};A.addGetterSetter(se,"contrast",0,le(),A.afterSetFilter);const J$=function(t){var e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),a=0,s=0,u=t.data,c=t.width,f=t.height,h=c*4,p=f;switch(r){case"top-left":a=-1,s=-1;break;case"top":a=-1,s=0;break;case"top-right":a=-1,s=1;break;case"right":a=0,s=1;break;case"bottom-right":a=1,s=1;break;case"bottom":a=1,s=0;break;case"bottom-left":a=1,s=-1;break;case"left":a=0,s=-1;break;default:G.error("Unknown emboss direction: "+r)}do{var g=(p-1)*h,y=a;p+y<1&&(y=0),p+y>f&&(y=0);var v=(p-1+y)*c*4,w=c;do{var x=g+(w-1)*4,_=s;w+_<1&&(_=0),w+_>c&&(_=0);var S=v+(w-1+_)*4,C=u[x]-u[S],O=u[x+1]-u[S+1],I=u[x+2]-u[S+2],L=C,D=L>0?L:-L,U=O>0?O:-O,X=I>0?I:-I;if(U>D&&(L=O),X>D&&(L=I),L*=e,i){var K=u[x]+L,te=u[x+1]+L,ce=u[x+2]+L;u[x]=K>255?255:K<0?0:K,u[x+1]=te>255?255:te<0?0:te,u[x+2]=ce>255?255:ce<0?0:ce}else{var j=n-L;j<0?j=0:j>255&&(j=255),u[x]=u[x+1]=u[x+2]=j}}while(--w)}while(--p)};A.addGetterSetter(se,"embossStrength",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossWhiteLevel",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossDirection","top-left",null,A.afterSetFilter);A.addGetterSetter(se,"embossBlend",!1,null,A.afterSetFilter);function Mm(t,e,n,r,i){var a=n-e,s=i-r,u;return a===0?r+s/2:s===0?r:(u=(t-e)/a,u=s*u+r,u)}const Z$=function(t){var e=t.data,n=e.length,r=e[0],i=r,a,s=e[1],u=s,c,f=e[2],h=f,p,g,y=this.enhance();if(y!==0){for(g=0;gi&&(i=a),c=e[g+1],cu&&(u=c),p=e[g+2],ph&&(h=p);i===r&&(i=255,r=0),u===s&&(u=255,s=0),h===f&&(h=255,f=0);var v,w,x,_,S,C,O,I,L;for(y>0?(w=i+y*(255-i),x=r-y*(r-0),S=u+y*(255-u),C=s-y*(s-0),I=h+y*(255-h),L=f-y*(f-0)):(v=(i+r)*.5,w=i+y*(i-v),x=r+y*(r-v),_=(u+s)*.5,S=u+y*(u-_),C=s+y*(s-_),O=(h+f)*.5,I=h+y*(h-O),L=f+y*(f-O)),g=0;g_?x:_;var S=s,C=a,O,I,L=360/C*Math.PI/180,D,U;for(I=0;IC?S:C;var O=s,I=a,L,D,U=n.polarRotation||0,X,K;for(h=0;he&&(O=C,I=0,L=-1),i=0;i=0&&y=0&&v=0&&y=0&&v=255*4?255:0}return s}function dz(t,e,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),s=[],u=0;u=0&&y=0&&v=n))for(a=w;a=r||(s=(n*a+i)*4,u+=O[s+0],c+=O[s+1],f+=O[s+2],h+=O[s+3],C+=1);for(u=u/C,c=c/C,f=f/C,h=h/C,i=y;i=n))for(a=w;a=r||(s=(n*a+i)*4,O[s+0]=u,O[s+1]=c,O[s+2]=f,O[s+3]=h)}};A.addGetterSetter(se,"pixelSize",8,le(),A.afterSetFilter);const mz=function(t){var e=Math.round(this.levels()*254)+1,n=t.data,r=n.length,i=255/e,a;for(a=0;a255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,$k,A.afterSetFilter);const yz=function(t){var e=t.data,n=e.length,r=this.red(),i=this.green(),a=this.blue(),s=this.alpha(),u,c;for(u=0;u255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,$k,A.afterSetFilter);A.addGetterSetter(se,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});const Sz=function(t){var e=t.data,n=e.length,r,i,a,s;for(r=0;r127&&(f=255-f),h>127&&(h=255-h),p>127&&(p=255-p),e[c]=f,e[c+1]=h,e[c+2]=p}while(--u)}while(--a)},wz=function(t){var e=this.threshold()*255,n=t.data,r=n.length,i;for(i=0;i{const{width:n,height:r}=e,i=document.createElement("div"),a=new Vl.Stage({container:i,width:n,height:r}),s=new Vl.Layer,u=new Vl.Layer;s.add(new Vl.Rect({...e,fill:"white"})),t.forEach(f=>u.add(new Vl.Line({points:f.points,stroke:"black",strokeWidth:f.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:f.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(u);const c=a.toDataURL({...e});return i.remove(),c};let vP=null,yP=null;const $W=t=>{vP=t},Cz=()=>vP,zW=t=>{yP=t},GW=()=>yP,xz=t=>{const e=window.open("");e&&t.forEach(n=>{const r=new Image;r.src=n.base64,e.document.write(n.caption),e.document.write("
"),e.document.write(r.outerHTML),e.document.write("

")})},kz=(t,e)=>Math.floor(Math.random()*(e-t+1)+t),Pz=t=>{const e=Cz(),{generationMode:n,generationState:r,postprocessingState:i,canvasState:a,systemState:s}=t,{codeformerFidelity:u,facetoolStrength:c,facetoolType:f,hiresFix:h,hiresStrength:p,shouldRunESRGAN:g,shouldRunFacetool:y,upscalingLevel:v,upscalingStrength:w,upscalingDenoising:x}=i,{cfgScale:_,height:S,img2imgStrength:C,infillMethod:O,initialImage:I,iterations:L,perlin:D,prompt:U,negativePrompt:X,sampler:K,seamBlur:te,seamless:ce,seamSize:j,seamSteps:T,seamStrength:$,seed:V,seedWeights:ie,shouldFitToWidthHeight:W,shouldGenerateVariations:Y,shouldRandomizeSeed:Q,steps:oe,threshold:ve,tileSize:we,variationAmount:Ue,width:At,shouldUseSymmetry:me,horizontalSymmetrySteps:qt,verticalSymmetrySteps:Bt}=r,{shouldDisplayInProgressType:bn,saveIntermediatesInterval:wr,enableImageDebugging:Ft}=s,xe={prompt:U,iterations:L,steps:oe,cfg_scale:_,threshold:ve,perlin:D,height:S,width:At,sampler_name:K,seed:V,progress_images:bn==="full-res",progress_latents:bn==="latents",save_intermediates:wr,generation_mode:n,init_mask:""};let Wr=!1,Et=!1;if(X!==""&&(xe.prompt=`${U} [${X}]`),xe.seed=Q?kz(cF,fF):V,me&&(qt>0&&(xe.h_symmetry_time_pct=Math.max(0,Math.min(1,qt/oe))),Bt>0&&(xe.v_symmetry_time_pct=Math.max(0,Math.min(1,Bt/oe)))),n==="txt2img"&&(xe.hires_fix=h,h&&(xe.strength=p)),["txt2img","img2img"].includes(n)&&(xe.seamless=ce,g&&(Wr={level:v,denoise_str:x,strength:w}),y&&(Et={type:f,strength:c},f==="codeformer"&&(Et.codeformer_fidelity=u))),n==="img2img"&&I&&(xe.init_img=typeof I=="string"?I:I.url,xe.strength=C,xe.fit=W),n==="unifiedCanvas"&&e){const{layerState:{objects:gi},boundingBoxCoordinates:Xs,boundingBoxDimensions:Mn,stageScale:Fa,isMaskEnabled:Qs,shouldPreserveMaskedArea:er,boundingBoxScaleMethod:Kt,scaledBoundingBoxDimensions:Dn}=a,bt={...Xs,...Mn},$a=bz(Qs?gi.filter(Qx):[],bt);xe.init_mask=$a,xe.fit=!1,xe.strength=C,xe.invert_mask=er,xe.bounding_box=bt;const Hr=e.scale();e.scale({x:1/Fa,y:1/Fa});const Co=e.getAbsolutePosition(),Vr=e.toDataURL({x:bt.x+Co.x,y:bt.y+Co.y,width:bt.width,height:bt.height});Ft&&xz([{base64:$a,caption:"mask sent as init_mask"},{base64:Vr,caption:"image sent as init_img"}]),e.scale(Hr),xe.init_img=Vr,xe.progress_images=!1,Kt!=="none"&&(xe.inpaint_width=Dn.width,xe.inpaint_height=Dn.height),xe.seam_size=j,xe.seam_blur=te,xe.seam_strength=$,xe.seam_steps=T,xe.tile_size=we,xe.infill_method=O,xe.force_outpaint=!1}return Y?(xe.variation_amount=Ue,ie&&(xe.with_variations=A5(ie))):xe.variation_amount=0,Ft&&(xe.enable_image_debugging=Ft),{generationParameters:xe,esrganParameters:Wr,facetoolParameters:Et}};var Ez=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Oz=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Tz=/[^-+\dA-Z]/g;function Ut(t,e,n,r){if(arguments.length===1&&typeof t=="string"&&!/\d/.test(t)&&(e=t,t=void 0),t=t||t===0?t:new Date,t instanceof Date||(t=new Date(t)),isNaN(t))throw TypeError("Invalid date");e=String(Ub[e]||e||Ub.default);var i=e.slice(0,4);(i==="UTC:"||i==="GMT:")&&(e=e.slice(4),n=!0,i==="GMT:"&&(r=!0));var a=function(){return n?"getUTC":"get"},s=function(){return t[a()+"Date"]()},u=function(){return t[a()+"Day"]()},c=function(){return t[a()+"Month"]()},f=function(){return t[a()+"FullYear"]()},h=function(){return t[a()+"Hours"]()},p=function(){return t[a()+"Minutes"]()},g=function(){return t[a()+"Seconds"]()},y=function(){return t[a()+"Milliseconds"]()},v=function(){return n?0:t.getTimezoneOffset()},w=function(){return Rz(t)},x=function(){return Az(t)},_={d:function(){return s()},dd:function(){return Un(s())},ddd:function(){return En.dayNames[u()]},DDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:En.dayNames[u()],short:!0})},dddd:function(){return En.dayNames[u()+7]},DDDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:En.dayNames[u()+7]})},m:function(){return c()+1},mm:function(){return Un(c()+1)},mmm:function(){return En.monthNames[c()]},mmmm:function(){return En.monthNames[c()+12]},yy:function(){return String(f()).slice(2)},yyyy:function(){return Un(f(),4)},h:function(){return h()%12||12},hh:function(){return Un(h()%12||12)},H:function(){return h()},HH:function(){return Un(h())},M:function(){return p()},MM:function(){return Un(p())},s:function(){return g()},ss:function(){return Un(g())},l:function(){return Un(y(),3)},L:function(){return Un(Math.floor(y()/10))},t:function(){return h()<12?En.timeNames[0]:En.timeNames[1]},tt:function(){return h()<12?En.timeNames[2]:En.timeNames[3]},T:function(){return h()<12?En.timeNames[4]:En.timeNames[5]},TT:function(){return h()<12?En.timeNames[6]:En.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":Iz(t)},o:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60)*100+Math.abs(v())%60,4)},p:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60),2)+":"+Un(Math.floor(Math.abs(v())%60),2)},S:function(){return["th","st","nd","rd"][s()%10>3?0:(s()%100-s()%10!=10)*s()%10]},W:function(){return w()},WW:function(){return Un(w())},N:function(){return x()}};return e.replace(Ez,function(S){return S in _?_[S]():S.slice(1,S.length-1)})}var Ub={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},En={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},Un=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(e).padStart(n,"0")},jb=function(e){var n=e.y,r=e.m,i=e.d,a=e._,s=e.dayName,u=e.short,c=u===void 0?!1:u,f=new Date,h=new Date;h.setDate(h[a+"Date"]()-1);var p=new Date;p.setDate(p[a+"Date"]()+1);var g=function(){return f[a+"Date"]()},y=function(){return f[a+"Month"]()},v=function(){return f[a+"FullYear"]()},w=function(){return h[a+"Date"]()},x=function(){return h[a+"Month"]()},_=function(){return h[a+"FullYear"]()},S=function(){return p[a+"Date"]()},C=function(){return p[a+"Month"]()},O=function(){return p[a+"FullYear"]()};return v()===n&&y()===r&&g()===i?c?"Tdy":"Today":_()===n&&x()===r&&w()===i?c?"Ysd":"Yesterday":O()===n&&C()===r&&S()===i?c?"Tmw":"Tomorrow":s},Rz=function(e){var n=new Date(e.getFullYear(),e.getMonth(),e.getDate());n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=new Date(n.getFullYear(),0,4);r.setDate(r.getDate()-(r.getDay()+6)%7+3);var i=n.getTimezoneOffset()-r.getTimezoneOffset();n.setHours(n.getHours()-i);var a=(n-r)/(864e5*7);return 1+Math.floor(a)},Az=function(e){var n=e.getDay();return n===0&&(n=7),n},Iz=function(e){return(String(e).match(Oz)||[""]).pop().replace(Tz,"").replace(/GMT\+0000/g,"UTC")};const Lz=(t,e)=>{const{dispatch:n,getState:r}=t;return{emitGenerateImage:i=>{n(ei(!0));const a=r(),{generation:s,postprocessing:u,system:c,canvas:f}=a,h={generationMode:i,generationState:s,postprocessingState:u,canvasState:f,systemState:c};n(mB());const{generationParameters:p,esrganParameters:g,facetoolParameters:y}=Pz(h);e.emit("generateImage",p,g,y),p.init_mask&&(p.init_mask=p.init_mask.substr(0,64).concat("...")),p.init_img&&(p.init_img=p.init_img.substr(0,64).concat("...")),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generation requested: ${JSON.stringify({...p,...g,...y})}`}))},emitRunESRGAN:i=>{n(ei(!0));const{postprocessing:{upscalingLevel:a,upscalingDenoising:s,upscalingStrength:u}}=r(),c={upscale:[a,s,u]};e.emit("runPostprocessing",i,{type:"esrgan",...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`ESRGAN upscale requested: ${JSON.stringify({file:i.url,...c})}`}))},emitRunFacetool:i=>{n(ei(!0));const{postprocessing:{facetoolType:a,facetoolStrength:s,codeformerFidelity:u}}=r(),c={facetool_strength:s};a==="codeformer"&&(c.codeformer_fidelity=u),e.emit("runPostprocessing",i,{type:a,...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Face restoration (${a}) requested: ${JSON.stringify({file:i.url,...c})}`}))},emitDeleteImage:i=>{const{url:a,uuid:s,category:u,thumbnail:c}=i;n(ek(i)),e.emit("deleteImage",a,c,s,u)},emitRequestImages:i=>{const a=r().gallery,{earliest_mtime:s}=a.categories[i];e.emit("requestImages",i,s)},emitRequestNewImages:i=>{const a=r().gallery,{latest_mtime:s}=a.categories[i];e.emit("requestLatestImages",i,s)},emitCancelProcessing:()=>{e.emit("cancel")},emitRequestSystemConfig:()=>{e.emit("requestSystemConfig")},emitSearchForModels:i=>{e.emit("searchForModels",i)},emitAddNewModel:i=>{e.emit("addNewModel",i)},emitDeleteModel:i=>{e.emit("deleteModel",i)},emitConvertToDiffusers:i=>{n(pB()),e.emit("convertToDiffusers",i)},emitMergeDiffusersModels:i=>{n(gB()),e.emit("mergeDiffusersModels",i)},emitRequestModelChange:i=>{n(hB()),e.emit("requestModelChange",i)},emitSaveStagingAreaImageToGallery:i=>{e.emit("requestSaveStagingAreaImageToGallery",i)},emitRequestEmptyTempFolder:()=>{e.emit("requestEmptyTempFolder")}}};let Hf;const Mz=new Uint8Array(16);function Dz(){if(!Hf&&(Hf=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Hf))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Hf(Mz)}const Jt=[];for(let t=0;t<256;++t)Jt.push((t+256).toString(16).slice(1));function Nz(t,e=0){return(Jt[t[e+0]]+Jt[t[e+1]]+Jt[t[e+2]]+Jt[t[e+3]]+"-"+Jt[t[e+4]]+Jt[t[e+5]]+"-"+Jt[t[e+6]]+Jt[t[e+7]]+"-"+Jt[t[e+8]]+Jt[t[e+9]]+"-"+Jt[t[e+10]]+Jt[t[e+11]]+Jt[t[e+12]]+Jt[t[e+13]]+Jt[t[e+14]]+Jt[t[e+15]]).toLowerCase()}const Bz=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Wb={randomUUID:Bz};function Vf(t,e,n){if(Wb.randomUUID&&!e&&!t)return Wb.randomUUID();t=t||{};const r=t.random||(t.rng||Dz)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(let i=0;i<16;++i)e[n+i]=r[i];return e}return Nz(r)}const UW=dt("socketio/generateImage"),jW=dt("socketio/runESRGAN"),WW=dt("socketio/runFacetool"),HW=dt("socketio/deleteImage"),Hb=dt("socketio/requestImages"),Vb=dt("socketio/requestNewImages"),VW=dt("socketio/cancelProcessing"),Fz=dt("socketio/requestSystemConfig"),qW=dt("socketio/searchForModels"),KW=dt("socketio/addNewModel"),YW=dt("socketio/deleteModel"),XW=dt("socketio/convertToDiffusers"),QW=dt("socketio/mergeDiffusersModels"),JW=dt("socketio/requestModelChange"),ZW=dt("socketio/saveStagingAreaImageToGallery"),eH=dt("socketio/requestEmptyTempFolder"),$z=t=>{const{dispatch:e,getState:n}=t;return{onConnect:()=>{try{e(ub(!0)),e(ns(Ae.t("common.statusConnected"))),e(Fz());const r=n().gallery;r.categories.result.latest_mtime?e(Vb("result")):e(Hb("result")),r.categories.user.latest_mtime?e(Vb("user")):e(Hb("user"))}catch(r){console.error(r)}},onDisconnect:()=>{try{e(ub(!1)),e(ns(Ae.t("common.statusDisconnected"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Disconnected from server",level:"warning"}))}catch(r){console.error(r)}},onGenerationResult:r=>{try{const i=n(),{activeTab:a}=i.ui,{shouldLoopback:s}=i.postprocessing,{boundingBox:u,generationMode:c,...f}=r,h={uuid:Vf(),...f};if(["txt2img","img2img"].includes(c)&&e(Of({category:"result",image:{...h,category:"result"}})),c==="unifiedCanvas"&&r.boundingBox){const{boundingBox:p}=r;e(S5({image:{...h,category:"temp"},boundingBox:p})),i.canvas.shouldAutoSave&&e(Of({image:{...h,category:"result"},category:"result"}))}if(s)switch(wk[a]){case"img2img":{e(D5(h));break}}e(Cm()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generated: ${r.url}`}))}catch(i){console.error(i)}},onIntermediateResult:r=>{try{e(C5({uuid:Vf(),...r,category:"result"})),r.isBase64||e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image generated: ${r.url}`}))}catch(i){console.error(i)}},onPostprocessingResult:r=>{try{e(Of({category:"result",image:{uuid:Vf(),...r,category:"result"}})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Postprocessed: ${r.url}`}))}catch(i){console.error(i)}},onProgressUpdate:r=>{try{e(ei(!0)),e(cB(r))}catch(i){console.error(i)}},onError:r=>{const{message:i,additionalData:a}=r;try{e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Server error: ${i}`,level:"error"})),e(cb()),e(Cm())}catch(s){console.error(s)}},onGalleryImages:r=>{const{images:i,areMoreImagesAvailable:a,category:s}=r,u=i.map(c=>({uuid:Vf(),...c}));e(b5({images:u,areMoreImagesAvailable:a,category:s})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Loaded ${i.length} images`}))},onProcessingCanceled:()=>{e(dB());const{intermediateImage:r}=n().gallery;r&&(r.isBase64||(e(Of({category:"result",image:r})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image saved: ${r.url}`}))),e(Cm())),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Processing canceled",level:"warning"}))},onImageDeleted:r=>{const{url:i}=r;e(ek(r));const{generation:{initialImage:a,maskPath:s}}=n();(a===i||(a==null?void 0:a.url)===i)&&e(L5()),s===i&&e(N5("")),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image deleted: ${i}`}))},onSystemConfig:r=>{e(fB(r)),r.infill_methods.includes("patchmatch")||e(M5(r.infill_methods[0]))},onFoundModels:r=>{const{search_folder:i,found_models:a}=r;e(vB(i)),e(yB(a))},onNewModelAdded:r=>{const{new_model_name:i,model_list:a,update:s}=r;e(rs(a)),e(ei(!1)),e(ns(Ae.t("modelManager.modelAdded"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model Added: ${i}`,level:"info"})),e(zl({title:s?`${Ae.t("modelManager.modelUpdated")}: ${i}`:`${Ae.t("modelManager.modelAdded")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelDeleted:r=>{const{deleted_model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`${Ae.t("modelManager.modelAdded")}: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelEntryDeleted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelConverted:r=>{const{converted_model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelConverted"))),e(ei(!1)),e(Af(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model converted: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelConverted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelsMerged:r=>{const{merged_models:i,merged_model_name:a,model_list:s}=r;e(rs(s)),e(ns(Ae.t("common.statusMergedModels"))),e(ei(!1)),e(Af(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Models merged: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelsMerged")}: ${a}`,status:"success",duration:2500,isClosable:!0}))},onModelChanged:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelChanged"))),e(ei(!1)),e(Af(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model changed: ${i}`,level:"info"}))},onModelChangeFailed:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(Af(!0)),e(cb()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model change failed: ${i}`,level:"error"}))},onTempFolderEmptied:()=>{e(zl({title:Ae.t("toast.tempFoldersEmptied"),status:"success",duration:2500,isClosable:!0}))}}},zz=()=>{const{origin:t}=new URL(window.location.href),e=gd(t,{timeout:6e4,path:`${window.location.pathname}socket.io`});let n=!1;return i=>a=>s=>{const{onConnect:u,onDisconnect:c,onError:f,onPostprocessingResult:h,onGenerationResult:p,onIntermediateResult:g,onProgressUpdate:y,onGalleryImages:v,onProcessingCanceled:w,onImageDeleted:x,onSystemConfig:_,onModelChanged:S,onFoundModels:C,onNewModelAdded:O,onModelDeleted:I,onModelConverted:L,onModelsMerged:D,onModelChangeFailed:U,onTempFolderEmptied:X}=$z(i),{emitGenerateImage:K,emitRunESRGAN:te,emitRunFacetool:ce,emitDeleteImage:j,emitRequestImages:T,emitRequestNewImages:$,emitCancelProcessing:V,emitRequestSystemConfig:ie,emitSearchForModels:W,emitAddNewModel:Y,emitDeleteModel:Q,emitConvertToDiffusers:oe,emitMergeDiffusersModels:ve,emitRequestModelChange:we,emitSaveStagingAreaImageToGallery:Ue,emitRequestEmptyTempFolder:At}=Lz(i,e);switch(n||(e.on("connect",()=>u()),e.on("disconnect",()=>c()),e.on("error",me=>f(me)),e.on("generationResult",me=>p(me)),e.on("postprocessingResult",me=>h(me)),e.on("intermediateResult",me=>g(me)),e.on("progressUpdate",me=>y(me)),e.on("galleryImages",me=>v(me)),e.on("processingCanceled",()=>{w()}),e.on("imageDeleted",me=>{x(me)}),e.on("systemConfig",me=>{_(me)}),e.on("foundModels",me=>{C(me)}),e.on("newModelAdded",me=>{O(me)}),e.on("modelDeleted",me=>{I(me)}),e.on("modelConverted",me=>{L(me)}),e.on("modelsMerged",me=>{D(me)}),e.on("modelChanged",me=>{S(me)}),e.on("modelChangeFailed",me=>{U(me)}),e.on("tempFolderEmptied",()=>{X()}),n=!0),s.type){case"socketio/generateImage":{K(s.payload);break}case"socketio/runESRGAN":{te(s.payload);break}case"socketio/runFacetool":{ce(s.payload);break}case"socketio/deleteImage":{j(s.payload);break}case"socketio/requestImages":{T(s.payload);break}case"socketio/requestNewImages":{$(s.payload);break}case"socketio/cancelProcessing":{V();break}case"socketio/requestSystemConfig":{ie();break}case"socketio/searchForModels":{W(s.payload);break}case"socketio/addNewModel":{Y(s.payload);break}case"socketio/deleteModel":{Q(s.payload);break}case"socketio/convertToDiffusers":{oe(s.payload);break}case"socketio/mergeDiffusersModels":{ve(s.payload);break}case"socketio/requestModelChange":{we(s.payload);break}case"socketio/saveStagingAreaImageToGallery":{Ue(s.payload);break}case"socketio/requestEmptyTempFolder":{At();break}}a(s)}},Gz=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"].map(t=>`canvas.${t}`),Uz=["currentIteration","currentStatus","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","socketId","totalIterations","totalSteps","openModel","cancelOptions.cancelAfter"].map(t=>`system.${t}`),jz=["categories","currentCategory","currentImage","currentImageUuid","shouldAutoSwitchToNewImages","intermediateImage"].map(t=>`gallery.${t}`),Wz=["isLightboxOpen"].map(t=>`lightbox.${t}`),SP=Fx({generation:B5,postprocessing:$5,gallery:x5,system:SB,canvas:_5,ui:bB,lightbox:E5}),Hz=Yx.getPersistConfig({key:"root",storage:Kx,rootReducer:SP,blacklist:[...Gz,...Uz,...jz,...Wz],debounce:300}),Vz=ZN(Hz,SP),_P=TN({reducer:Vz,middleware:t=>t({immutableCheck:!1,serializableCheck:!1}).concat(zz()),devTools:{actionsDenylist:["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine"]}}),qz=a5(_P);function Kz(t){if(t.sheet)return t.sheet;for(var e=0;e0?en(Ys,--Ln):0,Gs--,Ot===10&&(Gs=1,rp--),Ot}function Kn(){return Ot=Ln2||Wu(Ot)>3?"":" "}function o6(t,e){for(;--e&&Kn()&&!(Ot<48||Ot>102||Ot>57&&Ot<65||Ot>70&&Ot<97););return ec(t,Sd()+(e<6&&ci()==32&&Kn()==32))}function cy(t){for(;Kn();)switch(Ot){case t:return Ln;case 34:case 39:t!==34&&t!==39&&cy(Ot);break;case 40:t===41&&cy(t);break;case 92:Kn();break}return Ln}function s6(t,e){for(;Kn()&&t+Ot!==47+10;)if(t+Ot===42+42&&ci()===47)break;return"/*"+ec(e,Ln-1)+"*"+np(t===47?t:Kn())}function l6(t){for(;!Wu(ci());)Kn();return ec(t,Ln)}function u6(t){return PP(wd("",null,null,null,[""],t=kP(t),0,[0],t))}function wd(t,e,n,r,i,a,s,u,c){for(var f=0,h=0,p=s,g=0,y=0,v=0,w=1,x=1,_=1,S=0,C="",O=i,I=a,L=r,D=C;x;)switch(v=S,S=Kn()){case 40:if(v!=108&&en(D,p-1)==58){uy(D+=qe(_d(S),"&","&\f"),"&\f")!=-1&&(_=-1);break}case 34:case 39:case 91:D+=_d(S);break;case 9:case 10:case 13:case 32:D+=a6(v);break;case 92:D+=o6(Sd()-1,7);continue;case 47:switch(ci()){case 42:case 47:qf(c6(s6(Kn(),Sd()),e,n),c);break;default:D+="/"}break;case 123*w:u[f++]=ti(D)*_;case 125*w:case 59:case 0:switch(S){case 0:case 125:x=0;case 59+h:y>0&&ti(D)-p&&qf(y>32?Kb(D+";",r,n,p-1):Kb(qe(D," ","")+";",r,n,p-2),c);break;case 59:D+=";";default:if(qf(L=qb(D,e,n,f,h,i,u,C,O=[],I=[],p),a),S===123)if(h===0)wd(D,e,L,L,O,a,p,u,I);else switch(g===99&&en(D,3)===110?100:g){case 100:case 109:case 115:wd(t,L,L,r&&qf(qb(t,L,L,0,0,i,u,C,i,O=[],p),I),i,I,p,u,r?O:I);break;default:wd(D,L,L,L,[""],I,0,u,I)}}f=h=y=0,w=_=1,C=D="",p=s;break;case 58:p=1+ti(D),y=v;default:if(w<1){if(S==123)--w;else if(S==125&&w++==0&&i6()==125)continue}switch(D+=np(S),S*w){case 38:_=h>0?1:(D+="\f",-1);break;case 44:u[f++]=(ti(D)-1)*_,_=1;break;case 64:ci()===45&&(D+=_d(Kn())),g=ci(),h=p=ti(C=D+=l6(Sd())),S++;break;case 45:v===45&&ti(D)==2&&(w=0)}}return a}function qb(t,e,n,r,i,a,s,u,c,f,h){for(var p=i-1,g=i===0?a:[""],y=$0(g),v=0,w=0,x=0;v0?g[_]+" "+S:qe(S,/&\f/g,g[_])))&&(c[x++]=C);return ip(t,e,n,i===0?B0:u,c,f,h)}function c6(t,e,n){return ip(t,e,n,wP,np(r6()),ju(t,2,-2),0)}function Kb(t,e,n,r){return ip(t,e,n,F0,ju(t,0,r),ju(t,r+1,-1),r)}function Rs(t,e){for(var n="",r=$0(t),i=0;i6)switch(en(t,e+1)){case 109:if(en(t,e+4)!==45)break;case 102:return qe(t,/(.+:)(.+)-([^]+)/,"$1"+He+"$2-$3$1"+lh+(en(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~uy(t,"stretch")?OP(qe(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(en(t,e+1)!==115)break;case 6444:switch(en(t,ti(t)-3-(~uy(t,"!important")&&10))){case 107:return qe(t,":",":"+He)+t;case 101:return qe(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+He+(en(t,14)===45?"inline-":"")+"box$3$1"+He+"$2$3$1"+ln+"$2box$3")+t}break;case 5936:switch(en(t,e+11)){case 114:return He+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return He+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return He+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return He+t+ln+t+t}return t}var S6=function(e,n,r,i){if(e.length>-1&&!e.return)switch(e.type){case F0:e.return=OP(e.value,e.length);break;case bP:return Rs([ql(e,{value:qe(e.value,"@","@"+He)})],i);case B0:if(e.length)return n6(e.props,function(a){switch(t6(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Rs([ql(e,{props:[qe(a,/:(read-\w+)/,":"+lh+"$1")]})],i);case"::placeholder":return Rs([ql(e,{props:[qe(a,/:(plac\w+)/,":"+He+"input-$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,":"+lh+"$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,ln+"input-$1")]})],i)}return""})}},_6=[S6],w6=function(e){var n=e.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(w){var x=w.getAttribute("data-emotion");x.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var i=e.stylisPlugins||_6,a={},s,u=[];s=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(w){for(var x=w.getAttribute("data-emotion").split(" "),_=1;_=4;++r,i-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(i){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var k6={animationIterationCount: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},P6=/[A-Z]|^ms/g,E6=/_EMO_([^_]+?)_([^]*?)_EMO_/g,AP=function(e){return e.charCodeAt(1)===45},Qb=function(e){return e!=null&&typeof e!="boolean"},Dm=EP(function(t){return AP(t)?t:t.replace(P6,"-$&").toLowerCase()}),Jb=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(E6,function(r,i,a){return ni={name:i,styles:a,next:ni},i})}return k6[e]!==1&&!AP(e)&&typeof n=="number"&&n!==0?n+"px":n};function Hu(t,e,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 ni={name:n.name,styles:n.styles,next:ni},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)ni={name:r.name,styles:r.styles,next:ni},r=r.next;var i=n.styles+";";return i}return O6(t,e,n)}case"function":{if(t!==void 0){var a=ni,s=n(t);return ni=a,Hu(t,e,s)}break}}if(e==null)return n;var u=e[n];return u!==void 0?u:n}function O6(t,e,n){var r="";if(Array.isArray(n))for(var i=0;i` or ``");return t}var NP=be.createContext({});NP.displayName="ColorModeContext";function BP(){const t=be.useContext(NP);if(t===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return t}function D6(){const t=BP(),e=DP();return{...t,theme:e}}function N6(t,e,n){var r,i;if(e==null)return e;const a=s=>{var u,c;return(c=(u=t.__breakpoints)==null?void 0:u.asArray)==null?void 0:c[s]};return(i=(r=a(e))!=null?r:a(n))!=null?i:n}function B6(t,e,n){var r,i;if(e==null)return e;const a=s=>{var u,c;return(c=(u=t.__cssMap)==null?void 0:u[s])==null?void 0:c.value};return(i=(r=a(e))!=null?r:a(n))!=null?i:n}function rH(t,e,n){const r=DP();return F6(t,e,n)(r)}function F6(t,e,n){const r=Array.isArray(e)?e:[e],i=Array.isArray(n)?n:[n];return a=>{const s=i.filter(Boolean),u=r.map((c,f)=>{var h,p;if(t==="breakpoints")return N6(a,c,(h=s[f])!=null?h:c);const g=`${t}.${c}`;return B6(a,g,(p=s[f])!=null?p:c)});return Array.isArray(e)?u:u[0]}}var FP=(...t)=>t.filter(Boolean).join(" ");function $6(){return!1}function zr(t){const e=typeof t;return t!=null&&(e==="object"||e==="function")&&!Array.isArray(t)}var iH=t=>{const{condition:e,message:n}=t;e&&$6()&&console.warn(n)};function io(t,...e){return z6(t)?t(...e):t}var z6=t=>typeof t=="function",aH=t=>t?"":void 0,oH=t=>t?!0:void 0;function sH(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function lH(...t){return function(n){t.forEach(r=>{r==null||r(n)})}}var uh={},G6={get exports(){return uh},set exports(t){uh=t}};(function(t,e){var n=200,r="__lodash_hash_undefined__",i=800,a=16,s=9007199254740991,u="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",h="[object Boolean]",p="[object Date]",g="[object Error]",y="[object Function]",v="[object GeneratorFunction]",w="[object Map]",x="[object Number]",_="[object Null]",S="[object Object]",C="[object Proxy]",O="[object RegExp]",I="[object Set]",L="[object String]",D="[object Undefined]",U="[object WeakMap]",X="[object ArrayBuffer]",K="[object DataView]",te="[object Float32Array]",ce="[object Float64Array]",j="[object Int8Array]",T="[object Int16Array]",$="[object Int32Array]",V="[object Uint8Array]",ie="[object Uint8ClampedArray]",W="[object Uint16Array]",Y="[object Uint32Array]",Q=/[\\^$.*+?()[\]{}|]/g,oe=/^\[object .+?Constructor\]$/,ve=/^(?:0|[1-9]\d*)$/,we={};we[te]=we[ce]=we[j]=we[T]=we[$]=we[V]=we[ie]=we[W]=we[Y]=!0,we[u]=we[c]=we[X]=we[h]=we[K]=we[p]=we[g]=we[y]=we[w]=we[x]=we[S]=we[O]=we[I]=we[L]=we[U]=!1;var Ue=typeof yn=="object"&&yn&&yn.Object===Object&&yn,At=typeof self=="object"&&self&&self.Object===Object&&self,me=Ue||At||Function("return this")(),qt=e&&!e.nodeType&&e,Bt=qt&&!0&&t&&!t.nodeType&&t,bn=Bt&&Bt.exports===qt,wr=bn&&Ue.process,Ft=function(){try{var E=Bt&&Bt.require&&Bt.require("util").types;return E||wr&&wr.binding&&wr.binding("util")}catch{}}(),xe=Ft&&Ft.isTypedArray;function Wr(E,N,H){switch(H.length){case 0:return E.call(N);case 1:return E.call(N,H[0]);case 2:return E.call(N,H[0],H[1]);case 3:return E.call(N,H[0],H[1],H[2])}return E.apply(N,H)}function Et(E,N){for(var H=-1,fe=Array(E);++H-1}function mp(E,N){var H=this.__data__,fe=yi(H,E);return fe<0?(++this.size,H.push([E,N])):H[fe][1]=N,this}xr.prototype.clear=tl,xr.prototype.delete=pp,xr.prototype.get=nl,xr.prototype.has=gp,xr.prototype.set=mp;function Xi(E){var N=-1,H=E==null?0:E.length;for(this.clear();++N1?H[Ie-1]:void 0,Pe=Ie>2?H[2]:void 0;for(Ye=E.length>3&&typeof Ye=="function"?(Ie--,Ye):void 0,Pe&&hc(H[0],H[1],Pe)&&(Ye=Ie<3?void 0:Ye,Ie=1),N=Object(N);++fe-1&&E%1==0&&E0){if(++N>=i)return arguments[0]}else N=0;return E.apply(void 0,arguments)}}function yc(E){if(E!=null){try{return Dn.call(E)}catch{}try{return E+""}catch{}}return""}function Mo(E,N){return E===N||E!==E&&N!==N}var ul=il(function(){return arguments}())?il:function(E){return za(E)&&bt.call(E,"callee")&&!Js.call(E,"callee")},cl=Array.isArray;function Do(E){return E!=null&&_c(E.length)&&!fl(E)}function Dp(E){return za(E)&&Do(E)}var Sc=sp||Fp;function fl(E){if(!kr(E))return!1;var N=To(E);return N==y||N==v||N==f||N==C}function _c(E){return typeof E=="number"&&E>-1&&E%1==0&&E<=s}function kr(E){var N=typeof E;return E!=null&&(N=="object"||N=="function")}function za(E){return E!=null&&typeof E=="object"}function Np(E){if(!za(E)||To(E)!=S)return!1;var N=Eo(E);if(N===null)return!0;var H=bt.call(N,"constructor")&&N.constructor;return typeof H=="function"&&H instanceof H&&Dn.call(H)==Co}var wc=xe?gi(xe):ic;function Bp(E){return uc(E,bc(E))}function bc(E){return Do(E)?Ep(E,!0):Rp(E)}var nt=Ro(function(E,N,H,fe){ac(E,N,H,fe)});function et(E){return function(){return E}}function Cc(E){return E}function Fp(){return!1}t.exports=nt})(G6,uh);const ai=uh;var U6=t=>/!(important)?$/.test(t),t2=t=>typeof t=="string"?t.replace(/!(important)?$/,"").trim():t,j6=(t,e)=>n=>{const r=String(e),i=U6(r),a=t2(r),s=t?`${t}.${a}`:a;let u=zr(n.__cssMap)&&s in n.__cssMap?n.__cssMap[s].varRef:e;return u=t2(u),i?`${u} !important`:u};function G0(t){const{scale:e,transform:n,compose:r}=t;return(a,s)=>{var u;const c=j6(e,a)(s);let f=(u=n==null?void 0:n(c,s))!=null?u:c;return r&&(f=r(f,s)),f}}var Kf=(...t)=>e=>t.reduce((n,r)=>r(n),e);function Ir(t,e){return n=>{const r={property:n,scale:t};return r.transform=G0({scale:t,transform:e}),r}}var W6=({rtl:t,ltr:e})=>n=>n.direction==="rtl"?t:e;function H6(t){const{property:e,scale:n,transform:r}=t;return{scale:n,property:W6(e),transform:n?G0({scale:n,compose:r}):r}}var $P=["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 V6(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...$P].join(" ")}function q6(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...$P].join(" ")}var K6={"--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(" ")},Y6={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 X6(t){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":t,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var Q6={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},fy={"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"},J6=new Set(Object.values(fy)),zP=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),Z6=t=>t.trim();function e8(t,e){if(t==null||zP.has(t))return t;const r=/(^[a-z-A-Z]+)\((.*)\)/g.exec(t),i=r==null?void 0:r[1],a=r==null?void 0:r[2];if(!i||!a)return t;const s=i.includes("-gradient")?i:`${i}-gradient`,[u,...c]=a.split(",").map(Z6).filter(Boolean);if((c==null?void 0:c.length)===0)return t;const f=u in fy?fy[u]:u;c.unshift(f);const h=c.map(p=>{if(J6.has(p))return p;const g=p.indexOf(" "),[y,v]=g!==-1?[p.substr(0,g),p.substr(g+1)]:[p],w=GP(v)?v:v&&v.split(" "),x=`colors.${y}`,_=x in e.__cssMap?e.__cssMap[x].varRef:y;return w?[_,...Array.isArray(w)?w:[w]].join(" "):_});return`${s}(${h.join(", ")})`}var GP=t=>typeof t=="string"&&t.includes("(")&&t.includes(")"),t8=(t,e)=>e8(t,e??{});function n8(t){return/^var\(--.+\)$/.test(t)}var r8=t=>{const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}},Jr=t=>e=>`${t}(${e})`,Fe={filter(t){return t!=="auto"?t:K6},backdropFilter(t){return t!=="auto"?t:Y6},ring(t){return X6(Fe.px(t))},bgClip(t){return t==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:t}},transform(t){return t==="auto"?V6():t==="auto-gpu"?q6():t},vh(t){return t==="$100vh"?"var(--chakra-vh)":t},px(t){if(t==null)return t;const{unitless:e}=r8(t);return e||typeof t=="number"?`${t}px`:t},fraction(t){return typeof t!="number"||t>1?t:`${t*100}%`},float(t,e){const n={left:"right",right:"left"};return e.direction==="rtl"?n[t]:t},degree(t){if(n8(t)||t==null)return t;const e=typeof t=="string"&&!t.endsWith("deg");return typeof t=="number"||e?`${t}deg`:t},gradient:t8,blur:Jr("blur"),opacity:Jr("opacity"),brightness:Jr("brightness"),contrast:Jr("contrast"),dropShadow:Jr("drop-shadow"),grayscale:Jr("grayscale"),hueRotate:Jr("hue-rotate"),invert:Jr("invert"),saturate:Jr("saturate"),sepia:Jr("sepia"),bgImage(t){return t==null||GP(t)||zP.has(t)?t:`url(${t})`},outline(t){const e=String(t)==="0"||String(t)==="none";return t!==null&&e?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:t}},flexDirection(t){var e;const{space:n,divide:r}=(e=Q6[t])!=null?e:{},i={flexDirection:t};return n&&(i[n]=1),r&&(i[r]=1),i}},B={borderWidths:Ir("borderWidths"),borderStyles:Ir("borderStyles"),colors:Ir("colors"),borders:Ir("borders"),radii:Ir("radii",Fe.px),space:Ir("space",Kf(Fe.vh,Fe.px)),spaceT:Ir("space",Kf(Fe.vh,Fe.px)),degreeT(t){return{property:t,transform:Fe.degree}},prop(t,e,n){return{property:t,scale:e,...e&&{transform:G0({scale:e,transform:n})}}},propT(t,e){return{property:t,transform:e}},sizes:Ir("sizes",Kf(Fe.vh,Fe.px)),sizesT:Ir("sizes",Kf(Fe.vh,Fe.fraction)),shadows:Ir("shadows"),logical:H6,blur:Ir("blur",Fe.blur)},bd={background:B.colors("background"),backgroundColor:B.colors("backgroundColor"),backgroundImage:B.propT("backgroundImage",Fe.bgImage),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Fe.bgClip},bgSize:B.prop("backgroundSize"),bgPosition:B.prop("backgroundPosition"),bg:B.colors("background"),bgColor:B.colors("backgroundColor"),bgPos:B.prop("backgroundPosition"),bgRepeat:B.prop("backgroundRepeat"),bgAttachment:B.prop("backgroundAttachment"),bgGradient:B.propT("backgroundImage",Fe.gradient),bgClip:{transform:Fe.bgClip}};Object.assign(bd,{bgImage:bd.backgroundImage,bgImg:bd.backgroundImage});var We={border:B.borders("border"),borderWidth:B.borderWidths("borderWidth"),borderStyle:B.borderStyles("borderStyle"),borderColor:B.colors("borderColor"),borderRadius:B.radii("borderRadius"),borderTop:B.borders("borderTop"),borderBlockStart:B.borders("borderBlockStart"),borderTopLeftRadius:B.radii("borderTopLeftRadius"),borderStartStartRadius:B.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:B.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:B.radii("borderTopRightRadius"),borderStartEndRadius:B.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:B.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:B.borders("borderRight"),borderInlineEnd:B.borders("borderInlineEnd"),borderBottom:B.borders("borderBottom"),borderBlockEnd:B.borders("borderBlockEnd"),borderBottomLeftRadius:B.radii("borderBottomLeftRadius"),borderBottomRightRadius:B.radii("borderBottomRightRadius"),borderLeft:B.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:B.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:B.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:B.borders(["borderLeft","borderRight"]),borderInline:B.borders("borderInline"),borderY:B.borders(["borderTop","borderBottom"]),borderBlock:B.borders("borderBlock"),borderTopWidth:B.borderWidths("borderTopWidth"),borderBlockStartWidth:B.borderWidths("borderBlockStartWidth"),borderTopColor:B.colors("borderTopColor"),borderBlockStartColor:B.colors("borderBlockStartColor"),borderTopStyle:B.borderStyles("borderTopStyle"),borderBlockStartStyle:B.borderStyles("borderBlockStartStyle"),borderBottomWidth:B.borderWidths("borderBottomWidth"),borderBlockEndWidth:B.borderWidths("borderBlockEndWidth"),borderBottomColor:B.colors("borderBottomColor"),borderBlockEndColor:B.colors("borderBlockEndColor"),borderBottomStyle:B.borderStyles("borderBottomStyle"),borderBlockEndStyle:B.borderStyles("borderBlockEndStyle"),borderLeftWidth:B.borderWidths("borderLeftWidth"),borderInlineStartWidth:B.borderWidths("borderInlineStartWidth"),borderLeftColor:B.colors("borderLeftColor"),borderInlineStartColor:B.colors("borderInlineStartColor"),borderLeftStyle:B.borderStyles("borderLeftStyle"),borderInlineStartStyle:B.borderStyles("borderInlineStartStyle"),borderRightWidth:B.borderWidths("borderRightWidth"),borderInlineEndWidth:B.borderWidths("borderInlineEndWidth"),borderRightColor:B.colors("borderRightColor"),borderInlineEndColor:B.colors("borderInlineEndColor"),borderRightStyle:B.borderStyles("borderRightStyle"),borderInlineEndStyle:B.borderStyles("borderInlineEndStyle"),borderTopRadius:B.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:B.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:B.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:B.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(We,{rounded:We.borderRadius,roundedTop:We.borderTopRadius,roundedTopLeft:We.borderTopLeftRadius,roundedTopRight:We.borderTopRightRadius,roundedTopStart:We.borderStartStartRadius,roundedTopEnd:We.borderStartEndRadius,roundedBottom:We.borderBottomRadius,roundedBottomLeft:We.borderBottomLeftRadius,roundedBottomRight:We.borderBottomRightRadius,roundedBottomStart:We.borderEndStartRadius,roundedBottomEnd:We.borderEndEndRadius,roundedLeft:We.borderLeftRadius,roundedRight:We.borderRightRadius,roundedStart:We.borderInlineStartRadius,roundedEnd:We.borderInlineEndRadius,borderStart:We.borderInlineStart,borderEnd:We.borderInlineEnd,borderTopStartRadius:We.borderStartStartRadius,borderTopEndRadius:We.borderStartEndRadius,borderBottomStartRadius:We.borderEndStartRadius,borderBottomEndRadius:We.borderEndEndRadius,borderStartRadius:We.borderInlineStartRadius,borderEndRadius:We.borderInlineEndRadius,borderStartWidth:We.borderInlineStartWidth,borderEndWidth:We.borderInlineEndWidth,borderStartColor:We.borderInlineStartColor,borderEndColor:We.borderInlineEndColor,borderStartStyle:We.borderInlineStartStyle,borderEndStyle:We.borderInlineEndStyle});var i8={color:B.colors("color"),textColor:B.colors("color"),fill:B.colors("fill"),stroke:B.colors("stroke")},dy={boxShadow:B.shadows("boxShadow"),mixBlendMode:!0,blendMode:B.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:B.prop("backgroundBlendMode"),opacity:!0};Object.assign(dy,{shadow:dy.boxShadow});var a8={filter:{transform:Fe.filter},blur:B.blur("--chakra-blur"),brightness:B.propT("--chakra-brightness",Fe.brightness),contrast:B.propT("--chakra-contrast",Fe.contrast),hueRotate:B.degreeT("--chakra-hue-rotate"),invert:B.propT("--chakra-invert",Fe.invert),saturate:B.propT("--chakra-saturate",Fe.saturate),dropShadow:B.propT("--chakra-drop-shadow",Fe.dropShadow),backdropFilter:{transform:Fe.backdropFilter},backdropBlur:B.blur("--chakra-backdrop-blur"),backdropBrightness:B.propT("--chakra-backdrop-brightness",Fe.brightness),backdropContrast:B.propT("--chakra-backdrop-contrast",Fe.contrast),backdropHueRotate:B.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:B.propT("--chakra-backdrop-invert",Fe.invert),backdropSaturate:B.propT("--chakra-backdrop-saturate",Fe.saturate)},ch={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Fe.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:B.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:B.space("gap"),rowGap:B.space("rowGap"),columnGap:B.space("columnGap")};Object.assign(ch,{flexDir:ch.flexDirection});var UP={gridGap:B.space("gridGap"),gridColumnGap:B.space("gridColumnGap"),gridRowGap:B.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},o8={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Fe.outline},outlineOffset:!0,outlineColor:B.colors("outlineColor")},lr={width:B.sizesT("width"),inlineSize:B.sizesT("inlineSize"),height:B.sizes("height"),blockSize:B.sizes("blockSize"),boxSize:B.sizes(["width","height"]),minWidth:B.sizes("minWidth"),minInlineSize:B.sizes("minInlineSize"),minHeight:B.sizes("minHeight"),minBlockSize:B.sizes("minBlockSize"),maxWidth:B.sizes("maxWidth"),maxInlineSize:B.sizes("maxInlineSize"),maxHeight:B.sizes("maxHeight"),maxBlockSize:B.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,hideFrom:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.minWQuery)!=null?i:`@media screen and (min-width: ${t})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.maxWQuery)!=null?i:`@media screen and (max-width: ${t})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:B.propT("float",Fe.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(lr,{w:lr.width,h:lr.height,minW:lr.minWidth,maxW:lr.maxWidth,minH:lr.minHeight,maxH:lr.maxHeight,overscroll:lr.overscrollBehavior,overscrollX:lr.overscrollBehaviorX,overscrollY:lr.overscrollBehaviorY});var s8={listStyleType:!0,listStylePosition:!0,listStylePos:B.prop("listStylePosition"),listStyleImage:!0,listStyleImg:B.prop("listStyleImage")};function l8(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},c8=u8(l8),f8={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},d8={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},Nm=(t,e,n)=>{const r={},i=c8(t,e,{});for(const a in i)a in n&&n[a]!=null||(r[a]=i[a]);return r},h8={srOnly:{transform(t){return t===!0?f8:t==="focusable"?d8:{}}},layerStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`layerStyles.${t}`,n)},textStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`textStyles.${t}`,n)},apply:{processResult:!0,transform:(t,e,n)=>Nm(e,t,n)}},Su={position:!0,pos:B.prop("position"),zIndex:B.prop("zIndex","zIndices"),inset:B.spaceT("inset"),insetX:B.spaceT(["left","right"]),insetInline:B.spaceT("insetInline"),insetY:B.spaceT(["top","bottom"]),insetBlock:B.spaceT("insetBlock"),top:B.spaceT("top"),insetBlockStart:B.spaceT("insetBlockStart"),bottom:B.spaceT("bottom"),insetBlockEnd:B.spaceT("insetBlockEnd"),left:B.spaceT("left"),insetInlineStart:B.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:B.spaceT("right"),insetInlineEnd:B.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Su,{insetStart:Su.insetInlineStart,insetEnd:Su.insetInlineEnd});var p8={ring:{transform:Fe.ring},ringColor:B.colors("--chakra-ring-color"),ringOffset:B.prop("--chakra-ring-offset-width"),ringOffsetColor:B.colors("--chakra-ring-offset-color"),ringInset:B.prop("--chakra-ring-inset")},st={margin:B.spaceT("margin"),marginTop:B.spaceT("marginTop"),marginBlockStart:B.spaceT("marginBlockStart"),marginRight:B.spaceT("marginRight"),marginInlineEnd:B.spaceT("marginInlineEnd"),marginBottom:B.spaceT("marginBottom"),marginBlockEnd:B.spaceT("marginBlockEnd"),marginLeft:B.spaceT("marginLeft"),marginInlineStart:B.spaceT("marginInlineStart"),marginX:B.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:B.spaceT("marginInline"),marginY:B.spaceT(["marginTop","marginBottom"]),marginBlock:B.spaceT("marginBlock"),padding:B.space("padding"),paddingTop:B.space("paddingTop"),paddingBlockStart:B.space("paddingBlockStart"),paddingRight:B.space("paddingRight"),paddingBottom:B.space("paddingBottom"),paddingBlockEnd:B.space("paddingBlockEnd"),paddingLeft:B.space("paddingLeft"),paddingInlineStart:B.space("paddingInlineStart"),paddingInlineEnd:B.space("paddingInlineEnd"),paddingX:B.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:B.space("paddingInline"),paddingY:B.space(["paddingTop","paddingBottom"]),paddingBlock:B.space("paddingBlock")};Object.assign(st,{m:st.margin,mt:st.marginTop,mr:st.marginRight,me:st.marginInlineEnd,marginEnd:st.marginInlineEnd,mb:st.marginBottom,ml:st.marginLeft,ms:st.marginInlineStart,marginStart:st.marginInlineStart,mx:st.marginX,my:st.marginY,p:st.padding,pt:st.paddingTop,py:st.paddingY,px:st.paddingX,pb:st.paddingBottom,pl:st.paddingLeft,ps:st.paddingInlineStart,paddingStart:st.paddingInlineStart,pr:st.paddingRight,pe:st.paddingInlineEnd,paddingEnd:st.paddingInlineEnd});var g8={textDecorationColor:B.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:B.shadows("textShadow")},m8={clipPath:!0,transform:B.propT("transform",Fe.transform),transformOrigin:!0,translateX:B.spaceT("--chakra-translate-x"),translateY:B.spaceT("--chakra-translate-y"),skewX:B.degreeT("--chakra-skew-x"),skewY:B.degreeT("--chakra-skew-y"),scaleX:B.prop("--chakra-scale-x"),scaleY:B.prop("--chakra-scale-y"),scale:B.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:B.degreeT("--chakra-rotate")},v8={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:B.prop("transitionDuration","transition.duration"),transitionProperty:B.prop("transitionProperty","transition.property"),transitionTimingFunction:B.prop("transitionTimingFunction","transition.easing")},y8={fontFamily:B.prop("fontFamily","fonts"),fontSize:B.prop("fontSize","fontSizes",Fe.px),fontWeight:B.prop("fontWeight","fontWeights"),lineHeight:B.prop("lineHeight","lineHeights"),letterSpacing:B.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(t){if(t===!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"}},S8={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:B.spaceT("scrollMargin"),scrollMarginTop:B.spaceT("scrollMarginTop"),scrollMarginBottom:B.spaceT("scrollMarginBottom"),scrollMarginLeft:B.spaceT("scrollMarginLeft"),scrollMarginRight:B.spaceT("scrollMarginRight"),scrollMarginX:B.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:B.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:B.spaceT("scrollPadding"),scrollPaddingTop:B.spaceT("scrollPaddingTop"),scrollPaddingBottom:B.spaceT("scrollPaddingBottom"),scrollPaddingLeft:B.spaceT("scrollPaddingLeft"),scrollPaddingRight:B.spaceT("scrollPaddingRight"),scrollPaddingX:B.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:B.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function jP(t){return zr(t)&&t.reference?t.reference:String(t)}var ap=(t,...e)=>e.map(jP).join(` ${t} `).replace(/calc/g,""),n2=(...t)=>`calc(${ap("+",...t)})`,r2=(...t)=>`calc(${ap("-",...t)})`,hy=(...t)=>`calc(${ap("*",...t)})`,i2=(...t)=>`calc(${ap("/",...t)})`,a2=t=>{const e=jP(t);return e!=null&&!Number.isNaN(parseFloat(e))?String(e).startsWith("-")?String(e).slice(1):`-${e}`:hy(e,-1)},eo=Object.assign(t=>({add:(...e)=>eo(n2(t,...e)),subtract:(...e)=>eo(r2(t,...e)),multiply:(...e)=>eo(hy(t,...e)),divide:(...e)=>eo(i2(t,...e)),negate:()=>eo(a2(t)),toString:()=>t.toString()}),{add:n2,subtract:r2,multiply:hy,divide:i2,negate:a2});function _8(t,e="-"){return t.replace(/\s+/g,e)}function w8(t){const e=_8(t.toString());return C8(b8(e))}function b8(t){return t.includes("\\.")?t:!Number.isInteger(parseFloat(t.toString()))?t.replace(".","\\."):t}function C8(t){return t.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function x8(t,e=""){return[e,t].filter(Boolean).join("-")}function k8(t,e){return`var(${t}${e?`, ${e}`:""})`}function P8(t,e=""){return w8(`--${x8(t,e)}`)}function E8(t,e,n){const r=P8(t,n);return{variable:r,reference:k8(r,e)}}function O8(t){const e=t==null?0:t.length;return e?t[e-1]:void 0}function T8(t){const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}}function py(t){if(t==null)return t;const{unitless:e}=T8(t);return e||typeof t=="number"?`${t}px`:t}var WP=(t,e)=>parseInt(t[1],10)>parseInt(e[1],10)?1:-1,U0=t=>Object.fromEntries(Object.entries(t).sort(WP));function o2(t){const e=U0(t);return Object.assign(Object.values(e),e)}function R8(t){const e=Object.keys(U0(t));return new Set(e)}function s2(t){var e;if(!t)return t;t=(e=py(t))!=null?e:t;const n=-.02;return typeof t=="number"?`${t+n}`:t.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function au(t,e){const n=["@media screen"];return t&&n.push("and",`(min-width: ${py(t)})`),e&&n.push("and",`(max-width: ${py(e)})`),n.join(" ")}function A8(t){var e;if(!t)return null;t.base=(e=t.base)!=null?e:"0px";const n=o2(t),r=Object.entries(t).sort(WP).map(([s,u],c,f)=>{var h;let[,p]=(h=f[c+1])!=null?h:[];return p=parseFloat(p)>0?s2(p):void 0,{_minW:s2(u),breakpoint:s,minW:u,maxW:p,maxWQuery:au(null,p),minWQuery:au(u),minMaxQuery:au(u,p)}}),i=R8(t),a=Array.from(i.values());return{keys:i,normalized:n,isResponsive(s){const u=Object.keys(s);return u.length>0&&u.every(c=>i.has(c))},asObject:U0(t),asArray:o2(t),details:r,get(s){return r.find(u=>u.breakpoint===s)},media:[null,...n.map(s=>au(s)).slice(1)],toArrayValue(s){if(!zr(s))throw new Error("toArrayValue: value must be an object");const u=a.map(c=>{var f;return(f=s[c])!=null?f:null});for(;O8(u)===null;)u.pop();return u},toObjectValue(s){if(!Array.isArray(s))throw new Error("toObjectValue: value must be an array");return s.reduce((u,c,f)=>{const h=a[f];return h!=null&&c!=null&&(u[h]=c),u},{})}}}var Qt={hover:(t,e)=>`${t}:hover ${e}, ${t}[data-hover] ${e}`,focus:(t,e)=>`${t}:focus ${e}, ${t}[data-focus] ${e}`,focusVisible:(t,e)=>`${t}:focus-visible ${e}`,focusWithin:(t,e)=>`${t}:focus-within ${e}`,active:(t,e)=>`${t}:active ${e}, ${t}[data-active] ${e}`,disabled:(t,e)=>`${t}:disabled ${e}, ${t}[data-disabled] ${e}`,invalid:(t,e)=>`${t}:invalid ${e}, ${t}[data-invalid] ${e}`,checked:(t,e)=>`${t}:checked ${e}, ${t}[data-checked] ${e}`,indeterminate:(t,e)=>`${t}:indeterminate ${e}, ${t}[aria-checked=mixed] ${e}, ${t}[data-indeterminate] ${e}`,readOnly:(t,e)=>`${t}:read-only ${e}, ${t}[readonly] ${e}, ${t}[data-read-only] ${e}`,expanded:(t,e)=>`${t}:read-only ${e}, ${t}[aria-expanded=true] ${e}, ${t}[data-expanded] ${e}`,placeholderShown:(t,e)=>`${t}:placeholder-shown ${e}`},la=t=>HP(e=>t(e,"&"),"[role=group]","[data-group]",".group"),Ai=t=>HP(e=>t(e,"~ &"),"[data-peer]",".peer"),HP=(t,...e)=>e.map(t).join(", "),op={_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",_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:la(Qt.hover),_peerHover:Ai(Qt.hover),_groupFocus:la(Qt.focus),_peerFocus:Ai(Qt.focus),_groupFocusVisible:la(Qt.focusVisible),_peerFocusVisible:Ai(Qt.focusVisible),_groupActive:la(Qt.active),_peerActive:Ai(Qt.active),_groupDisabled:la(Qt.disabled),_peerDisabled:Ai(Qt.disabled),_groupInvalid:la(Qt.invalid),_peerInvalid:Ai(Qt.invalid),_groupChecked:la(Qt.checked),_peerChecked:Ai(Qt.checked),_groupFocusWithin:la(Qt.focusWithin),_peerFocusWithin:Ai(Qt.focusWithin),_peerPlaceholderShown:Ai(Qt.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]"},I8=Object.keys(op);function l2(t,e){return E8(String(t).replace(/\./g,"-"),void 0,e)}function L8(t,e){let n={};const r={};for(const[i,a]of Object.entries(t)){const{isSemantic:s,value:u}=a,{variable:c,reference:f}=l2(i,e==null?void 0:e.cssVarPrefix);if(!s){if(i.startsWith("space")){const g=i.split("."),[y,...v]=g,w=`${y}.-${v.join(".")}`,x=eo.negate(u),_=eo.negate(f);r[w]={value:x,var:c,varRef:_}}n[c]=u,r[i]={value:u,var:c,varRef:f};continue}const h=g=>{const v=[String(i).split(".")[0],g].join(".");if(!t[v])return g;const{reference:x}=l2(v,e==null?void 0:e.cssVarPrefix);return x},p=zr(u)?u:{default:u};n=ai(n,Object.entries(p).reduce((g,[y,v])=>{var w,x;const _=h(v);if(y==="default")return g[c]=_,g;const S=(x=(w=op)==null?void 0:w[y])!=null?x:y;return g[S]={[c]:_},g},{})),r[i]={value:f,var:c,varRef:f}}return{cssVars:n,cssMap:r}}function M8(t,e=[]){const n=Object.assign({},t);for(const r of e)r in n&&delete n[r];return n}function D8(t,e){const n={};for(const r of e)r in t&&(n[r]=t[r]);return n}var N8=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function B8(t){return D8(t,N8)}function F8(t){return t.semanticTokens}function $8(t){const{__cssMap:e,__cssVars:n,__breakpoints:r,...i}=t;return i}function z8({tokens:t,semanticTokens:e}){var n,r;const i=Object.entries((n=gy(t))!=null?n:{}).map(([s,u])=>[s,{isSemantic:!1,value:u}]),a=Object.entries((r=gy(e,1))!=null?r:{}).map(([s,u])=>[s,{isSemantic:!0,value:u}]);return Object.fromEntries([...i,...a])}function gy(t,e=1/0){return!zr(t)&&!Array.isArray(t)||!e?t:Object.entries(t).reduce((n,[r,i])=>(zr(i)||Array.isArray(i)?Object.entries(gy(i,e-1)).forEach(([a,s])=>{n[`${r}.${a}`]=s}):n[r]=i,n),{})}function uH(t){var e;const n=$8(t),r=B8(n),i=F8(n),a=z8({tokens:r,semanticTokens:i}),s=(e=n.config)==null?void 0:e.cssVarPrefix,{cssMap:u,cssVars:c}=L8(a,{cssVarPrefix:s});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"},...c},__cssMap:u,__breakpoints:A8(n.breakpoints)}),n}var j0=ai({},bd,We,i8,ch,lr,a8,p8,o8,UP,h8,Su,dy,st,S8,y8,g8,m8,s8,v8),G8=Object.assign({},st,lr,ch,UP,Su),cH=Object.keys(G8),U8=[...Object.keys(j0),...I8],j8={...j0,...op},W8=t=>t in j8,H8=t=>e=>{if(!e.__breakpoints)return t;const{isResponsive:n,toArrayValue:r,media:i}=e.__breakpoints,a={};for(const s in t){let u=io(t[s],e);if(u==null)continue;if(u=zr(u)&&n(u)?r(u):u,!Array.isArray(u)){a[s]=u;continue}const c=u.slice(0,i.length).length;for(let f=0;ft.startsWith("--")&&typeof e=="string"&&!q8(e),Y8=(t,e)=>{var n,r;if(e==null)return e;const i=c=>{var f,h;return(h=(f=t.__cssMap)==null?void 0:f[c])==null?void 0:h.varRef},a=c=>{var f;return(f=i(c))!=null?f:c},[s,u]=V8(e);return e=(r=(n=i(s))!=null?n:a(u))!=null?r:a(e),e};function X8(t){const{configs:e={},pseudos:n={},theme:r}=t,i=(a,s=!1)=>{var u,c,f;const h=io(a,r),p=H8(h)(r);let g={};for(let y in p){const v=p[y];let w=io(v,r);y in n&&(y=n[y]),K8(y,w)&&(w=Y8(r,w));let x=e[y];if(x===!0&&(x={property:y}),zr(w)){g[y]=(u=g[y])!=null?u:{},g[y]=ai({},g[y],i(w,!0));continue}let _=(f=(c=x==null?void 0:x.transform)==null?void 0:c.call(x,w,r,h))!=null?f:w;_=x!=null&&x.processResult?i(_,!0):_;const S=io(x==null?void 0:x.property,r);if(!s&&(x!=null&&x.static)){const C=io(x.static,r);g=ai({},g,C)}if(S&&Array.isArray(S)){for(const C of S)g[C]=_;continue}if(S){S==="&"&&zr(_)?g=ai({},g,_):g[S]=_;continue}if(zr(_)){g=ai({},g,_);continue}g[y]=_}return g};return i}var Q8=t=>e=>X8({theme:e,pseudos:op,configs:j0})(t);function fH(t){return t}function dH(t){return t}function hH(t){return{definePartsStyle(e){return e},defineMultiStyleConfig(e){return{parts:t,...e}}}}function J8(t,e){if(Array.isArray(t))return t;if(zr(t))return e(t);if(t!=null)return[t]}function Z8(t,e){for(let n=e+1;n{ai(f,{[C]:g?S[C]:{[_]:S[C]}})});continue}if(!y){g?ai(f,S):f[_]=S;continue}f[_]=S}}return f}}function tG(t){return e=>{var n;const{variant:r,size:i,theme:a}=e,s=eG(a);return ai({},io((n=t.baseStyle)!=null?n:{},e),s(t,"sizes",i,e),s(t,"variants",r,e))}}function pH(t,e,n){var r,i,a;return(a=(i=(r=t.__cssMap)==null?void 0:r[`${e}.${n}`])==null?void 0:i.varRef)!=null?a:n}function VP(t){return M8(t,["styleConfig","size","variant","colorScheme"])}function nG(t,e){const n={};return Object.keys(t).forEach(r=>{e.includes(r)||(n[r]=t[r])}),n}function rG(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},aG=iG(rG);function qP(t,e){const n={};return Object.keys(t).forEach(r=>{const i=t[r];e(i,r,t)&&(n[r]=i)}),n}var KP=t=>qP(t,e=>e!=null);function oG(t){return typeof t=="function"}function sG(t,...e){return oG(t)?t(...e):t}function gH(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var lG=typeof Element<"u",uG=typeof Map=="function",cG=typeof Set=="function",fG=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Cd(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!Cd(t[r],e[r]))return!1;return!0}var a;if(uG&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;for(a=t.entries();!(r=a.next()).done;)if(!Cd(r.value[1],e.get(r.value[0])))return!1;return!0}if(cG&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(fG&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;if(lG&&t instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&t.$$typeof)&&!Cd(t[i[r]],e[i[r]]))return!1;return!0}return t!==t&&e!==e}var dG=function(e,n){try{return Cd(e,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};function YP(t,e={}){var n;const{styleConfig:r,...i}=e,{theme:a,colorMode:s}=D6(),u=t?aG(a,`components.${t}`):void 0,c=r||u,f=ai({theme:a,colorMode:s},(n=c==null?void 0:c.defaultProps)!=null?n:{},KP(nG(i,["children"]))),h=be.useRef({});if(c){const g=tG(c)(f);dG(h.current,g)||(h.current=g)}return h.current}function XP(t,e={}){return YP(t,e)}function mH(t,e={}){return YP(t,e)}var hG=new Set([...U8,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),pG=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function gG(t){return pG.has(t)||!hG.has(t)}function mG(t){const e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function vG(t,...e){if(t==null)throw new TypeError("Cannot convert undefined or null to object");const n={...t};for(const r of e)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}var yG=/^((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)-.*))$/,SG=EP(function(t){return yG.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),_G=SG,wG=function(e){return e!=="theme"},u2=function(e){return typeof e=="string"&&e.charCodeAt(0)>96?_G:wG},c2=function(e,n,r){var i;if(n){var a=n.shouldForwardProp;i=e.__emotion_forwardProp&&a?function(s){return e.__emotion_forwardProp(s)&&a(s)}:a}return typeof i!="function"&&r&&(i=e.__emotion_forwardProp),i},bG=function(e){var n=e.cache,r=e.serialized,i=e.isStringTag;return TP(n,r,i),R6(function(){return RP(n,r,i)}),null},CG=function t(e,n){var r=e.__emotion_real===e,i=r&&e.__emotion_base||e,a,s;n!==void 0&&(a=n.label,s=n.target);var u=c2(e,n,r),c=u||u2(i),f=!c("as");return function(){var h=arguments,p=r&&e.__emotion_styles!==void 0?e.__emotion_styles.slice(0):[];if(a!==void 0&&p.push("label:"+a+";"),h[0]==null||h[0].raw===void 0)p.push.apply(p,h);else{p.push(h[0][0]);for(var g=h.length,y=1;ye=>{const{theme:n,css:r,__css:i,sx:a,...s}=e,u=qP(s,(p,g)=>W8(g)),c=sG(t,e),f=vG({},i,c,KP(u),a),h=Q8(f)(e.theme);return r?[h,r]:h};function Bm(t,e){const{baseStyle:n,...r}=e??{};r.shouldForwardProp||(r.shouldForwardProp=gG);const i=PG({baseStyle:n}),a=kG(t,r)(i);return As.forwardRef(function(c,f){const{colorMode:h,forced:p}=BP();return As.createElement(a,{ref:f,"data-theme":p?h:void 0,...c})})}function EG(){const t=new Map;return new Proxy(Bm,{apply(e,n,r){return Bm(...r)},get(e,n){return t.has(n)||t.set(n,Bm(n)),t.get(n)}})}var dh=EG();function W0(t){return be.forwardRef(t)}var OG=M6({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),QP=W0((t,e)=>{const n=XP("Spinner",t),{label:r="Loading...",thickness:i="2px",speed:a="0.45s",emptyColor:s="transparent",className:u,...c}=VP(t),f=FP("chakra-spinner",u),h={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:s,borderLeftColor:s,animation:`${OG} ${a} linear infinite`,...n};return jt.jsx(dh.div,{ref:e,__css:h,className:f,...c,children:r&&jt.jsx(dh.span,{srOnly:!0,children:r})})});QP.displayName="Spinner";var JP=W0(function(e,n){const r=XP("Text",e),{className:i,align:a,decoration:s,casing:u,...c}=VP(e),f=mG({textAlign:e.align,textDecoration:e.decoration,textTransform:e.casing});return jt.jsx(dh.p,{ref:n,className:FP("chakra-text",e.className),...f,...c,__css:r})});JP.displayName="Text";var ZP=W0(function(e,n){const{direction:r,align:i,justify:a,wrap:s,basis:u,grow:c,shrink:f,...h}=e,p={display:"flex",flexDirection:r,alignItems:i,justifyContent:a,flexWrap:s,flexBasis:u,flexGrow:c,flexShrink:f};return jt.jsx(dh.div,{ref:n,__css:p,...h})});ZP.displayName="Flex";const d2=t=>{const{t:e}=lB(),{showText:n=!1,text:r=e("common.loadingInvokeAI")}=t;return jt.jsxs(ZP,{width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#121212",flexDirection:"column",rowGap:4,children:[jt.jsx(QP,{color:"grey",w:"5rem",h:"5rem"}),n&&jt.jsx(JP,{color:"grey",fontWeight:"semibold",fontFamily:"'Inter', sans-serif",children:r})]})},TG=be.lazy(()=>bx(()=>import("./App-982926da.js"),["./App-982926da.js","./storeHooks-e63a2dc4.js","./App-08e5c546.css"],import.meta.url)),RG=be.lazy(()=>bx(()=>import("./ThemeLocaleProvider-a1ea5622.js"),["./ThemeLocaleProvider-a1ea5622.js","./storeHooks-e63a2dc4.js"],import.meta.url));function AG(){return jt.jsx(As.StrictMode,{children:jt.jsx(Y3,{store:_P,children:jt.jsx(Ax,{loading:jt.jsx(d2,{}),persistor:qz,children:jt.jsx(As.Suspense,{fallback:jt.jsx(d2,{showText:!0}),children:jt.jsx(RG,{children:jt.jsx(TG,{})})})})})})}Fm.createRoot(document.getElementById("root")).render(jt.jsx(AG,{}));export{rW as $,Vf as A,Of as B,yU as C,D5 as D,lB as E,ZP as F,xd as G,tW as H,oW as I,XW as J,KW as K,qW as L,wW as M,vB as N,yB as O,CW as P,JW as Q,As as R,QP as S,JP as T,fW as U,YW as V,rH as W,QW as X,BW as Y,eW as Z,Xd as _,FP as a,IW as a$,aW as a0,_W as a1,bW as a2,lW as a3,qz as a4,sW as a5,gW as a6,vU as a7,vW as a8,TW as a9,gj as aA,Ow as aB,Rj as aC,kj as aD,Vj as aE,Fj as aF,mj as aG,N5 as aH,vj as aI,Aj as aJ,tj as aK,ej as aL,L5 as aM,Xj as aN,zj as aO,Gj as aP,$j as aQ,Lj as aR,kz as aS,fF as aT,cF as aU,Yj as aV,Ij as aW,R5 as aX,Bj as aY,MW as aZ,yj as a_,yW as aa,OW as ab,NW as ac,Hj as ad,Wj as ae,jj as af,Jj as ag,Zj as ah,DW as ai,Qj as aj,HW as ak,dd as al,O5 as am,wj as an,bj as ao,lj as ap,pW as aq,hj as ar,Tj as as,jW as at,WW as au,SW as av,Dj as aw,_j as ax,Cj as ay,Mj as az,sH as b,XU as b$,AW as b0,uj as b1,LW as b2,iW as b3,VW as b4,hW as b5,dW as b6,Ew as b7,UW as b8,Kj as b9,VU as bA,Qx as bB,zG as bC,GG as bD,UG as bE,jU as bF,tU as bG,eU as bH,XG as bI,UU as bJ,ZW as bK,QG as bL,lU as bM,uU as bN,Ef as bO,va as bP,PU as bQ,xU as bR,wU as bS,NG as bT,BG as bU,$W as bV,zW as bW,pU as bX,oU as bY,sU as bZ,nU as b_,qj as ba,$m as bb,AL as bc,pe as bd,Lb as be,kU as bf,HU as bg,WU as bh,iU as bi,DU as bj,qU as bk,GW as bl,KG as bm,_U as bn,Vl as bo,gU as bp,YG as bq,Cz as br,SU as bs,HG as bt,mU as bu,VG as bv,ZG as bw,LG as bx,MG as by,DG as bz,dh as c,cW as c0,Af as c1,ei as c2,zl as c3,Ae as c4,TU as c5,ns as c6,FG as c7,EU as c8,rU as c9,uW as cA,kW as cB,dj as cC,ZU as cD,aj as cE,nj as cF,rj as cG,ij as cH,sj as cI,Hb as cJ,EW as cK,RW as cL,BP as cM,nH as cN,NP as cO,fH as cP,hH as cQ,E8 as cR,dH as cS,ai as cT,uH as cU,tH as cV,aG as cW,Q8 as cX,Yd as cY,T3 as cZ,IG as c_,aU as ca,WG as cb,jG as cc,eH as cd,qG as ce,GU as cf,RU as cg,AU as ch,FU as ci,hU as cj,dU as ck,OU as cl,JU as cm,MU as cn,IU as co,zU as cp,$G as cq,M5 as cr,Nj as cs,QU as ct,fU as cu,xj as cv,Pj as cw,Ej as cx,Oj as cy,PW as cz,mH as d,XP as e,W0 as f,aH as g,oH as h,lH as i,jt as j,M6 as k,jv as l,Ur as m,sG as n,VP as o,gH as p,zr as q,be as r,DP as s,io as t,D6 as u,cH as v,iH as w,pH as x,wk as y,_t as z}; diff --git a/invokeai/frontend/web/dist/assets/index-61f10aa8.js b/invokeai/frontend/web/dist/assets/index-61f10aa8.js deleted file mode 100644 index e9a5ec3fa2..0000000000 --- a/invokeai/frontend/web/dist/assets/index-61f10aa8.js +++ /dev/null @@ -1,115 +0,0 @@ -function h2(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var yn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function p2(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var jt={},AL={get exports(){return jt},set exports(t){jt=t}},hh={},be={},IL={get exports(){return be},set exports(t){be=t}},De={};/** - * @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 Ku=Symbol.for("react.element"),LL=Symbol.for("react.portal"),ML=Symbol.for("react.fragment"),DL=Symbol.for("react.strict_mode"),NL=Symbol.for("react.profiler"),BL=Symbol.for("react.provider"),FL=Symbol.for("react.context"),$L=Symbol.for("react.forward_ref"),zL=Symbol.for("react.suspense"),GL=Symbol.for("react.memo"),UL=Symbol.for("react.lazy"),qS=Symbol.iterator;function jL(t){return t===null||typeof t!="object"?null:(t=qS&&t[qS]||t["@@iterator"],typeof t=="function"?t:null)}var g2={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m2=Object.assign,v2={};function Us(t,e,n){this.props=t,this.context=e,this.refs=v2,this.updater=n||g2}Us.prototype.isReactComponent={};Us.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};Us.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function y2(){}y2.prototype=Us.prototype;function my(t,e,n){this.props=t,this.context=e,this.refs=v2,this.updater=n||g2}var vy=my.prototype=new y2;vy.constructor=my;m2(vy,Us.prototype);vy.isPureReactComponent=!0;var KS=Array.isArray,S2=Object.prototype.hasOwnProperty,yy={current:null},_2={key:!0,ref:!0,__self:!0,__source:!0};function w2(t,e,n){var r,i={},a=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(a=""+e.key),e)S2.call(e,r)&&!_2.hasOwnProperty(r)&&(i[r]=e[r]);var u=arguments.length-2;if(u===1)i.children=n;else if(1>>1,ve=H[oe];if(0>>1;oei(At,Q))mei(qt,At)?(H[oe]=qt,H[me]=Q,oe=me):(H[oe]=At,H[Ue]=Q,oe=Ue);else if(mei(qt,Q))H[oe]=qt,H[me]=Q,oe=me;else break e}}return Y}function i(H,Y){var Q=H.sortIndex-Y.sortIndex;return Q!==0?Q:H.id-Y.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var s=Date,u=s.now();t.unstable_now=function(){return s.now()-u}}var c=[],f=[],h=1,p=null,g=3,y=!1,v=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(H){for(var Y=n(f);Y!==null;){if(Y.callback===null)r(f);else if(Y.startTime<=H)r(f),Y.sortIndex=Y.expirationTime,e(c,Y);else break;Y=n(f)}}function O(H){if(w=!1,C(H),!v)if(n(c)!==null)v=!0,V(I);else{var Y=n(f);Y!==null&&ie(O,Y.startTime-H)}}function I(H,Y){v=!1,w&&(w=!1,_(U),U=-1),y=!0;var Q=g;try{for(C(Y),p=n(c);p!==null&&(!(p.expirationTime>Y)||H&&!te());){var oe=p.callback;if(typeof oe=="function"){p.callback=null,g=p.priorityLevel;var ve=oe(p.expirationTime<=Y);Y=t.unstable_now(),typeof ve=="function"?p.callback=ve:p===n(c)&&r(c),C(Y)}else r(c);p=n(c)}if(p!==null)var we=!0;else{var Ue=n(f);Ue!==null&&ie(O,Ue.startTime-Y),we=!1}return we}finally{p=null,g=Q,y=!1}}var L=!1,D=null,U=-1,X=5,K=-1;function te(){return!(t.unstable_now()-KH||125oe?(H.sortIndex=Q,e(f,H),n(c)===null&&H===n(f)&&(w?(_(U),U=-1):w=!0,ie(O,Q-oe))):(H.sortIndex=ve,e(c,H),v||y||(v=!0,V(I))),H},t.unstable_shouldYield=te,t.unstable_wrapCallback=function(H){var Y=g;return function(){var Q=g;g=Y;try{return H.apply(this,arguments)}finally{g=Q}}}})(C2);(function(t){t.exports=C2})(tM);/** - * @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 x2=be,Yn=$m;function ae(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zm=Object.prototype.hasOwnProperty,nM=/^[: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]*$/,QS={},JS={};function rM(t){return zm.call(JS,t)?!0:zm.call(QS,t)?!1:nM.test(t)?JS[t]=!0:(QS[t]=!0,!1)}function iM(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function aM(t,e,n,r){if(e===null||typeof e>"u"||iM(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function wn(t,e,n,r,i,a,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=a,this.removeEmptyString=s}var nn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){nn[t]=new wn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];nn[e]=new wn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){nn[t]=new wn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){nn[t]=new wn(t,2,!1,t,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(t){nn[t]=new wn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){nn[t]=new wn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){nn[t]=new wn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){nn[t]=new wn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){nn[t]=new wn(t,5,!1,t.toLowerCase(),null,!1,!1)});var _y=/[\-:]([a-z])/g;function wy(t){return t[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(t){var e=t.replace(_y,wy);nn[e]=new wn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(_y,wy);nn[e]=new wn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(_y,wy);nn[e]=new wn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){nn[t]=new wn(t,1,!1,t.toLowerCase(),null,!1,!1)});nn.xlinkHref=new wn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){nn[t]=new wn(t,1,!1,t.toLowerCase(),null,!0,!0)});function by(t,e,n,r){var i=nn.hasOwnProperty(e)?nn[e]:null;(i!==null?i.type!==0:r||!(2u||i[s]!==a[u]){var c=` -`+i[s].replace(" at new "," at ");return t.displayName&&c.includes("")&&(c=c.replace("",t.displayName)),c}while(1<=s&&0<=u);break}}}finally{Hg=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Kl(t):""}function oM(t){switch(t.tag){case 5:return Kl(t.type);case 16:return Kl("Lazy");case 13:return Kl("Suspense");case 19:return Kl("SuspenseList");case 0:case 2:case 15:return t=Wg(t.type,!1),t;case 11:return t=Wg(t.type.render,!1),t;case 1:return t=Wg(t.type,!0),t;default:return""}}function Hm(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ls:return"Fragment";case ss:return"Portal";case Gm:return"Profiler";case Cy:return"StrictMode";case Um:return"Suspense";case jm:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case P2:return(t.displayName||"Context")+".Consumer";case E2:return(t._context.displayName||"Context")+".Provider";case xy:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ky:return e=t.displayName||null,e!==null?e:Hm(t.type)||"Memo";case ca:e=t._payload,t=t._init;try{return Hm(t(e))}catch{}}return null}function sM(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Hm(e);case 8:return e===Cy?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Oa(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function T2(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function lM(t){var e=T2(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,a=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,a.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function hf(t){t._valueTracker||(t._valueTracker=lM(t))}function R2(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=T2(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function kd(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Wm(t,e){var n=e.checked;return mt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function e_(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Oa(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function A2(t,e){e=e.checked,e!=null&&by(t,"checked",e,!1)}function Vm(t,e){A2(t,e);var n=Oa(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?qm(t,e.type,n):e.hasOwnProperty("defaultValue")&&qm(t,e.type,Oa(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function t_(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function qm(t,e,n){(e!=="number"||kd(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Yl=Array.isArray;function _s(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=pf.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function bu(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var ou={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},uM=["Webkit","ms","Moz","O"];Object.keys(ou).forEach(function(t){uM.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ou[e]=ou[t]})});function D2(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||ou.hasOwnProperty(t)&&ou[t]?(""+e).trim():e+"px"}function N2(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=D2(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var cM=mt({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 Xm(t,e){if(e){if(cM[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ae(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ae(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ae(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ae(62))}}function Qm(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 Jm=null;function Ey(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Zm=null,ws=null,bs=null;function i_(t){if(t=Qu(t)){if(typeof Zm!="function")throw Error(ae(280));var e=t.stateNode;e&&(e=yh(e),Zm(t.stateNode,t.type,e))}}function B2(t){ws?bs?bs.push(t):bs=[t]:ws=t}function F2(){if(ws){var t=ws,e=bs;if(bs=ws=null,i_(t),e)for(t=0;t>>=0,t===0?32:31-(wM(t)/bM|0)|0}var gf=64,mf=4194304;function Xl(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Td(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,a=t.pingedLanes,s=n&268435455;if(s!==0){var u=s&~i;u!==0?r=Xl(u):(a&=s,a!==0&&(r=Xl(a)))}else s=n&~i,s!==0?r=Xl(s):a!==0&&(r=Xl(a));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,a=e&-e,i>=a||i===16&&(a&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Yu(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Fr(e),t[e]=n}function EM(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=lu),h_=String.fromCharCode(32),p_=!1;function iC(t,e){switch(t){case"keyup":return eD.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function aC(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var us=!1;function nD(t,e){switch(t){case"compositionend":return aC(e);case"keypress":return e.which!==32?null:(p_=!0,h_);case"textInput":return t=e.data,t===h_&&p_?null:t;default:return null}}function rD(t,e){if(us)return t==="compositionend"||!My&&iC(t,e)?(t=nC(),Zf=Ay=ga=null,us=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=y_(n)}}function uC(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?uC(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function cC(){for(var t=window,e=kd();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=kd(t.document)}return e}function Dy(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function dD(t){var e=cC(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&uC(n.ownerDocument.documentElement,n)){if(r!==null&&Dy(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!t.extend&&a>r&&(i=r,r=a,a=i),i=S_(n,a);var s=S_(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),a>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,cs=null,av=null,cu=null,ov=!1;function __(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ov||cs==null||cs!==kd(r)||(r=cs,"selectionStart"in r&&Dy(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}),cu&&Ou(cu,r)||(cu=r,r=Id(av,"onSelect"),0hs||(t.current=dv[hs],dv[hs]=null,hs--)}function at(t,e){hs++,dv[hs]=t.current,t.current=e}var Ta={},fn=La(Ta),Rn=La(!1),so=Ta;function Ls(t,e){var n=t.type.contextTypes;if(!n)return Ta;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=e[a];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function An(t){return t=t.childContextTypes,t!=null}function Md(){lt(Rn),lt(fn)}function P_(t,e,n){if(fn.current!==Ta)throw Error(ae(168));at(fn,e),at(Rn,n)}function SC(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(ae(108,sM(t)||"Unknown",i));return mt({},n,r)}function Dd(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Ta,so=fn.current,at(fn,t),at(Rn,Rn.current),!0}function O_(t,e,n){var r=t.stateNode;if(!r)throw Error(ae(169));n?(t=SC(t,e,so),r.__reactInternalMemoizedMergedChildContext=t,lt(Rn),lt(fn),at(fn,t)):lt(Rn),at(Rn,n)}var Mi=null,Sh=!1,am=!1;function _C(t){Mi===null?Mi=[t]:Mi.push(t)}function xD(t){Sh=!0,_C(t)}function Ma(){if(!am&&Mi!==null){am=!0;var t=0,e=Qe;try{var n=Mi;for(Qe=1;t>=s,i-=s,Di=1<<32-Fr(e)+i|n<U?(X=D,D=null):X=D.sibling;var K=g(_,D,C[U],O);if(K===null){D===null&&(D=X);break}t&&D&&K.alternate===null&&e(_,D),S=a(K,S,U),L===null?I=K:L.sibling=K,L=K,D=X}if(U===C.length)return n(_,D),ft&&Qa(_,U),I;if(D===null){for(;UU?(X=D,D=null):X=D.sibling;var te=g(_,D,K.value,O);if(te===null){D===null&&(D=X);break}t&&D&&te.alternate===null&&e(_,D),S=a(te,S,U),L===null?I=te:L.sibling=te,L=te,D=X}if(K.done)return n(_,D),ft&&Qa(_,U),I;if(D===null){for(;!K.done;U++,K=C.next())K=p(_,K.value,O),K!==null&&(S=a(K,S,U),L===null?I=K:L.sibling=K,L=K);return ft&&Qa(_,U),I}for(D=r(_,D);!K.done;U++,K=C.next())K=y(D,_,U,K.value,O),K!==null&&(t&&K.alternate!==null&&D.delete(K.key===null?U:K.key),S=a(K,S,U),L===null?I=K:L.sibling=K,L=K);return t&&D.forEach(function(ce){return e(_,ce)}),ft&&Qa(_,U),I}function x(_,S,C,O){if(typeof C=="object"&&C!==null&&C.type===ls&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case df:e:{for(var I=C.key,L=S;L!==null;){if(L.key===I){if(I=C.type,I===ls){if(L.tag===7){n(_,L.sibling),S=i(L,C.props.children),S.return=_,_=S;break e}}else if(L.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===ca&&D_(I)===L.type){n(_,L.sibling),S=i(L,C.props),S.ref=Ll(_,L,C),S.return=_,_=S;break e}n(_,L);break}else e(_,L);L=L.sibling}C.type===ls?(S=oo(C.props.children,_.mode,O,C.key),S.return=_,_=S):(O=sd(C.type,C.key,C.props,null,_.mode,O),O.ref=Ll(_,S,C),O.return=_,_=O)}return s(_);case ss:e:{for(L=C.key;S!==null;){if(S.key===L)if(S.tag===4&&S.stateNode.containerInfo===C.containerInfo&&S.stateNode.implementation===C.implementation){n(_,S.sibling),S=i(S,C.children||[]),S.return=_,_=S;break e}else{n(_,S);break}else e(_,S);S=S.sibling}S=hm(C,_.mode,O),S.return=_,_=S}return s(_);case ca:return L=C._init,x(_,S,L(C._payload),O)}if(Yl(C))return v(_,S,C,O);if(Ol(C))return w(_,S,C,O);Cf(_,C)}return typeof C=="string"&&C!==""||typeof C=="number"?(C=""+C,S!==null&&S.tag===6?(n(_,S.sibling),S=i(S,C),S.return=_,_=S):(n(_,S),S=dm(C,_.mode,O),S.return=_,_=S),s(_)):n(_,S)}return x}var Ds=OC(!0),TC=OC(!1),Ju={},si=La(Ju),Iu=La(Ju),Lu=La(Ju);function ro(t){if(t===Ju)throw Error(ae(174));return t}function Hy(t,e){switch(at(Lu,e),at(Iu,t),at(si,Ju),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ym(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ym(e,t)}lt(si),at(si,e)}function Ns(){lt(si),lt(Iu),lt(Lu)}function RC(t){ro(Lu.current);var e=ro(si.current),n=Ym(e,t.type);e!==n&&(at(Iu,t),at(si,n))}function Wy(t){Iu.current===t&&(lt(si),lt(Iu))}var pt=La(0);function Gd(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var om=[];function Vy(){for(var t=0;tn?n:4,t(!0);var r=sm.transition;sm.transition={};try{t(!1),e()}finally{Qe=n,sm.transition=r}}function VC(){return vr().memoizedState}function OD(t,e,n){var r=xa(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},qC(t))KC(e,n);else if(n=xC(t,e,n,r),n!==null){var i=Sn();$r(n,t,r,i),YC(n,e,r)}}function TD(t,e,n){var r=xa(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(qC(t))KC(e,i);else{var a=t.alternate;if(t.lanes===0&&(a===null||a.lanes===0)&&(a=e.lastRenderedReducer,a!==null))try{var s=e.lastRenderedState,u=a(s,n);if(i.hasEagerState=!0,i.eagerState=u,Gr(u,s)){var c=e.interleaved;c===null?(i.next=i,Uy(e)):(i.next=c.next,c.next=i),e.interleaved=i;return}}catch{}finally{}n=xC(t,e,i,r),n!==null&&(i=Sn(),$r(n,t,r,i),YC(n,e,r))}}function qC(t){var e=t.alternate;return t===gt||e!==null&&e===gt}function KC(t,e){fu=Ud=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function YC(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Oy(t,n)}}var jd={readContext:mr,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useInsertionEffect:on,useLayoutEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useMutableSource:on,useSyncExternalStore:on,useId:on,unstable_isNewReconciler:!1},RD={readContext:mr,useCallback:function(t,e){return Zr().memoizedState=[t,e===void 0?null:e],t},useContext:mr,useEffect:B_,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,rd(4194308,4,GC.bind(null,e,t),n)},useLayoutEffect:function(t,e){return rd(4194308,4,t,e)},useInsertionEffect:function(t,e){return rd(4,2,t,e)},useMemo:function(t,e){var n=Zr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Zr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=OD.bind(null,gt,t),[r.memoizedState,t]},useRef:function(t){var e=Zr();return t={current:t},e.memoizedState=t},useState:N_,useDebugValue:Qy,useDeferredValue:function(t){return Zr().memoizedState=t},useTransition:function(){var t=N_(!1),e=t[0];return t=PD.bind(null,t[1]),Zr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=gt,i=Zr();if(ft){if(n===void 0)throw Error(ae(407));n=n()}else{if(n=e(),Wt===null)throw Error(ae(349));uo&30||LC(r,e,n)}i.memoizedState=n;var a={value:n,getSnapshot:e};return i.queue=a,B_(DC.bind(null,r,a,t),[t]),r.flags|=2048,Nu(9,MC.bind(null,r,a,n,e),void 0,null),n},useId:function(){var t=Zr(),e=Wt.identifierPrefix;if(ft){var n=Ni,r=Di;n=(r&~(1<<32-Fr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Mu++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[ri]=e,t[Au]=r,ix(t,e,!1,!1),e.stateNode=t;e:{switch(s=Qm(n,r),n){case"dialog":ot("cancel",t),ot("close",t),i=r;break;case"iframe":case"object":case"embed":ot("load",t),i=r;break;case"video":case"audio":for(i=0;iFs&&(e.flags|=128,r=!0,Ml(a,!1),e.lanes=4194304)}else{if(!r)if(t=Gd(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Ml(a,!0),a.tail===null&&a.tailMode==="hidden"&&!s.alternate&&!ft)return sn(e),null}else 2*Et()-a.renderingStartTime>Fs&&n!==1073741824&&(e.flags|=128,r=!0,Ml(a,!1),e.lanes=4194304);a.isBackwards?(s.sibling=e.child,e.child=s):(n=a.last,n!==null?n.sibling=s:e.child=s,a.last=s)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=Et(),e.sibling=null,n=pt.current,at(pt,r?n&1|2:n&1),e):(sn(e),null);case 22:case 23:return r0(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?jn&1073741824&&(sn(e),e.subtreeFlags&6&&(e.flags|=8192)):sn(e),null;case 24:return null;case 25:return null}throw Error(ae(156,e.tag))}function FD(t,e){switch(By(e),e.tag){case 1:return An(e.type)&&Md(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ns(),lt(Rn),lt(fn),Vy(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Wy(e),null;case 13:if(lt(pt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ae(340));Ms()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return lt(pt),null;case 4:return Ns(),null;case 10:return Gy(e.type._context),null;case 22:case 23:return r0(),null;case 24:return null;default:return null}}var kf=!1,cn=!1,$D=typeof WeakSet=="function"?WeakSet:Set,he=null;function vs(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){wt(t,e,r)}else n.current=null}function xv(t,e,n){try{n()}catch(r){wt(t,e,r)}}var V_=!1;function zD(t,e){if(sv=Rd,t=cC(),Dy(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var s=0,u=-1,c=-1,f=0,h=0,p=t,g=null;t:for(;;){for(var y;p!==n||i!==0&&p.nodeType!==3||(u=s+i),p!==a||r!==0&&p.nodeType!==3||(c=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(y=p.firstChild)!==null;)g=p,p=y;for(;;){if(p===t)break t;if(g===n&&++f===i&&(u=s),g===a&&++h===r&&(c=s),(y=p.nextSibling)!==null)break;p=g,g=p.parentNode}p=y}n=u===-1||c===-1?null:{start:u,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(lv={focusedElem:t,selectionRange:n},Rd=!1,he=e;he!==null;)if(e=he,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,he=t;else for(;he!==null;){e=he;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var w=v.memoizedProps,x=v.memoizedState,_=e.stateNode,S=_.getSnapshotBeforeUpdate(e.elementType===e.type?w:Lr(e.type,w),x);_.__reactInternalSnapshotBeforeUpdate=S}break;case 3:var C=e.stateNode.containerInfo;C.nodeType===1?C.textContent="":C.nodeType===9&&C.documentElement&&C.removeChild(C.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ae(163))}}catch(O){wt(e,e.return,O)}if(t=e.sibling,t!==null){t.return=e.return,he=t;break}he=e.return}return v=V_,V_=!1,v}function du(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var a=i.destroy;i.destroy=void 0,a!==void 0&&xv(e,n,a)}i=i.next}while(i!==r)}}function bh(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function kv(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function sx(t){var e=t.alternate;e!==null&&(t.alternate=null,sx(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ri],delete e[Au],delete e[fv],delete e[bD],delete e[CD])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function lx(t){return t.tag===5||t.tag===3||t.tag===4}function q_(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||lx(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Ev(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Ld));else if(r!==4&&(t=t.child,t!==null))for(Ev(t,e,n),t=t.sibling;t!==null;)Ev(t,e,n),t=t.sibling}function Pv(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Pv(t,e,n),t=t.sibling;t!==null;)Pv(t,e,n),t=t.sibling}var Zt=null,Mr=!1;function sa(t,e,n){for(n=n.child;n!==null;)ux(t,e,n),n=n.sibling}function ux(t,e,n){if(oi&&typeof oi.onCommitFiberUnmount=="function")try{oi.onCommitFiberUnmount(ph,n)}catch{}switch(n.tag){case 5:cn||vs(n,e);case 6:var r=Zt,i=Mr;Zt=null,sa(t,e,n),Zt=r,Mr=i,Zt!==null&&(Mr?(t=Zt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Zt.removeChild(n.stateNode));break;case 18:Zt!==null&&(Mr?(t=Zt,n=n.stateNode,t.nodeType===8?im(t.parentNode,n):t.nodeType===1&&im(t,n),Eu(t)):im(Zt,n.stateNode));break;case 4:r=Zt,i=Mr,Zt=n.stateNode.containerInfo,Mr=!0,sa(t,e,n),Zt=r,Mr=i;break;case 0:case 11:case 14:case 15:if(!cn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,s=a.destroy;a=a.tag,s!==void 0&&(a&2||a&4)&&xv(n,e,s),i=i.next}while(i!==r)}sa(t,e,n);break;case 1:if(!cn&&(vs(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){wt(n,e,u)}sa(t,e,n);break;case 21:sa(t,e,n);break;case 22:n.mode&1?(cn=(r=cn)||n.memoizedState!==null,sa(t,e,n),cn=r):sa(t,e,n);break;default:sa(t,e,n)}}function K_(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new $D),e.forEach(function(r){var i=YD.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Rr(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~a}if(r=i,r=Et()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*UD(r/1960))-r,10t?16:t,ma===null)var r=!1;else{if(t=ma,ma=null,Vd=0,$e&6)throw Error(ae(331));var i=$e;for($e|=4,he=t.current;he!==null;){var a=he,s=a.child;if(he.flags&16){var u=a.deletions;if(u!==null){for(var c=0;cEt()-t0?ao(t,0):e0|=n),In(t,e)}function vx(t,e){e===0&&(t.mode&1?(e=mf,mf<<=1,!(mf&130023424)&&(mf=4194304)):e=1);var n=Sn();t=Gi(t,e),t!==null&&(Yu(t,e,n),In(t,n))}function KD(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),vx(t,n)}function YD(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(ae(314))}r!==null&&r.delete(e),vx(t,n)}var yx;yx=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Rn.current)Tn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Tn=!1,ND(t,e,n);Tn=!!(t.flags&131072)}else Tn=!1,ft&&e.flags&1048576&&wC(e,Bd,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;id(t,e),t=e.pendingProps;var i=Ls(e,fn.current);xs(e,n),i=Ky(null,e,r,t,i,n);var a=Yy();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,An(r)?(a=!0,Dd(e)):a=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,jy(e),i.updater=_h,e.stateNode=i,i._reactInternals=e,vv(e,r,t,n),e=_v(null,e,r,!0,a,n)):(e.tag=0,ft&&a&&Ny(e),vn(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(id(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=QD(r),t=Lr(r,t),i){case 0:e=Sv(null,e,r,t,n);break e;case 1:e=j_(null,e,r,t,n);break e;case 11:e=G_(null,e,r,t,n);break e;case 14:e=U_(null,e,r,Lr(r.type,t),n);break e}throw Error(ae(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Lr(r,i),Sv(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Lr(r,i),j_(t,e,r,i,n);case 3:e:{if(tx(e),t===null)throw Error(ae(387));r=e.pendingProps,a=e.memoizedState,i=a.element,kC(t,e),zd(e,r,null,n);var s=e.memoizedState;if(r=s.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=a,e.memoizedState=a,e.flags&256){i=Bs(Error(ae(423)),e),e=H_(t,e,r,n,i);break e}else if(r!==i){i=Bs(Error(ae(424)),e),e=H_(t,e,r,n,i);break e}else for(Wn=wa(e.stateNode.containerInfo.firstChild),Vn=e,ft=!0,Nr=null,n=TC(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ms(),r===i){e=Ui(t,e,n);break e}vn(t,e,r,n)}e=e.child}return e;case 5:return RC(e),t===null&&pv(e),r=e.type,i=e.pendingProps,a=t!==null?t.memoizedProps:null,s=i.children,uv(r,i)?s=null:a!==null&&uv(r,a)&&(e.flags|=32),ex(t,e),vn(t,e,s,n),e.child;case 6:return t===null&&pv(e),null;case 13:return nx(t,e,n);case 4:return Hy(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Ds(e,null,r,n):vn(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Lr(r,i),G_(t,e,r,i,n);case 7:return vn(t,e,e.pendingProps,n),e.child;case 8:return vn(t,e,e.pendingProps.children,n),e.child;case 12:return vn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,a=e.memoizedProps,s=i.value,at(Fd,r._currentValue),r._currentValue=s,a!==null)if(Gr(a.value,s)){if(a.children===i.children&&!Rn.current){e=Ui(t,e,n);break e}}else for(a=e.child,a!==null&&(a.return=e);a!==null;){var u=a.dependencies;if(u!==null){s=a.child;for(var c=u.firstContext;c!==null;){if(c.context===r){if(a.tag===1){c=Bi(-1,n&-n),c.tag=2;var f=a.updateQueue;if(f!==null){f=f.shared;var h=f.pending;h===null?c.next=c:(c.next=h.next,h.next=c),f.pending=c}}a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),gv(a.return,n,e),u.lanes|=n;break}c=c.next}}else if(a.tag===10)s=a.type===e.type?null:a.child;else if(a.tag===18){if(s=a.return,s===null)throw Error(ae(341));s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),gv(s,n,e),s=a.sibling}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}vn(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,xs(e,n),i=mr(i),r=r(i),e.flags|=1,vn(t,e,r,n),e.child;case 14:return r=e.type,i=Lr(r,e.pendingProps),i=Lr(r.type,i),U_(t,e,r,i,n);case 15:return JC(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Lr(r,i),id(t,e),e.tag=1,An(r)?(t=!0,Dd(e)):t=!1,xs(e,n),PC(e,r,i),vv(e,r,i,n),_v(null,e,r,!0,t,n);case 19:return rx(t,e,n);case 22:return ZC(t,e,n)}throw Error(ae(156,e.tag))};function Sx(t,e){return W2(t,e)}function XD(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,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 hr(t,e,n,r){return new XD(t,e,n,r)}function a0(t){return t=t.prototype,!(!t||!t.isReactComponent)}function QD(t){if(typeof t=="function")return a0(t)?1:0;if(t!=null){if(t=t.$$typeof,t===xy)return 11;if(t===ky)return 14}return 2}function ka(t,e){var n=t.alternate;return n===null?(n=hr(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function sd(t,e,n,r,i,a){var s=2;if(r=t,typeof t=="function")a0(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case ls:return oo(n.children,i,a,e);case Cy:s=8,i|=8;break;case Gm:return t=hr(12,n,e,i|2),t.elementType=Gm,t.lanes=a,t;case Um:return t=hr(13,n,e,i),t.elementType=Um,t.lanes=a,t;case jm:return t=hr(19,n,e,i),t.elementType=jm,t.lanes=a,t;case O2:return xh(n,i,a,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case E2:s=10;break e;case P2:s=9;break e;case xy:s=11;break e;case ky:s=14;break e;case ca:s=16,r=null;break e}throw Error(ae(130,t==null?t:typeof t,""))}return e=hr(s,n,e,i),e.elementType=t,e.type=r,e.lanes=a,e}function oo(t,e,n,r){return t=hr(7,t,r,e),t.lanes=n,t}function xh(t,e,n,r){return t=hr(22,t,r,e),t.elementType=O2,t.lanes=n,t.stateNode={isHidden:!1},t}function dm(t,e,n){return t=hr(6,t,null,e),t.lanes=n,t}function hm(t,e,n){return e=hr(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function JD(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qg(0),this.expirationTimes=qg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qg(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function o0(t,e,n,r,i,a,s,u,c){return t=new JD(t,e,n,u,c),e===1?(e=1,a===!0&&(e|=8)):e=0,a=hr(3,null,null,e),t.current=a,a.stateNode=t,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},jy(a),t}function ZD(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}e(),t.exports=Qn})(eM);const OG=p2(_u);var nw=_u;Fm.createRoot=nw.createRoot,Fm.hydrateRoot=nw.hydrateRoot;const i3="modulepreload",a3=function(t,e){return new URL(t,e).href},rw={},Cx=function(e,n,r){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(a=>{if(a=a3(a,r),a in rw)return;rw[a]=!0;const s=a.endsWith(".css"),u=s?'[rel="stylesheet"]':"";if(!!r)for(let h=i.length-1;h>=0;h--){const p=i[h];if(p.href===a&&(!s||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${u}`))return;const f=document.createElement("link");if(f.rel=s?"stylesheet":i3,s||(f.as="script",f.crossOrigin=""),f.href=a,document.head.appendChild(f),s)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${a}`)))})})).then(()=>e())};var Iv={},o3={get exports(){return Iv},set exports(t){Iv=t}},xx={};/** - * @license React - * use-sync-external-store-shim.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 $s=be;function s3(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var l3=typeof Object.is=="function"?Object.is:s3,u3=$s.useState,c3=$s.useEffect,f3=$s.useLayoutEffect,d3=$s.useDebugValue;function h3(t,e){var n=e(),r=u3({inst:{value:n,getSnapshot:e}}),i=r[0].inst,a=r[1];return f3(function(){i.value=n,i.getSnapshot=e,pm(i)&&a({inst:i})},[t,n,e]),c3(function(){return pm(i)&&a({inst:i}),t(function(){pm(i)&&a({inst:i})})},[t]),d3(n),n}function pm(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!l3(t,n)}catch{return!0}}function p3(t,e){return e()}var g3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p3:h3;xx.useSyncExternalStore=$s.useSyncExternalStore!==void 0?$s.useSyncExternalStore:g3;(function(t){t.exports=xx})(o3);var Lv={},m3={get exports(){return Lv},set exports(t){Lv=t}},kx={};/** - * @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 Th=be,v3=Iv;function y3(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var S3=typeof Object.is=="function"?Object.is:y3,_3=v3.useSyncExternalStore,w3=Th.useRef,b3=Th.useEffect,C3=Th.useMemo,x3=Th.useDebugValue;kx.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var a=w3(null);if(a.current===null){var s={hasValue:!1,value:null};a.current=s}else s=a.current;a=C3(function(){function c(y){if(!f){if(f=!0,h=y,y=r(y),i!==void 0&&s.hasValue){var v=s.value;if(i(v,y))return p=v}return p=y}if(v=p,S3(h,y))return v;var w=r(y);return i!==void 0&&i(v,w)?v:(h=y,p=w)}var f=!1,h,p,g=n===void 0?null:n;return[function(){return c(e())},g===null?void 0:function(){return c(g())}]},[e,n,r,i]);var u=_3(t,a[0],a[1]);return b3(function(){s.hasValue=!0,s.value=u},[u]),x3(u),u};(function(t){t.exports=kx})(m3);function k3(t){t()}let Ex=k3;const E3=t=>Ex=t,P3=()=>Ex,Yd=be.createContext(null);function O3(){return be.useContext(Yd)}const T3=()=>{throw new Error("uSES not initialized!")};let Px=T3;const R3=t=>{Px=t},A3=(t,e)=>t===e;function I3(t=Yd){const e=t===Yd?O3:()=>be.useContext(t);return function(r,i=A3){const{store:a,subscription:s,getServerState:u}=e(),c=Px(s.addNestedSub,a.getState,u||a.getState,r,i);return be.useDebugValue(c),c}}const TG=I3();function Xd(){return Xd=Object.assign?Object.assign.bind():function(t){for(var e=1;e{let r=e;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=e;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,a=n={callback:r,next:null,prev:n};return a.prev?a.prev.next=a:e=a,function(){!i||e===null||(i=!1,a.next?a.next.prev=a.prev:n=a.prev,a.prev?a.prev.next=a.next:e=a.next)}}}}const aw={notify(){},get:()=>[]};function W3(t,e){let n,r=aw;function i(p){return c(),r.subscribe(p)}function a(){r.notify()}function s(){h.onStateChange&&h.onStateChange()}function u(){return Boolean(n)}function c(){n||(n=e?e.addNestedSub(s):t.subscribe(s),r=H3())}function f(){n&&(n(),n=void 0,r.clear(),r=aw)}const h={addNestedSub:i,notifyNestedSubs:a,handleChangeWrapper:s,isSubscribed:u,trySubscribe:c,tryUnsubscribe:f,getListeners:()=>r};return h}const V3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",q3=V3?be.useLayoutEffect:be.useEffect;function K3({store:t,context:e,children:n,serverState:r}){const i=be.useMemo(()=>{const u=W3(t);return{store:t,subscription:u,getServerState:r?()=>r:void 0}},[t,r]),a=be.useMemo(()=>t.getState(),[t]);q3(()=>{const{subscription:u}=i;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),a!==t.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[i,a]);const s=e||Yd;return As.createElement(s.Provider,{value:i},n)}R3(Lv.useSyncExternalStoreWithSelector);E3(_u.unstable_batchedUpdates);function ld(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ld=function(n){return typeof n}:ld=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},ld(t)}function Y3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ow(t,e){for(var n=0;n1?e-1:0),r=1;r3?e.i-4:e.i:Array.isArray(t)?1:g0(t)?2:m0(t)?3:0}function Es(t,e){return Ws(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Z3(t,e){return Ws(t)===2?t.get(e):t[e]}function Lx(t,e,n){var r=Ws(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function Mx(t,e){return t===e?t!==0||1/t==1/e:t!=t&&e!=e}function g0(t){return aN&&t instanceof Map}function m0(t){return oN&&t instanceof Set}function Za(t){return t.o||t.t}function v0(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=Nx(t);delete e[ct];for(var n=Ps(e),r=0;r1&&(t.set=t.add=t.clear=t.delete=eN),Object.freeze(t),e&&ho(t,function(n,r){return y0(r,!0)},!0)),t}function eN(){Br(2)}function S0(t){return t==null||typeof t!="object"||Object.isFrozen(t)}function li(t){var e=zv[t];return e||Br(18,t),e}function tN(t,e){zv[t]||(zv[t]=e)}function Bv(){return Fu}function gm(t,e){e&&(li("Patches"),t.u=[],t.s=[],t.v=e)}function Qd(t){Fv(t),t.p.forEach(nN),t.p=null}function Fv(t){t===Fu&&(Fu=t.l)}function sw(t){return Fu={p:[],l:Fu,h:t,m:!0,_:0}}function nN(t){var e=t[ct];e.i===0||e.i===1?e.j():e.O=!0}function mm(t,e){e._=e.p.length;var n=e.p[0],r=t!==void 0&&t!==n;return e.h.g||li("ES5").S(e,t,r),r?(n[ct].P&&(Qd(e),Br(4)),ji(t)&&(t=Jd(e,t),e.l||Zd(e,t)),e.u&&li("Patches").M(n[ct].t,t,e.u,e.s)):t=Jd(e,n,[]),Qd(e),e.u&&e.v(e.u,e.s),t!==Dx?t:void 0}function Jd(t,e,n){if(S0(e))return e;var r=e[ct];if(!r)return ho(e,function(u,c){return lw(t,r,e,u,c,n)},!0),e;if(r.A!==t)return e;if(!r.P)return Zd(t,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=v0(r.k):r.o,a=i,s=!1;r.i===3&&(a=new Set(i),i.clear(),s=!0),ho(a,function(u,c){return lw(t,r,i,u,c,n,s)}),Zd(t,i,!1),n&&t.u&&li("Patches").N(r,n,t.u,t.s)}return r.o}function lw(t,e,n,r,i,a,s){if(Ra(i)){var u=Jd(t,i,a&&e&&e.i!==3&&!Es(e.R,r)?a.concat(r):void 0);if(Lx(n,r,u),!Ra(u))return;t.m=!1}else s&&n.add(i);if(ji(i)&&!S0(i)){if(!t.h.D&&t._<1)return;Jd(t,i),e&&e.A.l||Zd(t,i)}}function Zd(t,e,n){n===void 0&&(n=!1),!t.l&&t.h.D&&t.m&&y0(e,n)}function vm(t,e){var n=t[ct];return(n?Za(n):t)[e]}function uw(t,e){if(e in t)for(var n=Object.getPrototypeOf(t);n;){var r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function pa(t){t.P||(t.P=!0,t.l&&pa(t.l))}function ym(t){t.o||(t.o=v0(t.t))}function $v(t,e,n){var r=g0(e)?li("MapSet").F(e,n):m0(e)?li("MapSet").T(e,n):t.g?function(i,a){var s=Array.isArray(i),u={i:s?1:0,A:a?a.A:Bv(),P:!1,I:!1,R:{},l:a,t:i,k:null,o:null,j:null,C:!1},c=u,f=$u;s&&(c=[u],f=Jl);var h=Proxy.revocable(c,f),p=h.revoke,g=h.proxy;return u.k=g,u.j=p,g}(e,n):li("ES5").J(e,n);return(n?n.A:Bv()).p.push(r),r}function rN(t){return Ra(t)||Br(22,t),function e(n){if(!ji(n))return n;var r,i=n[ct],a=Ws(n);if(i){if(!i.P&&(i.i<4||!li("ES5").K(i)))return i.t;i.I=!0,r=cw(n,a),i.I=!1}else r=cw(n,a);return ho(r,function(s,u){i&&Z3(i.t,s)===u||Lx(r,s,e(u))}),a===3?new Set(r):r}(t)}function cw(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return v0(t)}function iN(){function t(a,s){var u=i[a];return u?u.enumerable=s:i[a]=u={configurable:!0,enumerable:s,get:function(){var c=this[ct];return $u.get(c,a)},set:function(c){var f=this[ct];$u.set(f,a,c)}},u}function e(a){for(var s=a.length-1;s>=0;s--){var u=a[s][ct];if(!u.P)switch(u.i){case 5:r(u)&&pa(u);break;case 4:n(u)&&pa(u)}}}function n(a){for(var s=a.t,u=a.k,c=Ps(u),f=c.length-1;f>=0;f--){var h=c[f];if(h!==ct){var p=s[h];if(p===void 0&&!Es(s,h))return!0;var g=u[h],y=g&&g[ct];if(y?y.t!==p:!Mx(g,p))return!0}}var v=!!s[ct];return c.length!==Ps(s).length+(v?0:1)}function r(a){var s=a.k;if(s.length!==a.t.length)return!0;var u=Object.getOwnPropertyDescriptor(s,s.length-1);if(u&&!u.get)return!0;for(var c=0;c1?_-1:0),C=1;C<_;C++)S[C-1]=arguments[C];return c.produce(w,function(O){var I;return(I=a).call.apply(I,[x,O].concat(S))})}}var f;if(typeof a!="function"&&Br(6),s!==void 0&&typeof s!="function"&&Br(7),ji(i)){var h=sw(r),p=$v(r,i,void 0),g=!0;try{f=a(p),g=!1}finally{g?Qd(h):Fv(h)}return typeof Promise<"u"&&f instanceof Promise?f.then(function(w){return gm(h,s),mm(w,h)},function(w){throw Qd(h),w}):(gm(h,s),mm(f,h))}if(!i||typeof i!="object"){if((f=a(i))===void 0&&(f=i),f===Dx&&(f=void 0),r.D&&y0(f,!0),s){var y=[],v=[];li("Patches").M(i,f,y,v),s(y,v)}return f}Br(21,i)},this.produceWithPatches=function(i,a){if(typeof i=="function")return function(f){for(var h=arguments.length,p=Array(h>1?h-1:0),g=1;g=0;i--){var a=r[i];if(a.path.length===0&&a.op==="replace"){n=a.value;break}}i>-1&&(r=r.slice(i+1));var s=li("Patches").$;return Ra(n)?s(n,r):this.produce(n,function(u){return s(u,r)})},t}(),Xn=new lN,Bx=Xn.produce;Xn.produceWithPatches.bind(Xn);Xn.setAutoFreeze.bind(Xn);Xn.setUseProxies.bind(Xn);Xn.applyPatches.bind(Xn);Xn.createDraft.bind(Xn);Xn.finishDraft.bind(Xn);function gr(t){return gr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gr(t)}function uN(t,e){if(gr(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(gr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fx(t){var e=uN(t,"string");return gr(e)==="symbol"?e:String(e)}function Ur(t,e,n){return e=Fx(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gw(t){for(var e=1;e"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(un(1));return n(w0)(t,e)}if(typeof t!="function")throw new Error(un(2));var i=t,a=e,s=[],u=s,c=!1;function f(){u===s&&(u=s.slice())}function h(){if(c)throw new Error(un(3));return a}function p(w){if(typeof w!="function")throw new Error(un(4));if(c)throw new Error(un(5));var x=!0;return f(),u.push(w),function(){if(x){if(c)throw new Error(un(6));x=!1,f();var S=u.indexOf(w);u.splice(S,1),s=null}}}function g(w){if(!cN(w))throw new Error(un(7));if(typeof w.type>"u")throw new Error(un(8));if(c)throw new Error(un(9));try{c=!0,a=i(a,w)}finally{c=!1}for(var x=s=u,_=0;_"u")throw new Error(un(12));if(typeof n(void 0,{type:eh.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(un(13))})}function $x(t){for(var e=Object.keys(t),n={},r=0;r"u")throw f&&f.type,new Error(un(14));p[y]=x,h=h||x!==w}return h=h||a.length!==Object.keys(c).length,h?p:c}}function th(){for(var t=arguments.length,e=new Array(t),n=0;n0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]{Object.keys(L).forEach(function(D){C(D)&&h[D]!==L[D]&&g.indexOf(D)===-1&&g.push(D)}),Object.keys(h).forEach(function(D){L[D]===void 0&&C(D)&&g.indexOf(D)===-1&&h[D]!==void 0&&g.push(D)}),y===null&&(y=setInterval(_,i)),h=L},a)}function _(){if(g.length===0){y&&clearInterval(y),y=null;return}var L=g.shift(),D=r.reduce(function(U,X){return X.in(U,L,h)},h[L]);if(D!==void 0)try{p[L]=c(D)}catch(U){console.error("redux-persist/createPersistoid: error serializing state",U)}else delete p[L];g.length===0&&S()}function S(){Object.keys(p).forEach(function(L){h[L]===void 0&&delete p[L]}),v=u.setItem(s,c(p)).catch(O)}function C(L){return!(n&&n.indexOf(L)===-1&&L!=="_persist"||e&&e.indexOf(L)!==-1)}function O(L){f&&f(L)}var I=function(){for(;g.length!==0;)_();return v||Promise.resolve()};return{update:x,flush:I}}function jN(t){return JSON.stringify(t)}function HN(t){var e=t.transforms||[],n="".concat(t.keyPrefix!==void 0?t.keyPrefix:C0).concat(t.key),r=t.storage;t.debug;var i;return t.deserialize===!1?i=function(s){return s}:typeof t.deserialize=="function"?i=t.deserialize:i=WN,r.getItem(n).then(function(a){if(a)try{var s={},u=i(a);return Object.keys(u).forEach(function(c){s[c]=e.reduceRight(function(f,h){return h.out(f,c,u)},i(u[c]))}),s}catch(c){throw c}else return})}function WN(t){return JSON.parse(t)}function VN(t){var e=t.storage,n="".concat(t.keyPrefix!==void 0?t.keyPrefix:C0).concat(t.key);return e.removeItem(n,qN)}function qN(t){}function Cw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ti(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function XN(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,a;for(a=0;a=0)&&(n[i]=t[i]);return n}var QN=5e3;function JN(t,e){var n=t.version!==void 0?t.version:FN;t.debug;var r=t.stateReconciler===void 0?GN:t.stateReconciler,i=t.getStoredState||HN,a=t.timeout!==void 0?t.timeout:QN,s=null,u=!1,c=!0,f=function(p){return p._persist.rehydrated&&s&&!c&&s.update(p),p};return function(h,p){var g=h||{},y=g._persist,v=YN(g,["_persist"]),w=v;if(p.type===Wx){var x=!1,_=function(U,X){x||(p.rehydrate(t.key,U,X),x=!0)};if(a&&setTimeout(function(){!x&&_(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(t.key,'"')))},a),c=!1,s||(s=UN(t)),y)return Ti({},e(w,p),{_persist:y});if(typeof p.rehydrate!="function"||typeof p.register!="function")throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return p.register(t.key),i(t).then(function(D){var U=t.migrate||function(X,K){return Promise.resolve(X)};U(D,n).then(function(X){_(X)},function(X){_(void 0,X)})},function(D){_(void 0,D)}),Ti({},e(w,p),{_persist:{version:n,rehydrated:!1}})}else{if(p.type===Vx)return u=!0,p.result(VN(t)),Ti({},e(w,p),{_persist:y});if(p.type===jx)return p.result(s&&s.flush()),Ti({},e(w,p),{_persist:y});if(p.type===Hx)c=!0;else if(p.type===x0){if(u)return Ti({},w,{_persist:Ti({},y,{rehydrated:!0})});if(p.key===t.key){var S=e(w,p),C=p.payload,O=r!==!1&&C!==void 0?r(C,h,S,t):S,I=Ti({},O,{_persist:Ti({},y,{rehydrated:!0})});return f(I)}}}if(!y)return e(h,p);var L=e(w,p);return L===w?h:f(Ti({},L,{_persist:y}))}}function xw(t){return t5(t)||e5(t)||ZN()}function ZN(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function e5(t){if(Symbol.iterator in Object(t)||Object.prototype.toString.call(t)==="[object Arguments]")return Array.from(t)}function t5(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&arguments[0]!==void 0?arguments[0]:Kx,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case qx:return Uv({},e,{registry:[].concat(xw(e.registry),[n.key])});case x0:var r=e.registry.indexOf(n.key),i=xw(e.registry);return i.splice(r,1),Uv({},e,{registry:i,bootstrapped:i.length===0});default:return e}};function i5(t,e,n){var r=n||!1,i=w0(r5,Kx,e&&e.enhancer?e.enhancer:void 0),a=function(f){i.dispatch({type:qx,key:f})},s=function(f,h,p){var g={type:x0,payload:h,err:p,key:f};t.dispatch(g),i.dispatch(g),r&&u.getState().bootstrapped&&(r(),r=!1)},u=Uv({},i,{purge:function(){var f=[];return t.dispatch({type:Vx,result:function(p){f.push(p)}}),Promise.all(f)},flush:function(){var f=[];return t.dispatch({type:jx,result:function(p){f.push(p)}}),Promise.all(f)},pause:function(){t.dispatch({type:Hx})},persist:function(){t.dispatch({type:Wx,register:a,rehydrate:s})}});return e&&e.manualPersist||u.persist(),u}var k0={},E0={};E0.__esModule=!0;E0.default=s5;function dd(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?dd=function(n){return typeof n}:dd=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},dd(t)}function bm(){}var a5={getItem:bm,setItem:bm,removeItem:bm};function o5(t){if((typeof self>"u"?"undefined":dd(self))!=="object"||!(t in self))return!1;try{var e=self[t],n="redux-persist ".concat(t," test");e.setItem(n,"test"),e.getItem(n),e.removeItem(n)}catch{return!1}return!0}function s5(t){var e="".concat(t,"Storage");return o5(e)?self[e]:a5}k0.__esModule=!0;k0.default=c5;var l5=u5(E0);function u5(t){return t&&t.__esModule?t:{default:t}}function c5(t){var e=(0,l5.default)(t);return{getItem:function(r){return new Promise(function(i,a){i(e.getItem(r))})},setItem:function(r,i){return new Promise(function(a,s){a(e.setItem(r,i))})},removeItem:function(r){return new Promise(function(i,a){i(e.removeItem(r))})}}}var Yx=void 0,f5=d5(k0);function d5(t){return t&&t.__esModule?t:{default:t}}var h5=(0,f5.default)("local");Yx=h5;var Xx={},Qx={},po={};Object.defineProperty(po,"__esModule",{value:!0});po.PLACEHOLDER_UNDEFINED=po.PACKAGE_NAME=void 0;po.PACKAGE_NAME="redux-deep-persist";po.PLACEHOLDER_UNDEFINED="@@placeholder/undefined";var P0={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigType=void 0,function(e){e[e.WHITELIST=0]="WHITELIST",e[e.BLACKLIST=1]="BLACKLIST"}(t.ConfigType||(t.ConfigType={}))})(P0);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getRootKeysGroup=t.throwError=t.configValidator=t.transformsValidator=t.singleTransformValidator=t.findDuplicatesAndSubsets=t.unique=t.preserveUndefined=t.mergeDeep=t.dissocPath=t.assocPath=t.path=t.difference=t.cloneDeep=t._cloneDeep=t.getCircularPath=t.isEmpty=t.isDate=t.isString=t.isIntegerString=t.isPlainObject=t.isArray=t.isLength=t.isObjectLike=void 0;const e=po,n=P0,r=function(j){return typeof j=="object"&&j!==null};t.isObjectLike=r;const i=function(j){return typeof j=="number"&&j>-1&&j%1==0&&j<=Number.MAX_SAFE_INTEGER};t.isLength=i,t.isArray=Array.isArray||function(j){return(0,t.isLength)(j&&j.length)&&Object.prototype.toString.call(j)==="[object Array]"};const a=function(j){return!!j&&typeof j=="object"&&!(0,t.isArray)(j)};t.isPlainObject=a;const s=function(j){return String(~~j)===j&&Number(j)>=0};t.isIntegerString=s;const u=function(j){return Object.prototype.toString.call(j)==="[object String]"};t.isString=u;const c=function(j){return Object.prototype.toString.call(j)==="[object Date]"};t.isDate=c;const f=function(j){return Object.keys(j).length===0};t.isEmpty=f;const h=Object.prototype.hasOwnProperty,p=function(j,T,$){$||($=new Set([j])),T||(T="");for(const V in j){const ie=T?`${T}.${V}`:V,H=j[V];if((0,t.isObjectLike)(H))return $.has(H)?`${T}.${V}:`:($.add(H),(0,t.getCircularPath)(H,ie,$))}return null};t.getCircularPath=p;const g=function(j){if(!(0,t.isObjectLike)(j))return j;if((0,t.isDate)(j))return new Date(+j);const T=(0,t.isArray)(j)?[]:{};for(const $ in j){const V=j[$];T[$]=(0,t._cloneDeep)(V)}return T};t._cloneDeep=g;const y=function(j){const T=(0,t.getCircularPath)(j);if(T)throw new Error(`${e.PACKAGE_NAME}: circular dependency detected under the path '${T}' of object you're trying to persist: ${j}`);return(0,t._cloneDeep)(j)};t.cloneDeep=y;const v=function(j,T){if(j===T)return{};if(!(0,t.isObjectLike)(j)||!(0,t.isObjectLike)(T))return T;const $=(0,t.cloneDeep)(j),V=(0,t.cloneDeep)(T),ie=Object.keys($).reduce((Y,Q)=>(h.call(V,Q)||(Y[Q]=void 0),Y),{});if((0,t.isDate)($)||(0,t.isDate)(V))return $.valueOf()===V.valueOf()?{}:V;const H=Object.keys(V).reduce((Y,Q)=>{if(!h.call($,Q))return Y[Q]=V[Q],Y;const oe=(0,t.difference)($[Q],V[Q]);return(0,t.isObjectLike)(oe)&&(0,t.isEmpty)(oe)&&!(0,t.isDate)(oe)?(0,t.isArray)($)&&!(0,t.isArray)(V)||!(0,t.isArray)($)&&(0,t.isArray)(V)?V:Y:(Y[Q]=oe,Y)},ie);return delete H._persist,H};t.difference=v;const w=function(j,T){return T.reduce(($,V)=>{if($){const ie=parseInt(V,10),H=(0,t.isIntegerString)(V)&&ie<0?$.length+ie:V;return(0,t.isString)($)?$.charAt(H):$[H]}},j)};t.path=w;const x=function(j,T){return[...j].reverse().reduce((ie,H,Y)=>{const Q=(0,t.isIntegerString)(H)?[]:{};return Q[H]=Y===0?T:ie,Q},{})};t.assocPath=x;const _=function(j,T){const $=(0,t.cloneDeep)(j);return T.reduce((V,ie,H)=>(H===T.length-1&&V&&(0,t.isObjectLike)(V)&&delete V[ie],V&&V[ie]),$),$};t.dissocPath=_;const S=function(j,T,...$){if(!$||!$.length)return T;const V=$.shift(),{preservePlaceholder:ie,preserveUndefined:H}=j;if((0,t.isObjectLike)(T)&&(0,t.isObjectLike)(V))for(const Y in V)if((0,t.isObjectLike)(V[Y])&&(0,t.isObjectLike)(T[Y]))T[Y]||(T[Y]={}),S(j,T[Y],V[Y]);else if((0,t.isArray)(T)){let Q=V[Y];const oe=ie?e.PLACEHOLDER_UNDEFINED:void 0;H||(Q=typeof Q<"u"?Q:T[parseInt(Y,10)]),Q=Q!==e.PLACEHOLDER_UNDEFINED?Q:oe,T[parseInt(Y,10)]=Q}else{const Q=V[Y]!==e.PLACEHOLDER_UNDEFINED?V[Y]:void 0;T[Y]=Q}return S(j,T,...$)},C=function(j,T,$){return S({preservePlaceholder:$==null?void 0:$.preservePlaceholder,preserveUndefined:$==null?void 0:$.preserveUndefined},(0,t.cloneDeep)(j),(0,t.cloneDeep)(T))};t.mergeDeep=C;const O=function(j,T=[],$,V,ie){if(!(0,t.isObjectLike)(j))return j;for(const H in j){const Y=j[H],Q=(0,t.isArray)(j),oe=V?V+"."+H:H;Y===null&&($===n.ConfigType.WHITELIST&&T.indexOf(oe)===-1||$===n.ConfigType.BLACKLIST&&T.indexOf(oe)!==-1)&&Q&&(j[parseInt(H,10)]=void 0),Y===void 0&&ie&&$===n.ConfigType.BLACKLIST&&T.indexOf(oe)===-1&&Q&&(j[parseInt(H,10)]=e.PLACEHOLDER_UNDEFINED),O(Y,T,$,oe,ie)}},I=function(j,T,$,V){const ie=(0,t.cloneDeep)(j);return O(ie,T,$,"",V),ie};t.preserveUndefined=I;const L=function(j,T,$){return $.indexOf(j)===T};t.unique=L;const D=function(j){return j.reduce((T,$)=>{const V=j.filter(ve=>ve===$),ie=j.filter(ve=>($+".").indexOf(ve+".")===0),{duplicates:H,subsets:Y}=T,Q=V.length>1&&H.indexOf($)===-1,oe=ie.length>1;return{duplicates:[...H,...Q?V:[]],subsets:[...Y,...oe?ie:[]].filter(t.unique).sort()}},{duplicates:[],subsets:[]})};t.findDuplicatesAndSubsets=D;const U=function(j,T,$){const V=$===n.ConfigType.WHITELIST?"whitelist":"blacklist",ie=`${e.PACKAGE_NAME}: incorrect ${V} configuration.`,H=`Check your create${$===n.ConfigType.WHITELIST?"White":"Black"}list arguments. - -`;if(!(0,t.isString)(T)||T.length<1)throw new Error(`${ie} Name (key) of reducer is required. ${H}`);if(!j||!j.length)return;const{duplicates:Y,subsets:Q}=(0,t.findDuplicatesAndSubsets)(j);if(Y.length>1)throw new Error(`${ie} Duplicated paths. - - ${JSON.stringify(Y)} - - ${H}`);if(Q.length>1)throw new Error(`${ie} You are trying to persist an entire property and also some of its subset. - -${JSON.stringify(Q)} - - ${H}`)};t.singleTransformValidator=U;const X=function(j){if(!(0,t.isArray)(j))return;const T=(j==null?void 0:j.map($=>$.deepPersistKey).filter($=>$))||[];if(T.length){const $=T.filter((V,ie)=>T.indexOf(V)!==ie);if($.length)throw new Error(`${e.PACKAGE_NAME}: found duplicated keys in transforms creators. You can createWhitelist or createBlacklist for a specific root reducer key only once. Duplicated keys among createWhitelist and createBlacklist transforms are not allowed. - - Duplicates: ${JSON.stringify($)}`)}};t.transformsValidator=X;const K=function({whitelist:j,blacklist:T}){if(j&&j.length&&T&&T.length)throw new Error(`${e.PACKAGE_NAME}: you should not define a whitelist and blacklist in parallel. It is allowed to use only one of these lists per config.`);if(j){const{duplicates:$,subsets:V}=(0,t.findDuplicatesAndSubsets)(j);(0,t.throwError)({duplicates:$,subsets:V},"whitelist")}if(T){const{duplicates:$,subsets:V}=(0,t.findDuplicatesAndSubsets)(T);(0,t.throwError)({duplicates:$,subsets:V},"blacklist")}};t.configValidator=K;const te=function({duplicates:j,subsets:T},$){if(j.length)throw new Error(`${e.PACKAGE_NAME}: duplicates of paths found in your ${$}. - - ${JSON.stringify(j)}`);if(T.length)throw new Error(`${e.PACKAGE_NAME}: subsets of some parent keys found in your ${$}. You must decide if you want to persist an entire path or its specific subset. - - ${JSON.stringify(T)}`)};t.throwError=te;const ce=function(j){return(0,t.isArray)(j)?j.filter(t.unique).reduce((T,$)=>{const V=$.split("."),ie=V[0],H=V.slice(1).join(".")||void 0,Y=T.filter(oe=>Object.keys(oe)[0]===ie)[0],Q=Y?Object.values(Y)[0]:void 0;return Y||T.push({[ie]:H?[H]:void 0}),Y&&!Q&&H&&(Y[ie]=[H]),Y&&Q&&H&&Q.push(H),T},[]):[]};t.getRootKeysGroup=ce})(Qx);(function(t){var e=yn&&yn.__rest||function(p,g){var y={};for(var v in p)Object.prototype.hasOwnProperty.call(p,v)&&g.indexOf(v)<0&&(y[v]=p[v]);if(p!=null&&typeof Object.getOwnPropertySymbols=="function")for(var w=0,v=Object.getOwnPropertySymbols(p);w!x(S)&&p?p(_,S,C):_,out:(_,S,C)=>!x(S)&&g?g(_,S,C):_,deepPersistKey:v&&v[0]}},s=(p,g,y,{debug:v,whitelist:w,blacklist:x,transforms:_})=>{if(w||x)throw new Error("State reconciler autoMergeDeep uses custom transforms instead of old whitelist or blacklist config properties. Please use createWhitelist or createBlacklist transforms.");(0,n.transformsValidator)(_);const S=(0,n.cloneDeep)(y);let C=p;if(C&&(0,n.isObjectLike)(C)){const O=(0,n.difference)(g,y);(0,n.isEmpty)(O)||(C=(0,n.mergeDeep)(p,O,{preserveUndefined:!0}),v&&console.log(`${r.PACKAGE_NAME}/autoMergeDeep: sub state of your state was modified by reducer during rehydration. Values from reducer will be kept: ${JSON.stringify(O)}`)),Object.keys(C).forEach(I=>{if(I!=="_persist"){if((0,n.isObjectLike)(S[I])){S[I]=(0,n.mergeDeep)(S[I],C[I]);return}S[I]=C[I]}})}return v&&C&&(0,n.isObjectLike)(C)&&console.log(`${r.PACKAGE_NAME}/autoMergeDeep: rehydrated keys ${JSON.stringify(C)}`),S};t.autoMergeDeep=s;const u=(p,g)=>((0,n.singleTransformValidator)(g,p,i.ConfigType.WHITELIST),a(y=>{if(!g||!g.length)return y;let v=null,w;return g.forEach(x=>{const _=x.split(".");w=(0,n.path)(y,_),typeof w>"u"&&(0,n.isIntegerString)(_[_.length-1])&&(w=r.PLACEHOLDER_UNDEFINED);const S=(0,n.assocPath)(_,w),C=(0,n.isArray)(S)?[]:{};v=(0,n.mergeDeep)(v||C,S,{preservePlaceholder:!0})}),v||y},y=>(0,n.preserveUndefined)(y,g,i.ConfigType.WHITELIST),{whitelist:[p]}));t.createWhitelist=u;const c=(p,g)=>((0,n.singleTransformValidator)(g,p,i.ConfigType.BLACKLIST),a(y=>{if(!g||!g.length)return;const v=(0,n.preserveUndefined)(y,g,i.ConfigType.BLACKLIST,!0);return g.map(x=>x.split(".")).reduce((x,_)=>(0,n.dissocPath)(x,_),v)},y=>(0,n.preserveUndefined)(y,g,i.ConfigType.BLACKLIST),{whitelist:[p]}));t.createBlacklist=c;const f=function(p,g){return g.map(y=>{const v=Object.keys(y)[0],w=y[v];return p===i.ConfigType.WHITELIST?(0,t.createWhitelist)(v,w):(0,t.createBlacklist)(v,w)})};t.getTransforms=f;const h=p=>{var{key:g,whitelist:y,blacklist:v,storage:w,transforms:x,rootReducer:_}=p,S=e(p,["key","whitelist","blacklist","storage","transforms","rootReducer"]);(0,n.configValidator)({whitelist:y,blacklist:v});const C=(0,n.getRootKeysGroup)(y),O=(0,n.getRootKeysGroup)(v),I=Object.keys(_(void 0,{type:""})),L=C.map(ce=>Object.keys(ce)[0]),D=O.map(ce=>Object.keys(ce)[0]),U=I.filter(ce=>L.indexOf(ce)===-1&&D.indexOf(ce)===-1),X=(0,t.getTransforms)(i.ConfigType.WHITELIST,C),K=(0,t.getTransforms)(i.ConfigType.BLACKLIST,O),te=(0,n.isArray)(y)?U.map(ce=>(0,t.createBlacklist)(ce)):[];return Object.assign(Object.assign({},S),{key:g,storage:w,transforms:[...X,...K,...te,...x||[]],stateReconciler:t.autoMergeDeep})};t.getPersistConfig=h})(Xx);const Of=(t,e)=>Math.floor(t/e)*e,va=(t,e)=>Math.round(t/e)*e;var _t={},p5={get exports(){return _t},set exports(t){_t=t}};/** - * @license - * Lodash - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */(function(t,e){(function(){var n,r="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",u="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",f=500,h="__lodash_placeholder__",p=1,g=2,y=4,v=1,w=2,x=1,_=2,S=4,C=8,O=16,I=32,L=64,D=128,U=256,X=512,K=30,te="...",ce=800,j=16,T=1,$=2,V=3,ie=1/0,H=9007199254740991,Y=17976931348623157e292,Q=0/0,oe=4294967295,ve=oe-1,we=oe>>>1,Ue=[["ary",D],["bind",x],["bindKey",_],["curry",C],["curryRight",O],["flip",X],["partial",I],["partialRight",L],["rearg",U]],At="[object Arguments]",me="[object Array]",qt="[object AsyncFunction]",Bt="[object Boolean]",bn="[object Date]",wr="[object DOMException]",Ft="[object Error]",xe="[object Function]",Hr="[object GeneratorFunction]",Pt="[object Map]",gi="[object Number]",Xs="[object Null]",Mn="[object Object]",Fa="[object Promise]",Qs="[object Proxy]",er="[object RegExp]",Kt="[object Set]",Dn="[object String]",bt="[object Symbol]",$a="[object Undefined]",Wr="[object WeakMap]",Co="[object WeakSet]",Vr="[object ArrayBuffer]",br="[object DataView]",xo="[object Float32Array]",ko="[object Float64Array]",Eo="[object Int8Array]",Po="[object Int16Array]",Oo="[object Int32Array]",Js="[object Uint8Array]",Zs="[object Uint8ClampedArray]",Cr="[object Uint16Array]",Ki="[object Uint32Array]",sp=/\b__p \+= '';/g,nc=/\b(__p \+=) '' \+/g,lp=/(__e\(.*?\)|\b__t\)) \+\n'';/g,el=/&(?:amp|lt|gt|quot|#39);/g,Yi=/[&<>"']/g,up=RegExp(el.source),mi=RegExp(Yi.source),cp=/<%-([\s\S]+?)%>/g,fp=/<%([\s\S]+?)%>/g,rc=/<%=([\s\S]+?)%>/g,dp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hp=/^\w*$/,xr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tl=/[\\^$.*+?()[\]{}|]/g,pp=RegExp(tl.source),nl=/^\s+/,gp=/\s/,mp=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Xi=/\{\n\/\* \[wrapped with (.+)\] \*/,vp=/,? & /,yp=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Sp=/[()=,{}\[\]\/\s]/,_p=/\\(\\)?/g,wp=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vi=/\w*$/,bp=/^[-+]0x[0-9a-f]+$/i,Cp=/^0b[01]+$/i,xp=/^\[object .+?Constructor\]$/,kp=/^0o[0-7]+$/i,Ep=/^(?:0|[1-9]\d*)$/,Pp=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qi=/($^)/,Op=/['\n\r\u2028\u2029\\]/g,yi="\\ud800-\\udfff",rl="\\u0300-\\u036f",Tp="\\ufe20-\\ufe2f",To="\\u20d0-\\u20ff",il=rl+Tp+To,ic="\\u2700-\\u27bf",ac="a-z\\xdf-\\xf6\\xf8-\\xff",Rp="\\xac\\xb1\\xd7\\xf7",oc="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ap="\\u2000-\\u206f",Ip=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",sc="A-Z\\xc0-\\xd6\\xd8-\\xde",lc="\\ufe0e\\ufe0f",uc=Rp+oc+Ap+Ip,al="['’]",Lp="["+yi+"]",cc="["+uc+"]",Ro="["+il+"]",fc="\\d+",Ao="["+ic+"]",Io="["+ac+"]",dc="[^"+yi+uc+fc+ic+ac+sc+"]",ol="\\ud83c[\\udffb-\\udfff]",hc="(?:"+Ro+"|"+ol+")",pc="[^"+yi+"]",sl="(?:\\ud83c[\\udde6-\\uddff]){2}",ll="[\\ud800-\\udbff][\\udc00-\\udfff]",Si="["+sc+"]",gc="\\u200d",mc="(?:"+Io+"|"+dc+")",Mp="(?:"+Si+"|"+dc+")",Lo="(?:"+al+"(?:d|ll|m|re|s|t|ve))?",vc="(?:"+al+"(?:D|LL|M|RE|S|T|VE))?",yc=hc+"?",Sc="["+lc+"]?",Mo="(?:"+gc+"(?:"+[pc,sl,ll].join("|")+")"+Sc+yc+")*",ul="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",cl="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Do=Sc+yc+Mo,Dp="(?:"+[Ao,sl,ll].join("|")+")"+Do,_c="(?:"+[pc+Ro+"?",Ro,sl,ll,Lp].join("|")+")",fl=RegExp(al,"g"),wc=RegExp(Ro,"g"),kr=RegExp(ol+"(?="+ol+")|"+_c+Do,"g"),za=RegExp([Si+"?"+Io+"+"+Lo+"(?="+[cc,Si,"$"].join("|")+")",Mp+"+"+vc+"(?="+[cc,Si+mc,"$"].join("|")+")",Si+"?"+mc+"+"+Lo,Si+"+"+vc,cl,ul,fc,Dp].join("|"),"g"),Np=RegExp("["+gc+yi+il+lc+"]"),bc=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Bp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Cc=-1,nt={};nt[xo]=nt[ko]=nt[Eo]=nt[Po]=nt[Oo]=nt[Js]=nt[Zs]=nt[Cr]=nt[Ki]=!0,nt[At]=nt[me]=nt[Vr]=nt[Bt]=nt[br]=nt[bn]=nt[Ft]=nt[xe]=nt[Pt]=nt[gi]=nt[Mn]=nt[er]=nt[Kt]=nt[Dn]=nt[Wr]=!1;var et={};et[At]=et[me]=et[Vr]=et[br]=et[Bt]=et[bn]=et[xo]=et[ko]=et[Eo]=et[Po]=et[Oo]=et[Pt]=et[gi]=et[Mn]=et[er]=et[Kt]=et[Dn]=et[bt]=et[Js]=et[Zs]=et[Cr]=et[Ki]=!0,et[Ft]=et[xe]=et[Wr]=!1;var xc={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Fp={"&":"&","<":"<",">":">",'"':""","'":"'"},P={"&":"&","<":"<",">":">",""":'"',"'":"'"},N={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},W=parseFloat,fe=parseInt,Ie=typeof yn=="object"&&yn&&yn.Object===Object&&yn,Ye=typeof self=="object"&&self&&self.Object===Object&&self,Ee=Ie||Ye||Function("return this")(),Te=e&&!e.nodeType&&e,ze=Te&&!0&&t&&!t.nodeType&&t,dn=ze&&ze.exports===Te,Yt=dn&&Ie.process,$t=function(){try{var F=ze&&ze.require&&ze.require("util").types;return F||Yt&&Yt.binding&&Yt.binding("util")}catch{}}(),No=$t&&$t.isArrayBuffer,Bo=$t&&$t.isDate,dl=$t&&$t.isMap,W0=$t&&$t.isRegExp,V0=$t&&$t.isSet,q0=$t&&$t.isTypedArray;function Nn(F,J,q){switch(q.length){case 0:return F.call(J);case 1:return F.call(J,q[0]);case 2:return F.call(J,q[0],q[1]);case 3:return F.call(J,q[0],q[1],q[2])}return F.apply(J,q)}function eP(F,J,q,de){for(var Ce=-1,je=F==null?0:F.length;++Ce-1}function $p(F,J,q){for(var de=-1,Ce=F==null?0:F.length;++de-1;);return q}function t1(F,J){for(var q=F.length;q--&&Fo(J,F[q],0)>-1;);return q}function uP(F,J){for(var q=F.length,de=0;q--;)F[q]===J&&++de;return de}var cP=jp(xc),fP=jp(Fp);function dP(F){return"\\"+N[F]}function hP(F,J){return F==null?n:F[J]}function $o(F){return Np.test(F)}function pP(F){return bc.test(F)}function gP(F){for(var J,q=[];!(J=F.next()).done;)q.push(J.value);return q}function qp(F){var J=-1,q=Array(F.size);return F.forEach(function(de,Ce){q[++J]=[Ce,de]}),q}function n1(F,J){return function(q){return F(J(q))}}function ea(F,J){for(var q=-1,de=F.length,Ce=0,je=[];++q-1}function nO(o,l){var d=this.__data__,m=Uc(d,o);return m<0?(++this.size,d.push([o,l])):d[m][1]=l,this}_i.prototype.clear=JP,_i.prototype.delete=ZP,_i.prototype.get=eO,_i.prototype.has=tO,_i.prototype.set=nO;function wi(o){var l=-1,d=o==null?0:o.length;for(this.clear();++l=l?o:l)),o}function ir(o,l,d,m,b,E){var R,M=l&p,z=l&g,Z=l&y;if(d&&(R=b?d(o,m,b,E):d(o)),R!==n)return R;if(!ht(o))return o;var ee=ke(o);if(ee){if(R=oT(o),!M)return Cn(o,R)}else{var ne=an(o),ue=ne==xe||ne==Hr;if(oa(o))return F1(o,M);if(ne==Mn||ne==At||ue&&!b){if(R=z||ue?{}:rS(o),!M)return z?YO(o,yO(R,o)):KO(o,p1(R,o))}else{if(!et[ne])return b?o:{};R=sT(o,ne,M)}}E||(E=new Pr);var ge=E.get(o);if(ge)return ge;E.set(o,R),IS(o)?o.forEach(function(_e){R.add(ir(_e,l,d,_e,o,E))}):RS(o)&&o.forEach(function(_e,Le){R.set(Le,ir(_e,l,d,Le,o,E))});var Se=Z?z?Sg:yg:z?kn:zt,Oe=ee?n:Se(o);return tr(Oe||o,function(_e,Le){Oe&&(Le=_e,_e=o[Le]),Sl(R,Le,ir(_e,l,d,Le,o,E))}),R}function SO(o){var l=zt(o);return function(d){return g1(d,o,l)}}function g1(o,l,d){var m=d.length;if(o==null)return!m;for(o=rt(o);m--;){var b=d[m],E=l[b],R=o[b];if(R===n&&!(b in o)||!E(R))return!1}return!0}function m1(o,l,d){if(typeof o!="function")throw new nr(s);return El(function(){o.apply(n,d)},l)}function _l(o,l,d,m){var b=-1,E=kc,R=!0,M=o.length,z=[],Z=l.length;if(!M)return z;d&&(l=ut(l,Bn(d))),m?(E=$p,R=!1):l.length>=i&&(E=hl,R=!1,l=new ja(l));e:for(;++bb?0:b+d),m=m===n||m>b?b:Pe(m),m<0&&(m+=b),m=d>m?0:MS(m);d0&&d(M)?l>1?Xt(M,l-1,d,m,b):Zi(b,M):m||(b[b.length]=M)}return b}var eg=H1(),S1=H1(!0);function qr(o,l){return o&&eg(o,l,zt)}function tg(o,l){return o&&S1(o,l,zt)}function Hc(o,l){return Ji(l,function(d){return Ei(o[d])})}function Wa(o,l){l=ia(l,o);for(var d=0,m=l.length;o!=null&&dl}function bO(o,l){return o!=null&&Xe.call(o,l)}function CO(o,l){return o!=null&&l in rt(o)}function xO(o,l,d){return o>=rn(l,d)&&o=120&&ee.length>=120)?new ja(R&&ee):n}ee=o[0];var ne=-1,ue=M[0];e:for(;++ne-1;)M!==o&&Dc.call(M,z,1),Dc.call(o,z,1);return o}function R1(o,l){for(var d=o?l.length:0,m=d-1;d--;){var b=l[d];if(d==m||b!==E){var E=b;ki(b)?Dc.call(o,b,1):fg(o,b)}}return o}function lg(o,l){return o+Fc(c1()*(l-o+1))}function BO(o,l,d,m){for(var b=-1,E=Lt(Bc((l-o)/(d||1)),0),R=q(E);E--;)R[m?E:++b]=o,o+=d;return R}function ug(o,l){var d="";if(!o||l<1||l>H)return d;do l%2&&(d+=o),l=Fc(l/2),l&&(o+=o);while(l);return d}function Re(o,l){return Eg(oS(o,l,En),o+"")}function FO(o){return h1(Xo(o))}function $O(o,l){var d=Xo(o);return tf(d,Ha(l,0,d.length))}function Cl(o,l,d,m){if(!ht(o))return o;l=ia(l,o);for(var b=-1,E=l.length,R=E-1,M=o;M!=null&&++bb?0:b+l),d=d>b?b:d,d<0&&(d+=b),b=l>d?0:d-l>>>0,l>>>=0;for(var E=q(b);++m>>1,R=o[E];R!==null&&!$n(R)&&(d?R<=l:R=i){var Z=l?null:ZO(o);if(Z)return Pc(Z);R=!1,b=hl,z=new ja}else z=l?[]:M;e:for(;++m=m?o:ar(o,l,d)}var B1=RP||function(o){return Ee.clearTimeout(o)};function F1(o,l){if(l)return o.slice();var d=o.length,m=a1?a1(d):new o.constructor(d);return o.copy(m),m}function gg(o){var l=new o.constructor(o.byteLength);return new Lc(l).set(new Lc(o)),l}function HO(o,l){var d=l?gg(o.buffer):o.buffer;return new o.constructor(d,o.byteOffset,o.byteLength)}function WO(o){var l=new o.constructor(o.source,vi.exec(o));return l.lastIndex=o.lastIndex,l}function VO(o){return yl?rt(yl.call(o)):{}}function $1(o,l){var d=l?gg(o.buffer):o.buffer;return new o.constructor(d,o.byteOffset,o.length)}function z1(o,l){if(o!==l){var d=o!==n,m=o===null,b=o===o,E=$n(o),R=l!==n,M=l===null,z=l===l,Z=$n(l);if(!M&&!Z&&!E&&o>l||E&&R&&z&&!M&&!Z||m&&R&&z||!d&&z||!b)return 1;if(!m&&!E&&!Z&&o=M)return z;var Z=d[m];return z*(Z=="desc"?-1:1)}}return o.index-l.index}function G1(o,l,d,m){for(var b=-1,E=o.length,R=d.length,M=-1,z=l.length,Z=Lt(E-R,0),ee=q(z+Z),ne=!m;++M1?d[b-1]:n,R=b>2?d[2]:n;for(E=o.length>3&&typeof E=="function"?(b--,E):n,R&&pn(d[0],d[1],R)&&(E=b<3?n:E,b=1),l=rt(l);++m-1?b[E?l[R]:R]:n}}function q1(o){return xi(function(l){var d=l.length,m=d,b=rr.prototype.thru;for(o&&l.reverse();m--;){var E=l[m];if(typeof E!="function")throw new nr(s);if(b&&!R&&Zc(E)=="wrapper")var R=new rr([],!0)}for(m=R?m:d;++m1&&Ne.reverse(),ee&&zM))return!1;var Z=E.get(o),ee=E.get(l);if(Z&&ee)return Z==l&&ee==o;var ne=-1,ue=!0,ge=d&w?new ja:n;for(E.set(o,l),E.set(l,o);++ne1?"& ":"")+l[m],l=l.join(d>2?", ":" "),o.replace(mp,`{ -/* [wrapped with `+l+`] */ -`)}function uT(o){return ke(o)||Ka(o)||!!(l1&&o&&o[l1])}function ki(o,l){var d=typeof o;return l=l??H,!!l&&(d=="number"||d!="symbol"&&Ep.test(o))&&o>-1&&o%1==0&&o0){if(++l>=ce)return arguments[0]}else l=0;return o.apply(n,arguments)}}function tf(o,l){var d=-1,m=o.length,b=m-1;for(l=l===n?m:l;++d1?o[l-1]:n;return d=typeof d=="function"?(o.pop(),d):n,yS(o,d)});function SS(o){var l=k(o);return l.__chain__=!0,l}function _R(o,l){return l(o),o}function nf(o,l){return l(o)}var wR=xi(function(o){var l=o.length,d=l?o[0]:0,m=this.__wrapped__,b=function(E){return Zp(E,o)};return l>1||this.__actions__.length||!(m instanceof Me)||!ki(d)?this.thru(b):(m=m.slice(d,+d+(l?1:0)),m.__actions__.push({func:nf,args:[b],thisArg:n}),new rr(m,this.__chain__).thru(function(E){return l&&!E.length&&E.push(n),E}))});function bR(){return SS(this)}function CR(){return new rr(this.value(),this.__chain__)}function xR(){this.__values__===n&&(this.__values__=LS(this.value()));var o=this.__index__>=this.__values__.length,l=o?n:this.__values__[this.__index__++];return{done:o,value:l}}function kR(){return this}function ER(o){for(var l,d=this;d instanceof Gc;){var m=dS(d);m.__index__=0,m.__values__=n,l?b.__wrapped__=m:l=m;var b=m;d=d.__wrapped__}return b.__wrapped__=o,l}function PR(){var o=this.__wrapped__;if(o instanceof Me){var l=o;return this.__actions__.length&&(l=new Me(this)),l=l.reverse(),l.__actions__.push({func:nf,args:[Pg],thisArg:n}),new rr(l,this.__chain__)}return this.thru(Pg)}function OR(){return D1(this.__wrapped__,this.__actions__)}var TR=Kc(function(o,l,d){Xe.call(o,d)?++o[d]:bi(o,d,1)});function RR(o,l,d){var m=ke(o)?K0:_O;return d&&pn(o,l,d)&&(l=n),m(o,ye(l,3))}function AR(o,l){var d=ke(o)?Ji:y1;return d(o,ye(l,3))}var IR=V1(hS),LR=V1(pS);function MR(o,l){return Xt(rf(o,l),1)}function DR(o,l){return Xt(rf(o,l),ie)}function NR(o,l,d){return d=d===n?1:Pe(d),Xt(rf(o,l),d)}function _S(o,l){var d=ke(o)?tr:na;return d(o,ye(l,3))}function wS(o,l){var d=ke(o)?tP:v1;return d(o,ye(l,3))}var BR=Kc(function(o,l,d){Xe.call(o,d)?o[d].push(l):bi(o,d,[l])});function FR(o,l,d,m){o=xn(o)?o:Xo(o),d=d&&!m?Pe(d):0;var b=o.length;return d<0&&(d=Lt(b+d,0)),uf(o)?d<=b&&o.indexOf(l,d)>-1:!!b&&Fo(o,l,d)>-1}var $R=Re(function(o,l,d){var m=-1,b=typeof l=="function",E=xn(o)?q(o.length):[];return na(o,function(R){E[++m]=b?Nn(l,R,d):wl(R,l,d)}),E}),zR=Kc(function(o,l,d){bi(o,d,l)});function rf(o,l){var d=ke(o)?ut:x1;return d(o,ye(l,3))}function GR(o,l,d,m){return o==null?[]:(ke(l)||(l=l==null?[]:[l]),d=m?n:d,ke(d)||(d=d==null?[]:[d]),O1(o,l,d))}var UR=Kc(function(o,l,d){o[d?0:1].push(l)},function(){return[[],[]]});function jR(o,l,d){var m=ke(o)?zp:J0,b=arguments.length<3;return m(o,ye(l,4),d,b,na)}function HR(o,l,d){var m=ke(o)?nP:J0,b=arguments.length<3;return m(o,ye(l,4),d,b,v1)}function WR(o,l){var d=ke(o)?Ji:y1;return d(o,sf(ye(l,3)))}function VR(o){var l=ke(o)?h1:FO;return l(o)}function qR(o,l,d){(d?pn(o,l,d):l===n)?l=1:l=Pe(l);var m=ke(o)?gO:$O;return m(o,l)}function KR(o){var l=ke(o)?mO:GO;return l(o)}function YR(o){if(o==null)return 0;if(xn(o))return uf(o)?zo(o):o.length;var l=an(o);return l==Pt||l==Kt?o.size:ag(o).length}function XR(o,l,d){var m=ke(o)?Gp:UO;return d&&pn(o,l,d)&&(l=n),m(o,ye(l,3))}var QR=Re(function(o,l){if(o==null)return[];var d=l.length;return d>1&&pn(o,l[0],l[1])?l=[]:d>2&&pn(l[0],l[1],l[2])&&(l=[l[0]]),O1(o,Xt(l,1),[])}),af=AP||function(){return Ee.Date.now()};function JR(o,l){if(typeof l!="function")throw new nr(s);return o=Pe(o),function(){if(--o<1)return l.apply(this,arguments)}}function bS(o,l,d){return l=d?n:l,l=o&&l==null?o.length:l,Ci(o,D,n,n,n,n,l)}function CS(o,l){var d;if(typeof l!="function")throw new nr(s);return o=Pe(o),function(){return--o>0&&(d=l.apply(this,arguments)),o<=1&&(l=n),d}}var Tg=Re(function(o,l,d){var m=x;if(d.length){var b=ea(d,Ko(Tg));m|=I}return Ci(o,m,l,d,b)}),xS=Re(function(o,l,d){var m=x|_;if(d.length){var b=ea(d,Ko(xS));m|=I}return Ci(l,m,o,d,b)});function kS(o,l,d){l=d?n:l;var m=Ci(o,C,n,n,n,n,n,l);return m.placeholder=kS.placeholder,m}function ES(o,l,d){l=d?n:l;var m=Ci(o,O,n,n,n,n,n,l);return m.placeholder=ES.placeholder,m}function PS(o,l,d){var m,b,E,R,M,z,Z=0,ee=!1,ne=!1,ue=!0;if(typeof o!="function")throw new nr(s);l=sr(l)||0,ht(d)&&(ee=!!d.leading,ne="maxWait"in d,E=ne?Lt(sr(d.maxWait)||0,l):E,ue="trailing"in d?!!d.trailing:ue);function ge(xt){var Tr=m,Oi=b;return m=b=n,Z=xt,R=o.apply(Oi,Tr),R}function Se(xt){return Z=xt,M=El(Le,l),ee?ge(xt):R}function Oe(xt){var Tr=xt-z,Oi=xt-Z,VS=l-Tr;return ne?rn(VS,E-Oi):VS}function _e(xt){var Tr=xt-z,Oi=xt-Z;return z===n||Tr>=l||Tr<0||ne&&Oi>=E}function Le(){var xt=af();if(_e(xt))return Ne(xt);M=El(Le,Oe(xt))}function Ne(xt){return M=n,ue&&m?ge(xt):(m=b=n,R)}function zn(){M!==n&&B1(M),Z=0,m=z=b=M=n}function gn(){return M===n?R:Ne(af())}function Gn(){var xt=af(),Tr=_e(xt);if(m=arguments,b=this,z=xt,Tr){if(M===n)return Se(z);if(ne)return B1(M),M=El(Le,l),ge(z)}return M===n&&(M=El(Le,l)),R}return Gn.cancel=zn,Gn.flush=gn,Gn}var ZR=Re(function(o,l){return m1(o,1,l)}),eA=Re(function(o,l,d){return m1(o,sr(l)||0,d)});function tA(o){return Ci(o,X)}function of(o,l){if(typeof o!="function"||l!=null&&typeof l!="function")throw new nr(s);var d=function(){var m=arguments,b=l?l.apply(this,m):m[0],E=d.cache;if(E.has(b))return E.get(b);var R=o.apply(this,m);return d.cache=E.set(b,R)||E,R};return d.cache=new(of.Cache||wi),d}of.Cache=wi;function sf(o){if(typeof o!="function")throw new nr(s);return function(){var l=arguments;switch(l.length){case 0:return!o.call(this);case 1:return!o.call(this,l[0]);case 2:return!o.call(this,l[0],l[1]);case 3:return!o.call(this,l[0],l[1],l[2])}return!o.apply(this,l)}}function nA(o){return CS(2,o)}var rA=jO(function(o,l){l=l.length==1&&ke(l[0])?ut(l[0],Bn(ye())):ut(Xt(l,1),Bn(ye()));var d=l.length;return Re(function(m){for(var b=-1,E=rn(m.length,d);++b=l}),Ka=w1(function(){return arguments}())?w1:function(o){return St(o)&&Xe.call(o,"callee")&&!s1.call(o,"callee")},ke=q.isArray,yA=No?Bn(No):EO;function xn(o){return o!=null&&lf(o.length)&&!Ei(o)}function Ct(o){return St(o)&&xn(o)}function SA(o){return o===!0||o===!1||St(o)&&hn(o)==Bt}var oa=LP||Gg,_A=Bo?Bn(Bo):PO;function wA(o){return St(o)&&o.nodeType===1&&!Pl(o)}function bA(o){if(o==null)return!0;if(xn(o)&&(ke(o)||typeof o=="string"||typeof o.splice=="function"||oa(o)||Yo(o)||Ka(o)))return!o.length;var l=an(o);if(l==Pt||l==Kt)return!o.size;if(kl(o))return!ag(o).length;for(var d in o)if(Xe.call(o,d))return!1;return!0}function CA(o,l){return bl(o,l)}function xA(o,l,d){d=typeof d=="function"?d:n;var m=d?d(o,l):n;return m===n?bl(o,l,n,d):!!m}function Ag(o){if(!St(o))return!1;var l=hn(o);return l==Ft||l==wr||typeof o.message=="string"&&typeof o.name=="string"&&!Pl(o)}function kA(o){return typeof o=="number"&&u1(o)}function Ei(o){if(!ht(o))return!1;var l=hn(o);return l==xe||l==Hr||l==qt||l==Qs}function TS(o){return typeof o=="number"&&o==Pe(o)}function lf(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=H}function ht(o){var l=typeof o;return o!=null&&(l=="object"||l=="function")}function St(o){return o!=null&&typeof o=="object"}var RS=dl?Bn(dl):TO;function EA(o,l){return o===l||ig(o,l,wg(l))}function PA(o,l,d){return d=typeof d=="function"?d:n,ig(o,l,wg(l),d)}function OA(o){return AS(o)&&o!=+o}function TA(o){if(dT(o))throw new Ce(a);return b1(o)}function RA(o){return o===null}function AA(o){return o==null}function AS(o){return typeof o=="number"||St(o)&&hn(o)==gi}function Pl(o){if(!St(o)||hn(o)!=Mn)return!1;var l=Mc(o);if(l===null)return!0;var d=Xe.call(l,"constructor")&&l.constructor;return typeof d=="function"&&d instanceof d&&Rc.call(d)==PP}var Ig=W0?Bn(W0):RO;function IA(o){return TS(o)&&o>=-H&&o<=H}var IS=V0?Bn(V0):AO;function uf(o){return typeof o=="string"||!ke(o)&&St(o)&&hn(o)==Dn}function $n(o){return typeof o=="symbol"||St(o)&&hn(o)==bt}var Yo=q0?Bn(q0):IO;function LA(o){return o===n}function MA(o){return St(o)&&an(o)==Wr}function DA(o){return St(o)&&hn(o)==Co}var NA=Jc(og),BA=Jc(function(o,l){return o<=l});function LS(o){if(!o)return[];if(xn(o))return uf(o)?Er(o):Cn(o);if(pl&&o[pl])return gP(o[pl]());var l=an(o),d=l==Pt?qp:l==Kt?Pc:Xo;return d(o)}function Pi(o){if(!o)return o===0?o:0;if(o=sr(o),o===ie||o===-ie){var l=o<0?-1:1;return l*Y}return o===o?o:0}function Pe(o){var l=Pi(o),d=l%1;return l===l?d?l-d:l:0}function MS(o){return o?Ha(Pe(o),0,oe):0}function sr(o){if(typeof o=="number")return o;if($n(o))return Q;if(ht(o)){var l=typeof o.valueOf=="function"?o.valueOf():o;o=ht(l)?l+"":l}if(typeof o!="string")return o===0?o:+o;o=Z0(o);var d=Cp.test(o);return d||kp.test(o)?fe(o.slice(2),d?2:8):bp.test(o)?Q:+o}function DS(o){return Kr(o,kn(o))}function FA(o){return o?Ha(Pe(o),-H,H):o===0?o:0}function Ve(o){return o==null?"":Fn(o)}var $A=Vo(function(o,l){if(kl(l)||xn(l)){Kr(l,zt(l),o);return}for(var d in l)Xe.call(l,d)&&Sl(o,d,l[d])}),NS=Vo(function(o,l){Kr(l,kn(l),o)}),cf=Vo(function(o,l,d,m){Kr(l,kn(l),o,m)}),zA=Vo(function(o,l,d,m){Kr(l,zt(l),o,m)}),GA=xi(Zp);function UA(o,l){var d=Wo(o);return l==null?d:p1(d,l)}var jA=Re(function(o,l){o=rt(o);var d=-1,m=l.length,b=m>2?l[2]:n;for(b&&pn(l[0],l[1],b)&&(m=1);++d1),E}),Kr(o,Sg(o),d),m&&(d=ir(d,p|g|y,eT));for(var b=l.length;b--;)fg(d,l[b]);return d});function sI(o,l){return FS(o,sf(ye(l)))}var lI=xi(function(o,l){return o==null?{}:DO(o,l)});function FS(o,l){if(o==null)return{};var d=ut(Sg(o),function(m){return[m]});return l=ye(l),T1(o,d,function(m,b){return l(m,b[0])})}function uI(o,l,d){l=ia(l,o);var m=-1,b=l.length;for(b||(b=1,o=n);++ml){var m=o;o=l,l=m}if(d||o%1||l%1){var b=c1();return rn(o+b*(l-o+W("1e-"+((b+"").length-1))),l)}return lg(o,l)}var _I=qo(function(o,l,d){return l=l.toLowerCase(),o+(d?GS(l):l)});function GS(o){return Dg(Ve(o).toLowerCase())}function US(o){return o=Ve(o),o&&o.replace(Pp,cP).replace(wc,"")}function wI(o,l,d){o=Ve(o),l=Fn(l);var m=o.length;d=d===n?m:Ha(Pe(d),0,m);var b=d;return d-=l.length,d>=0&&o.slice(d,b)==l}function bI(o){return o=Ve(o),o&&mi.test(o)?o.replace(Yi,fP):o}function CI(o){return o=Ve(o),o&&pp.test(o)?o.replace(tl,"\\$&"):o}var xI=qo(function(o,l,d){return o+(d?"-":"")+l.toLowerCase()}),kI=qo(function(o,l,d){return o+(d?" ":"")+l.toLowerCase()}),EI=W1("toLowerCase");function PI(o,l,d){o=Ve(o),l=Pe(l);var m=l?zo(o):0;if(!l||m>=l)return o;var b=(l-m)/2;return Qc(Fc(b),d)+o+Qc(Bc(b),d)}function OI(o,l,d){o=Ve(o),l=Pe(l);var m=l?zo(o):0;return l&&m>>0,d?(o=Ve(o),o&&(typeof l=="string"||l!=null&&!Ig(l))&&(l=Fn(l),!l&&$o(o))?aa(Er(o),0,d):o.split(l,d)):[]}var DI=qo(function(o,l,d){return o+(d?" ":"")+Dg(l)});function NI(o,l,d){return o=Ve(o),d=d==null?0:Ha(Pe(d),0,o.length),l=Fn(l),o.slice(d,d+l.length)==l}function BI(o,l,d){var m=k.templateSettings;d&&pn(o,l,d)&&(l=n),o=Ve(o),l=cf({},l,m,J1);var b=cf({},l.imports,m.imports,J1),E=zt(b),R=Vp(b,E),M,z,Z=0,ee=l.interpolate||Qi,ne="__p += '",ue=Kp((l.escape||Qi).source+"|"+ee.source+"|"+(ee===rc?wp:Qi).source+"|"+(l.evaluate||Qi).source+"|$","g"),ge="//# sourceURL="+(Xe.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Cc+"]")+` -`;o.replace(ue,function(_e,Le,Ne,zn,gn,Gn){return Ne||(Ne=zn),ne+=o.slice(Z,Gn).replace(Op,dP),Le&&(M=!0,ne+=`' + -__e(`+Le+`) + -'`),gn&&(z=!0,ne+=`'; -`+gn+`; -__p += '`),Ne&&(ne+=`' + -((__t = (`+Ne+`)) == null ? '' : __t) + -'`),Z=Gn+_e.length,_e}),ne+=`'; -`;var Se=Xe.call(l,"variable")&&l.variable;if(!Se)ne=`with (obj) { -`+ne+` -} -`;else if(Sp.test(Se))throw new Ce(u);ne=(z?ne.replace(sp,""):ne).replace(nc,"$1").replace(lp,"$1;"),ne="function("+(Se||"obj")+`) { -`+(Se?"":`obj || (obj = {}); -`)+"var __t, __p = ''"+(M?", __e = _.escape":"")+(z?`, __j = Array.prototype.join; -function print() { __p += __j.call(arguments, '') } -`:`; -`)+ne+`return __p -}`;var Oe=HS(function(){return je(E,ge+"return "+ne).apply(n,R)});if(Oe.source=ne,Ag(Oe))throw Oe;return Oe}function FI(o){return Ve(o).toLowerCase()}function $I(o){return Ve(o).toUpperCase()}function zI(o,l,d){if(o=Ve(o),o&&(d||l===n))return Z0(o);if(!o||!(l=Fn(l)))return o;var m=Er(o),b=Er(l),E=e1(m,b),R=t1(m,b)+1;return aa(m,E,R).join("")}function GI(o,l,d){if(o=Ve(o),o&&(d||l===n))return o.slice(0,r1(o)+1);if(!o||!(l=Fn(l)))return o;var m=Er(o),b=t1(m,Er(l))+1;return aa(m,0,b).join("")}function UI(o,l,d){if(o=Ve(o),o&&(d||l===n))return o.replace(nl,"");if(!o||!(l=Fn(l)))return o;var m=Er(o),b=e1(m,Er(l));return aa(m,b).join("")}function jI(o,l){var d=K,m=te;if(ht(l)){var b="separator"in l?l.separator:b;d="length"in l?Pe(l.length):d,m="omission"in l?Fn(l.omission):m}o=Ve(o);var E=o.length;if($o(o)){var R=Er(o);E=R.length}if(d>=E)return o;var M=d-zo(m);if(M<1)return m;var z=R?aa(R,0,M).join(""):o.slice(0,M);if(b===n)return z+m;if(R&&(M+=z.length-M),Ig(b)){if(o.slice(M).search(b)){var Z,ee=z;for(b.global||(b=Kp(b.source,Ve(vi.exec(b))+"g")),b.lastIndex=0;Z=b.exec(ee);)var ne=Z.index;z=z.slice(0,ne===n?M:ne)}}else if(o.indexOf(Fn(b),M)!=M){var ue=z.lastIndexOf(b);ue>-1&&(z=z.slice(0,ue))}return z+m}function HI(o){return o=Ve(o),o&&up.test(o)?o.replace(el,SP):o}var WI=qo(function(o,l,d){return o+(d?" ":"")+l.toUpperCase()}),Dg=W1("toUpperCase");function jS(o,l,d){return o=Ve(o),l=d?n:l,l===n?pP(o)?bP(o):aP(o):o.match(l)||[]}var HS=Re(function(o,l){try{return Nn(o,n,l)}catch(d){return Ag(d)?d:new Ce(d)}}),VI=xi(function(o,l){return tr(l,function(d){d=Yr(d),bi(o,d,Tg(o[d],o))}),o});function qI(o){var l=o==null?0:o.length,d=ye();return o=l?ut(o,function(m){if(typeof m[1]!="function")throw new nr(s);return[d(m[0]),m[1]]}):[],Re(function(m){for(var b=-1;++bH)return[];var d=oe,m=rn(o,oe);l=ye(l),o-=oe;for(var b=Wp(m,l);++d0||l<0)?new Me(d):(o<0?d=d.takeRight(-o):o&&(d=d.drop(o)),l!==n&&(l=Pe(l),d=l<0?d.dropRight(-l):d.take(l-o)),d)},Me.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Me.prototype.toArray=function(){return this.take(oe)},qr(Me.prototype,function(o,l){var d=/^(?:filter|find|map|reject)|While$/.test(l),m=/^(?:head|last)$/.test(l),b=k[m?"take"+(l=="last"?"Right":""):l],E=m||/^find/.test(l);b&&(k.prototype[l]=function(){var R=this.__wrapped__,M=m?[1]:arguments,z=R instanceof Me,Z=M[0],ee=z||ke(R),ne=function(Le){var Ne=b.apply(k,Zi([Le],M));return m&&ue?Ne[0]:Ne};ee&&d&&typeof Z=="function"&&Z.length!=1&&(z=ee=!1);var ue=this.__chain__,ge=!!this.__actions__.length,Se=E&&!ue,Oe=z&&!ge;if(!E&&ee){R=Oe?R:new Me(this);var _e=o.apply(R,M);return _e.__actions__.push({func:nf,args:[ne],thisArg:n}),new rr(_e,ue)}return Se&&Oe?o.apply(this,M):(_e=this.thru(ne),Se?m?_e.value()[0]:_e.value():_e)})}),tr(["pop","push","shift","sort","splice","unshift"],function(o){var l=Oc[o],d=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",m=/^(?:pop|shift)$/.test(o);k.prototype[o]=function(){var b=arguments;if(m&&!this.__chain__){var E=this.value();return l.apply(ke(E)?E:[],b)}return this[d](function(R){return l.apply(ke(R)?R:[],b)})}}),qr(Me.prototype,function(o,l){var d=k[l];if(d){var m=d.name+"";Xe.call(Ho,m)||(Ho[m]=[]),Ho[m].push({name:l,func:d})}}),Ho[Yc(n,_).name]=[{name:"wrapper",func:n}],Me.prototype.clone=HP,Me.prototype.reverse=WP,Me.prototype.value=VP,k.prototype.at=wR,k.prototype.chain=bR,k.prototype.commit=CR,k.prototype.next=xR,k.prototype.plant=ER,k.prototype.reverse=PR,k.prototype.toJSON=k.prototype.valueOf=k.prototype.value=OR,k.prototype.first=k.prototype.head,pl&&(k.prototype[pl]=kR),k},Go=CP();ze?((ze.exports=Go)._=Go,Te._=Go):Ee._=Go}).call(yn)})(p5,_t);const Jo=(t,e,n,r,i,a,s)=>{const u=t/2-(n+i/2)*s,c=e/2-(r+a/2)*s;return{x:u,y:c}},Zo=(t,e,n,r,i=.95)=>{const a=t*i/n,s=e*i/r;return Math.min(1,Math.min(a,s))},RG=.999,AG=.1,IG=20,Nl=.95,LG=30,MG=10,Ew=t=>({x:Math.floor(t.x),y:Math.floor(t.y)}),Ya=t=>{const{width:e,height:n}=t,r={width:e,height:n},i=512*512,a=e/n;let s=e*n,u=448;for(;s1?(r.width=u,r.height=va(u/a,64)):a<1&&(r.height=u,r.width=va(u*a,64)),s=r.width*r.height;return r},g5=t=>({width:va(t.width,64),height:va(t.height,64)}),DG=[{key:"Base",value:"base"},{key:"Mask",value:"mask"}],NG=[{key:"Auto",value:"auto"},{key:"Manual",value:"manual"},{key:"None",value:"none"}],Jx=t=>t.kind==="line"&&t.layer==="mask",BG=t=>t.kind==="line"&&t.layer==="base",Pw=t=>t.kind==="image"&&t.layer==="base",FG=t=>t.kind==="fillRect"&&t.layer==="base",$G=t=>t.kind==="eraseRect"&&t.layer==="base",m5=t=>t.kind==="line",Zl={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},v5={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"auto",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,canvasContainerDimensions:{width:0,height:0},colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,doesCanvasNeedScaling:!1,futureLayerStates:[],isCanvasInitialized:!1,isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:Zl,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},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"},Zx=vo({name:"canvas",initialState:v5,reducers:{setTool:(t,e)=>{const n=e.payload;t.tool=e.payload,n!=="move"&&(t.isTransformingBoundingBox=!1,t.isMouseOverBoundingBox=!1,t.isMovingBoundingBox=!1,t.isMovingStage=!1)},setLayer:(t,e)=>{t.layer=e.payload},toggleTool:t=>{const e=t.tool;e!=="move"&&(t.tool=e==="brush"?"eraser":"brush")},setMaskColor:(t,e)=>{t.maskColor=e.payload},setBrushColor:(t,e)=>{t.brushColor=e.payload},setBrushSize:(t,e)=>{t.brushSize=e.payload},clearMask:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState.objects=t.layerState.objects.filter(e=>!Jx(e)),t.futureLayerStates=[],t.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:t=>{t.shouldPreserveMaskedArea=!t.shouldPreserveMaskedArea},toggleShouldShowMask:t=>{t.isMaskEnabled=!t.isMaskEnabled},setShouldPreserveMaskedArea:(t,e)=>{t.shouldPreserveMaskedArea=e.payload},setIsMaskEnabled:(t,e)=>{t.isMaskEnabled=e.payload,t.layer=e.payload?"mask":"base"},setShouldShowCheckboardTransparency:(t,e)=>{t.shouldShowCheckboardTransparency=e.payload},setShouldShowBrushPreview:(t,e)=>{t.shouldShowBrushPreview=e.payload},setShouldShowBrush:(t,e)=>{t.shouldShowBrush=e.payload},setCursorPosition:(t,e)=>{t.cursorPosition=e.payload},setInitialCanvasImage:(t,e)=>{const n=e.payload,{stageDimensions:r}=t,i={width:Of(_t.clamp(n.width,64,512),64),height:Of(_t.clamp(n.height,64,512),64)},a={x:va(n.width/2-i.width/2,64),y:va(n.height/2-i.height/2,64)};if(t.boundingBoxScaleMethod==="auto"){const c=Ya(i);t.scaledBoundingBoxDimensions=c}t.boundingBoxDimensions=i,t.boundingBoxCoordinates=a,t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState={...Zl,objects:[{kind:"image",layer:"base",x:0,y:0,width:n.width,height:n.height,image:n}]},t.futureLayerStates=[],t.isCanvasInitialized=!1;const s=Zo(r.width,r.height,n.width,n.height,Nl),u=Jo(r.width,r.height,0,0,n.width,n.height,s);t.stageScale=s,t.stageCoordinates=u,t.doesCanvasNeedScaling=!0},setBoundingBoxDimensions:(t,e)=>{const n=g5(e.payload);if(t.boundingBoxDimensions=n,t.boundingBoxScaleMethod==="auto"){const r=Ya(n);t.scaledBoundingBoxDimensions=r}},setBoundingBoxCoordinates:(t,e)=>{t.boundingBoxCoordinates=Ew(e.payload)},setStageCoordinates:(t,e)=>{t.stageCoordinates=e.payload},setBoundingBoxPreviewFill:(t,e)=>{t.boundingBoxPreviewFill=e.payload},setDoesCanvasNeedScaling:(t,e)=>{t.doesCanvasNeedScaling=e.payload},setStageScale:(t,e)=>{t.stageScale=e.payload},setShouldDarkenOutsideBoundingBox:(t,e)=>{t.shouldDarkenOutsideBoundingBox=e.payload},setIsDrawing:(t,e)=>{t.isDrawing=e.payload},clearCanvasHistory:t=>{t.pastLayerStates=[],t.futureLayerStates=[]},setShouldLockBoundingBox:(t,e)=>{t.shouldLockBoundingBox=e.payload},toggleShouldLockBoundingBox:t=>{t.shouldLockBoundingBox=!t.shouldLockBoundingBox},setShouldShowBoundingBox:(t,e)=>{t.shouldShowBoundingBox=e.payload},setIsTransformingBoundingBox:(t,e)=>{t.isTransformingBoundingBox=e.payload},setIsMovingBoundingBox:(t,e)=>{t.isMovingBoundingBox=e.payload},setIsMouseOverBoundingBox:(t,e)=>{t.isMouseOverBoundingBox=e.payload},setIsMoveBoundingBoxKeyHeld:(t,e)=>{t.isMoveBoundingBoxKeyHeld=e.payload},setIsMoveStageKeyHeld:(t,e)=>{t.isMoveStageKeyHeld=e.payload},addImageToStagingArea:(t,e)=>{const{boundingBox:n,image:r}=e.payload;!n||!r||(t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.stagingArea.images.push({kind:"image",layer:"base",...n,image:r}),t.layerState.stagingArea.selectedImageIndex=t.layerState.stagingArea.images.length-1,t.futureLayerStates=[])},discardStagedImages:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.stagingArea={...Zl.stagingArea},t.futureLayerStates=[],t.shouldShowStagingOutline=!0,t.shouldShowStagingOutline=!0},addFillRect:t=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:n,brushColor:r}=t;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({kind:"fillRect",layer:"base",...e,...n,color:r}),t.futureLayerStates=[]},addEraseRect:t=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:n}=t;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({kind:"eraseRect",layer:"base",...e,...n}),t.futureLayerStates=[]},addLine:(t,e)=>{const{tool:n,layer:r,brushColor:i,brushSize:a,shouldRestrictStrokesToBox:s}=t;if(n==="move"||n==="colorPicker")return;const u=a/2,c=r==="base"&&n==="brush"?{color:i}:{};t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift();const f={kind:"line",layer:r,tool:n,strokeWidth:u,points:e.payload,...c};s&&(f.clip={...t.boundingBoxCoordinates,...t.boundingBoxDimensions}),t.layerState.objects.push(f),t.futureLayerStates=[]},addPointToCurrentLine:(t,e)=>{const n=t.layerState.objects.findLast(m5);n&&n.points.push(...e.payload)},undo:t=>{const e=t.pastLayerStates.pop();e&&(t.futureLayerStates.unshift(_t.cloneDeep(t.layerState)),t.futureLayerStates.length>t.maxHistory&&t.futureLayerStates.pop(),t.layerState=e)},redo:t=>{const e=t.futureLayerStates.shift();e&&(t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState=e)},setShouldShowGrid:(t,e)=>{t.shouldShowGrid=e.payload},setIsMovingStage:(t,e)=>{t.isMovingStage=e.payload},setShouldSnapToGrid:(t,e)=>{t.shouldSnapToGrid=e.payload},setShouldAutoSave:(t,e)=>{t.shouldAutoSave=e.payload},setShouldShowIntermediates:(t,e)=>{t.shouldShowIntermediates=e.payload},resetCanvas:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState=Zl,t.futureLayerStates=[]},setCanvasContainerDimensions:(t,e)=>{t.canvasContainerDimensions=e.payload},resizeAndScaleCanvas:t=>{const{width:e,height:n}=t.canvasContainerDimensions,r=t.layerState.objects.find(Pw),i={width:Math.floor(e),height:Math.floor(n)};if(!r){const h=Zo(i.width,i.height,512,512,Nl),p=Jo(i.width,i.height,0,0,512,512,h),g={width:512,height:512};if(t.stageScale=h,t.stageCoordinates=p,t.stageDimensions=i,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=g,t.boundingBoxScaleMethod==="auto"){const y=Ya(g);t.scaledBoundingBoxDimensions=y}return}const{width:a,height:s}=r,c=Zo(e,n,a,s,.95),f=Jo(i.width,i.height,0,0,a,s,c);t.minimumStageScale=c,t.stageScale=c,t.stageCoordinates=Ew(f),t.stageDimensions=i,t.isCanvasInitialized=!0},resizeCanvas:t=>{const{width:e,height:n}=t.canvasContainerDimensions,r={width:Math.floor(e),height:Math.floor(n)};if(t.stageDimensions=r,!t.layerState.objects.find(Pw)){const i=Zo(r.width,r.height,512,512,Nl),a=Jo(r.width,r.height,0,0,512,512,i),s={width:512,height:512};if(t.stageScale=i,t.stageCoordinates=a,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=s,t.boundingBoxScaleMethod==="auto"){const u=Ya(s);t.scaledBoundingBoxDimensions=u}}},resetCanvasView:(t,e)=>{const{contentRect:n,shouldScaleTo1:r}=e.payload,{stageDimensions:{width:i,height:a}}=t,{x:s,y:u,width:c,height:f}=n;if(c!==0&&f!==0){const h=r?1:Zo(i,a,c,f,Nl),p=Jo(i,a,s,u,c,f,h);t.stageScale=h,t.stageCoordinates=p}else{const h=Zo(i,a,512,512,Nl),p=Jo(i,a,0,0,512,512,h),g={width:512,height:512};if(t.stageScale=h,t.stageCoordinates=p,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=g,t.boundingBoxScaleMethod==="auto"){const y=Ya(g);t.scaledBoundingBoxDimensions=y}}},nextStagingAreaImage:t=>{const e=t.layerState.stagingArea.selectedImageIndex,n=t.layerState.stagingArea.images.length;t.layerState.stagingArea.selectedImageIndex=Math.min(e+1,n-1)},prevStagingAreaImage:t=>{const e=t.layerState.stagingArea.selectedImageIndex;t.layerState.stagingArea.selectedImageIndex=Math.max(e-1,0)},commitStagingAreaImage:t=>{const{images:e,selectedImageIndex:n}=t.layerState.stagingArea;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({...e[n]}),t.layerState.stagingArea={...Zl.stagingArea},t.futureLayerStates=[],t.shouldShowStagingOutline=!0,t.shouldShowStagingImage=!0},fitBoundingBoxToStage:t=>{const{boundingBoxDimensions:e,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=t,a=r.width/i,s=r.height/i;if(n.x<0||n.x+e.width>a||n.y<0||n.y+e.height>s){const u={width:Of(_t.clamp(a,64,512),64),height:Of(_t.clamp(s,64,512),64)},c={x:va(a/2-u.width/2,64),y:va(s/2-u.height/2,64)};if(t.boundingBoxDimensions=u,t.boundingBoxCoordinates=c,t.boundingBoxScaleMethod==="auto"){const f=Ya(u);t.scaledBoundingBoxDimensions=f}}},setBoundingBoxScaleMethod:(t,e)=>{if(t.boundingBoxScaleMethod=e.payload,e.payload==="auto"){const n=Ya(t.boundingBoxDimensions);t.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(t,e)=>{t.scaledBoundingBoxDimensions=e.payload},setShouldShowStagingImage:(t,e)=>{t.shouldShowStagingImage=e.payload},setShouldShowStagingOutline:(t,e)=>{t.shouldShowStagingOutline=e.payload},setShouldShowCanvasDebugInfo:(t,e)=>{t.shouldShowCanvasDebugInfo=e.payload},setShouldRestrictStrokesToBox:(t,e)=>{t.shouldRestrictStrokesToBox=e.payload},setShouldCropToBoundingBoxOnSave:(t,e)=>{t.shouldCropToBoundingBoxOnSave=e.payload},setColorPickerColor:(t,e)=>{t.colorPickerColor=e.payload},commitColorPickerColor:t=>{t.brushColor={...t.colorPickerColor,a:t.brushColor.a},t.tool="brush"},setMergedCanvas:(t,e)=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.futureLayerStates=[],t.layerState.objects=[e.payload]},resetCanvasInteractionState:t=>{t.cursorPosition=null,t.isDrawing=!1,t.isMouseOverBoundingBox=!1,t.isMoveBoundingBoxKeyHeld=!1,t.isMoveStageKeyHeld=!1,t.isMovingBoundingBox=!1,t.isMovingStage=!1,t.isTransformingBoundingBox=!1},mouseLeftCanvas:t=>{t.cursorPosition=null,t.isDrawing=!1,t.isMouseOverBoundingBox=!1,t.isMovingBoundingBox=!1,t.isTransformingBoundingBox=!1}}}),{addEraseRect:zG,addFillRect:GG,addImageToStagingArea:y5,addLine:UG,addPointToCurrentLine:jG,clearCanvasHistory:HG,clearMask:WG,commitColorPickerColor:VG,commitStagingAreaImage:qG,discardStagedImages:KG,fitBoundingBoxToStage:YG,mouseLeftCanvas:XG,nextStagingAreaImage:QG,prevStagingAreaImage:JG,redo:ZG,resetCanvas:eU,resetCanvasInteractionState:tU,resetCanvasView:nU,resizeAndScaleCanvas:rU,resizeCanvas:iU,setBoundingBoxCoordinates:aU,setBoundingBoxDimensions:oU,setBoundingBoxPreviewFill:sU,setBoundingBoxScaleMethod:lU,setBrushColor:uU,setBrushSize:cU,setCanvasContainerDimensions:fU,setColorPickerColor:dU,setCursorPosition:hU,setDoesCanvasNeedScaling:pU,setInitialCanvasImage:gU,setIsDrawing:mU,setIsMaskEnabled:vU,setIsMouseOverBoundingBox:yU,setIsMoveBoundingBoxKeyHeld:SU,setIsMoveStageKeyHeld:_U,setIsMovingBoundingBox:wU,setIsMovingStage:bU,setIsTransformingBoundingBox:CU,setLayer:xU,setMaskColor:kU,setMergedCanvas:EU,setShouldAutoSave:PU,setShouldCropToBoundingBoxOnSave:OU,setShouldDarkenOutsideBoundingBox:TU,setShouldLockBoundingBox:RU,setShouldPreserveMaskedArea:AU,setShouldShowBoundingBox:IU,setShouldShowBrush:LU,setShouldShowBrushPreview:MU,setShouldShowCanvasDebugInfo:DU,setShouldShowCheckboardTransparency:NU,setShouldShowGrid:BU,setShouldShowIntermediates:FU,setShouldShowStagingImage:$U,setShouldShowStagingOutline:zU,setShouldSnapToGrid:GU,setStageCoordinates:UU,setStageScale:jU,setTool:HU,toggleShouldLockBoundingBox:WU,toggleTool:VU,undo:qU,setScaledBoundingBoxDimensions:KU,setShouldRestrictStrokesToBox:YU}=Zx.actions,S5=Zx.reducer,_5={currentImageUuid:"",shouldPinGallery:!0,shouldShowGallery:!0,galleryImageMinimumWidth:64,galleryImageObjectFit:"cover",shouldHoldGalleryOpen:!1,shouldAutoSwitchToNewImages:!0,currentCategory:"result",categories:{user:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0},result:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0}},galleryWidth:300,shouldUseSingleGalleryColumn:!1},ek=vo({name:"gallery",initialState:_5,reducers:{setCurrentImage:(t,e)=>{t.currentImage=e.payload,t.currentImageUuid=e.payload.uuid},removeImage:(t,e)=>{const{uuid:n,category:r}=e.payload,i=t.categories[r].images,a=i.filter(s=>s.uuid!==n);if(n===t.currentImageUuid){const s=i.findIndex(c=>c.uuid===n),u=_t.clamp(s,0,a.length-1);t.currentImage=a.length?a[u]:void 0,t.currentImageUuid=a.length?a[u].uuid:""}t.categories[r].images=a},addImage:(t,e)=>{const{image:n,category:r}=e.payload,{uuid:i,url:a,mtime:s}=n,u=t.categories[r];u.images.find(c=>c.url===a&&c.mtime===s)||(u.images.unshift(n),t.shouldAutoSwitchToNewImages&&(t.currentImageUuid=i,t.currentImage=n,t.currentCategory=r),t.intermediateImage=void 0,u.latest_mtime=s)},setIntermediateImage:(t,e)=>{t.intermediateImage=e.payload},clearIntermediateImage:t=>{t.intermediateImage=void 0},selectNextImage:t=>{const{currentImage:e}=t;if(!e)return;const n=t.categories[e.category].images;if(e){const r=n.findIndex(i=>i.uuid===e.uuid);if(r{const{currentImage:e}=t;if(!e)return;const n=t.categories[e.category].images;if(e){const r=n.findIndex(i=>i.uuid===e.uuid);if(r>0){const i=n[r-1];t.currentImage=i,t.currentImageUuid=i.uuid}}},addGalleryImages:(t,e)=>{const{images:n,areMoreImagesAvailable:r,category:i}=e.payload,a=t.categories[i].images;if(n.length>0){const s=n.filter(u=>!a.find(c=>c.url===u.url&&c.mtime===u.mtime));if(t.categories[i].images=a.concat(s).sort((u,c)=>c.mtime-u.mtime),!t.currentImage){const u=n[0];t.currentImage=u,t.currentImageUuid=u.uuid}t.categories[i].latest_mtime=n[0].mtime,t.categories[i].earliest_mtime=n[n.length-1].mtime}r!==void 0&&(t.categories[i].areMoreImagesAvailable=r)},setShouldPinGallery:(t,e)=>{t.shouldPinGallery=e.payload},setShouldShowGallery:(t,e)=>{t.shouldShowGallery=e.payload},setGalleryImageMinimumWidth:(t,e)=>{t.galleryImageMinimumWidth=e.payload},setGalleryImageObjectFit:(t,e)=>{t.galleryImageObjectFit=e.payload},setShouldHoldGalleryOpen:(t,e)=>{t.shouldHoldGalleryOpen=e.payload},setShouldAutoSwitchToNewImages:(t,e)=>{t.shouldAutoSwitchToNewImages=e.payload},setCurrentCategory:(t,e)=>{t.currentCategory=e.payload},setGalleryWidth:(t,e)=>{t.galleryWidth=e.payload},setShouldUseSingleGalleryColumn:(t,e)=>{t.shouldUseSingleGalleryColumn=e.payload}}}),{addImage:Tf,clearIntermediateImage:Cm,removeImage:tk,setCurrentImage:XU,addGalleryImages:w5,setIntermediateImage:b5,selectNextImage:QU,selectPrevImage:JU,setShouldPinGallery:ZU,setShouldShowGallery:ej,setGalleryImageMinimumWidth:tj,setGalleryImageObjectFit:nj,setShouldHoldGalleryOpen:rj,setShouldAutoSwitchToNewImages:ij,setCurrentCategory:aj,setGalleryWidth:oj,setShouldUseSingleGalleryColumn:sj}=ek.actions,C5=ek.reducer,x5={isLightboxOpen:!1},k5=x5,nk=vo({name:"lightbox",initialState:k5,reducers:{setIsLightboxOpen:(t,e)=>{t.isLightboxOpen=e.payload}}}),{setIsLightboxOpen:lj}=nk.actions,E5=nk.reducer,hd=t=>typeof t=="string"?t:t.length===1?t[0].prompt:t.map(e=>`${e.prompt}:${e.weight}`).join(" ");function P5(t){let e=typeof t=="string"?t:hd(t),n="";const r=new RegExp(/\[([^\][]*)]/,"gi"),i=[...e.matchAll(r)].map(a=>a[1]);return i.length&&(n=i.join(" "),i.forEach(a=>{e=e.replace(`[${a}]`,"").replaceAll("[]","").trim()})),[e,n]}const O5=t=>{const r=t.split(",").map(i=>i.split(":")).map(i=>({seed:Number(i[0]),weight:Number(i[1])}));return T5(r)?r:!1},T5=t=>Boolean(typeof t=="string"?O5(t):t.length&&!t.some(e=>{const{seed:n,weight:r}=e,i=!isNaN(parseInt(n.toString(),10)),a=!isNaN(parseInt(r.toString(),10))&&r>=0&&r<=1;return!(i&&a)})),Ow=t=>t.reduce((e,n,r,i)=>{const{seed:a,weight:s}=n;return e+=`${a}:${s}`,r!==i.length-1&&(e+=","),e},""),R5=t=>t.split(",").map(r=>r.split(":")).map(r=>[parseInt(r[0],10),parseFloat(r[1])]),rk={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,maskPath:"",perlin:0,prompt:"",negativePrompt:"",sampler:"k_lms",seamBlur:16,seamless:!1,seamSize:96,seamSteps:30,seamStrength:.7,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,tileSize:32,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0},A5=rk,ik=vo({name:"generation",initialState:A5,reducers:{setPrompt:(t,e)=>{const n=e.payload;typeof n=="string"?t.prompt=n:t.prompt=hd(n)},setNegativePrompt:(t,e)=>{const n=e.payload;typeof n=="string"?t.negativePrompt=n:t.negativePrompt=hd(n)},setIterations:(t,e)=>{t.iterations=e.payload},setSteps:(t,e)=>{t.steps=e.payload},clampSymmetrySteps:t=>{t.horizontalSymmetrySteps=_t.clamp(t.horizontalSymmetrySteps,0,t.steps),t.verticalSymmetrySteps=_t.clamp(t.verticalSymmetrySteps,0,t.steps)},setCfgScale:(t,e)=>{t.cfgScale=e.payload},setThreshold:(t,e)=>{t.threshold=e.payload},setPerlin:(t,e)=>{t.perlin=e.payload},setHeight:(t,e)=>{t.height=e.payload},setWidth:(t,e)=>{t.width=e.payload},setSampler:(t,e)=>{t.sampler=e.payload},setSeed:(t,e)=>{t.seed=e.payload,t.shouldRandomizeSeed=!1},setImg2imgStrength:(t,e)=>{t.img2imgStrength=e.payload},setMaskPath:(t,e)=>{t.maskPath=e.payload},setSeamless:(t,e)=>{t.seamless=e.payload},setShouldFitToWidthHeight:(t,e)=>{t.shouldFitToWidthHeight=e.payload},resetSeed:t=>{t.seed=-1},setParameter:(t,e)=>{const{key:n,value:r}=e.payload,i={...t,[n]:r};return n==="seed"&&(i.shouldRandomizeSeed=!1),i},setShouldGenerateVariations:(t,e)=>{t.shouldGenerateVariations=e.payload},setVariationAmount:(t,e)=>{t.variationAmount=e.payload},setSeedWeights:(t,e)=>{t.seedWeights=e.payload,t.shouldGenerateVariations=!0,t.variationAmount=0},setAllTextToImageParameters:(t,e)=>{const{sampler:n,prompt:r,seed:i,variations:a,steps:s,cfg_scale:u,threshold:c,perlin:f,seamless:h,_hires_fix:p,width:g,height:y}=e.payload.image;a&&a.length>0?(t.seedWeights=Ow(a),t.shouldGenerateVariations=!0,t.variationAmount=0):t.shouldGenerateVariations=!1,i&&(t.seed=i,t.shouldRandomizeSeed=!1),r&&(t.prompt=hd(r)),n&&(t.sampler=n),s&&(t.steps=s),u&&(t.cfgScale=u),typeof c>"u"?t.threshold=0:t.threshold=c,typeof f>"u"?t.perlin=0:t.perlin=f,typeof h=="boolean"&&(t.seamless=h),g&&(t.width=g),y&&(t.height=y)},setAllImageToImageParameters:(t,e)=>{const{type:n,strength:r,fit:i,init_image_path:a,mask_image_path:s}=e.payload.image;n==="img2img"&&(a&&(t.initialImage=a),s&&(t.maskPath=s),r&&(t.img2imgStrength=r),typeof i=="boolean"&&(t.shouldFitToWidthHeight=i))},setAllParameters:(t,e)=>{const{type:n,sampler:r,prompt:i,seed:a,variations:s,steps:u,cfg_scale:c,threshold:f,perlin:h,seamless:p,_hires_fix:g,width:y,height:v,strength:w,fit:x,init_image_path:_,mask_image_path:S}=e.payload.image;if(n==="img2img"&&(_&&(t.initialImage=_),S&&(t.maskPath=S),w&&(t.img2imgStrength=w),typeof x=="boolean"&&(t.shouldFitToWidthHeight=x)),s&&s.length>0?(t.seedWeights=Ow(s),t.shouldGenerateVariations=!0,t.variationAmount=0):t.shouldGenerateVariations=!1,a&&(t.seed=a,t.shouldRandomizeSeed=!1),i){const[C,O]=P5(i);C&&(t.prompt=C),O?t.negativePrompt=O:t.negativePrompt=""}r&&(t.sampler=r),u&&(t.steps=u),c&&(t.cfgScale=c),typeof f>"u"?t.threshold=0:t.threshold=f,typeof h>"u"?t.perlin=0:t.perlin=h,typeof p=="boolean"&&(t.seamless=p),y&&(t.width=y),v&&(t.height=v)},resetParametersState:t=>({...t,...rk}),setShouldRandomizeSeed:(t,e)=>{t.shouldRandomizeSeed=e.payload},setInitialImage:(t,e)=>{t.initialImage=e.payload},clearInitialImage:t=>{t.initialImage=void 0},setSeamSize:(t,e)=>{t.seamSize=e.payload},setSeamBlur:(t,e)=>{t.seamBlur=e.payload},setSeamStrength:(t,e)=>{t.seamStrength=e.payload},setSeamSteps:(t,e)=>{t.seamSteps=e.payload},setTileSize:(t,e)=>{t.tileSize=e.payload},setInfillMethod:(t,e)=>{t.infillMethod=e.payload},setShouldUseSymmetry:(t,e)=>{t.shouldUseSymmetry=e.payload},setHorizontalSymmetrySteps:(t,e)=>{t.horizontalSymmetrySteps=e.payload},setVerticalSymmetrySteps:(t,e)=>{t.verticalSymmetrySteps=e.payload}}}),{clampSymmetrySteps:uj,clearInitialImage:I5,resetParametersState:cj,resetSeed:fj,setAllImageToImageParameters:dj,setAllParameters:hj,setAllTextToImageParameters:pj,setCfgScale:gj,setHeight:mj,setImg2imgStrength:vj,setInfillMethod:L5,setInitialImage:M5,setIterations:yj,setMaskPath:D5,setParameter:Sj,setPerlin:_j,setPrompt:wj,setNegativePrompt:bj,setSampler:Cj,setSeamBlur:xj,setSeamless:kj,setSeamSize:Ej,setSeamSteps:Pj,setSeamStrength:Oj,setSeed:Tj,setSeedWeights:Rj,setShouldFitToWidthHeight:Aj,setShouldGenerateVariations:Ij,setShouldRandomizeSeed:Lj,setSteps:Mj,setThreshold:Dj,setTileSize:Nj,setVariationAmount:Bj,setWidth:Fj,setShouldUseSymmetry:$j,setHorizontalSymmetrySteps:zj,setVerticalSymmetrySteps:Gj}=ik.actions,N5=ik.reducer,ak={codeformerFidelity:.75,facetoolStrength:.75,facetoolType:"gfpgan",hiresFix:!1,hiresStrength:.75,shouldLoopback:!1,shouldRunESRGAN:!1,shouldRunFacetool:!1,upscalingLevel:4,upscalingDenoising:.75,upscalingStrength:.75},B5=ak,ok=vo({name:"postprocessing",initialState:B5,reducers:{setFacetoolStrength:(t,e)=>{t.facetoolStrength=e.payload},setCodeformerFidelity:(t,e)=>{t.codeformerFidelity=e.payload},setUpscalingLevel:(t,e)=>{t.upscalingLevel=e.payload},setUpscalingDenoising:(t,e)=>{t.upscalingDenoising=e.payload},setUpscalingStrength:(t,e)=>{t.upscalingStrength=e.payload},setHiresFix:(t,e)=>{t.hiresFix=e.payload},setHiresStrength:(t,e)=>{t.hiresStrength=e.payload},resetPostprocessingState:t=>({...t,...ak}),setShouldRunFacetool:(t,e)=>{t.shouldRunFacetool=e.payload},setFacetoolType:(t,e)=>{t.facetoolType=e.payload},setShouldRunESRGAN:(t,e)=>{t.shouldRunESRGAN=e.payload},setShouldLoopback:(t,e)=>{t.shouldLoopback=e.payload}}}),{resetPostprocessingState:Uj,setCodeformerFidelity:jj,setFacetoolStrength:Hj,setFacetoolType:Wj,setHiresFix:Vj,setHiresStrength:qj,setShouldLoopback:Kj,setShouldRunESRGAN:Yj,setShouldRunFacetool:Xj,setUpscalingLevel:Qj,setUpscalingDenoising:Jj,setUpscalingStrength:Zj}=ok.actions,F5=ok.reducer;function Sr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tw(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.init(e,n)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=n||G5,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(n){this.debug=n}},{key:"log",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i1?r-1:0),a=1;a-1?u.replace(/###/g,"."):u}function i(){return!t||typeof t=="string"}for(var a=typeof e!="string"?[].concat(e):e.split(".");a.length>1;){if(i())return{};var s=r(a.shift());!t[s]&&n&&(t[s]=new n),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={}}return i()?{}:{obj:t,k:r(a.shift())}}function Mw(t,e,n){var r=O0(t,e,Object),i=r.obj,a=r.k;i[a]=n}function H5(t,e,n,r){var i=O0(t,e,Object),a=i.obj,s=i.k;a[s]=a[s]||[],r&&(a[s]=a[s].concat(n)),r||a[s].push(n)}function rh(t,e){var n=O0(t,e),r=n.obj,i=n.k;if(r)return r[i]}function Dw(t,e,n){var r=rh(t,n);return r!==void 0?r:rh(e,n)}function ck(t,e,n){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?typeof t[r]=="string"||t[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?n&&(t[r]=e[r]):ck(t[r],e[r],n):t[r]=e[r]);return t}function es(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var W5={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function V5(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,function(e){return W5[e]}):t}var Qh=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,q5=[" ",",","?","!",";"];function K5(t,e,n){e=e||"",n=n||"";var r=q5.filter(function(u){return e.indexOf(u)<0&&n.indexOf(u)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(u){return u==="?"?"\\?":u}).join("|"),")")),a=!i.test(t);if(!a){var s=t.indexOf(n);s>0&&!i.test(t.substring(0,s))&&(a=!0)}return a}function Nw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Rf(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function fk(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(t){if(t[e])return t[e];for(var r=e.split(n),i=t,a=0;aa+s;)s++,u=r.slice(a,a+s).join(n),c=i[u];if(c===void 0)return;if(c===null)return null;if(e.endsWith(u)){if(typeof c=="string")return c;if(u&&typeof c[u]=="string")return c[u]}var f=r.slice(a+s).join(n);return f?fk(c,f,n):void 0}i=i[r[a]]}return i}}var Q5=function(t){Xh(n,t);var e=Y5(n);function n(r){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Sr(this,n),i=e.call(this),Qh&&Aa.call(Pa(i)),i.data=r||{},i.options=a,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return _r(n,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var a=this.options.ns.indexOf(i);a>-1&&this.options.ns.splice(a,1)}},{key:"getResource",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},c=u.keySeparator!==void 0?u.keySeparator:this.options.keySeparator,f=u.ignoreJSONStructure!==void 0?u.ignoreJSONStructure:this.options.ignoreJSONStructure,h=[i,a];s&&typeof s!="string"&&(h=h.concat(s)),s&&typeof s=="string"&&(h=h.concat(c?s.split(c):s)),i.indexOf(".")>-1&&(h=i.split("."));var p=rh(this.data,h);return p||!f||typeof s!="string"?p:fk(this.data&&this.data[i]&&this.data[i][a],s,c)}},{key:"addResource",value:function(i,a,s,u){var c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},f=this.options.keySeparator;f===void 0&&(f=".");var h=[i,a];s&&(h=h.concat(f?s.split(f):s)),i.indexOf(".")>-1&&(h=i.split("."),u=a,a=h[1]),this.addNamespaces(a),Mw(this.data,h,u),c.silent||this.emit("added",i,a,s,u)}},{key:"addResources",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var c in s)(typeof s[c]=="string"||Object.prototype.toString.apply(s[c])==="[object Array]")&&this.addResource(i,a,c,s[c],{silent:!0});u.silent||this.emit("added",i,a,s)}},{key:"addResourceBundle",value:function(i,a,s,u,c){var f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},h=[i,a];i.indexOf(".")>-1&&(h=i.split("."),u=s,s=a,a=h[1]),this.addNamespaces(a);var p=rh(this.data,h)||{};u?ck(p,s,c):p=Rf(Rf({},p),s),Mw(this.data,h,p),f.silent||this.emit("added",i,a,s)}},{key:"removeResourceBundle",value:function(i,a){this.hasResourceBundle(i,a)&&delete this.data[i][a],this.removeNamespaces(a),this.emit("removed",i,a)}},{key:"hasResourceBundle",value:function(i,a){return this.getResource(i,a)!==void 0}},{key:"getResourceBundle",value:function(i,a){return a||(a=this.options.defaultNS),this.options.compatibilityAPI==="v1"?Rf(Rf({},{}),this.getResource(i,a)):this.getResource(i,a)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var a=this.getDataByLanguage(i),s=a&&Object.keys(a)||[];return!!s.find(function(u){return a[u]&&Object.keys(a[u]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),n}(Aa),dk={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,n,r,i,a){var s=this;return e.forEach(function(u){s.processors[u]&&(n=s.processors[u].process(n,r,i,a))}),n}};function Bw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mn(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Fw={},$w=function(t){Xh(n,t);var e=J5(n);function n(r){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Sr(this,n),i=e.call(this),Qh&&Aa.call(Pa(i)),j5(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,Pa(i)),i.options=a,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=ii.create("translator"),i}return _r(n,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var s=this.resolve(i,a);return s&&s.res!==void 0}},{key:"extractFromKey",value:function(i,a){var s=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");var u=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=a.ns||this.options.defaultNS||[],f=s&&i.indexOf(s)>-1,h=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!K5(i,s,u);if(f&&!h){var p=i.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:i,namespaces:c};var g=i.split(s);(s!==u||s===u&&this.options.ns.indexOf(g[0])>-1)&&(c=g.shift()),i=g.join(u)}return typeof c=="string"&&(c=[c]),{key:i,namespaces:c}}},{key:"translate",value:function(i,a,s){var u=this;if(gr(a)!=="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),a||(a={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var c=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,f=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,h=this.extractFromKey(i[i.length-1],a),p=h.key,g=h.namespaces,y=g[g.length-1],v=a.lng||this.language,w=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(v&&v.toLowerCase()==="cimode"){if(w){var x=a.nsSeparator||this.options.nsSeparator;return c?{res:"".concat(y).concat(x).concat(p),usedKey:p,exactUsedKey:p,usedLng:v,usedNS:y}:"".concat(y).concat(x).concat(p)}return c?{res:p,usedKey:p,exactUsedKey:p,usedLng:v,usedNS:y}:p}var _=this.resolve(i,a),S=_&&_.res,C=_&&_.usedKey||p,O=_&&_.exactUsedKey||p,I=Object.prototype.toString.apply(S),L=["[object Number]","[object Function]","[object RegExp]"],D=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,U=!this.i18nFormat||this.i18nFormat.handleAsObject,X=typeof S!="string"&&typeof S!="boolean"&&typeof S!="number";if(U&&S&&X&&L.indexOf(I)<0&&!(typeof D=="string"&&I==="[object Array]")){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var K=this.options.returnedObjectHandler?this.options.returnedObjectHandler(C,S,mn(mn({},a),{},{ns:g})):"key '".concat(p," (").concat(this.language,")' returned an object instead of string.");return c?(_.res=K,_):K}if(f){var te=I==="[object Array]",ce=te?[]:{},j=te?O:C;for(var T in S)if(Object.prototype.hasOwnProperty.call(S,T)){var $="".concat(j).concat(f).concat(T);ce[T]=this.translate($,mn(mn({},a),{joinArrays:!1,ns:g})),ce[T]===$&&(ce[T]=S[T])}S=ce}}else if(U&&typeof D=="string"&&I==="[object Array]")S=S.join(D),S&&(S=this.extendTranslation(S,i,a,s));else{var V=!1,ie=!1,H=a.count!==void 0&&typeof a.count!="string",Y=n.hasDefaultValue(a),Q=H?this.pluralResolver.getSuffix(v,a.count,a):"",oe=a["defaultValue".concat(Q)]||a.defaultValue;!this.isValidLookup(S)&&Y&&(V=!0,S=oe),this.isValidLookup(S)||(ie=!0,S=p);var ve=a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,we=ve&&ie?void 0:S,Ue=Y&&oe!==S&&this.options.updateMissing;if(ie||V||Ue){if(this.logger.log(Ue?"updateKey":"missingKey",v,y,p,Ue?oe:S),f){var At=this.resolve(p,mn(mn({},a),{},{keySeparator:!1}));At&&At.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.")}var me=[],qt=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&qt&&qt[0])for(var Bt=0;Bt1&&arguments[1]!==void 0?arguments[1]:{},u,c,f,h,p;return typeof i=="string"&&(i=[i]),i.forEach(function(g){if(!a.isValidLookup(u)){var y=a.extractFromKey(g,s),v=y.key;c=v;var w=y.namespaces;a.options.fallbackNS&&(w=w.concat(a.options.fallbackNS));var x=s.count!==void 0&&typeof s.count!="string",_=x&&!s.ordinal&&s.count===0&&a.pluralResolver.shouldUseIntlApi(),S=s.context!==void 0&&(typeof s.context=="string"||typeof s.context=="number")&&s.context!=="",C=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);w.forEach(function(O){a.isValidLookup(u)||(p=O,!Fw["".concat(C[0],"-").concat(O)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(p)&&(Fw["".concat(C[0],"-").concat(O)]=!0,a.logger.warn('key "'.concat(c,'" for languages "').concat(C.join(", "),`" won't get resolved as namespace "`).concat(p,'" 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!!!")),C.forEach(function(I){if(!a.isValidLookup(u)){h=I;var L=[v];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(L,v,I,O,s);else{var D;x&&(D=a.pluralResolver.getSuffix(I,s.count,s));var U="".concat(a.options.pluralSeparator,"zero");if(x&&(L.push(v+D),_&&L.push(v+U)),S){var X="".concat(v).concat(a.options.contextSeparator).concat(s.context);L.push(X),x&&(L.push(X+D),_&&L.push(X+U))}}for(var K;K=L.pop();)a.isValidLookup(u)||(f=K,u=a.getResource(I,O,K,s))}}))})}}),{res:u,usedKey:c,exactUsedKey:f,usedLng:h,usedNS:p}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,a,s,u):this.resourceStore.getResource(i,a,s,u)}}],[{key:"hasDefaultValue",value:function(i){var a="defaultValue";for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&a===s.substring(0,a.length)&&i[s]!==void 0)return!0;return!1}}]),n}(Aa);function xm(t){return t.charAt(0).toUpperCase()+t.slice(1)}var zw=function(){function t(e){Sr(this,t),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ii.create("languageUtils")}return _r(t,[{key:"getScriptPartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return null;var r=n.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return n;var r=n.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(n){if(typeof n=="string"&&n.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=n.split("-");return this.options.lowerCaseLng?i=i.map(function(a){return a.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=xm(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=xm(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=xm(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}},{key:"isSupportedCode",value:function(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}},{key:"getBestMatchFromCodes",value:function(n){var r=this;if(!n)return null;var i;return n.forEach(function(a){if(!i){var s=r.formatLanguageCode(a);(!r.options.supportedLngs||r.isSupportedCode(s))&&(i=s)}}),!i&&this.options.supportedLngs&&n.forEach(function(a){if(!i){var s=r.getLanguagePartFromCode(a);if(r.isSupportedCode(s))return i=s;i=r.options.supportedLngs.find(function(u){if(u.indexOf(s)===0)return u})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(n,r){if(!n)return[];if(typeof n=="function"&&(n=n(r)),typeof n=="string"&&(n=[n]),Object.prototype.toString.apply(n)==="[object Array]")return n;if(!r)return n.default||[];var i=n[r];return i||(i=n[this.getScriptPartFromCode(r)]),i||(i=n[this.formatLanguageCode(r)]),i||(i=n[this.getLanguagePartFromCode(r)]),i||(i=n.default),i||[]}},{key:"toResolveHierarchy",value:function(n,r){var i=this,a=this.getFallbackCodes(r||this.options.fallbackLng||[],n),s=[],u=function(f){f&&(i.isSupportedCode(f)?s.push(f):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(f)))};return typeof n=="string"&&n.indexOf("-")>-1?(this.options.load!=="languageOnly"&&u(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&u(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&u(this.getLanguagePartFromCode(n))):typeof n=="string"&&u(this.formatLanguageCode(n)),a.forEach(function(c){s.indexOf(c)<0&&u(i.formatLanguageCode(c))}),s}}]),t}(),e4=[{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}],t4={1:function(e){return Number(e>1)},2:function(e){return Number(e!=1)},3:function(e){return 0},4:function(e){return Number(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 Number(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 Number(e==1?0:e>=2&&e<=4?1:2)},7:function(e){return Number(e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(e==1?0:e==2?1:e!=8&&e!=11?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(e==1?0:e==2?1:e<7?2:e<11?3:4)},11:function(e){return Number(e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(e!==0)},14:function(e){return Number(e==1?0:e==2?1:e==3?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:e!==0?1:2)},17:function(e){return Number(e==1||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(e==0?0:e==1?1:2)},19:function(e){return Number(e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(e==1?0:e==0||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3)}},n4=["v1","v2","v3"],Gw={zero:0,one:1,two:2,few:3,many:4,other:5};function r4(){var t={};return e4.forEach(function(e){e.lngs.forEach(function(n){t[n]={numbers:e.nr,plurals:t4[e.fc]}})}),t}var i4=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.languageUtils=e,this.options=n,this.logger=ii.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(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=r4()}return _r(t,[{key:"addRule",value:function(n,r){this.rules[n]=r}},{key:"getRule",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(n,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[n]||this.rules[this.languageUtils.getLanguagePartFromCode(n)]}},{key:"needsPlural",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(n,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(n,i).map(function(a){return"".concat(r).concat(a)})}},{key:"getSuffixes",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.getRule(n,i);return a?this.shouldUseIntlApi()?a.resolvedOptions().pluralCategories.sort(function(s,u){return Gw[s]-Gw[u]}).map(function(s){return"".concat(r.options.prepend).concat(s)}):a.numbers.map(function(s){return r.getSuffix(n,s,i)}):[]}},{key:"getSuffix",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=this.getRule(n,i);return a?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(a.select(r)):this.getSuffixRetroCompatible(a,r):(this.logger.warn("no plural rule found for: ".concat(n)),"")}},{key:"getSuffixRetroCompatible",value:function(n,r){var i=this,a=n.noAbs?n.plurals(r):n.plurals(Math.abs(r)),s=n.numbers[a];this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));var u=function(){return i.options.prepend&&s.toString()?i.options.prepend+s.toString():s.toString()};return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?"_plural_".concat(s.toString()):u():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1?u():this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString()}},{key:"shouldUseIntlApi",value:function(){return!n4.includes(this.options.compatibilityJSON)}}]),t}();function Uw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ar(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Sr(this,t),this.logger=ii.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(n){return n},this.init(e)}return _r(t,[{key:"init",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n.interpolation||(n.interpolation={escapeValue:!0});var r=n.interpolation;this.escape=r.escape!==void 0?r.escape:V5,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?es(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?es(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?es(r.nestingPrefix):r.nestingPrefixEscaped||es("$t("),this.nestingSuffix=r.nestingSuffix?es(r.nestingSuffix):r.nestingSuffixEscaped||es(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var n="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(n,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(n,r,i,a){var s=this,u,c,f,h=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function p(x){return x.replace(/\$/g,"$$$$")}var g=function(_){if(_.indexOf(s.formatSeparator)<0){var S=Dw(r,h,_);return s.alwaysFormat?s.format(S,void 0,i,Ar(Ar(Ar({},a),r),{},{interpolationkey:_})):S}var C=_.split(s.formatSeparator),O=C.shift().trim(),I=C.join(s.formatSeparator).trim();return s.format(Dw(r,h,O),I,i,Ar(Ar(Ar({},a),r),{},{interpolationkey:O}))};this.resetRegExp();var y=a&&a.missingInterpolationHandler||this.options.missingInterpolationHandler,v=a&&a.interpolation&&a.interpolation.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,w=[{regex:this.regexpUnescape,safeValue:function(_){return p(_)}},{regex:this.regexp,safeValue:function(_){return s.escapeValue?p(s.escape(_)):p(_)}}];return w.forEach(function(x){for(f=0;u=x.regex.exec(n);){var _=u[1].trim();if(c=g(_),c===void 0)if(typeof y=="function"){var S=y(n,u,a);c=typeof S=="string"?S:""}else if(a&&Object.prototype.hasOwnProperty.call(a,_))c="";else if(v){c=u[0];continue}else s.logger.warn("missed to pass in variable ".concat(_," for interpolating ").concat(n)),c="";else typeof c!="string"&&!s.useRawValueToEscape&&(c=Lw(c));var C=x.safeValue(c);if(n=n.replace(u[0],C),v?(x.regex.lastIndex+=c.length,x.regex.lastIndex-=u[0].length):x.regex.lastIndex=0,f++,f>=s.maxReplaces)break}}),n}},{key:"nest",value:function(n,r){var i=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,u,c;function f(y,v){var w=this.nestingOptionsSeparator;if(y.indexOf(w)<0)return y;var x=y.split(new RegExp("".concat(w,"[ ]*{"))),_="{".concat(x[1]);y=x[0],_=this.interpolate(_,c);var S=_.match(/'/g),C=_.match(/"/g);(S&&S.length%2===0&&!C||C.length%2!==0)&&(_=_.replace(/'/g,'"'));try{c=JSON.parse(_),v&&(c=Ar(Ar({},v),c))}catch(O){return this.logger.warn("failed parsing options string in nesting for key ".concat(y),O),"".concat(y).concat(w).concat(_)}return delete c.defaultValue,y}for(;s=this.nestingRegexp.exec(n);){var h=[];c=Ar({},a),c=c.replace&&typeof c.replace!="string"?c.replace:c,c.applyPostProcessor=!1,delete c.defaultValue;var p=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){var g=s[1].split(this.formatSeparator).map(function(y){return y.trim()});s[1]=g.shift(),h=g,p=!0}if(u=r(f.call(this,s[1].trim(),c),c),u&&s[0]===n&&typeof u!="string")return u;typeof u!="string"&&(u=Lw(u)),u||(this.logger.warn("missed to resolve ".concat(s[1]," for nesting ").concat(n)),u=""),p&&(u=h.reduce(function(y,v){return i.format(y,v,a.lng,Ar(Ar({},a),{},{interpolationkey:s[1].trim()}))},u.trim())),n=n.replace(s[0],u),this.regexp.lastIndex=0}return n}}]),t}();function jw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ri(t){for(var e=1;e-1){var r=t.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)n.currency||(n.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)n.range||(n.range=i.trim());else{var a=i.split(";");a.forEach(function(s){if(s){var u=s.split(":"),c=z5(u),f=c[0],h=c.slice(1),p=h.join(":").trim().replace(/^'+|'+$/g,"");n[f.trim()]||(n[f.trim()]=p),p==="false"&&(n[f.trim()]=!1),p==="true"&&(n[f.trim()]=!0),isNaN(p)||(n[f.trim()]=parseInt(p,10))}})}}return{formatName:e,formatOptions:n}}function ts(t){var e={};return function(r,i,a){var s=i+JSON.stringify(a),u=e[s];return u||(u=t(i,a),e[s]=u),u(r)}}var s4=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Sr(this,t),this.logger=ii.create("formatter"),this.options=e,this.formats={number:ts(function(n,r){var i=new Intl.NumberFormat(n,Ri({},r));return function(a){return i.format(a)}}),currency:ts(function(n,r){var i=new Intl.NumberFormat(n,Ri(Ri({},r),{},{style:"currency"}));return function(a){return i.format(a)}}),datetime:ts(function(n,r){var i=new Intl.DateTimeFormat(n,Ri({},r));return function(a){return i.format(a)}}),relativetime:ts(function(n,r){var i=new Intl.RelativeTimeFormat(n,Ri({},r));return function(a){return i.format(a,r.range||"day")}}),list:ts(function(n,r){var i=new Intl.ListFormat(n,Ri({},r));return function(a){return i.format(a)}})},this.init(e)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(n,r){this.formats[n.toLowerCase().trim()]=r}},{key:"addCached",value:function(n,r){this.formats[n.toLowerCase().trim()]=ts(r)}},{key:"format",value:function(n,r,i){var a=this,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},u=r.split(this.formatSeparator),c=u.reduce(function(f,h){var p=o4(h),g=p.formatName,y=p.formatOptions;if(a.formats[g]){var v=f;try{var w=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},x=w.locale||w.lng||s.locale||s.lng||i;v=a.formats[g](f,x,Ri(Ri(Ri({},y),s),w))}catch(_){a.logger.warn(_)}return v}else a.logger.warn("there was no format function for ".concat(g));return f},n);return c}}]),t}();function Hw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ww(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function c4(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}var f4=function(t){Xh(n,t);var e=l4(n);function n(r,i,a){var s,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Sr(this,n),s=e.call(this),Qh&&Aa.call(Pa(s)),s.backend=r,s.store=i,s.services=a,s.languageUtils=a.languageUtils,s.options=u,s.logger=ii.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=u.maxParallelReads||10,s.readingCalls=0,s.maxRetries=u.maxRetries>=0?u.maxRetries:5,s.retryTimeout=u.retryTimeout>=1?u.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(a,u.backend,u),s}return _r(n,[{key:"queueLoad",value:function(i,a,s,u){var c=this,f={},h={},p={},g={};return i.forEach(function(y){var v=!0;a.forEach(function(w){var x="".concat(y,"|").concat(w);!s.reload&&c.store.hasResourceBundle(y,w)?c.state[x]=2:c.state[x]<0||(c.state[x]===1?h[x]===void 0&&(h[x]=!0):(c.state[x]=1,v=!1,h[x]===void 0&&(h[x]=!0),f[x]===void 0&&(f[x]=!0),g[w]===void 0&&(g[w]=!0)))}),v||(p[y]=!0)}),(Object.keys(f).length||Object.keys(h).length)&&this.queue.push({pending:h,pendingCount:Object.keys(h).length,loaded:{},errors:[],callback:u}),{toLoad:Object.keys(f),pending:Object.keys(h),toLoadLanguages:Object.keys(p),toLoadNamespaces:Object.keys(g)}}},{key:"loaded",value:function(i,a,s){var u=i.split("|"),c=u[0],f=u[1];a&&this.emit("failedLoading",c,f,a),s&&this.store.addResourceBundle(c,f,s),this.state[i]=a?-1:2;var h={};this.queue.forEach(function(p){H5(p.loaded,[c],f),c4(p,i),a&&p.errors.push(a),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(function(g){h[g]||(h[g]={});var y=p.loaded[g];y.length&&y.forEach(function(v){h[g][v]===void 0&&(h[g][v]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",h),this.queue=this.queue.filter(function(p){return!p.done})}},{key:"read",value:function(i,a,s){var u=this,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,h=arguments.length>5?arguments[5]:void 0;if(!i.length)return h(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:a,fcName:s,tried:c,wait:f,callback:h});return}this.readingCalls++;var p=function(w,x){if(u.readingCalls--,u.waitingReads.length>0){var _=u.waitingReads.shift();u.read(_.lng,_.ns,_.fcName,_.tried,_.wait,_.callback)}if(w&&x&&c2&&arguments[2]!==void 0?arguments[2]:{},c=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."),c&&c();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof a=="string"&&(a=[a]);var f=this.queueLoad(i,a,u,c);if(!f.toLoad.length)return f.pending.length||c(),null;f.toLoad.forEach(function(h){s.loadOne(h)})}},{key:"load",value:function(i,a,s){this.prepareLoading(i,a,{},s)}},{key:"reload",value:function(i,a,s){this.prepareLoading(i,a,{reload:!0},s)}},{key:"loadOne",value:function(i){var a=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",u=i.split("|"),c=u[0],f=u[1];this.read(c,f,"read",void 0,void 0,function(h,p){h&&a.logger.warn("".concat(s,"loading namespace ").concat(f," for language ").concat(c," failed"),h),!h&&p&&a.logger.log("".concat(s,"loaded namespace ").concat(f," for language ").concat(c),p),a.loaded(i,h,p)})}},{key:"saveMissing",value:function(i,a,s,u,c){var f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(a)){this.logger.warn('did not save key "'.concat(s,'" as the namespace "').concat(a,'" 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(!(s==null||s==="")){if(this.backend&&this.backend.create){var p=Ww(Ww({},f),{},{isUpdate:c}),g=this.backend.create.bind(this.backend);if(g.length<6)try{var y;g.length===5?y=g(i,a,s,u,p):y=g(i,a,s,u),y&&typeof y.then=="function"?y.then(function(v){return h(null,v)}).catch(h):h(null,y)}catch(v){h(v)}else g(i,a,s,u,h,p)}!i||!i[0]||this.store.addResource(i[0],a,s,u)}}}]),n}(Aa);function Vw(){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:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var n={};if(gr(e[1])==="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),gr(e[2])==="object"||gr(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:function(e,n,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function qw(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function Kw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Qr(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Af(){}function p4(t){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(t));e.forEach(function(n){typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}var ih=function(t){Xh(n,t);var e=d4(n);function n(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;if(Sr(this,n),r=e.call(this),Qh&&Aa.call(Pa(r)),r.options=qw(i),r.services={},r.logger=ii,r.modules={external:[]},p4(Pa(r)),a&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,a),Zu(r,Pa(r));setTimeout(function(){r.init(i,a)},0)}return r}return _r(n,[{key:"init",value:function(){var i=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;typeof a=="function"&&(s=a,a={}),!a.defaultNS&&a.defaultNS!==!1&&a.ns&&(typeof a.ns=="string"?a.defaultNS=a.ns:a.ns.indexOf("translation")<0&&(a.defaultNS=a.ns[0]));var u=Vw();this.options=Qr(Qr(Qr({},u),this.options),qw(a)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Qr(Qr({},u.interpolation),this.options.interpolation)),a.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=a.keySeparator),a.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=a.nsSeparator);function c(_){return _?typeof _=="function"?new _:_:null}if(!this.options.isClone){this.modules.logger?ii.init(c(this.modules.logger),this.options):ii.init(null,this.options);var f;this.modules.formatter?f=this.modules.formatter:typeof Intl<"u"&&(f=s4);var h=new zw(this.options);this.store=new Q5(this.options.resources,this.options);var p=this.services;p.logger=ii,p.resourceStore=this.store,p.languageUtils=h,p.pluralResolver=new i4(h,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),f&&(!this.options.interpolation.format||this.options.interpolation.format===u.interpolation.format)&&(p.formatter=c(f),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new a4(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new f4(c(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(_){for(var S=arguments.length,C=new Array(S>1?S-1:0),O=1;O1?S-1:0),O=1;O0&&g[0]!=="dev"&&(this.options.lng=g[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var y=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];y.forEach(function(_){i[_]=function(){var S;return(S=i.store)[_].apply(S,arguments)}});var v=["addResource","addResources","addResourceBundle","removeResourceBundle"];v.forEach(function(_){i[_]=function(){var S;return(S=i.store)[_].apply(S,arguments),i}});var w=Bl(),x=function(){var S=function(O,I){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),w.resolve(I),s(O,I)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return S(null,i.t.bind(i));i.changeLanguage(i.options.lng,S)};return this.options.resources||!this.options.initImmediate?x():setTimeout(x,0),w}},{key:"loadResources",value:function(i){var a=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Af,u=s,c=typeof i=="string"?i:this.language;if(typeof i=="function"&&(u=i),!this.options.resources||this.options.partialBundledLanguages){if(c&&c.toLowerCase()==="cimode")return u();var f=[],h=function(y){if(y){var v=a.services.languageUtils.toResolveHierarchy(y);v.forEach(function(w){f.indexOf(w)<0&&f.push(w)})}};if(c)h(c);else{var p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.forEach(function(g){return h(g)})}this.options.preload&&this.options.preload.forEach(function(g){return h(g)}),this.services.backendConnector.load(f,this.options.ns,function(g){!g&&!a.resolvedLanguage&&a.language&&a.setResolvedLanguage(a.language),u(g)})}else u(null)}},{key:"reloadResources",value:function(i,a,s){var u=Bl();return i||(i=this.languages),a||(a=this.options.ns),s||(s=Af),this.services.backendConnector.reload(i,a,function(c){u.resolve(),s(c)}),u}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&dk.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var a=0;a-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}},{key:"changeLanguage",value:function(i,a){var s=this;this.isLanguageChangingTo=i;var u=Bl();this.emit("languageChanging",i);var c=function(g){s.language=g,s.languages=s.services.languageUtils.toResolveHierarchy(g),s.resolvedLanguage=void 0,s.setResolvedLanguage(g)},f=function(g,y){y?(c(y),s.translator.changeLanguage(y),s.isLanguageChangingTo=void 0,s.emit("languageChanged",y),s.logger.log("languageChanged",y)):s.isLanguageChangingTo=void 0,u.resolve(function(){return s.t.apply(s,arguments)}),a&&a(g,function(){return s.t.apply(s,arguments)})},h=function(g){!i&&!g&&s.services.languageDetector&&(g=[]);var y=typeof g=="string"?g:s.services.languageUtils.getBestMatchFromCodes(g);y&&(s.language||c(y),s.translator.language||s.translator.changeLanguage(y),s.services.languageDetector&&s.services.languageDetector.cacheUserLanguage&&s.services.languageDetector.cacheUserLanguage(y)),s.loadResources(y,function(v){f(v,y)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?h(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(h):this.services.languageDetector.detect(h):h(i),u}},{key:"getFixedT",value:function(i,a,s){var u=this,c=function f(h,p){var g;if(gr(p)!=="object"){for(var y=arguments.length,v=new Array(y>2?y-2:0),w=2;w1&&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;var u=this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,f=this.languages[this.languages.length-1];if(u.toLowerCase()==="cimode")return!0;var h=function(y,v){var w=a.services.backendConnector.state["".concat(y,"|").concat(v)];return w===-1||w===2};if(s.precheck){var p=s.precheck(this,h);if(p!==void 0)return p}return!!(this.hasResourceBundle(u,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||h(u,i)&&(!c||h(f,i)))}},{key:"loadNamespaces",value:function(i,a){var s=this,u=Bl();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(c){s.options.ns.indexOf(c)<0&&s.options.ns.push(c)}),this.loadResources(function(c){u.resolve(),a&&a(c)}),u):(a&&a(),Promise.resolve())}},{key:"loadLanguages",value:function(i,a){var s=Bl();typeof i=="string"&&(i=[i]);var u=this.options.preload||[],c=i.filter(function(f){return u.indexOf(f)<0});return c.length?(this.options.preload=u.concat(c),this.loadResources(function(f){s.resolve(),a&&a(f)}),s):(a&&a(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var a=["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"],s=this.services&&this.services.languageUtils||new zw(Vw());return a.indexOf(s.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Af,u=Qr(Qr(Qr({},this.options),a),{isClone:!0}),c=new n(u);(a.debug!==void 0||a.prefix!==void 0)&&(c.logger=c.logger.clone(a));var f=["store","services","language"];return f.forEach(function(h){c[h]=i[h]}),c.services=Qr({},this.services),c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c.translator=new $w(c.services,c.options),c.translator.on("*",function(h){for(var p=arguments.length,g=new Array(p>1?p-1:0),y=1;y0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new ih(t,e)});var Ae=ih.createInstance();Ae.createInstance=ih.createInstance;Ae.createInstance;Ae.dir;Ae.init;Ae.loadResources;Ae.reloadResources;Ae.use;Ae.changeLanguage;Ae.getFixedT;Ae.t;Ae.exists;Ae.setDefaultNamespace;Ae.hasLoadedNamespace;Ae.loadNamespaces;Ae.loadLanguages;var hk=[],g4=hk.forEach,m4=hk.slice;function v4(t){return g4.call(m4.call(arguments,1),function(e){if(e)for(var n in e)t[n]===void 0&&(t[n]=e[n])}),t}var Yw=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,y4=function(e,n,r){var i=r||{};i.path=i.path||"/";var a=encodeURIComponent(n),s="".concat(e,"=").concat(a);if(i.maxAge>0){var u=i.maxAge-0;if(Number.isNaN(u))throw new Error("maxAge should be a Number");s+="; Max-Age=".concat(Math.floor(u))}if(i.domain){if(!Yw.test(i.domain))throw new TypeError("option domain is invalid");s+="; Domain=".concat(i.domain)}if(i.path){if(!Yw.test(i.path))throw new TypeError("option path is invalid");s+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(s+="; HttpOnly"),i.secure&&(s+="; Secure"),i.sameSite){var c=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(c){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return s},Xw={create:function(e,n,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+r*60*1e3)),i&&(a.domain=i),document.cookie=y4(e,encodeURIComponent(n),a)},read:function(e){for(var n="".concat(e,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),a=i.split("&"),s=0;s0){var c=a[s].substring(0,u);c===e.lookupQuerystring&&(n=a[s].substring(u+1))}}}return n}},Fl=null,Qw=function(){if(Fl!==null)return Fl;try{Fl=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Fl=!1}return Fl},w4={name:"localStorage",lookup:function(e){var n;if(e.lookupLocalStorage&&Qw()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(e,n){n.lookupLocalStorage&&Qw()&&window.localStorage.setItem(n.lookupLocalStorage,e)}},$l=null,Jw=function(){if($l!==null)return $l;try{$l=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{$l=!1}return $l},b4={name:"sessionStorage",lookup:function(e){var n;if(e.lookupSessionStorage&&Jw()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(e,n){n.lookupSessionStorage&&Jw()&&window.sessionStorage.setItem(n.lookupSessionStorage,e)}},C4={name:"navigator",lookup:function(e){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?n:void 0}},x4={name:"htmlTag",lookup:function(e){var n,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},k4={name:"path",lookup:function(e){var n;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;n=r[e.lookupFromPathIndex].replace("/","")}else n=r[0].replace("/","")}return n}},E4={name:"subdomain",lookup:function(e){var n=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};function P4(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var pk=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.type="languageDetector",this.detectors={},this.init(e,n)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=v4(r,this.options||{},P4()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(S4),this.addDetector(_4),this.addDetector(w4),this.addDetector(b4),this.addDetector(C4),this.addDetector(x4),this.addDetector(k4),this.addDetector(E4)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var i=[];return n.forEach(function(a){if(r.detectors[a]){var s=r.detectors[a].lookup(r.options);s&&typeof s=="string"&&(s=[s]),s&&(i=i.concat(s))}}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(a){i.detectors[a]&&i.detectors[a].cacheUserLanguage(n,i.options)}))}}]),t}();pk.type="languageDetector";function Hv(t){return Hv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hv(t)}var gk=[],O4=gk.forEach,T4=gk.slice;function Wv(t){return O4.call(T4.call(arguments,1),function(e){if(e)for(var n in e)t[n]===void 0&&(t[n]=e[n])}),t}function mk(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Hv(XMLHttpRequest))==="object"}function R4(t){return!!t&&typeof t.then=="function"}function A4(t){return R4(t)?t:Promise.resolve(t)}function I4(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zu={},L4={get exports(){return zu},set exports(t){zu=t}},gu={},M4={get exports(){return gu},set exports(t){gu=t}},Zw;function D4(){return Zw||(Zw=1,function(t,e){var n=typeof self<"u"?self:yn,r=function(){function a(){this.fetch=!1,this.DOMException=n.DOMException}return a.prototype=n,new a}();(function(a){(function(s){var u={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function c(T){return T&&DataView.prototype.isPrototypeOf(T)}if(u.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(T){return T&&f.indexOf(Object.prototype.toString.call(T))>-1};function p(T){if(typeof T!="string"&&(T=String(T)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(T))throw new TypeError("Invalid character in header field name");return T.toLowerCase()}function g(T){return typeof T!="string"&&(T=String(T)),T}function y(T){var $={next:function(){var V=T.shift();return{done:V===void 0,value:V}}};return u.iterable&&($[Symbol.iterator]=function(){return $}),$}function v(T){this.map={},T instanceof v?T.forEach(function($,V){this.append(V,$)},this):Array.isArray(T)?T.forEach(function($){this.append($[0],$[1])},this):T&&Object.getOwnPropertyNames(T).forEach(function($){this.append($,T[$])},this)}v.prototype.append=function(T,$){T=p(T),$=g($);var V=this.map[T];this.map[T]=V?V+", "+$:$},v.prototype.delete=function(T){delete this.map[p(T)]},v.prototype.get=function(T){return T=p(T),this.has(T)?this.map[T]:null},v.prototype.has=function(T){return this.map.hasOwnProperty(p(T))},v.prototype.set=function(T,$){this.map[p(T)]=g($)},v.prototype.forEach=function(T,$){for(var V in this.map)this.map.hasOwnProperty(V)&&T.call($,this.map[V],V,this)},v.prototype.keys=function(){var T=[];return this.forEach(function($,V){T.push(V)}),y(T)},v.prototype.values=function(){var T=[];return this.forEach(function($){T.push($)}),y(T)},v.prototype.entries=function(){var T=[];return this.forEach(function($,V){T.push([V,$])}),y(T)},u.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function w(T){if(T.bodyUsed)return Promise.reject(new TypeError("Already read"));T.bodyUsed=!0}function x(T){return new Promise(function($,V){T.onload=function(){$(T.result)},T.onerror=function(){V(T.error)}})}function _(T){var $=new FileReader,V=x($);return $.readAsArrayBuffer(T),V}function S(T){var $=new FileReader,V=x($);return $.readAsText(T),V}function C(T){for(var $=new Uint8Array(T),V=new Array($.length),ie=0;ie<$.length;ie++)V[ie]=String.fromCharCode($[ie]);return V.join("")}function O(T){if(T.slice)return T.slice(0);var $=new Uint8Array(T.byteLength);return $.set(new Uint8Array(T)),$.buffer}function I(){return this.bodyUsed=!1,this._initBody=function(T){this._bodyInit=T,T?typeof T=="string"?this._bodyText=T:u.blob&&Blob.prototype.isPrototypeOf(T)?this._bodyBlob=T:u.formData&&FormData.prototype.isPrototypeOf(T)?this._bodyFormData=T:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)?this._bodyText=T.toString():u.arrayBuffer&&u.blob&&c(T)?(this._bodyArrayBuffer=O(T.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(T)||h(T))?this._bodyArrayBuffer=O(T):this._bodyText=T=Object.prototype.toString.call(T):this._bodyText="",this.headers.get("content-type")||(typeof T=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var T=w(this);if(T)return T;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?w(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(_)}),this.text=function(){var T=w(this);if(T)return T;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(X)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function D(T){var $=T.toUpperCase();return L.indexOf($)>-1?$:T}function U(T,$){$=$||{};var V=$.body;if(T instanceof U){if(T.bodyUsed)throw new TypeError("Already read");this.url=T.url,this.credentials=T.credentials,$.headers||(this.headers=new v(T.headers)),this.method=T.method,this.mode=T.mode,this.signal=T.signal,!V&&T._bodyInit!=null&&(V=T._bodyInit,T.bodyUsed=!0)}else this.url=String(T);if(this.credentials=$.credentials||this.credentials||"same-origin",($.headers||!this.headers)&&(this.headers=new v($.headers)),this.method=D($.method||this.method||"GET"),this.mode=$.mode||this.mode||null,this.signal=$.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&V)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(V)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function X(T){var $=new FormData;return T.trim().split("&").forEach(function(V){if(V){var ie=V.split("="),H=ie.shift().replace(/\+/g," "),Y=ie.join("=").replace(/\+/g," ");$.append(decodeURIComponent(H),decodeURIComponent(Y))}}),$}function K(T){var $=new v,V=T.replace(/\r?\n[\t ]+/g," ");return V.split(/\r?\n/).forEach(function(ie){var H=ie.split(":"),Y=H.shift().trim();if(Y){var Q=H.join(":").trim();$.append(Y,Q)}}),$}I.call(U.prototype);function te(T,$){$||($={}),this.type="default",this.status=$.status===void 0?200:$.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in $?$.statusText:"OK",this.headers=new v($.headers),this.url=$.url||"",this._initBody(T)}I.call(te.prototype),te.prototype.clone=function(){return new te(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},te.error=function(){var T=new te(null,{status:0,statusText:""});return T.type="error",T};var ce=[301,302,303,307,308];te.redirect=function(T,$){if(ce.indexOf($)===-1)throw new RangeError("Invalid status code");return new te(null,{status:$,headers:{location:T}})},s.DOMException=a.DOMException;try{new s.DOMException}catch{s.DOMException=function($,V){this.message=$,this.name=V;var ie=Error($);this.stack=ie.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function j(T,$){return new Promise(function(V,ie){var H=new U(T,$);if(H.signal&&H.signal.aborted)return ie(new s.DOMException("Aborted","AbortError"));var Y=new XMLHttpRequest;function Q(){Y.abort()}Y.onload=function(){var oe={status:Y.status,statusText:Y.statusText,headers:K(Y.getAllResponseHeaders()||"")};oe.url="responseURL"in Y?Y.responseURL:oe.headers.get("X-Request-URL");var ve="response"in Y?Y.response:Y.responseText;V(new te(ve,oe))},Y.onerror=function(){ie(new TypeError("Network request failed"))},Y.ontimeout=function(){ie(new TypeError("Network request failed"))},Y.onabort=function(){ie(new s.DOMException("Aborted","AbortError"))},Y.open(H.method,H.url,!0),H.credentials==="include"?Y.withCredentials=!0:H.credentials==="omit"&&(Y.withCredentials=!1),"responseType"in Y&&u.blob&&(Y.responseType="blob"),H.headers.forEach(function(oe,ve){Y.setRequestHeader(ve,oe)}),H.signal&&(H.signal.addEventListener("abort",Q),Y.onreadystatechange=function(){Y.readyState===4&&H.signal.removeEventListener("abort",Q)}),Y.send(typeof H._bodyInit>"u"?null:H._bodyInit)})}return j.polyfill=!0,a.fetch||(a.fetch=j,a.Headers=v,a.Request=U,a.Response=te),s.Headers=v,s.Request=U,s.Response=te,s.fetch=j,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e}(M4,gu)),gu}(function(t,e){var n;if(typeof fetch=="function"&&(typeof yn<"u"&&yn.fetch?n=yn.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof I4<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||D4();r.default&&(r=r.default),e.default=r,t.exports=e.default}})(L4,zu);const vk=zu,eb=h2({__proto__:null,default:vk},[zu]);function ah(t){return ah=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ah(t)}var Fi;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?Fi=global.fetch:typeof window<"u"&&window.fetch?Fi=window.fetch:Fi=fetch);var Gu;mk()&&(typeof global<"u"&&global.XMLHttpRequest?Gu=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(Gu=window.XMLHttpRequest));var oh;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?oh=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(oh=window.ActiveXObject));!Fi&&eb&&!Gu&&!oh&&(Fi=vk||eb);typeof Fi!="function"&&(Fi=void 0);var Vv=function(e,n){if(n&&ah(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+r.slice(1)}return e},tb=function(e,n,r){Fi(e,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(a){r(null,{status:i.status,data:a})}).catch(r)}).catch(r)},nb=!1,N4=function(e,n,r,i){e.queryStringParams&&(n=Vv(n,e.queryStringParams));var a=Wv({},typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders);r&&(a["Content-Type"]="application/json");var s=typeof e.requestOptions=="function"?e.requestOptions(r):e.requestOptions,u=Wv({method:r?"POST":"GET",body:r?e.stringify(r):void 0,headers:a},nb?{}:s);try{tb(n,u,i)}catch(c){if(!s||Object.keys(s).length===0||!c.message||c.message.indexOf("not implemented")<0)return i(c);try{Object.keys(s).forEach(function(f){delete u[f]}),tb(n,u,i),nb=!0}catch(f){i(f)}}},B4=function(e,n,r,i){r&&ah(r)==="object"&&(r=Vv("",r).slice(1)),e.queryStringParams&&(n=Vv(n,e.queryStringParams));try{var a;Gu?a=new Gu:a=new oh("MSXML2.XMLHTTP.3.0"),a.open(r?"POST":"GET",n,1),e.crossDomain||a.setRequestHeader("X-Requested-With","XMLHttpRequest"),a.withCredentials=!!e.withCredentials,r&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.overrideMimeType&&a.overrideMimeType("application/json");var s=e.customHeaders;if(s=typeof s=="function"?s():s,s)for(var u in s)a.setRequestHeader(u,s[u]);a.onreadystatechange=function(){a.readyState>3&&i(a.status>=400?a.statusText:null,{status:a.status,data:a.responseText})},a.send(r)}catch(c){console&&console.log(c)}},F4=function(e,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},Fi&&n.indexOf("file:")!==0)return N4(e,n,r,i);if(mk()||typeof ActiveXObject=="function")return B4(e,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function Uu(t){return Uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uu(t)}function $4(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rb(t,e){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};$4(this,t),this.services=e,this.options=n,this.allOptions=r,this.type="backend",this.init(e,n,r)}return z4(t,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=Wv(i,this.options||{},j4()),this.allOptions=a,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,a,s){var u=this,c=this.options.loadPath;typeof this.options.loadPath=="function"&&(c=this.options.loadPath(n,i)),c=A4(c),c.then(function(f){if(!f)return s(null,{});var h=u.services.interpolator.interpolate(f,{lng:n.join("+"),ns:i.join("+")});u.loadUrl(h,s,r,a)})}},{key:"loadUrl",value:function(n,r,i,a){var s=this;this.options.request(this.options,n,void 0,function(u,c){if(c&&(c.status>=500&&c.status<600||!c.status))return r("failed loading "+n+"; status code: "+c.status,!0);if(c&&c.status>=400&&c.status<500)return r("failed loading "+n+"; status code: "+c.status,!1);if(!c&&u&&u.message&&u.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+u.message,!0);if(u)return r(u,!1);var f,h;try{typeof c.data=="string"?f=s.options.parse(c.data,i,a):f=c.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{key:"create",value:function(n,r,i,a,s){var u=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var c=this.options.parsePayload(r,i,a),f=0,h=[],p=[];n.forEach(function(g){var y=u.options.addPath;typeof u.options.addPath=="function"&&(y=u.options.addPath(g,r));var v=u.services.interpolator.interpolate(y,{lng:g,ns:r});u.options.request(u.options,v,c,function(w,x){f+=1,h.push(w),p.push(x),f===n.length&&typeof s=="function"&&s(h,p)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,a=r.languageUtils,s=r.logger,u=i.language;if(!(u&&u.toLowerCase()==="cimode")){var c=[],f=function(p){var g=a.toResolveHierarchy(p);g.forEach(function(y){c.indexOf(y)<0&&c.push(y)})};f(u),this.allOptions.preload&&this.allOptions.preload.forEach(function(h){return f(h)}),c.forEach(function(h){n.allOptions.ns.forEach(function(p){i.read(h,p,"read",null,null,function(g,y){g&&s.warn("loading namespace ".concat(p," for language ").concat(h," failed"),g),!g&&y&&s.log("loaded namespace ".concat(p," for language ").concat(h),y),i.loaded("".concat(h,"|").concat(p),g,y)})})})}}}]),t}();Sk.type="backend";function H4(){if(console&&console.warn){for(var t,e=arguments.length,n=new Array(e),r=0;r2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,a=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var s=function(c,f){var h=e.services.backendConnector.state["".concat(c,"|").concat(f)];return h===-1||h===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!s(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(r,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||s(r,t)&&(!i||s(a,t)))}function V4(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return qv("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(t,{precheck:function(a,s){if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!s(a.isLanguageChangingTo,t))return!1}}):W4(t,e,n)}var q4=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,K4={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Y4=function(e){return K4[e]},X4=function(e){return e.replace(q4,Y4)};function ob(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function sb(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Kv=sb(sb({},Kv),t)}function J4(){return Kv}var _k;function Z4(t){_k=t}function eB(){return _k}var tB={type:"3rdParty",init:function(e){Q4(e.options.react),Z4(e)}},nB=be.createContext(),rB=function(){function t(){Sr(this,t),this.usedNamespaces={}}return _r(t,[{key:"addUsedNamespaces",value:function(n){var r=this;n.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),t}();function iB(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,u=[],c=!0,f=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(h){f=!0,i=h}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(f)throw i}}return u}}function aB(t,e){return sk(t)||iB(t,e)||lk(t,e)||uk()}function lb(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function km(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},n=e.i18n,r=be.useContext(nB)||{},i=r.i18n,a=r.defaultNS,s=n||i||eB();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new rB),!s){qv("You will need to pass in an i18next instance by using initReactI18next");var u=function(X,K){return typeof K=="string"?K:K&&gr(K)==="object"&&typeof K.defaultValue=="string"?K.defaultValue:Array.isArray(X)?X[X.length-1]:X},c=[u,{},!1];return c.t=u,c.i18n={},c.ready=!1,c}s.options.react&&s.options.react.wait!==void 0&&qv("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var f=km(km(km({},J4()),s.options.react),e),h=f.useSuspense,p=f.keyPrefix,g=t||a||s.options&&s.options.defaultNS;g=typeof g=="string"?[g]:g||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(g);var y=(s.isInitialized||s.initializedStoreOnce)&&g.every(function(U){return V4(U,s,f)});function v(){return s.getFixedT(null,f.nsMode==="fallback"?g:g[0],p)}var w=be.useState(v),x=aB(w,2),_=x[0],S=x[1],C=g.join(),O=oB(C),I=be.useRef(!0);be.useEffect(function(){var U=f.bindI18n,X=f.bindI18nStore;I.current=!0,!y&&!h&&ab(s,g,function(){I.current&&S(v)}),y&&O&&O!==C&&I.current&&S(v);function K(){I.current&&S(v)}return U&&s&&s.on(U,K),X&&s&&s.store.on(X,K),function(){I.current=!1,U&&s&&U.split(" ").forEach(function(te){return s.off(te,K)}),X&&s&&X.split(" ").forEach(function(te){return s.store.off(te,K)})}},[s,C]);var L=be.useRef(!0);be.useEffect(function(){I.current&&!L.current&&S(v),L.current=!1},[s,p]);var D=[_,s,y];if(D.t=_,D.i18n=s,D.ready=y,y||!y&&!h)return D;throw new Promise(function(U){ab(s,g,function(){U()})})}Ae.use(Sk).use(pk).use(tB).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const lB={isConnected:!1,isProcessing:!1,log:[],shouldShowLogViewer:!1,shouldDisplayInProgressType:"latents",shouldDisplayGuides:!0,isGFPGANAvailable:!0,isESRGANAvailable:!0,socketId:"",shouldConfirmOnDelete:!0,openAccordions:[0],currentStep:0,totalSteps:0,currentIteration:0,totalIterations:0,currentStatus:Ae.isInitialized?Ae.t("common.statusDisconnected"):"Disconnected",currentStatusHasSteps:!1,model:"",model_id:"",model_hash:"",app_id:"",app_version:"",model_list:{},infill_methods:[],hasError:!1,wasErrorSeen:!0,isCancelable:!0,saveIntermediatesInterval:5,enableImageDebugging:!1,toastQueue:[],searchFolder:null,foundModels:null,openModel:null,cancelOptions:{cancelType:"immediate",cancelAfter:null}},wk=vo({name:"system",initialState:lB,reducers:{setShouldDisplayInProgressType:(t,e)=>{t.shouldDisplayInProgressType=e.payload},setIsProcessing:(t,e)=>{t.isProcessing=e.payload},setCurrentStatus:(t,e)=>{t.currentStatus=e.payload},setSystemStatus:(t,e)=>({...t,...e.payload}),errorOccurred:t=>{t.hasError=!0,t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusError"),t.wasErrorSeen=!1},errorSeen:t=>{t.hasError=!1,t.wasErrorSeen=!0,t.currentStatus=t.isConnected?Ae.t("common.statusConnected"):Ae.t("common.statusDisconnected")},addLogEntry:(t,e)=>{const{timestamp:n,message:r,level:i}=e.payload,s={timestamp:n,message:r,level:i||"info"};t.log.push(s)},setShouldShowLogViewer:(t,e)=>{t.shouldShowLogViewer=e.payload},setIsConnected:(t,e)=>{t.isConnected=e.payload,t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.hasError=!1},setSocketId:(t,e)=>{t.socketId=e.payload},setShouldConfirmOnDelete:(t,e)=>{t.shouldConfirmOnDelete=e.payload},setOpenAccordions:(t,e)=>{t.openAccordions=e.payload},setSystemConfig:(t,e)=>({...t,...e.payload}),setShouldDisplayGuides:(t,e)=>{t.shouldDisplayGuides=e.payload},processingCanceled:t=>{t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusProcessingCanceled")},generationRequested:t=>{t.isProcessing=!0,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusPreparing")},setModelList:(t,e)=>{t.model_list=e.payload},setIsCancelable:(t,e)=>{t.isCancelable=e.payload},modelChangeRequested:t=>{t.currentStatus=Ae.t("common.statusLoadingModel"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},modelConvertRequested:t=>{t.currentStatus=Ae.t("common.statusConvertingModel"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},modelMergingRequested:t=>{t.currentStatus=Ae.t("common.statusMergingModels"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},setSaveIntermediatesInterval:(t,e)=>{t.saveIntermediatesInterval=e.payload},setEnableImageDebugging:(t,e)=>{t.enableImageDebugging=e.payload},addToast:(t,e)=>{t.toastQueue.push(e.payload)},clearToastQueue:t=>{t.toastQueue=[]},setProcessingIndeterminateTask:(t,e)=>{t.isProcessing=!0,t.currentStatus=e.payload,t.currentStatusHasSteps=!1},setSearchFolder:(t,e)=>{t.searchFolder=e.payload},setFoundModels:(t,e)=>{t.foundModels=e.payload},setOpenModel:(t,e)=>{t.openModel=e.payload},setCancelType:(t,e)=>{t.cancelOptions.cancelType=e.payload},setCancelAfter:(t,e)=>{t.cancelOptions.cancelAfter=e.payload}}}),{setShouldDisplayInProgressType:eH,setIsProcessing:ei,addLogEntry:Gt,setShouldShowLogViewer:tH,setIsConnected:ub,setSocketId:nH,setShouldConfirmOnDelete:rH,setOpenAccordions:iH,setSystemStatus:uB,setCurrentStatus:ns,setSystemConfig:cB,setShouldDisplayGuides:aH,processingCanceled:fB,errorOccurred:cb,errorSeen:oH,setModelList:rs,setIsCancelable:If,modelChangeRequested:dB,modelConvertRequested:hB,modelMergingRequested:pB,setSaveIntermediatesInterval:sH,setEnableImageDebugging:lH,generationRequested:gB,addToast:zl,clearToastQueue:uH,setProcessingIndeterminateTask:cH,setSearchFolder:mB,setFoundModels:vB,setOpenModel:fH,setCancelType:dH,setCancelAfter:hH}=wk.actions,yB=wk.reducer,bk=["txt2img","img2img","unifiedCanvas","nodes","postprocess","training"],SB={activeTab:0,currentTheme:"dark",parametersPanelScrollPosition:0,shouldHoldParametersPanelOpen:!1,shouldPinParametersPanel:!0,shouldShowParametersPanel:!0,shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,addNewModelUIOption:null},_B=SB,Ck=vo({name:"ui",initialState:_B,reducers:{setActiveTab:(t,e)=>{typeof e.payload=="number"?t.activeTab=e.payload:t.activeTab=bk.indexOf(e.payload)},setCurrentTheme:(t,e)=>{t.currentTheme=e.payload},setParametersPanelScrollPosition:(t,e)=>{t.parametersPanelScrollPosition=e.payload},setShouldPinParametersPanel:(t,e)=>{t.shouldPinParametersPanel=e.payload},setShouldShowParametersPanel:(t,e)=>{t.shouldShowParametersPanel=e.payload},setShouldHoldParametersPanelOpen:(t,e)=>{t.shouldHoldParametersPanelOpen=e.payload},setShouldShowImageDetails:(t,e)=>{t.shouldShowImageDetails=e.payload},setShouldUseCanvasBetaLayout:(t,e)=>{t.shouldUseCanvasBetaLayout=e.payload},setShouldShowExistingModelsInSearch:(t,e)=>{t.shouldShowExistingModelsInSearch=e.payload},setShouldUseSliders:(t,e)=>{t.shouldUseSliders=e.payload},setAddNewModelUIOption:(t,e)=>{t.addNewModelUIOption=e.payload}}}),{setActiveTab:pH,setCurrentTheme:gH,setParametersPanelScrollPosition:mH,setShouldHoldParametersPanelOpen:vH,setShouldPinParametersPanel:yH,setShouldShowParametersPanel:SH,setShouldShowImageDetails:_H,setShouldUseCanvasBetaLayout:wH,setShouldShowExistingModelsInSearch:bH,setShouldUseSliders:CH,setAddNewModelUIOption:xH}=Ck.actions,wB=Ck.reducer,di=Object.create(null);di.open="0";di.close="1";di.ping="2";di.pong="3";di.message="4";di.upgrade="5";di.noop="6";const pd=Object.create(null);Object.keys(di).forEach(t=>{pd[di[t]]=t});const bB={type:"error",data:"parser error"},CB=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",xB=typeof ArrayBuffer=="function",kB=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,xk=({type:t,data:e},n,r)=>CB&&e instanceof Blob?n?r(e):fb(e,r):xB&&(e instanceof ArrayBuffer||kB(e))?n?r(e):fb(new Blob([e]),r):r(di[t]+(e||"")),fb=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)},db="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eu=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t{let e=t.length*.75,n=t.length,r,i=0,a,s,u,c;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const f=new ArrayBuffer(e),h=new Uint8Array(f);for(r=0;r>4,h[i++]=(s&15)<<4|u>>2,h[i++]=(u&3)<<6|c&63;return f},PB=typeof ArrayBuffer=="function",kk=(t,e)=>{if(typeof t!="string")return{type:"message",data:Ek(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:OB(t.substring(1),e)}:pd[n]?t.length>1?{type:pd[n],data:t.substring(1)}:{type:pd[n]}:bB},OB=(t,e)=>{if(PB){const n=EB(t);return Ek(n,e)}else return{base64:!0,data:t}},Ek=(t,e)=>{switch(e){case"blob":return t instanceof ArrayBuffer?new Blob([t]):t;case"arraybuffer":default:return t}},Pk=String.fromCharCode(30),TB=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((a,s)=>{xk(a,!1,u=>{r[s]=u,++i===n&&e(r.join(Pk))})})},RB=(t,e)=>{const n=t.split(Pk),r=[];for(let i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function Tk(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const IB=fr.setTimeout,LB=fr.clearTimeout;function Jh(t,e){e.useNativeTimers?(t.setTimeoutFn=IB.bind(fr),t.clearTimeoutFn=LB.bind(fr)):(t.setTimeoutFn=fr.setTimeout.bind(fr),t.clearTimeoutFn=fr.clearTimeout.bind(fr))}const MB=1.33;function DB(t){return typeof t=="string"?NB(t):Math.ceil((t.byteLength||t.size)*MB)}function NB(t){let e=0,n=0;for(let r=0,i=t.length;r=57344?n+=3:(r++,n+=4);return n}class BB extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Rk extends Rt{constructor(e){super(),this.writable=!1,Jh(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,n,r){return super.emitReserved("error",new BB(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=kk(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}}const Ak="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Yv=64,FB={};let hb=0,Lf=0,pb;function gb(t){let e="";do e=Ak[t%Yv]+e,t=Math.floor(t/Yv);while(t>0);return e}function Ik(){const t=gb(+new Date);return t!==pb?(hb=0,pb=t):t+"."+gb(hb++)}for(;Lf{this.readyState="paused",e()};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(e){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)};RB(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,TB(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const n=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Ik()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(n==="https"&&Number(this.opts.port)!==443||n==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const i=Lk(e),a=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(a?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new ui(this.uri(),e)}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class ui extends Rt{constructor(e,n){super(),Jh(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.async=n.async!==!1,this.data=n.data!==void 0?n.data:null,this.create()}create(){const e=Tk(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const n=this.xhr=new Dk(e);try{n.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{n.readyState===4&&(n.status===200||n.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof n.status=="number"?n.status:0)},0))},n.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=ui.requestsCount++,ui.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=GB,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ui.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}ui.requestsCount=0;ui.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",mb);else if(typeof addEventListener=="function"){const t="onpagehide"in fr?"pagehide":"unload";addEventListener(t,mb,!1)}}function mb(){for(let t in ui.requests)ui.requests.hasOwnProperty(t)&&ui.requests[t].abort()}const Nk=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0))(),Mf=fr.WebSocket||fr.MozWebSocket,vb=!0,HB="arraybuffer",yb=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WB extends Rk{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),n=this.opts.protocols,r=yb?{}:Tk(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=vb&&!yb?n?new Mf(e,n):new Mf(e):new Mf(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||HB,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n{const s={};try{vb&&this.ws.send(a)}catch{}i&&Nk(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const n=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(n==="wss"&&Number(this.opts.port)!==443||n==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=Ik()),this.supportsBinary||(e.b64=1);const i=Lk(e),a=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(a?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}check(){return!!Mf}}const VB={websocket:WB,polling:jB},qB=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,KB=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Xv(t){const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=qB.exec(t||""),a={},s=14;for(;s--;)a[KB[s]]=i[s]||"";return n!=-1&&r!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=YB(a,a.path),a.queryKey=XB(a,a.query),a}function YB(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function XB(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}let Bk=class os extends Rt{constructor(e,n={}){super(),this.writeBuffer=[],e&&typeof e=="object"&&(n=e,e=null),e?(e=Xv(e),n.hostname=e.host,n.secure=e.protocol==="https"||e.protocol==="wss",n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=Xv(n.host).host),Jh(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"],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:!0},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=$B(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(e){const n=Object.assign({},this.opts.query);n.EIO=Ok,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts.transportOptions[e],this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new VB[e](r)}open(){let e;if(this.opts.rememberUpgrade&&os.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.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(e){let n=this.createTransport(e),r=!1;os.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!r)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;os.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(h(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const g=new Error("probe error");g.transport=n.name,this.emitReserved("upgradeError",g)}}))};function a(){r||(r=!0,h(),n.close(),n=null)}const s=p=>{const g=new Error("probe error: "+p);g.transport=n.name,a(),this.emitReserved("upgradeError",g)};function u(){s("transport closed")}function c(){s("socket closed")}function f(p){n&&p.name!==n.name&&a()}const h=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",u),this.off("close",c),this.off("upgrading",f)};n.once("open",i),n.once("error",s),n.once("close",u),this.once("close",c),this.once("upgrading",f),n.open()}onOpen(){if(this.readyState="open",os.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const n=this.upgrades.length;for(;e{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 e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.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(e,n,r){return this.sendPacket("message",e,n,r),this}send(e,n,r){return this.sendPacket("message",e,n,r),this}sendPacket(e,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 a={type:e,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},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():e()}):this.upgrading?r():e()),this}onError(e){os.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,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",e,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const n=[];let r=0;const i=e.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,Fk=Object.prototype.toString,eF=typeof Blob=="function"||typeof Blob<"u"&&Fk.call(Blob)==="[object BlobConstructor]",tF=typeof File=="function"||typeof File<"u"&&Fk.call(File)==="[object FileConstructor]";function T0(t){return JB&&(t instanceof ArrayBuffer||ZB(t))||eF&&t instanceof Blob||tF&&t instanceof File}function gd(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n=0&&t.num0;case Be.ACK:case Be.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class oF{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=rF(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const sF=Object.freeze(Object.defineProperty({__proto__:null,Decoder:R0,Encoder:aF,get PacketType(){return Be},protocol:iF},Symbol.toStringTag,{value:"Module"}));function Dr(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const lF=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class $k extends Rt{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Dr(e,"open",this.onopen.bind(this)),Dr(e,"packet",this.onpacket.bind(this)),Dr(e,"error",this.onerror.bind(this)),Dr(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){if(lF.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const r={type:Be.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const s=this.ids++,u=n.pop();this._registerAckCallback(s,u),r.id=s}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[e]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let s=0;s{this.io.clearTimeoutFn(a),n.apply(this,[null,...s])}}emitWithAck(e,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,a)=>{n.push((s,u)=>r?s?a(s):i(u):i(s)),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...a)=>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,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Be.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Be.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 Be.EVENT:case Be.BINARY_EVENT:this.onevent(e);break;case Be.ACK:case Be.BINARY_ACK:this.onack(e);break;case Be.DISCONNECT:this.ondisconnect();break;case Be.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Be.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(n.apply(this,e.data),delete this.acks[e.id])}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Be.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r0&&t.jitter<=1?t.jitter:0,this.attempts=0}Vs.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};Vs.prototype.reset=function(){this.attempts=0};Vs.prototype.setMin=function(t){this.ms=t};Vs.prototype.setMax=function(t){this.max=t};Vs.prototype.setJitter=function(t){this.jitter=t};class Zv extends Rt{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Jh(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 Vs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||sF;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Bk(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Dr(n,"open",function(){r.onopen(),e&&e()}),a=Dr(n,"error",s=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",s),e?e(s):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const s=this._timeout;s===0&&i();const u=this.setTimeoutFn(()=>{i(),n.close(),n.emit("error",new Error("timeout"))},s);this.opts.autoUnref&&u.unref(),this.subs.push(function(){clearTimeout(u)})}return this.subs.push(i),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Dr(e,"ping",this.onping.bind(this)),Dr(e,"data",this.ondata.bind(this)),Dr(e,"error",this.onerror.bind(this)),Dr(e,"close",this.onclose.bind(this)),Dr(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Nk(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new $k(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;re()),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(e,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=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(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Gl={};function md(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=QB(t,e.path||"/socket.io"),r=n.source,i=n.id,a=n.path,s=Gl[i]&&a in Gl[i].nsps,u=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let c;return u?c=new Zv(r,e):(Gl[i]||(Gl[i]=new Zv(r,e)),c=Gl[i]),n.query&&!e.query&&(e.query=n.queryKey),c.socket(n.path,e)}Object.assign(md,{Manager:Zv,Socket:$k,io:md,connect:md});const kH=["ddim","plms","k_lms","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_dpmpp_2_a","k_euler","k_euler_a","k_heun"],EH=["ddim","plms","k_lms","dpmpp_2","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_euler","k_euler_a","k_heun"],PH=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],OH=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],TH=[{key:"2x",value:2},{key:"4x",value:4}],uF=0,cF=4294967295,RH=["gfpgan","codeformer"],AH=[{key:"None",value:"none"},{key:"Fast",value:"latents"},{key:"Accurate",value:"full-res"}];var fF=Math.PI/180;function dF(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const Os=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},pe={_global:Os,version:"8.4.2",isBrowser:dF(),isUnminified:/param/.test(function(t){}.toString()),dblClickWindow:400,getAngle(t){return pe.angleDeg?t*fF:t},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 pe.DD.isDragging},isDragReady(){return!!pe.DD.node},releaseCanvasOnDestroy:!0,document:Os.document,_injectGlobal(t){Os.Konva=t}},yt=t=>{pe[t.prototype.getClassName()]=t};pe._injectGlobal(pe);class Hn{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.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 Hn(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var n=this.m;return{x:n[0]*e.x+n[2]*e.y+n[4],y:n[1]*e.x+n[3]*e.y+n[5]}}translate(e,n){return this.m[4]+=this.m[0]*e+this.m[2]*n,this.m[5]+=this.m[1]*e+this.m[3]*n,this}scale(e,n){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=n,this.m[3]*=n,this}rotate(e){var n=Math.cos(e),r=Math.sin(e),i=this.m[0]*n+this.m[2]*r,a=this.m[1]*n+this.m[3]*r,s=this.m[0]*-r+this.m[2]*n,u=this.m[1]*-r+this.m[3]*n;return this.m[0]=i,this.m[1]=a,this.m[2]=s,this.m[3]=u,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,n){var r=this.m[0]+this.m[2]*n,i=this.m[1]+this.m[3]*n,a=this.m[2]+this.m[0]*e,s=this.m[3]+this.m[1]*e;return this.m[0]=r,this.m[1]=i,this.m[2]=a,this.m[3]=s,this}multiply(e){var n=this.m[0]*e.m[0]+this.m[2]*e.m[1],r=this.m[1]*e.m[0]+this.m[3]*e.m[1],i=this.m[0]*e.m[2]+this.m[2]*e.m[3],a=this.m[1]*e.m[2]+this.m[3]*e.m[3],s=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],u=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=s,this.m[5]=u,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*e,r=-this.m[1]*e,i=-this.m[2]*e,a=this.m[0]*e,s=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),u=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=s,this.m[5]=u,this}getMatrix(){return this.m}decompose(){var e=this.m[0],n=this.m[1],r=this.m[2],i=this.m[3],a=this.m[4],s=this.m[5],u=e*i-n*r;let c={x:a,y:s,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||n!=0){var f=Math.sqrt(e*e+n*n);c.rotation=n>0?Math.acos(e/f):-Math.acos(e/f),c.scaleX=f,c.scaleY=u/f,c.skewX=(e*r+n*i)/u,c.skewY=0}else if(r!=0||i!=0){var h=Math.sqrt(r*r+i*i);c.rotation=Math.PI/2-(i>0?Math.acos(-r/h):-Math.acos(r/h)),c.scaleX=u/h,c.scaleY=h,c.skewX=0,c.skewY=(e*r+n*i)/u}return c.rotation=G._getRotation(c.rotation),c}}var hF="[object Array]",pF="[object Number]",gF="[object String]",mF="[object Boolean]",vF=Math.PI/180,yF=180/Math.PI,Em="#",SF="",_F="0",wF="Konva warning: ",Sb="Konva error: ",bF="rgb(",Pm={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]},CF=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Df=[];const xF=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(t){setTimeout(t,60)},G={_isElement(t){return!!(t&&t.nodeType==1)},_isFunction(t){return!!(t&&t.constructor&&t.call&&t.apply)},_isPlainObject(t){return!!t&&t.constructor===Object},_isArray(t){return Object.prototype.toString.call(t)===hF},_isNumber(t){return Object.prototype.toString.call(t)===pF&&!isNaN(t)&&isFinite(t)},_isString(t){return Object.prototype.toString.call(t)===gF},_isBoolean(t){return Object.prototype.toString.call(t)===mF},isObject(t){return t instanceof Object},isValidSelector(t){if(typeof t!="string")return!1;var e=t[0];return e==="#"||e==="."||e===e.toUpperCase()},_sign(t){return t===0||t>0?1:-1},requestAnimFrame(t){Df.push(t),Df.length===1&&xF(function(){const e=Df;Df=[],e.forEach(function(n){n()})})},createCanvasElement(){var t=document.createElement("canvas");try{t.style=t.style||{}}catch{}return t},createImageElement(){return document.createElement("img")},_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(t,e){var n=G.createImageElement();n.onload=function(){e(n)},n.src=t},_rgbToHex(t,e,n){return((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)},_hexToRgb(t){t=t.replace(Em,SF);var e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:e&255}},getRandomColor(){for(var t=(Math.random()*16777215<<0).toString(16);t.length<6;)t=_F+t;return Em+t},getRGB(t){var e;return t in Pm?(e=Pm[t],{r:e[0],g:e[1],b:e[2]}):t[0]===Em?this._hexToRgb(t.substring(1)):t.substr(0,4)===bF?(e=CF.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA(t){return t=t||"black",G._namedColorToRBA(t)||G._hex3ColorToRGBA(t)||G._hex4ColorToRGBA(t)||G._hex6ColorToRGBA(t)||G._hex8ColorToRGBA(t)||G._rgbColorToRGBA(t)||G._rgbaColorToRGBA(t)||G._hslColorToRGBA(t)},_namedColorToRBA(t){var e=Pm[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(t.indexOf("rgb(")===0){t=t.match(/rgb\(([^)]+)\)/)[1];var e=t.split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(t.indexOf("rgba(")===0){t=t.match(/rgba\(([^)]+)\)/)[1];var e=t.split(/ *, */).map((n,r)=>n.slice(-1)==="%"?r===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if(t[0]==="#"&&t.length===9)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if(t[0]==="#"&&t.length===7)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if(t[0]==="#"&&t.length===5)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if(t[0]==="#"&&t.length===4)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){const[e,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),r=Number(n[0])/360,i=Number(n[1])/100,a=Number(n[2])/100;let s,u,c;if(i===0)return c=a*255,{r:Math.round(c),g:Math.round(c),b:Math.round(c),a:1};a<.5?s=a*(1+i):s=a+i-a*i;const f=2*a-s,h=[0,0,0];for(let p=0;p<3;p++)u=r+1/3*-(p-1),u<0&&u++,u>1&&u--,6*u<1?c=f+(s-f)*6*u:2*u<1?c=s:3*u<2?c=f+(s-f)*(2/3-u)*6:c=f,h[p]=c*255;return{r:Math.round(h[0]),g:Math.round(h[1]),b:Math.round(h[2]),a:1}}},haveIntersection(t,e){return!(e.x>t.x+t.width||e.x+e.widtht.y+t.height||e.y+e.height1?(s=n,u=r,c=(n-i)*(n-i)+(r-a)*(r-a)):(s=t+h*(n-t),u=e+h*(r-e),c=(s-i)*(s-i)+(u-a)*(u-a))}return[s,u,c]},_getProjectionToLine(t,e,n){var r=G.cloneObject(t),i=Number.MAX_VALUE;return e.forEach(function(a,s){if(!(!n&&s===e.length-1)){var u=e[(s+1)%e.length],c=G._getProjectionToSegment(a.x,a.y,u.x,u.y,t.x,t.y),f=c[0],h=c[1],p=c[2];pe.length){var s=e;e=t,t=s}for(r=0;r{e.width=0,e.height=0})},drawRoundedRectPath(t,e,n,r){let i=0,a=0,s=0,u=0;typeof r=="number"?i=a=s=u=Math.min(r,e/2,n/2):(i=Math.min(r[0]||0,e/2,n/2),a=Math.min(r[1]||0,e/2,n/2),u=Math.min(r[2]||0,e/2,n/2),s=Math.min(r[3]||0,e/2,n/2)),t.moveTo(i,0),t.lineTo(e-a,0),t.arc(e-a,a,a,Math.PI*3/2,0,!1),t.lineTo(e,n-u),t.arc(e-u,n-u,u,0,Math.PI/2,!1),t.lineTo(s,n),t.arc(s,n-s,s,Math.PI/2,Math.PI,!1),t.lineTo(0,i),t.arc(i,i,i,Math.PI,Math.PI*3/2,!1)}};function Da(t){return G._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||G._isBoolean(t)?t:Object.prototype.toString.call(t)}function zk(t){return t>255?255:t<0?0:Math.round(t)}function le(){if(pe.isUnminified)return function(t,e){return G._isNumber(t)||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function A0(t){if(pe.isUnminified)return function(e,n){let r=G._isNumber(e),i=G._isArray(e)&&e.length==t;return!r&&!i&&G.warn(Da(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+t+")"),e}}function I0(){if(pe.isUnminified)return function(t,e){var n=G._isNumber(t),r=t==="auto";return n||r||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function qs(){if(pe.isUnminified)return function(t,e){return G._isString(t)||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function Gk(){if(pe.isUnminified)return function(t,e){const n=G._isString(t),r=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return n||r||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function kF(){if(pe.isUnminified)return function(t,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&t instanceof n||(G._isArray(t)?t.forEach(function(r){G._isNumber(r)||G.warn('"'+e+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function jr(){if(pe.isUnminified)return function(t,e){var n=t===!0||t===!1;return n||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function EF(t){if(pe.isUnminified)return function(e,n){return e==null||G.isObject(e)||G.warn(Da(e)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+t),e}}var Ul="get",jl="set";const A={addGetterSetter(t,e,n,r,i){A.addGetter(t,e,n),A.addSetter(t,e,r,i),A.addOverloadedGetterSetter(t,e)},addGetter(t,e,n){var r=Ul+G._capitalize(e);t.prototype[r]=t.prototype[r]||function(){var i=this.attrs[e];return i===void 0?n:i}},addSetter(t,e,n,r){var i=jl+G._capitalize(e);t.prototype[i]||A.overWriteSetter(t,e,n,r)},overWriteSetter(t,e,n,r){var i=jl+G._capitalize(e);t.prototype[i]=function(a){return n&&a!==void 0&&a!==null&&(a=n.call(this,a,e)),this._setAttr(e,a),r&&r.call(this),this}},addComponentsGetterSetter(t,e,n,r,i){var a=n.length,s=G._capitalize,u=Ul+s(e),c=jl+s(e),f,h;t.prototype[u]=function(){var g={};for(f=0;f{this._setAttr(e+s(w),void 0)}),this._fireChangeEvent(e,y,g),i&&i.call(this),this},A.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){var n=G._capitalize(e),r=jl+n,i=Ul+n;t.prototype[e]=function(){return arguments.length?(this[r](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(t,e,n,r){G.error("Adding deprecated "+e);var i=Ul+G._capitalize(e),a=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[i]=function(){G.error(a);var s=this.attrs[e];return s===void 0?n:s},A.addSetter(t,e,r,function(){G.error(a)}),A.addOverloadedGetterSetter(t,e)},backCompat(t,e){G.each(e,function(n,r){var i=t.prototype[r],a=Ul+G._capitalize(n),s=jl+G._capitalize(n);function u(){i.apply(this,arguments),G.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+r+'" instead.')}t.prototype[n]=u,t.prototype[a]=u,t.prototype[s]=u})},afterSetFilter(){this._filterUpToDate=!1}};function PF(t){var e=[],n=t.length,r=G,i,a;for(i=0;itypeof h=="number"?Math.floor(h):h)),a+=OF+f.join(_b)+TF)):(a+=u.property,e||(a+=MF+u.val)),a+=IF;return a}clearTrace(){this.traceArr=[]}_trace(e){var n=this.traceArr,r;n.push(e),r=n.length,r>=NF&&n.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var n=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){var n=e.getLineCap();n&&this.setAttr("lineCap",n)}_applyOpacity(e){var n=e.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(e){var n=e.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(e,n){this._context[e]=n}arc(e,n,r,i,a,s){this._context.arc(e,n,r,i,a,s)}arcTo(e,n,r,i,a){this._context.arcTo(e,n,r,i,a)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,r,i,a,s){this._context.bezierCurveTo(e,n,r,i,a,s)}clearRect(e,n,r,i){this._context.clearRect(e,n,r,i)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(e,n){var r=arguments;if(r.length===2)return this._context.createImageData(e,n);if(r.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,r,i){return this._context.createLinearGradient(e,n,r,i)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,r,i,a,s){return this._context.createRadialGradient(e,n,r,i,a,s)}drawImage(e,n,r,i,a,s,u,c,f){var h=arguments,p=this._context;h.length===3?p.drawImage(e,n,r):h.length===5?p.drawImage(e,n,r,i,a):h.length===9&&p.drawImage(e,n,r,i,a,s,u,c,f)}ellipse(e,n,r,i,a,s,u,c){this._context.ellipse(e,n,r,i,a,s,u,c)}isPointInPath(e,n,r,i){return r?this._context.isPointInPath(r,e,n,i):this._context.isPointInPath(e,n,i)}fill(e){e?this._context.fill(e):this._context.fill()}fillRect(e,n,r,i){this._context.fillRect(e,n,r,i)}strokeRect(e,n,r,i){this._context.strokeRect(e,n,r,i)}fillText(e,n,r,i){i?this._context.fillText(e,n,r,i):this._context.fillText(e,n,r)}measureText(e){return this._context.measureText(e)}getImageData(e,n,r,i){return this._context.getImageData(e,n,r,i)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,r,i){this._context.rect(e,n,r,i)}putImageData(e,n,r){this._context.putImageData(e,n,r)}quadraticCurveTo(e,n,r,i){this._context.quadraticCurveTo(e,n,r,i)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,n,r,i,a,s){this._context.setTransform(e,n,r,i,a,s)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,n,r,i){this._context.strokeText(e,n,r,i)}transform(e,n,r,i,a,s){this._context.transform(e,n,r,i,a,s)}translate(e,n){this._context.translate(e,n)}_enableTrace(){var e=this,n=wb.length,r=this.setAttr,i,a,s=function(u){var c=e[u],f;e[u]=function(){return a=PF(Array.prototype.slice.call(arguments,0)),f=c.apply(e,arguments),e._trace({method:u,args:a}),f}};for(i=0;i{e.dragStatus==="dragging"&&(t=!0)}),t},justDragged:!1,get node(){var t;return Ge._dragElements.forEach(e=>{t=e.node}),t},_dragElements:new Map,_drag(t){const e=[];Ge._dragElements.forEach((n,r)=>{const{node:i}=n,a=i.getStage();a.setPointersPositions(t),n.pointerId===void 0&&(n.pointerId=G._getFirstPointerId(t));const s=a._changedPointerPositions.find(f=>f.id===n.pointerId);if(s){if(n.dragStatus!=="dragging"){var u=i.dragDistance(),c=Math.max(Math.abs(s.x-n.startPointerPos.x),Math.abs(s.y-n.startPointerPos.y));if(c{n.fire("dragmove",{type:"dragmove",target:n,evt:t},!0)})},_endDragBefore(t){const e=[];Ge._dragElements.forEach(n=>{const{node:r}=n,i=r.getStage();if(t&&i.setPointersPositions(t),!i._changedPointerPositions.find(u=>u.id===n.pointerId))return;(n.dragStatus==="dragging"||n.dragStatus==="stopped")&&(Ge.justDragged=!0,pe._mouseListenClick=!1,pe._touchListenClick=!1,pe._pointerListenClick=!1,n.dragStatus="stopped");const s=n.node.getLayer()||n.node instanceof pe.Stage&&n.node;s&&e.indexOf(s)===-1&&e.push(s)}),e.forEach(n=>{n.draw()})},_endDragAfter(t){Ge._dragElements.forEach((e,n)=>{e.dragStatus==="stopped"&&e.node.fire("dragend",{type:"dragend",target:e.node,evt:t},!0),e.dragStatus!=="dragging"&&Ge._dragElements.delete(n)})}};pe.isBrowser&&(window.addEventListener("mouseup",Ge._endDragBefore,!0),window.addEventListener("touchend",Ge._endDragBefore,!0),window.addEventListener("mousemove",Ge._drag),window.addEventListener("touchmove",Ge._drag),window.addEventListener("mouseup",Ge._endDragAfter,!1),window.addEventListener("touchend",Ge._endDragAfter,!1));var vd="absoluteOpacity",Bf="allEventListeners",Ii="absoluteTransform",bb="absoluteScale",Xa="canvas",zF="Change",GF="children",UF="konva",ey="listening",Cb="mouseenter",xb="mouseleave",kb="set",Eb="Shape",yd=" ",Pb="stage",ua="transform",jF="Stage",ty="visible",HF=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(yd);let WF=1;class se{constructor(e){this._id=WF++,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(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===ua||e===Ii)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,n){var r=this._cache.get(e),i=e===ua||e===Ii,a=r===void 0||i&&r.dirty===!0;return a&&(r=n.call(this),this._cache.set(e,r)),r}_calculate(e,n,r){if(!this._attachedDepsListeners.get(e)){const i=n.map(a=>a+"Change.konva").join(yd);this.on(i,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,r)}_getCanvasCache(){return this._cache.get(Xa)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Ii&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Xa)){const{scene:e,filter:n,hit:r}=this._cache.get(Xa);G.releaseCanvas(e,n,r),this._cache.delete(Xa)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var n=e||{},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),a=Math.ceil(n.height||r.height),s=n.pixelRatio,u=n.x===void 0?Math.floor(r.x):n.x,c=n.y===void 0?Math.floor(r.y):n.y,f=n.offset||0,h=n.drawBorder||!1,p=n.hitCanvasPixelRatio||1;if(!i||!a){G.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=f*2+1,a+=f*2+1,u-=f,c-=f;var g=new Ts({pixelRatio:s,width:i,height:a}),y=new Ts({pixelRatio:s,width:0,height:0}),v=new L0({pixelRatio:p,width:i,height:a}),w=g.getContext(),x=v.getContext();return v.isCache=!0,g.isCache=!0,this._cache.delete(Xa),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(g.getContext()._context.imageSmoothingEnabled=!1,y.getContext()._context.imageSmoothingEnabled=!1),w.save(),x.save(),w.translate(-u,-c),x.translate(-u,-c),this._isUnderCache=!0,this._clearSelfAndDescendantCache(vd),this._clearSelfAndDescendantCache(bb),this.drawScene(g,this),this.drawHit(v,this),this._isUnderCache=!1,w.restore(),x.restore(),h&&(w.save(),w.beginPath(),w.rect(0,0,i,a),w.closePath(),w.setAttr("strokeStyle","red"),w.setAttr("lineWidth",5),w.stroke(),w.restore()),this._cache.set(Xa,{scene:g,filter:y,hit:v,x:u,y:c}),this._requestDraw(),this}isCached(){return this._cache.has(Xa)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,n){var r=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],i,a,s,u,c=this.getAbsoluteTransform(n);return r.forEach(function(f){var h=c.point(f);i===void 0&&(i=s=h.x,a=u=h.y),i=Math.min(i,h.x),a=Math.min(a,h.y),s=Math.max(s,h.x),u=Math.max(u,h.y)}),{x:i,y:a,width:s-i,height:u-a}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;e.drawImage(r._canvas,0,0,r.width/i,r.height/i),e.restore()}_drawCachedHitCanvas(e){var n=this._getCanvasCache(),r=n.hit;e.save(),e.translate(n.x,n.y),e.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,a=i.getContext(),s,u,c,f;if(e){if(!this._filterUpToDate){var h=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(s=e.length,a.clear(),a.drawImage(r._canvas,0,0,r.getWidth()/h,r.getHeight()/h),u=a.getImageData(0,0,i.getWidth(),i.getHeight()),c=0;c{var n,r;if(!e)return this;for(n in e)n!==GF&&(r=kb+G._capitalize(n),G._isFunction(this[r])?this[r](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(ey,this._isListening)}_isListening(e){if(!this.listening())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isListening(e):!0}isVisible(){return this._getCache(ty,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isVisible(e):!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);var r=this.getLayer(),i=!1;Ge._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(i=!0)});var a=!n&&!pe.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e=this.getDepth(),n=this,r=0,i,a,s,u;function c(f){for(i=[],a=f.length,s=0;s0&&i[0].getDepth()<=e&&c(i)}return n.nodeType!==jF&&c(n.getStage().getChildren()),r}getDepth(){for(var e=0,n=this.parent;n;)e++,n=n.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(ua),this._clearSelfAndDescendantCache(Ii)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(e)}getAbsolutePosition(e){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!e&&(e=!0);var i=this.getAbsoluteTransform(e).getMatrix(),a=new Hn,s=this.offset();return a.m=i.slice(),a.translate(s.x,s.y),a.getTranslation()}setAbsolutePosition(e){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(ua);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(e.x,e.y),e={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:e.x,y:e.y}),this._clearCache(ua),this._clearSelfAndDescendantCache(Ii),this}_setTransform(e){var n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){var e={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,e}move(e){var n=e.x,r=e.y,i=this.x(),a=this.y();return n!==void 0&&(i+=n),r!==void 0&&(a+=r),this.setPosition({x:i,y:a}),this}_eachAncestorReverse(e,n){var r=[],i=this.getParent(),a,s;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(a=r.length,s=0;s0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return G.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return G.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&G.warn("Unexpected value "+e+" 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(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(vd,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(e*=n.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e={},n=this.getAttrs(),r,i,a,s,u;e.attrs={};for(r in n)i=n[r],u=G.isObject(i)&&!G._isPlainObject(i)&&!G._isArray(i),!u&&(a=typeof this[r]=="function"&&this[r],delete n[r],s=a?a.call(this):null,n[r]=i,s!==i&&(e.attrs[r]=i));return e.className=this.getClassName(),G._prepareToStringify(e)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,r){var i=[];n&&this._isMatch(e)&&i.push(this);for(var a=this.parent;a;){if(a===r)return i;a._isMatch(e)&&i.push(a),a=a.parent}return i}isAncestorOf(e){return!1}findAncestor(e,n,r){return this.findAncestors(e,n,r)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);var n=e.replace(/ /g,"").split(","),r=n.length,i,a;for(i=0;i{try{const i=e==null?void 0:e.callback;i&&delete e.callback,G._urlToImage(this.toDataURL(e),function(a){n(a),i==null||i(a)})}catch(i){r(i)}})}toBlob(e){return new Promise((n,r)=>{try{const i=e==null?void 0:e.callback;i&&delete e.callback,this.toCanvas(e).toBlob(a=>{n(a),i==null||i(a)})}catch(i){r(i)}})}setSize(e){return this.width(e.width),this.height(e.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():pe.dragDistance}_off(e,n,r){var i=this.eventListeners[e],a,s,u;for(a=0;a=0;if(r&&!this.isDragging()){var i=!1;Ge._dragElements.forEach(a=>{this.isAncestorOf(a.node)&&(i=!0)}),i||this._createDragElement(e)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var e=this.getStage();if(!e)return;const n=Ge._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Ge._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return G.haveIntersection(r,this.getClientRect())}static create(e,n){return G._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){var r=se.prototype.getClassName.call(e),i=e.children,a,s,u;n&&(e.attrs.container=n),pe[r]||(G.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const c=pe[r];if(a=new c(e.attrs),i)for(s=i.length,u=0;u0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(e,n){var r=[];return this._descendants(i=>{const a=i._isMatch(e);return a&&r.push(i),!!(a&&n)}),r}_descendants(e){let n=!1;const r=this.getChildren();for(const i of r){if(n=e(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(e),n))return!0}return!1}toObject(){var e=se.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(n=>{e.children.push(n.toObject())}),e}isAncestorOf(e){for(var n=e.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){var n=se.prototype.clone.call(this,e);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(e){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(e)&&n.push(r)}),n}_clearSelfAndDescendantCache(e){var n;super._clearSelfAndDescendantCache(e),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(e,n){var r=this.getLayer(),i=e||r&&r.getCanvas(),a=i&&i.getContext(),s=this._getCanvasCache(),u=s&&s.scene,c=i&&i.isCache;if(!this.isVisible()&&!c)return this;if(u){a.save();var f=this.getAbsoluteTransform(n).getMatrix();a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=e||r&&r.hitCanvas,a=i&&i.getContext(),s=this._getCanvasCache(),u=s&&s.hit;if(u){a.save();var c=this.getAbsoluteTransform(n).getMatrix();a.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedHitCanvas(a),a.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(e,n,r){var i,a=n&&n.getContext(),s=this.clipWidth(),u=this.clipHeight(),c=this.clipFunc(),f=s&&u||c;const h=r===this;if(f){a.save();var p=this.getAbsoluteTransform(r),g=p.getMatrix();if(a.transform(g[0],g[1],g[2],g[3],g[4],g[5]),a.beginPath(),c)c.call(this,a,this);else{var y=this.clipX(),v=this.clipY();a.rect(y,v,s,u)}a.clip(),g=p.copy().invert().getMatrix(),a.transform(g[0],g[1],g[2],g[3],g[4],g[5])}var w=!h&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";w&&(a.save(),a._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(x){x[e](n,r)}),w&&a.restore(),f&&a.restore()}getClientRect(e){var n;e=e||{};var r=e.skipTransform,i=e.relativeTo,a,s,u,c,f={x:1/0,y:1/0,width:0,height:0},h=this;(n=this.children)===null||n===void 0||n.forEach(function(w){if(w.visible()){var x=w.getClientRect({relativeTo:h,skipShadow:e.skipShadow,skipStroke:e.skipStroke});x.width===0&&x.height===0||(a===void 0?(a=x.x,s=x.y,u=x.x+x.width,c=x.y+x.height):(a=Math.min(a,x.x),s=Math.min(s,x.y),u=Math.max(u,x.x+x.width),c=Math.max(c,x.y+x.height)))}});for(var p=this.find("Shape"),g=!1,y=0;yt.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",is=t=>{const e=iu(t);if(e==="pointer")return pe.pointerEventsEnabled&&Tm.pointer;if(e==="touch")return Tm.touch;if(e==="mouse")return Tm.mouse};function Tb(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&G.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}const JF="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);",Sd=[];class tp extends qn{constructor(e){super(Tb(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Sd.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{Tb(this.attrs)}),this._checkVisibility()}_validateAdd(e){const n=e.getType()==="Layer",r=e.getType()==="FastLayer";n||r||G.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if(typeof e===qF){if(e.charAt(0)==="."){var n=e.slice(1);e=document.getElementsByClassName(n)[0]}else{var r;e.charAt(0)!=="#"?r=e:r=e.slice(1),e=document.getElementById(r)}if(!e)throw"Can not find container in document with id "+r}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var e=this.children,n=e.length,r;for(r=0;r-1&&Sd.splice(n,1),G.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(G.warn(JF),null)}_getPointerById(e){return this._pointerPositions.find(n=>n.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e=e||{},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var n=new Ts({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),r=n.getContext()._context,i=this.children;return(e.x||e.y)&&r.translate(-1*e.x,-1*e.y),i.forEach(function(a){if(a.isVisible()){var s=a._toKonvaCanvas(e);r.drawImage(s._canvas,e.x,e.y,s.getWidth()/s.getPixelRatio(),s.getHeight()/s.getPixelRatio())}}),n}getIntersection(e){if(!e)return null;var n=this.children,r=n.length,i=r-1,a;for(a=i;a>=0;a--){const s=n[a].getIntersection(e);if(s)return s}return null}_resizeDOM(){var e=this.width(),n=this.height();this.content&&(this.content.style.width=e+Ob,this.content.style.height=n+Ob),this.bufferCanvas.setSize(e,n),this.bufferHitCanvas.setSize(e,n),this.children.forEach(r=>{r.setSize({width:e,height:n}),r.draw()})}add(e,...n){if(arguments.length>1){for(var r=0;rXF&&G.warn("The stage has "+i+" 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."),e.setSize({width:this.width(),height:this.height()}),e.draw(),pe.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return jk(e,this)}setPointerCapture(e){Hk(e,this)}releaseCapture(e){mu(e)}getLayers(){return this.children}_bindContentEvents(){pe.isBrowser&&QF.forEach(([e,n])=>{this.content.addEventListener(e,r=>{this[n](r)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const n=is(e.type);this._fire(n.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const n=is(e.type);this._fire(n.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let n=this[e+"targetShape"];return n&&!n.getStage()&&(n=null),n}_pointerleave(e){const n=is(e.type),r=iu(e.type);if(n){this.setPointersPositions(e);var i=this._getTargetShape(r),a=!Ge.isDragging||pe.hitOnDragEnabled;i&&a?(i._fireAndBubble(n.pointerout,{evt:e}),i._fireAndBubble(n.pointerleave,{evt:e}),this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this[r+"targetShape"]=null):a&&(this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(n.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(e){const n=is(e.type),r=iu(e.type);if(n){this.setPointersPositions(e);var i=!1;this._changedPointerPositions.forEach(a=>{var s=this.getIntersection(a);if(Ge.justDragged=!1,pe["_"+r+"ListenClick"]=!0,!(s&&s.isListening()))return;pe.capturePointerEventsEnabled&&s.setPointerCapture(a.id),this[r+"ClickStartShape"]=s,s._fireAndBubble(n.pointerdown,{evt:e,pointerId:a.id}),i=!0;const c=e.type.indexOf("touch")>=0;s.preventDefault()&&e.cancelable&&c&&e.preventDefault()}),i||this._fire(n.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const n=is(e.type),r=iu(e.type);if(!n)return;Ge.isDragging&&Ge.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e);var i=!Ge.isDragging||pe.hitOnDragEnabled;if(!i)return;var a={};let s=!1;var u=this._getTargetShape(r);this._changedPointerPositions.forEach(c=>{const f=Om(c.id)||this.getIntersection(c),h=c.id,p={evt:e,pointerId:h};var g=u!==f;if(g&&u&&(u._fireAndBubble(n.pointerout,Object.assign({},p),f),u._fireAndBubble(n.pointerleave,Object.assign({},p),f)),f){if(a[f._id])return;a[f._id]=!0}f&&f.isListening()?(s=!0,g&&(f._fireAndBubble(n.pointerover,Object.assign({},p),u),f._fireAndBubble(n.pointerenter,Object.assign({},p),u),this[r+"targetShape"]=f),f._fireAndBubble(n.pointermove,Object.assign({},p))):u&&(this._fire(n.pointerover,{evt:e,target:this,currentTarget:this,pointerId:h}),this[r+"targetShape"]=null)}),s||this._fire(n.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const n=is(e.type),r=iu(e.type);if(!n)return;this.setPointersPositions(e);const i=this[r+"ClickStartShape"],a=this[r+"ClickEndShape"];var s={};let u=!1;this._changedPointerPositions.forEach(c=>{const f=Om(c.id)||this.getIntersection(c);if(f){if(f.releaseCapture(c.id),s[f._id])return;s[f._id]=!0}const h=c.id,p={evt:e,pointerId:h};let g=!1;pe["_"+r+"InDblClickWindow"]?(g=!0,clearTimeout(this[r+"DblTimeout"])):Ge.justDragged||(pe["_"+r+"InDblClickWindow"]=!0,clearTimeout(this[r+"DblTimeout"])),this[r+"DblTimeout"]=setTimeout(function(){pe["_"+r+"InDblClickWindow"]=!1},pe.dblClickWindow),f&&f.isListening()?(u=!0,this[r+"ClickEndShape"]=f,f._fireAndBubble(n.pointerup,Object.assign({},p)),pe["_"+r+"ListenClick"]&&i&&i===f&&(f._fireAndBubble(n.pointerclick,Object.assign({},p)),g&&a&&a===f&&f._fireAndBubble(n.pointerdblclick,Object.assign({},p)))):(this[r+"ClickEndShape"]=null,pe["_"+r+"ListenClick"]&&this._fire(n.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:h}),g&&this._fire(n.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:h}))}),u||this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),pe["_"+r+"ListenClick"]=!1,e.cancelable&&r!=="touch"&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(ny,{evt:e}):this._fire(ny,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(ry,{evt:e}):this._fire(ry,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const n=Om(e.pointerId)||this.getIntersection(this.getPointerPosition());n&&n._fireAndBubble(Ss,M0(e)),mu(e.pointerId)}_lostpointercapture(e){mu(e.pointerId)}setPointersPositions(e){var n=this._getContentPosition(),r=null,i=null;e=e||window.event,e.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,a=>{this._pointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,a=>{this._changedPointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})})):(r=(e.clientX-n.left)/n.scaleX,i=(e.clientY-n.top)/n.scaleY,this.pointerPos={x:r,y:i},this._pointerPositions=[{x:r,y:i,id:G._getFirstPointerId(e)}],this._changedPointerPositions=[{x:r,y:i,id:G._getFirstPointerId(e)}])}_setPointerPosition(e){G.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Ts({width:this.width(),height:this.height()}),this.bufferHitCanvas=new L0({pixelRatio:1,width:this.width(),height:this.height()}),!!pe.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.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"),e.appendChild(this.content),this._resizeDOM()}}cache(){return G.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(e){e.batchDraw()}),this}}tp.prototype.nodeType=VF;yt(tp);A.addGetterSetter(tp,"container");var tE="hasShadow",nE="shadowRGBA",rE="patternImage",iE="linearGradient",aE="radialGradient";let Uf;function Rm(){return Uf||(Uf=G.createCanvasElement().getContext("2d"),Uf)}const vu={};function ZF(t){t.fill()}function e$(t){t.stroke()}function t$(t){t.fill()}function n$(t){t.stroke()}function r$(){this._clearCache(tE)}function i$(){this._clearCache(nE)}function a$(){this._clearCache(rE)}function o$(){this._clearCache(iE)}function s$(){this._clearCache(aE)}class re extends se{constructor(e){super(e);let n;for(;n=G.getRandomColor(),!(n&&!(n in vu)););this.colorKey=n,vu[n]=this}getContext(){return G.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return G.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(tE,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(rE,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var e=Rm();const n=e.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(n&&n.setTransform){const r=new Hn;r.translate(this.fillPatternX(),this.fillPatternY()),r.rotate(pe.getAngle(this.fillPatternRotation())),r.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),r.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const i=r.getMatrix(),a=typeof DOMMatrix>"u"?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);n.setTransform(a)}return n}}_getLinearGradient(){return this._getCache(iE,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var n=Rm(),r=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),a=n.createLinearGradient(r.x,r.y,i.x,i.y),s=0;sthis.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 e=this.hitStrokeWidth();return e==="auto"?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){var n=this.getStage(),r=n.bufferHitCanvas,i;return r.getContext().clear(),this.drawHit(r,null,!0),i=r.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data,i[3]>0}destroy(){return se.prototype.destroy.call(this),delete vu[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var n;if(!this.getStage()||!((n=this.attrs.perfectDrawEnabled)!==null&&n!==void 0?n:!0))return!1;const i=e||this.hasFill(),a=this.hasStroke(),s=this.getAbsoluteOpacity()!==1;if(i&&a&&s)return!0;const u=this.hasShadow(),c=this.shadowForStrokeEnabled();return!!(i&&a&&u&&c)}setStrokeHitEnabled(e){G.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){const n=e.skipTransform,r=e.relativeTo,i=this.getSelfRect(),s=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,u=i.width+s,c=i.height+s,f=!e.skipShadow&&this.hasShadow(),h=f?this.shadowOffsetX():0,p=f?this.shadowOffsetY():0,g=u+Math.abs(h),y=c+Math.abs(p),v=f&&this.shadowBlur()||0,w=g+v*2,x=y+v*2,_={width:w,height:x,x:-(s/2+v)+Math.min(h,0)+i.x,y:-(s/2+v)+Math.min(p,0)+i.y};return n?_:this._transformedRect(_,r)}drawScene(e,n){var r=this.getLayer(),i=e||r.getCanvas(),a=i.getContext(),s=this._getCanvasCache(),u=this.getSceneFunc(),c=this.hasShadow(),f,h,p,g=i.isCache,y=n===this;if(!this.isVisible()&&!y)return this;if(s){a.save();var v=this.getAbsoluteTransform(n).getMatrix();return a.transform(v[0],v[1],v[2],v[3],v[4],v[5]),this._drawCachedSceneCanvas(a),a.restore(),this}if(!u)return this;if(a.save(),this._useBufferCanvas()&&!g){f=this.getStage(),h=f.bufferCanvas,p=h.getContext(),p.clear(),p.save(),p._applyLineJoin(this);var w=this.getAbsoluteTransform(n).getMatrix();p.transform(w[0],w[1],w[2],w[3],w[4],w[5]),u.call(this,p,this),p.restore();var x=h.pixelRatio;c&&a._applyShadow(this),a._applyOpacity(this),a._applyGlobalCompositeOperation(this),a.drawImage(h._canvas,0,0,h.width/x,h.height/x)}else{if(a._applyLineJoin(this),!y){var w=this.getAbsoluteTransform(n).getMatrix();a.transform(w[0],w[1],w[2],w[3],w[4],w[5]),a._applyOpacity(this),a._applyGlobalCompositeOperation(this)}c&&a._applyShadow(this),u.call(this,a,this)}return a.restore(),this}drawHit(e,n,r=!1){if(!this.shouldDrawHit(n,r))return this;var i=this.getLayer(),a=e||i.hitCanvas,s=a&&a.getContext(),u=this.hitFunc()||this.sceneFunc(),c=this._getCanvasCache(),f=c&&c.hit;if(this.colorKey||G.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()"),f){s.save();var h=this.getAbsoluteTransform(n).getMatrix();return s.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(s),s.restore(),this}if(!u)return this;if(s.save(),s._applyLineJoin(this),!(this===n)){var g=this.getAbsoluteTransform(n).getMatrix();s.transform(g[0],g[1],g[2],g[3],g[4],g[5])}return u.call(this,s,this),s.restore(),this}drawHitFromCache(e=0){var n=this._getCanvasCache(),r=this._getCachedSceneCanvas(),i=n.hit,a=i.getContext(),s=i.getWidth(),u=i.getHeight(),c,f,h,p,g,y;a.clear(),a.drawImage(r._canvas,0,0,s,u);try{for(c=a.getImageData(0,0,s,u),f=c.data,h=f.length,p=G._hexToRgb(this.colorKey),g=0;ge?(f[g]=p.r,f[g+1]=p.g,f[g+2]=p.b,f[g+3]=255):f[g+3]=0;a.putImageData(c,0,0)}catch(v){G.error("Unable to draw hit graph from cached scene canvas. "+v.message)}return this}hasPointerCapture(e){return jk(e,this)}setPointerCapture(e){Hk(e,this)}releaseCapture(e){mu(e)}}re.prototype._fillFunc=ZF;re.prototype._strokeFunc=e$;re.prototype._fillFuncHit=t$;re.prototype._strokeFuncHit=n$;re.prototype._centroid=!1;re.prototype.nodeType="Shape";yt(re);re.prototype.eventListeners={};re.prototype.on.call(re.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",r$);re.prototype.on.call(re.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",i$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",a$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",o$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",s$);A.addGetterSetter(re,"stroke",void 0,Gk());A.addGetterSetter(re,"strokeWidth",2,le());A.addGetterSetter(re,"fillAfterStrokeEnabled",!1);A.addGetterSetter(re,"hitStrokeWidth","auto",I0());A.addGetterSetter(re,"strokeHitEnabled",!0,jr());A.addGetterSetter(re,"perfectDrawEnabled",!0,jr());A.addGetterSetter(re,"shadowForStrokeEnabled",!0,jr());A.addGetterSetter(re,"lineJoin");A.addGetterSetter(re,"lineCap");A.addGetterSetter(re,"sceneFunc");A.addGetterSetter(re,"hitFunc");A.addGetterSetter(re,"dash");A.addGetterSetter(re,"dashOffset",0,le());A.addGetterSetter(re,"shadowColor",void 0,qs());A.addGetterSetter(re,"shadowBlur",0,le());A.addGetterSetter(re,"shadowOpacity",1,le());A.addComponentsGetterSetter(re,"shadowOffset",["x","y"]);A.addGetterSetter(re,"shadowOffsetX",0,le());A.addGetterSetter(re,"shadowOffsetY",0,le());A.addGetterSetter(re,"fillPatternImage");A.addGetterSetter(re,"fill",void 0,Gk());A.addGetterSetter(re,"fillPatternX",0,le());A.addGetterSetter(re,"fillPatternY",0,le());A.addGetterSetter(re,"fillLinearGradientColorStops");A.addGetterSetter(re,"strokeLinearGradientColorStops");A.addGetterSetter(re,"fillRadialGradientStartRadius",0);A.addGetterSetter(re,"fillRadialGradientEndRadius",0);A.addGetterSetter(re,"fillRadialGradientColorStops");A.addGetterSetter(re,"fillPatternRepeat","repeat");A.addGetterSetter(re,"fillEnabled",!0);A.addGetterSetter(re,"strokeEnabled",!0);A.addGetterSetter(re,"shadowEnabled",!0);A.addGetterSetter(re,"dashEnabled",!0);A.addGetterSetter(re,"strokeScaleEnabled",!0);A.addGetterSetter(re,"fillPriority","color");A.addComponentsGetterSetter(re,"fillPatternOffset",["x","y"]);A.addGetterSetter(re,"fillPatternOffsetX",0,le());A.addGetterSetter(re,"fillPatternOffsetY",0,le());A.addComponentsGetterSetter(re,"fillPatternScale",["x","y"]);A.addGetterSetter(re,"fillPatternScaleX",1,le());A.addGetterSetter(re,"fillPatternScaleY",1,le());A.addComponentsGetterSetter(re,"fillLinearGradientStartPoint",["x","y"]);A.addComponentsGetterSetter(re,"strokeLinearGradientStartPoint",["x","y"]);A.addGetterSetter(re,"fillLinearGradientStartPointX",0);A.addGetterSetter(re,"strokeLinearGradientStartPointX",0);A.addGetterSetter(re,"fillLinearGradientStartPointY",0);A.addGetterSetter(re,"strokeLinearGradientStartPointY",0);A.addComponentsGetterSetter(re,"fillLinearGradientEndPoint",["x","y"]);A.addComponentsGetterSetter(re,"strokeLinearGradientEndPoint",["x","y"]);A.addGetterSetter(re,"fillLinearGradientEndPointX",0);A.addGetterSetter(re,"strokeLinearGradientEndPointX",0);A.addGetterSetter(re,"fillLinearGradientEndPointY",0);A.addGetterSetter(re,"strokeLinearGradientEndPointY",0);A.addComponentsGetterSetter(re,"fillRadialGradientStartPoint",["x","y"]);A.addGetterSetter(re,"fillRadialGradientStartPointX",0);A.addGetterSetter(re,"fillRadialGradientStartPointY",0);A.addComponentsGetterSetter(re,"fillRadialGradientEndPoint",["x","y"]);A.addGetterSetter(re,"fillRadialGradientEndPointX",0);A.addGetterSetter(re,"fillRadialGradientEndPointY",0);A.addGetterSetter(re,"fillPatternRotation",0);A.backCompat(re,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var l$="#",u$="beforeDraw",c$="draw",oE=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],f$=oE.length;class yo extends qn{constructor(e){super(e),this.canvas=new Ts,this.hitCanvas=new L0({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(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(e,n){var r=this.getLayer(),i=e||r&&r.getCanvas();return this._fire(u$,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),qn.prototype.drawScene.call(this,i,n),this._fire(c$,{node:this}),this}drawHit(e,n){var r=this.getLayer(),i=e||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),qn.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){G.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return G.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var e=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return G.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}yo.prototype.nodeType="Layer";yt(yo);A.addGetterSetter(yo,"imageSmoothingEnabled",!0);A.addGetterSetter(yo,"clearBeforeDraw",!0);A.addGetterSetter(yo,"hitGraphEnabled",!0,jr());class D0 extends yo{constructor(e){super(e),this.listening(!1),G.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}D0.prototype.nodeType="FastLayer";yt(D0);class zs extends qn{_validateAdd(e){var n=e.getType();n!=="Group"&&n!=="Shape"&&G.throw("You may only add groups and shapes to groups.")}}zs.prototype.nodeType="Group";yt(zs);var Am=function(){return Os.performance&&Os.performance.now?function(){return Os.performance.now()}:function(){return new Date().getTime()}}();class dr{constructor(e,n){this.id=dr.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Am(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){var n=[];return e?e.length>0?n=e:n=[e]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(e){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=Rb,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=Ab,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,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 e=this.getTimer()-this._startTime;this.state===Rb?this.setTime(e):this.state===Ab&&this.setTime(this.duration-e)}pause(){this.state=h$,this.fire("onPause")}getTimer(){return new Date().getTime()}}class kt{constructor(e){var n=this,r=e.node,i=r._id,a,s=e.easing||yu.Linear,u=!!e.yoyo,c;typeof e.duration>"u"?a=.3:e.duration===0?a=.001:a=e.duration,this.node=r,this._id=p$++;var f=r.getLayer()||(r instanceof pe.Stage?r.getLayers():null);f||G.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new dr(function(){n.tween.onEnterFrame()},f),this.tween=new g$(c,function(h){n._tweenFunc(h)},s,0,1,a*1e3,u),this._addListeners(),kt.attrs[i]||(kt.attrs[i]={}),kt.attrs[i][this._id]||(kt.attrs[i][this._id]={}),kt.tweens[i]||(kt.tweens[i]={});for(c in e)d$[c]===void 0&&this._addAttr(c,e[c]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,n){var r=this.node,i=r._id,a,s,u,c,f,h,p,g;if(u=kt.tweens[i][e],u&&delete kt.attrs[i][u][e],a=r.getAttr(e),G._isArray(n))if(s=[],f=Math.max(n.length,a.length),e==="points"&&n.length!==a.length&&(n.length>a.length?(p=a,a=G._prepareArrayForTween(a,n,r.closed())):(h=n,n=G._prepareArrayForTween(n,a,r.closed()))),e.indexOf("fill")===0)for(c=0;c{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,n=kt.attrs[e._id][this._id];n.points&&n.points.trueEnd&&e.setAttr("points",n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,n=kt.attrs[e._id][this._id];n.points&&n.points.trueStart&&e.points(n.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(e){return this.tween.seek(e*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e=this.node._id,n=this._id,r=kt.tweens[e],i;this.pause();for(i in r)delete kt.tweens[e][i];delete kt.attrs[e][n]}}kt.attrs={};kt.tweens={};se.prototype.to=function(t){var e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()};var n=new kt(t);n.play()};const yu={BackEaseIn(t,e,n,r){var i=1.70158;return n*(t/=r)*t*((i+1)*t-i)+e},BackEaseOut(t,e,n,r){var i=1.70158;return n*((t=t/r-1)*t*((i+1)*t+i)+1)+e},BackEaseInOut(t,e,n,r){var i=1.70158;return(t/=r/2)<1?n/2*(t*t*(((i*=1.525)+1)*t-i))+e:n/2*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)+e},ElasticEaseIn(t,e,n,r,i,a){var s=0;return t===0?e:(t/=r)===1?e+n:(a||(a=r*.3),!i||i0?e:n),h=s*n,p=u*(u>0?e:n),g=c*(c>0?n:e);return{x:f,y:r?-1*g:p,width:h-f,height:g-p}}}Wi.prototype._centroid=!0;Wi.prototype.className="Arc";Wi.prototype._attrsAffectingSize=["innerRadius","outerRadius"];yt(Wi);A.addGetterSetter(Wi,"innerRadius",0,le());A.addGetterSetter(Wi,"outerRadius",0,le());A.addGetterSetter(Wi,"angle",0,le());A.addGetterSetter(Wi,"clockwise",!1,jr());function iy(t,e,n,r,i,a,s){var u=Math.sqrt(Math.pow(n-t,2)+Math.pow(r-e,2)),c=Math.sqrt(Math.pow(i-n,2)+Math.pow(a-r,2)),f=s*u/(u+c),h=s*c/(u+c),p=n-f*(i-t),g=r-f*(a-e),y=n+h*(i-t),v=r+h*(a-e);return[p,g,y,v]}function Mb(t,e){var n=t.length,r=[],i,a;for(i=2;i4){for(u=this.getTensionPoints(),c=u.length,f=a?0:4,a||e.quadraticCurveTo(u[0],u[1],u[2],u[3]);fh?f:h,x=f>h?1:f/h,_=f>h?h/f:1;e.translate(u,c),e.rotate(y),e.scale(x,_),e.arc(0,0,w,p,p+g,1-v),e.scale(1/x,1/_),e.rotate(-y),e.translate(-u,-c);break;case"z":r=!0,e.closePath();break}}!r&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach(function(f){if(f.command==="A"){var h=f.points[4],p=f.points[5],g=f.points[4]+p,y=Math.PI/180;if(Math.abs(h-g)g;v-=y){const w=tt.getPointOnEllipticalArc(f.points[0],f.points[1],f.points[2],f.points[3],v,0);e.push(w.x,w.y)}else for(let v=h+y;vthis.dataArray[r].pathLength;)e-=this.dataArray[r].pathLength,++r;if(r===i)return n=this.dataArray[r-1].points.slice(-2),{x:n[0],y:n[1]};if(e<.01)return n=this.dataArray[r].points.slice(0,2),{x:n[0],y:n[1]};var a=this.dataArray[r],s=a.points;switch(a.command){case"L":return tt.getPointOnLine(e,a.start.x,a.start.y,s[0],s[1]);case"C":return tt.getPointOnCubicBezier(e/a.pathLength,a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return tt.getPointOnQuadraticBezier(e/a.pathLength,a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":var u=s[0],c=s[1],f=s[2],h=s[3],p=s[4],g=s[5],y=s[6];return p+=g*e/a.pathLength,tt.getPointOnEllipticalArc(u,c,f,h,p,y)}return null}static getLineLength(e,n,r,i){return Math.sqrt((r-e)*(r-e)+(i-n)*(i-n))}static getPointOnLine(e,n,r,i,a,s,u){s===void 0&&(s=n),u===void 0&&(u=r);var c=(a-r)/(i-n+1e-8),f=Math.sqrt(e*e/(1+c*c));i0&&!isNaN(v[0]);){var S=null,C=[],O=c,I=f,L,D,U,X,K,te,ce,j,T,$;switch(y){case"l":c+=v.shift(),f+=v.shift(),S="L",C.push(c,f);break;case"L":c=v.shift(),f=v.shift(),C.push(c,f);break;case"m":var V=v.shift(),ie=v.shift();if(c+=V,f+=ie,S="M",s.length>2&&s[s.length-1].command==="z"){for(var H=s.length-2;H>=0;H--)if(s[H].command==="M"){c=s[H].points[0]+V,f=s[H].points[1]+ie;break}}C.push(c,f),y="l";break;case"M":c=v.shift(),f=v.shift(),S="M",C.push(c,f),y="L";break;case"h":c+=v.shift(),S="L",C.push(c,f);break;case"H":c=v.shift(),S="L",C.push(c,f);break;case"v":f+=v.shift(),S="L",C.push(c,f);break;case"V":f=v.shift(),S="L",C.push(c,f);break;case"C":C.push(v.shift(),v.shift(),v.shift(),v.shift()),c=v.shift(),f=v.shift(),C.push(c,f);break;case"c":C.push(c+v.shift(),f+v.shift(),c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="C",C.push(c,f);break;case"S":D=c,U=f,L=s[s.length-1],L.command==="C"&&(D=c+(c-L.points[2]),U=f+(f-L.points[3])),C.push(D,U,v.shift(),v.shift()),c=v.shift(),f=v.shift(),S="C",C.push(c,f);break;case"s":D=c,U=f,L=s[s.length-1],L.command==="C"&&(D=c+(c-L.points[2]),U=f+(f-L.points[3])),C.push(D,U,c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="C",C.push(c,f);break;case"Q":C.push(v.shift(),v.shift()),c=v.shift(),f=v.shift(),C.push(c,f);break;case"q":C.push(c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="Q",C.push(c,f);break;case"T":D=c,U=f,L=s[s.length-1],L.command==="Q"&&(D=c+(c-L.points[0]),U=f+(f-L.points[1])),c=v.shift(),f=v.shift(),S="Q",C.push(D,U,c,f);break;case"t":D=c,U=f,L=s[s.length-1],L.command==="Q"&&(D=c+(c-L.points[0]),U=f+(f-L.points[1])),c+=v.shift(),f+=v.shift(),S="Q",C.push(D,U,c,f);break;case"A":X=v.shift(),K=v.shift(),te=v.shift(),ce=v.shift(),j=v.shift(),T=c,$=f,c=v.shift(),f=v.shift(),S="A",C=this.convertEndpointToCenterParameterization(T,$,c,f,ce,j,X,K,te);break;case"a":X=v.shift(),K=v.shift(),te=v.shift(),ce=v.shift(),j=v.shift(),T=c,$=f,c+=v.shift(),f+=v.shift(),S="A",C=this.convertEndpointToCenterParameterization(T,$,c,f,ce,j,X,K,te);break}s.push({command:S||y,points:C,start:{x:O,y:I},pathLength:this.calcLength(O,I,S||y,C)})}(y==="z"||y==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(e,n,r,i){var a,s,u,c,f=tt;switch(r){case"L":return f.getLineLength(e,n,i[0],i[1]);case"C":for(a=0,s=f.getPointOnCubicBezier(0,e,n,i[0],i[1],i[2],i[3],i[4],i[5]),c=.01;c<=1;c+=.01)u=f.getPointOnCubicBezier(c,e,n,i[0],i[1],i[2],i[3],i[4],i[5]),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;return a;case"Q":for(a=0,s=f.getPointOnQuadraticBezier(0,e,n,i[0],i[1],i[2],i[3]),c=.01;c<=1;c+=.01)u=f.getPointOnQuadraticBezier(c,e,n,i[0],i[1],i[2],i[3]),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;return a;case"A":a=0;var h=i[4],p=i[5],g=i[4]+p,y=Math.PI/180;if(Math.abs(h-g)g;c-=y)u=f.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],c,0),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;else for(c=h+y;c1&&(u*=Math.sqrt(y),c*=Math.sqrt(y));var v=Math.sqrt((u*u*(c*c)-u*u*(g*g)-c*c*(p*p))/(u*u*(g*g)+c*c*(p*p)));a===s&&(v*=-1),isNaN(v)&&(v=0);var w=v*u*g/c,x=v*-c*p/u,_=(e+r)/2+Math.cos(h)*w-Math.sin(h)*x,S=(n+i)/2+Math.sin(h)*w+Math.cos(h)*x,C=function(K){return Math.sqrt(K[0]*K[0]+K[1]*K[1])},O=function(K,te){return(K[0]*te[0]+K[1]*te[1])/(C(K)*C(te))},I=function(K,te){return(K[0]*te[1]=1&&(X=0),s===0&&X>0&&(X=X-2*Math.PI),s===1&&X<0&&(X=X+2*Math.PI),[_,S,u,c,L,X,h,s]}}tt.prototype.className="Path";tt.prototype._attrsAffectingSize=["data"];yt(tt);A.addGetterSetter(tt,"data");class So extends Vi{_sceneFunc(e){super._sceneFunc(e);var n=Math.PI*2,r=this.points(),i=r,a=this.tension()!==0&&r.length>4;a&&(i=this.getTensionPoints());var s=this.pointerLength(),u=r.length,c,f;if(a){const g=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[u-2],r[u-1]],y=tt.calcLength(i[i.length-4],i[i.length-3],"C",g),v=tt.getPointOnQuadraticBezier(Math.min(1,1-s/y),g[0],g[1],g[2],g[3],g[4],g[5]);c=r[u-2]-v.x,f=r[u-1]-v.y}else c=r[u-2]-r[u-4],f=r[u-1]-r[u-3];var h=(Math.atan2(f,c)+n)%n,p=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(r[u-2],r[u-1]),e.rotate(h),e.moveTo(0,0),e.lineTo(-s,p/2),e.lineTo(-s,-p/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(r[0],r[1]),a?(c=(i[0]+i[2])/2-r[0],f=(i[1]+i[3])/2-r[1]):(c=r[2]-r[0],f=r[3]-r[1]),e.rotate((Math.atan2(-f,-c)+n)%n),e.moveTo(0,0),e.lineTo(-s,p/2),e.lineTo(-s,-p/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x-n,y:e.y-n,width:e.width+n*2,height:e.height+n*2}}}So.prototype.className="Arrow";yt(So);A.addGetterSetter(So,"pointerLength",10,le());A.addGetterSetter(So,"pointerWidth",10,le());A.addGetterSetter(So,"pointerAtBeginning",!1);A.addGetterSetter(So,"pointerAtEnding",!0);class Ks extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Ks.prototype._centroid=!0;Ks.prototype.className="Circle";Ks.prototype._attrsAffectingSize=["radius"];yt(Ks);A.addGetterSetter(Ks,"radius",0,le());class Na extends re{_sceneFunc(e){var n=this.radiusX(),r=this.radiusY();e.beginPath(),e.save(),n!==r&&e.scale(1,r/n),e.arc(0,0,n,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Na.prototype.className="Ellipse";Na.prototype._centroid=!0;Na.prototype._attrsAffectingSize=["radiusX","radiusY"];yt(Na);A.addComponentsGetterSetter(Na,"radius",["x","y"]);A.addGetterSetter(Na,"radiusX",0,le());A.addGetterSetter(Na,"radiusY",0,le());let hi=class sE extends re{constructor(e){super(e),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),a=this.attrs.image;let s;if(a){const u=this.attrs.cropWidth,c=this.attrs.cropHeight;u&&c?s=[a,this.cropX(),this.cropY(),u,c,0,0,n,r]:s=[a,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(e.beginPath(),i?G.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)),a&&(i&&e.clip(),e.drawImage.apply(e,s))}_hitFunc(e){var n=this.width(),r=this.height(),i=this.cornerRadius();e.beginPath(),i?G.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n;return(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var e,n;return(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(e,n,r=null){var i=G.createImageElement();i.onload=function(){var a=new sE({image:i});n(a)},i.onerror=r,i.crossOrigin="Anonymous",i.src=e}};hi.prototype.className="Image";yt(hi);A.addGetterSetter(hi,"cornerRadius",0,A0(4));A.addGetterSetter(hi,"image");A.addComponentsGetterSetter(hi,"crop",["x","y","width","height"]);A.addGetterSetter(hi,"cropX",0,le());A.addGetterSetter(hi,"cropY",0,le());A.addGetterSetter(hi,"cropWidth",0,le());A.addGetterSetter(hi,"cropHeight",0,le());var lE=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],m$="Change.konva",v$="none",ay="up",oy="right",sy="down",ly="left",y$=lE.length;class N0 extends zs{constructor(e){super(e),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(e){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,s.x),r=Math.max(r,s.x),i=Math.min(i,s.y),a=Math.max(a,s.y)}),{x:n,y:i,width:r-n,height:a-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}wo.prototype.className="RegularPolygon";wo.prototype._centroid=!0;wo.prototype._attrsAffectingSize=["radius"];yt(wo);A.addGetterSetter(wo,"radius",0,le());A.addGetterSetter(wo,"sides",0,le());var Db=Math.PI*2;class bo extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,Db,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),Db,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}bo.prototype.className="Ring";bo.prototype._centroid=!0;bo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];yt(bo);A.addGetterSetter(bo,"innerRadius",0,le());A.addGetterSetter(bo,"outerRadius",0,le());class pi extends re{constructor(e){super(e),this._updated=!0,this.anim=new dr(()=>{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(e){var n=this.animation(),r=this.frameIndex(),i=r*4,a=this.animations()[n],s=this.frameOffsets(),u=a[i+0],c=a[i+1],f=a[i+2],h=a[i+3],p=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,f,h),e.closePath(),e.fillStrokeShape(this)),p)if(s){var g=s[n],y=r*2;e.drawImage(p,u,c,f,h,g[y+0],g[y+1],f,h)}else e.drawImage(p,u,c,f,h,0,0,f,h)}_hitFunc(e){var n=this.animation(),r=this.frameIndex(),i=r*4,a=this.animations()[n],s=this.frameOffsets(),u=a[i+2],c=a[i+3];if(e.beginPath(),s){var f=s[n],h=r*2;e.rect(f[h+0],f[h+1],u,c)}else e.rect(0,0,u,c);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],a=i.length/4;e{e=e.trim();const n=e.indexOf(" ")>=0,r=e.indexOf('"')>=0||e.indexOf("'")>=0;return n&&!r&&(e=`"${e}"`),e}).join(", ")}var Hf;function Lm(){return Hf||(Hf=G.createCanvasElement().getContext(w$),Hf)}function I$(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function L$(t){t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function M$(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let vt=class extends re{constructor(e){super(M$(e)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(_+=s)}}}_hitFunc(e){var n=this.getWidth(),r=this.getHeight();e.beginPath(),e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}setText(e){var n=G._isString(e)?e:e==null?"":e+"";return this._setAttr(b$,n),this}getWidth(){var e=this.attrs.width===as||this.attrs.width===void 0;return e?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var e=this.attrs.height===as||this.attrs.height===void 0;return e?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return G.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n=Lm(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(e),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+jf+this.fontVariant()+jf+(this.fontSize()+E$)+A$(this.fontFamily())}_addTextLine(e){this.align()===Hl&&(e=e.trim());var r=this._getTextWidth(e);return this.textArr.push({text:e,width:r,lastInParagraph:!1})}_getTextWidth(e){var n=this.letterSpacing(),r=e.length;return Lm().measureText(e).width+(r?n*(r-1):0)}_setTextData(){var e=this.text().split(` -`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,a=this.attrs.width,s=this.attrs.height,u=a!==as&&a!==void 0,c=s!==as&&s!==void 0,f=this.padding(),h=a-f*2,p=s-f*2,g=0,y=this.wrap(),v=y!==Fb,w=y!==T$&&v,x=this.ellipsis();this.textArr=[],Lm().font=this._getContextFont();for(var _=x?this._getTextWidth(Im):0,S=0,C=e.length;Sh)for(;O.length>0;){for(var L=0,D=O.length,U="",X=0;L>>1,te=O.slice(0,K+1),ce=this._getTextWidth(te)+_;ce<=h?(L=K+1,U=te,X=ce):D=K}if(U){if(w){var j,T=O[U.length],$=T===jf||T===Nb;$&&X<=h?j=U.length:j=Math.max(U.lastIndexOf(jf),U.lastIndexOf(Nb))+1,j>0&&(L=j,U=U.slice(0,L),X=this._getTextWidth(U))}U=U.trimRight(),this._addTextLine(U),r=Math.max(r,X),g+=i;var V=this._shouldHandleEllipsis(g);if(V){this._tryToAddEllipsisToLastLine();break}if(O=O.slice(L),O=O.trimLeft(),O.length>0&&(I=this._getTextWidth(O),I<=h)){this._addTextLine(O),g+=i,r=Math.max(r,I);break}}else break}else this._addTextLine(O),g+=i,r=Math.max(r,I),this._shouldHandleEllipsis(g)&&Sp)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(e){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,a=i!==as&&i!==void 0,s=this.padding(),u=i-s*2,c=this.wrap(),f=c!==Fb;return!f||a&&e+r>u}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,n=e!==as&&e!==void 0,r=this.padding(),i=e-r*2,a=this.ellipsis(),s=this.textArr[this.textArr.length-1];if(!(!s||!a)){if(n){var u=this._getTextWidth(s.text+Im)=1){var r=n[0].p0;e.moveTo(r.x,r.y)}for(var i=0;i0&&(u+=e.dataArray[c].pathLength);var f=0;i==="center"&&(f=Math.max(0,u/2-s/2)),i==="right"&&(f=Math.max(0,u-s));for(var h=uE(this.text()),p=this.text().split(" ").length-1,g,y,v,w=-1,x=0,_=function(){x=0;for(var ce=e.dataArray,j=w+1;j0)return w=j,ce[j];ce[j].command==="M"&&(g={x:ce[j].points[0],y:ce[j].points[1]})}return{}},S=function(ce){var j=e._getTextSize(ce).width+r;ce===" "&&i==="justify"&&(j+=(u-s)/p);var T=0,$=0;for(y=void 0;Math.abs(j-T)/j>.01&&$<20;){$++;for(var V=T;v===void 0;)v=_(),v&&V+v.pathLengthj?y=tt.getPointOnLine(j,g.x,g.y,v.points[0],v.points[1],g.x,g.y):v=void 0;break;case"A":var H=v.points[4],Y=v.points[5],Q=v.points[4]+Y;x===0?x=H+1e-8:j>T?x+=Math.PI/180*Y/Math.abs(Y):x-=Math.PI/360*Y/Math.abs(Y),(Y<0&&x=0&&x>Q)&&(x=Q,ie=!0),y=tt.getPointOnEllipticalArc(v.points[0],v.points[1],v.points[2],v.points[3],x,v.points[6]);break;case"C":x===0?j>v.pathLength?x=1e-8:x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength/2:x=Math.max(x-(T-j)/v.pathLength/2,0),x>1&&(x=1,ie=!0),y=tt.getPointOnCubicBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3],v.points[4],v.points[5]);break;case"Q":x===0?x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength:x-=(T-j)/v.pathLength,x>1&&(x=1,ie=!0),y=tt.getPointOnQuadraticBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3]);break}y!==void 0&&(T=tt.getLineLength(g.x,g.y,y.x,y.y)),ie&&(ie=!1,v=void 0)}},C="C",O=e._getTextSize(C).width+r,I=f/O-1,L=0;Lt+`.${mE}`).join(" "),$b="nodesRect",B$=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],F$={"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 $$="ontouchstart"in pe._global;function z$(t,e){if(t==="rotater")return"crosshair";e+=G.degToRad(F$[t]||0);var n=(G.radToDeg(e)%360+360)%360;return G._inRange(n,315+22.5,360)||G._inRange(n,0,22.5)?"ns-resize":G._inRange(n,45-22.5,45+22.5)?"nesw-resize":G._inRange(n,90-22.5,90+22.5)?"ew-resize":G._inRange(n,135-22.5,135+22.5)?"nwse-resize":G._inRange(n,180-22.5,180+22.5)?"ns-resize":G._inRange(n,225-22.5,225+22.5)?"nesw-resize":G._inRange(n,270-22.5,270+22.5)?"ew-resize":G._inRange(n,315-22.5,315+22.5)?"nwse-resize":(G.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var sh=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],zb=1e8;function G$(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function vE(t,e,n){const r=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),i=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return Object.assign(Object.assign({},t),{rotation:t.rotation+e,x:r,y:i})}function U$(t,e){const n=G$(t);return vE(t,e,n)}function j$(t,e,n){let r=e;for(let i=0;i{const i=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=r._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");r.on(a,i),r.on(B$.map(s=>s+`.${this._getEventNamespace()}`).join(" "),i),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,i),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,r=>{n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(r,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=e.getAbsolutePosition(),a=i.x-n.x,s=i.y-n.y;this.nodes().forEach(u=>{if(u===e||u.isDragging())return;const c=u.getAbsolutePosition();u.setAbsolutePosition({x:c.x+a,y:c.y+s}),u.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache($b),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache($b,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),r){var i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(r),s=e.getAbsolutePosition(r),u=i.x*a.x-e.offsetX()*a.x,c=i.y*a.y-e.offsetY()*a.y;const f=(pe.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),h={x:s.x+u*Math.cos(f)+c*Math.sin(-f),y:s.y+c*Math.cos(f)+u*Math.sin(f),width:i.width*a.x,height:i.height*a.y,rotation:f};return vE(h,-pe.getAngle(n),{x:0,y:0})}__getNodeRect(){var e=this.getNode();if(!e)return{x:-zb,y:-zb,width:0,height:0,rotation:0};const n=[];this.nodes().map(f=>{const h=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var p=[{x:h.x,y:h.y},{x:h.x+h.width,y:h.y},{x:h.x+h.width,y:h.y+h.height},{x:h.x,y:h.y+h.height}],g=f.getAbsoluteTransform();p.forEach(function(y){var v=g.point(y);n.push(v)})});const r=new Hn;r.rotate(-pe.getAngle(this.rotation()));var i,a,s,u;n.forEach(function(f){var h=r.point(f);i===void 0&&(i=s=h.x,a=u=h.y),i=Math.min(i,h.x),a=Math.min(a,h.y),s=Math.max(s,h.x),u=Math.max(u,h.y)}),r.invert();const c=r.point({x:i,y:a});return{x:c.x,y:c.y,width:s-i,height:u-a,rotation:pe.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(),sh.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var n=new ec({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:$$?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=pe.getAngle(this.rotation()),a=z$(e,i);n.getStage().content&&(n.getStage().content.style.cursor=a),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var e=new re({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()*G._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(e),this._proxyDrag(e),e.on("dragstart",n=>{n.cancelBubble=!0}),e.on("dragmove",n=>{n.cancelBubble=!0}),e.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,a=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/a),this.cos=Math.abs(r/a),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 s=e.target.getAbsolutePosition(),u=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:u.x-s.x,y:u.y-s.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(c=>{c._fire("transformstart",{evt:e.evt,target:c})})}_handleMouseMove(e){var n,r,i,a=this.findOne("."+this._movingAnchorName),s=a.getStage();s.setPointersPositions(e);const u=s.getPointerPosition();let c={x:u.x-this._anchorDragOffset.x,y:u.y-this._anchorDragOffset.y};const f=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(c=this.anchorDragBoundFunc()(f,c,e)),a.setAbsolutePosition(c);const h=a.getAbsolutePosition();if(!(f.x===h.x&&f.y===h.y)){if(this._movingAnchorName==="rotater"){var p=this._getNodeRect();n=a.x()-p.width/2,r=-a.y()+p.height/2;let ce=Math.atan2(-r,n)+Math.PI/2;p.height<0&&(ce-=Math.PI);var g=pe.getAngle(this.rotation());const j=g+ce,T=pe.getAngle(this.rotationSnapTolerance()),V=j$(this.rotationSnaps(),j,T)-p.rotation,ie=U$(p,V);this._fitNodesInto(ie,e);return}var y=this.keepRatio()||e.shiftKey,S=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(y){var v=S?{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(v.x-a.x(),2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-left").x()>v.x?-1:1,x=this.findOne(".top-left").y()>v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-left").x(v.x-n),this.findOne(".top-left").y(v.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(a.y());else if(this._movingAnchorName==="top-right"){if(y){var v=S?{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(a.x()-v.x,2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-right").x()v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-right").x(v.x+n),this.findOne(".top-right").y(v.y-r)}var _=a.position();this.findOne(".top-left").y(_.y),this.findOne(".bottom-right").x(_.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(a.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(a.x());else if(this._movingAnchorName==="bottom-left"){if(y){var v=S?{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(v.x-a.x(),2)+Math.pow(a.y()-v.y,2));var w=v.x{r._fire("transformend",{evt:e,target:r})}),this._movingAnchorName=null}}_fitNodesInto(e,n){var r=this._getNodeRect();const i=1;if(G._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(G._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const a=this.flipEnabled();var s=new Hn;if(s.rotate(pe.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const p=s.point({x:-this.padding()*2,y:0});if(e.x+=p.x,e.y+=p.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,!a){this.update();return}}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const p=s.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.width+=this.padding()*2,!a){this.update();return}}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const p=s.point({x:0,y:-this.padding()*2});if(e.x+=p.x,e.y+=p.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const p=s.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}if(this.boundBoxFunc()){const p=this.boundBoxFunc()(r,e);p?e=p:G.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const u=1e7,c=new Hn;c.translate(r.x,r.y),c.rotate(r.rotation),c.scale(r.width/u,r.height/u);const f=new Hn;f.translate(e.x,e.y),f.rotate(e.rotation),f.scale(e.width/u,e.height/u);const h=f.multiply(c.invert());this._nodes.forEach(p=>{var g;const y=p.getParent().getAbsoluteTransform(),v=p.getTransform().copy();v.translate(p.offsetX(),p.offsetY());const w=new Hn;w.multiply(y.copy().invert()).multiply(h).multiply(y).multiply(v);const x=w.decompose();p.setAttrs(x),this._fire("transform",{evt:n,target:p}),p._fire("transform",{evt:n,target:p}),(g=p.getLayer())===null||g===void 0||g.batchDraw()}),this.rotation(G._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e,n=this._getNodeRect();this.rotation(G._getRotation(n.rotation));var r=n.width,i=n.height,a=this.enabledAnchors(),s=this.resizeEnabled(),u=this.padding(),c=this.anchorSize();this.find("._anchor").forEach(f=>{f.setAttrs({width:c,height:c,offsetX:c/2,offsetY:c/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:c/2+u,offsetY:c/2+u,visible:s&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:c/2+u,visible:s&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:c/2-u,offsetY:c/2+u,visible:s&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:c/2+u,visible:s&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:c/2-u,visible:s&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:c/2+u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:c/2-u,visible:s&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:c/2-u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*G._sign(i)-u,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}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),zs.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return se.prototype.toObject.call(this)}clone(e){var n=se.prototype.clone.call(this,e);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}function H$(t){return t instanceof Array||G.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){sh.indexOf(e)===-1&&G.warn("Unknown anchor name: "+e+". Available names are: "+sh.join(", "))}),t||[]}Ke.prototype.className="Transformer";yt(Ke);A.addGetterSetter(Ke,"enabledAnchors",sh,H$);A.addGetterSetter(Ke,"flipEnabled",!0,jr());A.addGetterSetter(Ke,"resizeEnabled",!0);A.addGetterSetter(Ke,"anchorSize",10,le());A.addGetterSetter(Ke,"rotateEnabled",!0);A.addGetterSetter(Ke,"rotationSnaps",[]);A.addGetterSetter(Ke,"rotateAnchorOffset",50,le());A.addGetterSetter(Ke,"rotationSnapTolerance",5,le());A.addGetterSetter(Ke,"borderEnabled",!0);A.addGetterSetter(Ke,"anchorStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"anchorStrokeWidth",1,le());A.addGetterSetter(Ke,"anchorFill","white");A.addGetterSetter(Ke,"anchorCornerRadius",0,le());A.addGetterSetter(Ke,"borderStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"borderStrokeWidth",1,le());A.addGetterSetter(Ke,"borderDash");A.addGetterSetter(Ke,"keepRatio",!0);A.addGetterSetter(Ke,"centeredScaling",!1);A.addGetterSetter(Ke,"ignoreStroke",!1);A.addGetterSetter(Ke,"padding",0,le());A.addGetterSetter(Ke,"node");A.addGetterSetter(Ke,"nodes");A.addGetterSetter(Ke,"boundBoxFunc");A.addGetterSetter(Ke,"anchorDragBoundFunc");A.addGetterSetter(Ke,"shouldOverdrawWholeArea",!1);A.addGetterSetter(Ke,"useSingleNodeRotation",!0);A.backCompat(Ke,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class qi extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,pe.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}qi.prototype.className="Wedge";qi.prototype._centroid=!0;qi.prototype._attrsAffectingSize=["radius"];yt(qi);A.addGetterSetter(qi,"radius",0,le());A.addGetterSetter(qi,"angle",0,le());A.addGetterSetter(qi,"clockwise",!1);A.backCompat(qi,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function Gb(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var W$=[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],V$=[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 q$(t,e){var n=t.data,r=t.width,i=t.height,a,s,u,c,f,h,p,g,y,v,w,x,_,S,C,O,I,L,D,U,X,K,te,ce,j=e+e+1,T=r-1,$=i-1,V=e+1,ie=V*(V+1)/2,H=new Gb,Y=null,Q=H,oe=null,ve=null,we=W$[e],Ue=V$[e];for(u=1;u>Ue,te!==0?(te=255/te,n[h]=(g*we>>Ue)*te,n[h+1]=(y*we>>Ue)*te,n[h+2]=(v*we>>Ue)*te):n[h]=n[h+1]=n[h+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=p+((c=a+e+1)>Ue,te>0?(te=255/te,n[c]=(g*we>>Ue)*te,n[c+1]=(y*we>>Ue)*te,n[c+2]=(v*we>>Ue)*te):n[c]=n[c+1]=n[c+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=a+((c=s+V)<$?c:$)*r<<2,g+=O+=oe.r=n[c],y+=I+=oe.g=n[c+1],v+=L+=oe.b=n[c+2],w+=D+=oe.a=n[c+3],oe=oe.next,x+=U=ve.r,_+=X=ve.g,S+=K=ve.b,C+=te=ve.a,O-=U,I-=X,L-=K,D-=te,ve=ve.next,h+=r}}const K$=function(e){var n=Math.round(this.blurRadius());n>0&&q$(e,n)};A.addGetterSetter(se,"blurRadius",0,le(),A.afterSetFilter);const Y$=function(t){var e=this.brightness()*255,n=t.data,r=n.length,i;for(i=0;i255?255:i,a=a<0?0:a>255?255:a,s=s<0?0:s>255?255:s,n[u]=i,n[u+1]=a,n[u+2]=s};A.addGetterSetter(se,"contrast",0,le(),A.afterSetFilter);const Q$=function(t){var e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),a=0,s=0,u=t.data,c=t.width,f=t.height,h=c*4,p=f;switch(r){case"top-left":a=-1,s=-1;break;case"top":a=-1,s=0;break;case"top-right":a=-1,s=1;break;case"right":a=0,s=1;break;case"bottom-right":a=1,s=1;break;case"bottom":a=1,s=0;break;case"bottom-left":a=1,s=-1;break;case"left":a=0,s=-1;break;default:G.error("Unknown emboss direction: "+r)}do{var g=(p-1)*h,y=a;p+y<1&&(y=0),p+y>f&&(y=0);var v=(p-1+y)*c*4,w=c;do{var x=g+(w-1)*4,_=s;w+_<1&&(_=0),w+_>c&&(_=0);var S=v+(w-1+_)*4,C=u[x]-u[S],O=u[x+1]-u[S+1],I=u[x+2]-u[S+2],L=C,D=L>0?L:-L,U=O>0?O:-O,X=I>0?I:-I;if(U>D&&(L=O),X>D&&(L=I),L*=e,i){var K=u[x]+L,te=u[x+1]+L,ce=u[x+2]+L;u[x]=K>255?255:K<0?0:K,u[x+1]=te>255?255:te<0?0:te,u[x+2]=ce>255?255:ce<0?0:ce}else{var j=n-L;j<0?j=0:j>255&&(j=255),u[x]=u[x+1]=u[x+2]=j}}while(--w)}while(--p)};A.addGetterSetter(se,"embossStrength",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossWhiteLevel",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossDirection","top-left",null,A.afterSetFilter);A.addGetterSetter(se,"embossBlend",!1,null,A.afterSetFilter);function Mm(t,e,n,r,i){var a=n-e,s=i-r,u;return a===0?r+s/2:s===0?r:(u=(t-e)/a,u=s*u+r,u)}const J$=function(t){var e=t.data,n=e.length,r=e[0],i=r,a,s=e[1],u=s,c,f=e[2],h=f,p,g,y=this.enhance();if(y!==0){for(g=0;gi&&(i=a),c=e[g+1],cu&&(u=c),p=e[g+2],ph&&(h=p);i===r&&(i=255,r=0),u===s&&(u=255,s=0),h===f&&(h=255,f=0);var v,w,x,_,S,C,O,I,L;for(y>0?(w=i+y*(255-i),x=r-y*(r-0),S=u+y*(255-u),C=s-y*(s-0),I=h+y*(255-h),L=f-y*(f-0)):(v=(i+r)*.5,w=i+y*(i-v),x=r+y*(r-v),_=(u+s)*.5,S=u+y*(u-_),C=s+y*(s-_),O=(h+f)*.5,I=h+y*(h-O),L=f+y*(f-O)),g=0;g_?x:_;var S=s,C=a,O,I,L=360/C*Math.PI/180,D,U;for(I=0;IC?S:C;var O=s,I=a,L,D,U=n.polarRotation||0,X,K;for(h=0;he&&(O=C,I=0,L=-1),i=0;i=0&&y=0&&v=0&&y=0&&v=255*4?255:0}return s}function fz(t,e,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),s=[],u=0;u=0&&y=0&&v=n))for(a=w;a=r||(s=(n*a+i)*4,u+=O[s+0],c+=O[s+1],f+=O[s+2],h+=O[s+3],C+=1);for(u=u/C,c=c/C,f=f/C,h=h/C,i=y;i=n))for(a=w;a=r||(s=(n*a+i)*4,O[s+0]=u,O[s+1]=c,O[s+2]=f,O[s+3]=h)}};A.addGetterSetter(se,"pixelSize",8,le(),A.afterSetFilter);const gz=function(t){var e=Math.round(this.levels()*254)+1,n=t.data,r=n.length,i=255/e,a;for(a=0;a255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,zk,A.afterSetFilter);const vz=function(t){var e=t.data,n=e.length,r=this.red(),i=this.green(),a=this.blue(),s=this.alpha(),u,c;for(u=0;u255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,zk,A.afterSetFilter);A.addGetterSetter(se,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});const yz=function(t){var e=t.data,n=e.length,r,i,a,s;for(r=0;r127&&(f=255-f),h>127&&(h=255-h),p>127&&(p=255-p),e[c]=f,e[c+1]=h,e[c+2]=p}while(--u)}while(--a)},_z=function(t){var e=this.threshold()*255,n=t.data,r=n.length,i;for(i=0;i{const{width:n,height:r}=e,i=document.createElement("div"),a=new Vl.Stage({container:i,width:n,height:r}),s=new Vl.Layer,u=new Vl.Layer;s.add(new Vl.Rect({...e,fill:"white"})),t.forEach(f=>u.add(new Vl.Line({points:f.points,stroke:"black",strokeWidth:f.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:f.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(u);const c=a.toDataURL({...e});return i.remove(),c};let yE=null,SE=null;const LH=t=>{yE=t},bz=()=>yE,MH=t=>{SE=t},DH=()=>SE,Cz=t=>{const e=window.open("");e&&t.forEach(n=>{const r=new Image;r.src=n.base64,e.document.write(n.caption),e.document.write("
"),e.document.write(r.outerHTML),e.document.write("

")})},xz=(t,e)=>Math.floor(Math.random()*(e-t+1)+t),kz=t=>{const e=bz(),{generationMode:n,generationState:r,postprocessingState:i,canvasState:a,systemState:s}=t,{codeformerFidelity:u,facetoolStrength:c,facetoolType:f,hiresFix:h,hiresStrength:p,shouldRunESRGAN:g,shouldRunFacetool:y,upscalingLevel:v,upscalingStrength:w,upscalingDenoising:x}=i,{cfgScale:_,height:S,img2imgStrength:C,infillMethod:O,initialImage:I,iterations:L,perlin:D,prompt:U,negativePrompt:X,sampler:K,seamBlur:te,seamless:ce,seamSize:j,seamSteps:T,seamStrength:$,seed:V,seedWeights:ie,shouldFitToWidthHeight:H,shouldGenerateVariations:Y,shouldRandomizeSeed:Q,steps:oe,threshold:ve,tileSize:we,variationAmount:Ue,width:At,shouldUseSymmetry:me,horizontalSymmetrySteps:qt,verticalSymmetrySteps:Bt}=r,{shouldDisplayInProgressType:bn,saveIntermediatesInterval:wr,enableImageDebugging:Ft}=s,xe={prompt:U,iterations:L,steps:oe,cfg_scale:_,threshold:ve,perlin:D,height:S,width:At,sampler_name:K,seed:V,progress_images:bn==="full-res",progress_latents:bn==="latents",save_intermediates:wr,generation_mode:n,init_mask:""};let Hr=!1,Pt=!1;if(X!==""&&(xe.prompt=`${U} [${X}]`),xe.seed=Q?xz(uF,cF):V,me&&(qt>0&&(xe.h_symmetry_time_pct=Math.max(0,Math.min(1,qt/oe))),Bt>0&&(xe.v_symmetry_time_pct=Math.max(0,Math.min(1,Bt/oe)))),n==="txt2img"&&(xe.hires_fix=h,h&&(xe.strength=p)),["txt2img","img2img"].includes(n)&&(xe.seamless=ce,g&&(Hr={level:v,denoise_str:x,strength:w}),y&&(Pt={type:f,strength:c},f==="codeformer"&&(Pt.codeformer_fidelity=u))),n==="img2img"&&I&&(xe.init_img=typeof I=="string"?I:I.url,xe.strength=C,xe.fit=H),n==="unifiedCanvas"&&e){const{layerState:{objects:gi},boundingBoxCoordinates:Xs,boundingBoxDimensions:Mn,stageScale:Fa,isMaskEnabled:Qs,shouldPreserveMaskedArea:er,boundingBoxScaleMethod:Kt,scaledBoundingBoxDimensions:Dn}=a,bt={...Xs,...Mn},$a=wz(Qs?gi.filter(Jx):[],bt);xe.init_mask=$a,xe.fit=!1,xe.strength=C,xe.invert_mask=er,xe.bounding_box=bt;const Wr=e.scale();e.scale({x:1/Fa,y:1/Fa});const Co=e.getAbsolutePosition(),Vr=e.toDataURL({x:bt.x+Co.x,y:bt.y+Co.y,width:bt.width,height:bt.height});Ft&&Cz([{base64:$a,caption:"mask sent as init_mask"},{base64:Vr,caption:"image sent as init_img"}]),e.scale(Wr),xe.init_img=Vr,xe.progress_images=!1,Kt!=="none"&&(xe.inpaint_width=Dn.width,xe.inpaint_height=Dn.height),xe.seam_size=j,xe.seam_blur=te,xe.seam_strength=$,xe.seam_steps=T,xe.tile_size=we,xe.infill_method=O,xe.force_outpaint=!1}return Y?(xe.variation_amount=Ue,ie&&(xe.with_variations=R5(ie))):xe.variation_amount=0,Ft&&(xe.enable_image_debugging=Ft),{generationParameters:xe,esrganParameters:Hr,facetoolParameters:Pt}};var Ez=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Pz=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Oz=/[^-+\dA-Z]/g;function Ut(t,e,n,r){if(arguments.length===1&&typeof t=="string"&&!/\d/.test(t)&&(e=t,t=void 0),t=t||t===0?t:new Date,t instanceof Date||(t=new Date(t)),isNaN(t))throw TypeError("Invalid date");e=String(Ub[e]||e||Ub.default);var i=e.slice(0,4);(i==="UTC:"||i==="GMT:")&&(e=e.slice(4),n=!0,i==="GMT:"&&(r=!0));var a=function(){return n?"getUTC":"get"},s=function(){return t[a()+"Date"]()},u=function(){return t[a()+"Day"]()},c=function(){return t[a()+"Month"]()},f=function(){return t[a()+"FullYear"]()},h=function(){return t[a()+"Hours"]()},p=function(){return t[a()+"Minutes"]()},g=function(){return t[a()+"Seconds"]()},y=function(){return t[a()+"Milliseconds"]()},v=function(){return n?0:t.getTimezoneOffset()},w=function(){return Tz(t)},x=function(){return Rz(t)},_={d:function(){return s()},dd:function(){return Un(s())},ddd:function(){return Pn.dayNames[u()]},DDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:Pn.dayNames[u()],short:!0})},dddd:function(){return Pn.dayNames[u()+7]},DDDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:Pn.dayNames[u()+7]})},m:function(){return c()+1},mm:function(){return Un(c()+1)},mmm:function(){return Pn.monthNames[c()]},mmmm:function(){return Pn.monthNames[c()+12]},yy:function(){return String(f()).slice(2)},yyyy:function(){return Un(f(),4)},h:function(){return h()%12||12},hh:function(){return Un(h()%12||12)},H:function(){return h()},HH:function(){return Un(h())},M:function(){return p()},MM:function(){return Un(p())},s:function(){return g()},ss:function(){return Un(g())},l:function(){return Un(y(),3)},L:function(){return Un(Math.floor(y()/10))},t:function(){return h()<12?Pn.timeNames[0]:Pn.timeNames[1]},tt:function(){return h()<12?Pn.timeNames[2]:Pn.timeNames[3]},T:function(){return h()<12?Pn.timeNames[4]:Pn.timeNames[5]},TT:function(){return h()<12?Pn.timeNames[6]:Pn.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":Az(t)},o:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60)*100+Math.abs(v())%60,4)},p:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60),2)+":"+Un(Math.floor(Math.abs(v())%60),2)},S:function(){return["th","st","nd","rd"][s()%10>3?0:(s()%100-s()%10!=10)*s()%10]},W:function(){return w()},WW:function(){return Un(w())},N:function(){return x()}};return e.replace(Ez,function(S){return S in _?_[S]():S.slice(1,S.length-1)})}var Ub={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Pn={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},Un=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(e).padStart(n,"0")},jb=function(e){var n=e.y,r=e.m,i=e.d,a=e._,s=e.dayName,u=e.short,c=u===void 0?!1:u,f=new Date,h=new Date;h.setDate(h[a+"Date"]()-1);var p=new Date;p.setDate(p[a+"Date"]()+1);var g=function(){return f[a+"Date"]()},y=function(){return f[a+"Month"]()},v=function(){return f[a+"FullYear"]()},w=function(){return h[a+"Date"]()},x=function(){return h[a+"Month"]()},_=function(){return h[a+"FullYear"]()},S=function(){return p[a+"Date"]()},C=function(){return p[a+"Month"]()},O=function(){return p[a+"FullYear"]()};return v()===n&&y()===r&&g()===i?c?"Tdy":"Today":_()===n&&x()===r&&w()===i?c?"Ysd":"Yesterday":O()===n&&C()===r&&S()===i?c?"Tmw":"Tomorrow":s},Tz=function(e){var n=new Date(e.getFullYear(),e.getMonth(),e.getDate());n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=new Date(n.getFullYear(),0,4);r.setDate(r.getDate()-(r.getDay()+6)%7+3);var i=n.getTimezoneOffset()-r.getTimezoneOffset();n.setHours(n.getHours()-i);var a=(n-r)/(864e5*7);return 1+Math.floor(a)},Rz=function(e){var n=e.getDay();return n===0&&(n=7),n},Az=function(e){return(String(e).match(Pz)||[""]).pop().replace(Oz,"").replace(/GMT\+0000/g,"UTC")};const Iz=(t,e)=>{const{dispatch:n,getState:r}=t;return{emitGenerateImage:i=>{n(ei(!0));const a=r(),{generation:s,postprocessing:u,system:c,canvas:f}=a,h={generationMode:i,generationState:s,postprocessingState:u,canvasState:f,systemState:c};n(gB());const{generationParameters:p,esrganParameters:g,facetoolParameters:y}=kz(h);e.emit("generateImage",p,g,y),p.init_mask&&(p.init_mask=p.init_mask.substr(0,64).concat("...")),p.init_img&&(p.init_img=p.init_img.substr(0,64).concat("...")),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generation requested: ${JSON.stringify({...p,...g,...y})}`}))},emitRunESRGAN:i=>{n(ei(!0));const{postprocessing:{upscalingLevel:a,upscalingDenoising:s,upscalingStrength:u}}=r(),c={upscale:[a,s,u]};e.emit("runPostprocessing",i,{type:"esrgan",...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`ESRGAN upscale requested: ${JSON.stringify({file:i.url,...c})}`}))},emitRunFacetool:i=>{n(ei(!0));const{postprocessing:{facetoolType:a,facetoolStrength:s,codeformerFidelity:u}}=r(),c={facetool_strength:s};a==="codeformer"&&(c.codeformer_fidelity=u),e.emit("runPostprocessing",i,{type:a,...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Face restoration (${a}) requested: ${JSON.stringify({file:i.url,...c})}`}))},emitDeleteImage:i=>{const{url:a,uuid:s,category:u,thumbnail:c}=i;n(tk(i)),e.emit("deleteImage",a,c,s,u)},emitRequestImages:i=>{const a=r().gallery,{earliest_mtime:s}=a.categories[i];e.emit("requestImages",i,s)},emitRequestNewImages:i=>{const a=r().gallery,{latest_mtime:s}=a.categories[i];e.emit("requestLatestImages",i,s)},emitCancelProcessing:()=>{e.emit("cancel")},emitRequestSystemConfig:()=>{e.emit("requestSystemConfig")},emitSearchForModels:i=>{e.emit("searchForModels",i)},emitAddNewModel:i=>{e.emit("addNewModel",i)},emitDeleteModel:i=>{e.emit("deleteModel",i)},emitConvertToDiffusers:i=>{n(hB()),e.emit("convertToDiffusers",i)},emitMergeDiffusersModels:i=>{n(pB()),e.emit("mergeDiffusersModels",i)},emitRequestModelChange:i=>{n(dB()),e.emit("requestModelChange",i)},emitSaveStagingAreaImageToGallery:i=>{e.emit("requestSaveStagingAreaImageToGallery",i)},emitRequestEmptyTempFolder:()=>{e.emit("requestEmptyTempFolder")}}};let Vf;const Lz=new Uint8Array(16);function Mz(){if(!Vf&&(Vf=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Vf))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Vf(Lz)}const Jt=[];for(let t=0;t<256;++t)Jt.push((t+256).toString(16).slice(1));function Dz(t,e=0){return(Jt[t[e+0]]+Jt[t[e+1]]+Jt[t[e+2]]+Jt[t[e+3]]+"-"+Jt[t[e+4]]+Jt[t[e+5]]+"-"+Jt[t[e+6]]+Jt[t[e+7]]+"-"+Jt[t[e+8]]+Jt[t[e+9]]+"-"+Jt[t[e+10]]+Jt[t[e+11]]+Jt[t[e+12]]+Jt[t[e+13]]+Jt[t[e+14]]+Jt[t[e+15]]).toLowerCase()}const Nz=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hb={randomUUID:Nz};function qf(t,e,n){if(Hb.randomUUID&&!e&&!t)return Hb.randomUUID();t=t||{};const r=t.random||(t.rng||Mz)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(let i=0;i<16;++i)e[n+i]=r[i];return e}return Dz(r)}const NH=dt("socketio/generateImage"),BH=dt("socketio/runESRGAN"),FH=dt("socketio/runFacetool"),$H=dt("socketio/deleteImage"),Wb=dt("socketio/requestImages"),Vb=dt("socketio/requestNewImages"),zH=dt("socketio/cancelProcessing"),Bz=dt("socketio/requestSystemConfig"),GH=dt("socketio/searchForModels"),UH=dt("socketio/addNewModel"),jH=dt("socketio/deleteModel"),HH=dt("socketio/convertToDiffusers"),WH=dt("socketio/mergeDiffusersModels"),VH=dt("socketio/requestModelChange"),qH=dt("socketio/saveStagingAreaImageToGallery"),KH=dt("socketio/requestEmptyTempFolder"),Fz=t=>{const{dispatch:e,getState:n}=t;return{onConnect:()=>{try{e(ub(!0)),e(ns(Ae.t("common.statusConnected"))),e(Bz());const r=n().gallery;r.categories.result.latest_mtime?e(Vb("result")):e(Wb("result")),r.categories.user.latest_mtime?e(Vb("user")):e(Wb("user"))}catch(r){console.error(r)}},onDisconnect:()=>{try{e(ub(!1)),e(ns(Ae.t("common.statusDisconnected"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Disconnected from server",level:"warning"}))}catch(r){console.error(r)}},onGenerationResult:r=>{try{const i=n(),{activeTab:a}=i.ui,{shouldLoopback:s}=i.postprocessing,{boundingBox:u,generationMode:c,...f}=r,h={uuid:qf(),...f};if(["txt2img","img2img"].includes(c)&&e(Tf({category:"result",image:{...h,category:"result"}})),c==="unifiedCanvas"&&r.boundingBox){const{boundingBox:p}=r;e(y5({image:{...h,category:"temp"},boundingBox:p})),i.canvas.shouldAutoSave&&e(Tf({image:{...h,category:"result"},category:"result"}))}if(s)switch(bk[a]){case"img2img":{e(M5(h));break}}e(Cm()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generated: ${r.url}`}))}catch(i){console.error(i)}},onIntermediateResult:r=>{try{e(b5({uuid:qf(),...r,category:"result"})),r.isBase64||e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image generated: ${r.url}`}))}catch(i){console.error(i)}},onPostprocessingResult:r=>{try{e(Tf({category:"result",image:{uuid:qf(),...r,category:"result"}})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Postprocessed: ${r.url}`}))}catch(i){console.error(i)}},onProgressUpdate:r=>{try{e(ei(!0)),e(uB(r))}catch(i){console.error(i)}},onError:r=>{const{message:i,additionalData:a}=r;try{e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Server error: ${i}`,level:"error"})),e(cb()),e(Cm())}catch(s){console.error(s)}},onGalleryImages:r=>{const{images:i,areMoreImagesAvailable:a,category:s}=r,u=i.map(c=>({uuid:qf(),...c}));e(w5({images:u,areMoreImagesAvailable:a,category:s})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Loaded ${i.length} images`}))},onProcessingCanceled:()=>{e(fB());const{intermediateImage:r}=n().gallery;r&&(r.isBase64||(e(Tf({category:"result",image:r})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image saved: ${r.url}`}))),e(Cm())),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Processing canceled",level:"warning"}))},onImageDeleted:r=>{const{url:i}=r;e(tk(r));const{generation:{initialImage:a,maskPath:s}}=n();(a===i||(a==null?void 0:a.url)===i)&&e(I5()),s===i&&e(D5("")),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image deleted: ${i}`}))},onSystemConfig:r=>{e(cB(r)),r.infill_methods.includes("patchmatch")||e(L5(r.infill_methods[0]))},onFoundModels:r=>{const{search_folder:i,found_models:a}=r;e(mB(i)),e(vB(a))},onNewModelAdded:r=>{const{new_model_name:i,model_list:a,update:s}=r;e(rs(a)),e(ei(!1)),e(ns(Ae.t("modelManager.modelAdded"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model Added: ${i}`,level:"info"})),e(zl({title:s?`${Ae.t("modelManager.modelUpdated")}: ${i}`:`${Ae.t("modelManager.modelAdded")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelDeleted:r=>{const{deleted_model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`${Ae.t("modelManager.modelAdded")}: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelEntryDeleted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelConverted:r=>{const{converted_model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelConverted"))),e(ei(!1)),e(If(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model converted: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelConverted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelsMerged:r=>{const{merged_models:i,merged_model_name:a,model_list:s}=r;e(rs(s)),e(ns(Ae.t("common.statusMergedModels"))),e(ei(!1)),e(If(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Models merged: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelsMerged")}: ${a}`,status:"success",duration:2500,isClosable:!0}))},onModelChanged:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelChanged"))),e(ei(!1)),e(If(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model changed: ${i}`,level:"info"}))},onModelChangeFailed:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(If(!0)),e(cb()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model change failed: ${i}`,level:"error"}))},onTempFolderEmptied:()=>{e(zl({title:Ae.t("toast.tempFoldersEmptied"),status:"success",duration:2500,isClosable:!0}))}}},$z=()=>{const{origin:t}=new URL(window.location.href),e=md(t,{timeout:6e4,path:`${window.location.pathname}socket.io`});let n=!1;return i=>a=>s=>{const{onConnect:u,onDisconnect:c,onError:f,onPostprocessingResult:h,onGenerationResult:p,onIntermediateResult:g,onProgressUpdate:y,onGalleryImages:v,onProcessingCanceled:w,onImageDeleted:x,onSystemConfig:_,onModelChanged:S,onFoundModels:C,onNewModelAdded:O,onModelDeleted:I,onModelConverted:L,onModelsMerged:D,onModelChangeFailed:U,onTempFolderEmptied:X}=Fz(i),{emitGenerateImage:K,emitRunESRGAN:te,emitRunFacetool:ce,emitDeleteImage:j,emitRequestImages:T,emitRequestNewImages:$,emitCancelProcessing:V,emitRequestSystemConfig:ie,emitSearchForModels:H,emitAddNewModel:Y,emitDeleteModel:Q,emitConvertToDiffusers:oe,emitMergeDiffusersModels:ve,emitRequestModelChange:we,emitSaveStagingAreaImageToGallery:Ue,emitRequestEmptyTempFolder:At}=Iz(i,e);switch(n||(e.on("connect",()=>u()),e.on("disconnect",()=>c()),e.on("error",me=>f(me)),e.on("generationResult",me=>p(me)),e.on("postprocessingResult",me=>h(me)),e.on("intermediateResult",me=>g(me)),e.on("progressUpdate",me=>y(me)),e.on("galleryImages",me=>v(me)),e.on("processingCanceled",()=>{w()}),e.on("imageDeleted",me=>{x(me)}),e.on("systemConfig",me=>{_(me)}),e.on("foundModels",me=>{C(me)}),e.on("newModelAdded",me=>{O(me)}),e.on("modelDeleted",me=>{I(me)}),e.on("modelConverted",me=>{L(me)}),e.on("modelsMerged",me=>{D(me)}),e.on("modelChanged",me=>{S(me)}),e.on("modelChangeFailed",me=>{U(me)}),e.on("tempFolderEmptied",()=>{X()}),n=!0),s.type){case"socketio/generateImage":{K(s.payload);break}case"socketio/runESRGAN":{te(s.payload);break}case"socketio/runFacetool":{ce(s.payload);break}case"socketio/deleteImage":{j(s.payload);break}case"socketio/requestImages":{T(s.payload);break}case"socketio/requestNewImages":{$(s.payload);break}case"socketio/cancelProcessing":{V();break}case"socketio/requestSystemConfig":{ie();break}case"socketio/searchForModels":{H(s.payload);break}case"socketio/addNewModel":{Y(s.payload);break}case"socketio/deleteModel":{Q(s.payload);break}case"socketio/convertToDiffusers":{oe(s.payload);break}case"socketio/mergeDiffusersModels":{ve(s.payload);break}case"socketio/requestModelChange":{we(s.payload);break}case"socketio/saveStagingAreaImageToGallery":{Ue(s.payload);break}case"socketio/requestEmptyTempFolder":{At();break}}a(s)}},zz=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"].map(t=>`canvas.${t}`),Gz=["currentIteration","currentStatus","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","socketId","totalIterations","totalSteps","openModel","cancelOptions.cancelAfter"].map(t=>`system.${t}`),Uz=["categories","currentCategory","currentImage","currentImageUuid","shouldAutoSwitchToNewImages","shouldHoldGalleryOpen","intermediateImage"].map(t=>`gallery.${t}`),_E=$x({generation:N5,postprocessing:F5,gallery:C5,system:yB,canvas:S5,ui:wB,lightbox:E5}),jz=Xx.getPersistConfig({key:"root",storage:Yx,rootReducer:_E,blacklist:[...zz,...Gz,...Uz],debounce:300}),Hz=JN(jz,_E),wE=ON({reducer:Hz,middleware:t=>t({immutableCheck:!1,serializableCheck:!1}).concat($z()),devTools:{actionsDenylist:["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine"]}}),Wz=i5(wE);function Vz(t){if(t.sheet)return t.sheet;for(var e=0;e0?en(Ys,--Ln):0,Gs--,Ot===10&&(Gs=1,rp--),Ot}function Kn(){return Ot=Ln2||Wu(Ot)>3?"":" "}function i6(t,e){for(;--e&&Kn()&&!(Ot<48||Ot>102||Ot>57&&Ot<65||Ot>70&&Ot<97););return tc(t,_d()+(e<6&&ci()==32&&Kn()==32))}function cy(t){for(;Kn();)switch(Ot){case t:return Ln;case 34:case 39:t!==34&&t!==39&&cy(Ot);break;case 40:t===41&&cy(t);break;case 92:Kn();break}return Ln}function a6(t,e){for(;Kn()&&t+Ot!==47+10;)if(t+Ot===42+42&&ci()===47)break;return"/*"+tc(e,Ln-1)+"*"+np(t===47?t:Kn())}function o6(t){for(;!Wu(ci());)Kn();return tc(t,Ln)}function s6(t){return PE(bd("",null,null,null,[""],t=EE(t),0,[0],t))}function bd(t,e,n,r,i,a,s,u,c){for(var f=0,h=0,p=s,g=0,y=0,v=0,w=1,x=1,_=1,S=0,C="",O=i,I=a,L=r,D=C;x;)switch(v=S,S=Kn()){case 40:if(v!=108&&en(D,p-1)==58){uy(D+=qe(wd(S),"&","&\f"),"&\f")!=-1&&(_=-1);break}case 34:case 39:case 91:D+=wd(S);break;case 9:case 10:case 13:case 32:D+=r6(v);break;case 92:D+=i6(_d()-1,7);continue;case 47:switch(ci()){case 42:case 47:Kf(l6(a6(Kn(),_d()),e,n),c);break;default:D+="/"}break;case 123*w:u[f++]=ti(D)*_;case 125*w:case 59:case 0:switch(S){case 0:case 125:x=0;case 59+h:y>0&&ti(D)-p&&Kf(y>32?Kb(D+";",r,n,p-1):Kb(qe(D," ","")+";",r,n,p-2),c);break;case 59:D+=";";default:if(Kf(L=qb(D,e,n,f,h,i,u,C,O=[],I=[],p),a),S===123)if(h===0)bd(D,e,L,L,O,a,p,u,I);else switch(g===99&&en(D,3)===110?100:g){case 100:case 109:case 115:bd(t,L,L,r&&Kf(qb(t,L,L,0,0,i,u,C,i,O=[],p),I),i,I,p,u,r?O:I);break;default:bd(D,L,L,L,[""],I,0,u,I)}}f=h=y=0,w=_=1,C=D="",p=s;break;case 58:p=1+ti(D),y=v;default:if(w<1){if(S==123)--w;else if(S==125&&w++==0&&n6()==125)continue}switch(D+=np(S),S*w){case 38:_=h>0?1:(D+="\f",-1);break;case 44:u[f++]=(ti(D)-1)*_,_=1;break;case 64:ci()===45&&(D+=wd(Kn())),g=ci(),h=p=ti(C=D+=o6(_d())),S++;break;case 45:v===45&&ti(D)==2&&(w=0)}}return a}function qb(t,e,n,r,i,a,s,u,c,f,h){for(var p=i-1,g=i===0?a:[""],y=$0(g),v=0,w=0,x=0;v0?g[_]+" "+S:qe(S,/&\f/g,g[_])))&&(c[x++]=C);return ip(t,e,n,i===0?B0:u,c,f,h)}function l6(t,e,n){return ip(t,e,n,bE,np(t6()),Hu(t,2,-2),0)}function Kb(t,e,n,r){return ip(t,e,n,F0,Hu(t,0,r),Hu(t,r+1,-1),r)}function Rs(t,e){for(var n="",r=$0(t),i=0;i6)switch(en(t,e+1)){case 109:if(en(t,e+4)!==45)break;case 102:return qe(t,/(.+:)(.+)-([^]+)/,"$1"+We+"$2-$3$1"+lh+(en(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~uy(t,"stretch")?TE(qe(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(en(t,e+1)!==115)break;case 6444:switch(en(t,ti(t)-3-(~uy(t,"!important")&&10))){case 107:return qe(t,":",":"+We)+t;case 101:return qe(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+We+(en(t,14)===45?"inline-":"")+"box$3$1"+We+"$2$3$1"+ln+"$2box$3")+t}break;case 5936:switch(en(t,e+11)){case 114:return We+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return We+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return We+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return We+t+ln+t+t}return t}var v6=function(e,n,r,i){if(e.length>-1&&!e.return)switch(e.type){case F0:e.return=TE(e.value,e.length);break;case CE:return Rs([ql(e,{value:qe(e.value,"@","@"+We)})],i);case B0:if(e.length)return e6(e.props,function(a){switch(Zz(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Rs([ql(e,{props:[qe(a,/:(read-\w+)/,":"+lh+"$1")]})],i);case"::placeholder":return Rs([ql(e,{props:[qe(a,/:(plac\w+)/,":"+We+"input-$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,":"+lh+"$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,ln+"input-$1")]})],i)}return""})}},y6=[v6],S6=function(e){var n=e.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(w){var x=w.getAttribute("data-emotion");x.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var i=e.stylisPlugins||y6,a={},s,u=[];s=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(w){for(var x=w.getAttribute("data-emotion").split(" "),_=1;_=4;++r,i-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(i){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var C6={animationIterationCount: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},x6=/[A-Z]|^ms/g,k6=/_EMO_([^_]+?)_([^]*?)_EMO_/g,IE=function(e){return e.charCodeAt(1)===45},Qb=function(e){return e!=null&&typeof e!="boolean"},Dm=OE(function(t){return IE(t)?t:t.replace(x6,"-$&").toLowerCase()}),Jb=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(k6,function(r,i,a){return ni={name:i,styles:a,next:ni},i})}return C6[e]!==1&&!IE(e)&&typeof n=="number"&&n!==0?n+"px":n};function Vu(t,e,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 ni={name:n.name,styles:n.styles,next:ni},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)ni={name:r.name,styles:r.styles,next:ni},r=r.next;var i=n.styles+";";return i}return E6(t,e,n)}case"function":{if(t!==void 0){var a=ni,s=n(t);return ni=a,Vu(t,e,s)}break}}if(e==null)return n;var u=e[n];return u!==void 0?u:n}function E6(t,e,n){var r="";if(Array.isArray(n))for(var i=0;i` or ``");return t}var NE=be.createContext({});NE.displayName="ColorModeContext";function BE(){const t=be.useContext(NE);if(t===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return t}function M6(){const t=BE(),e=L6();return{...t,theme:e}}var FE=(...t)=>t.filter(Boolean).join(" ");function D6(){return!1}function zr(t){const e=typeof t;return t!=null&&(e==="object"||e==="function")&&!Array.isArray(t)}var QH=t=>{const{condition:e,message:n}=t;e&&D6()&&console.warn(n)};function io(t,...e){return N6(t)?t(...e):t}var N6=t=>typeof t=="function",JH=t=>t?"":void 0,ZH=t=>t?!0:void 0;function eW(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function tW(...t){return function(n){t.forEach(r=>{r==null||r(n)})}}var uh={},B6={get exports(){return uh},set exports(t){uh=t}};(function(t,e){var n=200,r="__lodash_hash_undefined__",i=800,a=16,s=9007199254740991,u="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",h="[object Boolean]",p="[object Date]",g="[object Error]",y="[object Function]",v="[object GeneratorFunction]",w="[object Map]",x="[object Number]",_="[object Null]",S="[object Object]",C="[object Proxy]",O="[object RegExp]",I="[object Set]",L="[object String]",D="[object Undefined]",U="[object WeakMap]",X="[object ArrayBuffer]",K="[object DataView]",te="[object Float32Array]",ce="[object Float64Array]",j="[object Int8Array]",T="[object Int16Array]",$="[object Int32Array]",V="[object Uint8Array]",ie="[object Uint8ClampedArray]",H="[object Uint16Array]",Y="[object Uint32Array]",Q=/[\\^$.*+?()[\]{}|]/g,oe=/^\[object .+?Constructor\]$/,ve=/^(?:0|[1-9]\d*)$/,we={};we[te]=we[ce]=we[j]=we[T]=we[$]=we[V]=we[ie]=we[H]=we[Y]=!0,we[u]=we[c]=we[X]=we[h]=we[K]=we[p]=we[g]=we[y]=we[w]=we[x]=we[S]=we[O]=we[I]=we[L]=we[U]=!1;var Ue=typeof yn=="object"&&yn&&yn.Object===Object&&yn,At=typeof self=="object"&&self&&self.Object===Object&&self,me=Ue||At||Function("return this")(),qt=e&&!e.nodeType&&e,Bt=qt&&!0&&t&&!t.nodeType&&t,bn=Bt&&Bt.exports===qt,wr=bn&&Ue.process,Ft=function(){try{var P=Bt&&Bt.require&&Bt.require("util").types;return P||wr&&wr.binding&&wr.binding("util")}catch{}}(),xe=Ft&&Ft.isTypedArray;function Hr(P,N,W){switch(W.length){case 0:return P.call(N);case 1:return P.call(N,W[0]);case 2:return P.call(N,W[0],W[1]);case 3:return P.call(N,W[0],W[1],W[2])}return P.apply(N,W)}function Pt(P,N){for(var W=-1,fe=Array(P);++W-1}function mp(P,N){var W=this.__data__,fe=yi(W,P);return fe<0?(++this.size,W.push([P,N])):W[fe][1]=N,this}xr.prototype.clear=tl,xr.prototype.delete=pp,xr.prototype.get=nl,xr.prototype.has=gp,xr.prototype.set=mp;function Xi(P){var N=-1,W=P==null?0:P.length;for(this.clear();++N1?W[Ie-1]:void 0,Ee=Ie>2?W[2]:void 0;for(Ye=P.length>3&&typeof Ye=="function"?(Ie--,Ye):void 0,Ee&&pc(W[0],W[1],Ee)&&(Ye=Ie<3?void 0:Ye,Ie=1),N=Object(N);++fe-1&&P%1==0&&P0){if(++N>=i)return arguments[0]}else N=0;return P.apply(void 0,arguments)}}function Sc(P){if(P!=null){try{return Dn.call(P)}catch{}try{return P+""}catch{}}return""}function Mo(P,N){return P===N||P!==P&&N!==N}var ul=il(function(){return arguments}())?il:function(P){return za(P)&&bt.call(P,"callee")&&!Js.call(P,"callee")},cl=Array.isArray;function Do(P){return P!=null&&wc(P.length)&&!fl(P)}function Dp(P){return za(P)&&Do(P)}var _c=sp||Fp;function fl(P){if(!kr(P))return!1;var N=To(P);return N==y||N==v||N==f||N==C}function wc(P){return typeof P=="number"&&P>-1&&P%1==0&&P<=s}function kr(P){var N=typeof P;return P!=null&&(N=="object"||N=="function")}function za(P){return P!=null&&typeof P=="object"}function Np(P){if(!za(P)||To(P)!=S)return!1;var N=Po(P);if(N===null)return!0;var W=bt.call(N,"constructor")&&N.constructor;return typeof W=="function"&&W instanceof W&&Dn.call(W)==Co}var bc=xe?gi(xe):ac;function Bp(P){return cc(P,Cc(P))}function Cc(P){return Do(P)?Pp(P,!0):Rp(P)}var nt=Ro(function(P,N,W,fe){oc(P,N,W,fe)});function et(P){return function(){return P}}function xc(P){return P}function Fp(){return!1}t.exports=nt})(B6,uh);const ai=uh;var F6=t=>/!(important)?$/.test(t),t2=t=>typeof t=="string"?t.replace(/!(important)?$/,"").trim():t,$6=(t,e)=>n=>{const r=String(e),i=F6(r),a=t2(r),s=t?`${t}.${a}`:a;let u=zr(n.__cssMap)&&s in n.__cssMap?n.__cssMap[s].varRef:e;return u=t2(u),i?`${u} !important`:u};function G0(t){const{scale:e,transform:n,compose:r}=t;return(a,s)=>{var u;const c=$6(e,a)(s);let f=(u=n==null?void 0:n(c,s))!=null?u:c;return r&&(f=r(f,s)),f}}var Yf=(...t)=>e=>t.reduce((n,r)=>r(n),e);function Ir(t,e){return n=>{const r={property:n,scale:t};return r.transform=G0({scale:t,transform:e}),r}}var z6=({rtl:t,ltr:e})=>n=>n.direction==="rtl"?t:e;function G6(t){const{property:e,scale:n,transform:r}=t;return{scale:n,property:z6(e),transform:n?G0({scale:n,compose:r}):r}}var $E=["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 U6(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...$E].join(" ")}function j6(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...$E].join(" ")}var H6={"--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(" ")},W6={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 V6(t){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":t,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var q6={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},fy={"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"},K6=new Set(Object.values(fy)),zE=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),Y6=t=>t.trim();function X6(t,e){if(t==null||zE.has(t))return t;const r=/(^[a-z-A-Z]+)\((.*)\)/g.exec(t),i=r==null?void 0:r[1],a=r==null?void 0:r[2];if(!i||!a)return t;const s=i.includes("-gradient")?i:`${i}-gradient`,[u,...c]=a.split(",").map(Y6).filter(Boolean);if((c==null?void 0:c.length)===0)return t;const f=u in fy?fy[u]:u;c.unshift(f);const h=c.map(p=>{if(K6.has(p))return p;const g=p.indexOf(" "),[y,v]=g!==-1?[p.substr(0,g),p.substr(g+1)]:[p],w=GE(v)?v:v&&v.split(" "),x=`colors.${y}`,_=x in e.__cssMap?e.__cssMap[x].varRef:y;return w?[_,...Array.isArray(w)?w:[w]].join(" "):_});return`${s}(${h.join(", ")})`}var GE=t=>typeof t=="string"&&t.includes("(")&&t.includes(")"),Q6=(t,e)=>X6(t,e??{});function J6(t){return/^var\(--.+\)$/.test(t)}var Z6=t=>{const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}},Jr=t=>e=>`${t}(${e})`,Fe={filter(t){return t!=="auto"?t:H6},backdropFilter(t){return t!=="auto"?t:W6},ring(t){return V6(Fe.px(t))},bgClip(t){return t==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:t}},transform(t){return t==="auto"?U6():t==="auto-gpu"?j6():t},vh(t){return t==="$100vh"?"var(--chakra-vh)":t},px(t){if(t==null)return t;const{unitless:e}=Z6(t);return e||typeof t=="number"?`${t}px`:t},fraction(t){return typeof t!="number"||t>1?t:`${t*100}%`},float(t,e){const n={left:"right",right:"left"};return e.direction==="rtl"?n[t]:t},degree(t){if(J6(t)||t==null)return t;const e=typeof t=="string"&&!t.endsWith("deg");return typeof t=="number"||e?`${t}deg`:t},gradient:Q6,blur:Jr("blur"),opacity:Jr("opacity"),brightness:Jr("brightness"),contrast:Jr("contrast"),dropShadow:Jr("drop-shadow"),grayscale:Jr("grayscale"),hueRotate:Jr("hue-rotate"),invert:Jr("invert"),saturate:Jr("saturate"),sepia:Jr("sepia"),bgImage(t){return t==null||GE(t)||zE.has(t)?t:`url(${t})`},outline(t){const e=String(t)==="0"||String(t)==="none";return t!==null&&e?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:t}},flexDirection(t){var e;const{space:n,divide:r}=(e=q6[t])!=null?e:{},i={flexDirection:t};return n&&(i[n]=1),r&&(i[r]=1),i}},B={borderWidths:Ir("borderWidths"),borderStyles:Ir("borderStyles"),colors:Ir("colors"),borders:Ir("borders"),radii:Ir("radii",Fe.px),space:Ir("space",Yf(Fe.vh,Fe.px)),spaceT:Ir("space",Yf(Fe.vh,Fe.px)),degreeT(t){return{property:t,transform:Fe.degree}},prop(t,e,n){return{property:t,scale:e,...e&&{transform:G0({scale:e,transform:n})}}},propT(t,e){return{property:t,transform:e}},sizes:Ir("sizes",Yf(Fe.vh,Fe.px)),sizesT:Ir("sizes",Yf(Fe.vh,Fe.fraction)),shadows:Ir("shadows"),logical:G6,blur:Ir("blur",Fe.blur)},Cd={background:B.colors("background"),backgroundColor:B.colors("backgroundColor"),backgroundImage:B.propT("backgroundImage",Fe.bgImage),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Fe.bgClip},bgSize:B.prop("backgroundSize"),bgPosition:B.prop("backgroundPosition"),bg:B.colors("background"),bgColor:B.colors("backgroundColor"),bgPos:B.prop("backgroundPosition"),bgRepeat:B.prop("backgroundRepeat"),bgAttachment:B.prop("backgroundAttachment"),bgGradient:B.propT("backgroundImage",Fe.gradient),bgClip:{transform:Fe.bgClip}};Object.assign(Cd,{bgImage:Cd.backgroundImage,bgImg:Cd.backgroundImage});var He={border:B.borders("border"),borderWidth:B.borderWidths("borderWidth"),borderStyle:B.borderStyles("borderStyle"),borderColor:B.colors("borderColor"),borderRadius:B.radii("borderRadius"),borderTop:B.borders("borderTop"),borderBlockStart:B.borders("borderBlockStart"),borderTopLeftRadius:B.radii("borderTopLeftRadius"),borderStartStartRadius:B.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:B.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:B.radii("borderTopRightRadius"),borderStartEndRadius:B.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:B.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:B.borders("borderRight"),borderInlineEnd:B.borders("borderInlineEnd"),borderBottom:B.borders("borderBottom"),borderBlockEnd:B.borders("borderBlockEnd"),borderBottomLeftRadius:B.radii("borderBottomLeftRadius"),borderBottomRightRadius:B.radii("borderBottomRightRadius"),borderLeft:B.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:B.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:B.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:B.borders(["borderLeft","borderRight"]),borderInline:B.borders("borderInline"),borderY:B.borders(["borderTop","borderBottom"]),borderBlock:B.borders("borderBlock"),borderTopWidth:B.borderWidths("borderTopWidth"),borderBlockStartWidth:B.borderWidths("borderBlockStartWidth"),borderTopColor:B.colors("borderTopColor"),borderBlockStartColor:B.colors("borderBlockStartColor"),borderTopStyle:B.borderStyles("borderTopStyle"),borderBlockStartStyle:B.borderStyles("borderBlockStartStyle"),borderBottomWidth:B.borderWidths("borderBottomWidth"),borderBlockEndWidth:B.borderWidths("borderBlockEndWidth"),borderBottomColor:B.colors("borderBottomColor"),borderBlockEndColor:B.colors("borderBlockEndColor"),borderBottomStyle:B.borderStyles("borderBottomStyle"),borderBlockEndStyle:B.borderStyles("borderBlockEndStyle"),borderLeftWidth:B.borderWidths("borderLeftWidth"),borderInlineStartWidth:B.borderWidths("borderInlineStartWidth"),borderLeftColor:B.colors("borderLeftColor"),borderInlineStartColor:B.colors("borderInlineStartColor"),borderLeftStyle:B.borderStyles("borderLeftStyle"),borderInlineStartStyle:B.borderStyles("borderInlineStartStyle"),borderRightWidth:B.borderWidths("borderRightWidth"),borderInlineEndWidth:B.borderWidths("borderInlineEndWidth"),borderRightColor:B.colors("borderRightColor"),borderInlineEndColor:B.colors("borderInlineEndColor"),borderRightStyle:B.borderStyles("borderRightStyle"),borderInlineEndStyle:B.borderStyles("borderInlineEndStyle"),borderTopRadius:B.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:B.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:B.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:B.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(He,{rounded:He.borderRadius,roundedTop:He.borderTopRadius,roundedTopLeft:He.borderTopLeftRadius,roundedTopRight:He.borderTopRightRadius,roundedTopStart:He.borderStartStartRadius,roundedTopEnd:He.borderStartEndRadius,roundedBottom:He.borderBottomRadius,roundedBottomLeft:He.borderBottomLeftRadius,roundedBottomRight:He.borderBottomRightRadius,roundedBottomStart:He.borderEndStartRadius,roundedBottomEnd:He.borderEndEndRadius,roundedLeft:He.borderLeftRadius,roundedRight:He.borderRightRadius,roundedStart:He.borderInlineStartRadius,roundedEnd:He.borderInlineEndRadius,borderStart:He.borderInlineStart,borderEnd:He.borderInlineEnd,borderTopStartRadius:He.borderStartStartRadius,borderTopEndRadius:He.borderStartEndRadius,borderBottomStartRadius:He.borderEndStartRadius,borderBottomEndRadius:He.borderEndEndRadius,borderStartRadius:He.borderInlineStartRadius,borderEndRadius:He.borderInlineEndRadius,borderStartWidth:He.borderInlineStartWidth,borderEndWidth:He.borderInlineEndWidth,borderStartColor:He.borderInlineStartColor,borderEndColor:He.borderInlineEndColor,borderStartStyle:He.borderInlineStartStyle,borderEndStyle:He.borderInlineEndStyle});var e8={color:B.colors("color"),textColor:B.colors("color"),fill:B.colors("fill"),stroke:B.colors("stroke")},dy={boxShadow:B.shadows("boxShadow"),mixBlendMode:!0,blendMode:B.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:B.prop("backgroundBlendMode"),opacity:!0};Object.assign(dy,{shadow:dy.boxShadow});var t8={filter:{transform:Fe.filter},blur:B.blur("--chakra-blur"),brightness:B.propT("--chakra-brightness",Fe.brightness),contrast:B.propT("--chakra-contrast",Fe.contrast),hueRotate:B.degreeT("--chakra-hue-rotate"),invert:B.propT("--chakra-invert",Fe.invert),saturate:B.propT("--chakra-saturate",Fe.saturate),dropShadow:B.propT("--chakra-drop-shadow",Fe.dropShadow),backdropFilter:{transform:Fe.backdropFilter},backdropBlur:B.blur("--chakra-backdrop-blur"),backdropBrightness:B.propT("--chakra-backdrop-brightness",Fe.brightness),backdropContrast:B.propT("--chakra-backdrop-contrast",Fe.contrast),backdropHueRotate:B.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:B.propT("--chakra-backdrop-invert",Fe.invert),backdropSaturate:B.propT("--chakra-backdrop-saturate",Fe.saturate)},ch={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Fe.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:B.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:B.space("gap"),rowGap:B.space("rowGap"),columnGap:B.space("columnGap")};Object.assign(ch,{flexDir:ch.flexDirection});var UE={gridGap:B.space("gridGap"),gridColumnGap:B.space("gridColumnGap"),gridRowGap:B.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},n8={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Fe.outline},outlineOffset:!0,outlineColor:B.colors("outlineColor")},lr={width:B.sizesT("width"),inlineSize:B.sizesT("inlineSize"),height:B.sizes("height"),blockSize:B.sizes("blockSize"),boxSize:B.sizes(["width","height"]),minWidth:B.sizes("minWidth"),minInlineSize:B.sizes("minInlineSize"),minHeight:B.sizes("minHeight"),minBlockSize:B.sizes("minBlockSize"),maxWidth:B.sizes("maxWidth"),maxInlineSize:B.sizes("maxInlineSize"),maxHeight:B.sizes("maxHeight"),maxBlockSize:B.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,hideFrom:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.minWQuery)!=null?i:`@media screen and (min-width: ${t})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.maxWQuery)!=null?i:`@media screen and (max-width: ${t})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:B.propT("float",Fe.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(lr,{w:lr.width,h:lr.height,minW:lr.minWidth,maxW:lr.maxWidth,minH:lr.minHeight,maxH:lr.maxHeight,overscroll:lr.overscrollBehavior,overscrollX:lr.overscrollBehaviorX,overscrollY:lr.overscrollBehaviorY});var r8={listStyleType:!0,listStylePosition:!0,listStylePos:B.prop("listStylePosition"),listStyleImage:!0,listStyleImg:B.prop("listStyleImage")};function i8(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},o8=a8(i8),s8={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},l8={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},Nm=(t,e,n)=>{const r={},i=o8(t,e,{});for(const a in i)a in n&&n[a]!=null||(r[a]=i[a]);return r},u8={srOnly:{transform(t){return t===!0?s8:t==="focusable"?l8:{}}},layerStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`layerStyles.${t}`,n)},textStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`textStyles.${t}`,n)},apply:{processResult:!0,transform:(t,e,n)=>Nm(e,t,n)}},Su={position:!0,pos:B.prop("position"),zIndex:B.prop("zIndex","zIndices"),inset:B.spaceT("inset"),insetX:B.spaceT(["left","right"]),insetInline:B.spaceT("insetInline"),insetY:B.spaceT(["top","bottom"]),insetBlock:B.spaceT("insetBlock"),top:B.spaceT("top"),insetBlockStart:B.spaceT("insetBlockStart"),bottom:B.spaceT("bottom"),insetBlockEnd:B.spaceT("insetBlockEnd"),left:B.spaceT("left"),insetInlineStart:B.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:B.spaceT("right"),insetInlineEnd:B.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Su,{insetStart:Su.insetInlineStart,insetEnd:Su.insetInlineEnd});var c8={ring:{transform:Fe.ring},ringColor:B.colors("--chakra-ring-color"),ringOffset:B.prop("--chakra-ring-offset-width"),ringOffsetColor:B.colors("--chakra-ring-offset-color"),ringInset:B.prop("--chakra-ring-inset")},st={margin:B.spaceT("margin"),marginTop:B.spaceT("marginTop"),marginBlockStart:B.spaceT("marginBlockStart"),marginRight:B.spaceT("marginRight"),marginInlineEnd:B.spaceT("marginInlineEnd"),marginBottom:B.spaceT("marginBottom"),marginBlockEnd:B.spaceT("marginBlockEnd"),marginLeft:B.spaceT("marginLeft"),marginInlineStart:B.spaceT("marginInlineStart"),marginX:B.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:B.spaceT("marginInline"),marginY:B.spaceT(["marginTop","marginBottom"]),marginBlock:B.spaceT("marginBlock"),padding:B.space("padding"),paddingTop:B.space("paddingTop"),paddingBlockStart:B.space("paddingBlockStart"),paddingRight:B.space("paddingRight"),paddingBottom:B.space("paddingBottom"),paddingBlockEnd:B.space("paddingBlockEnd"),paddingLeft:B.space("paddingLeft"),paddingInlineStart:B.space("paddingInlineStart"),paddingInlineEnd:B.space("paddingInlineEnd"),paddingX:B.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:B.space("paddingInline"),paddingY:B.space(["paddingTop","paddingBottom"]),paddingBlock:B.space("paddingBlock")};Object.assign(st,{m:st.margin,mt:st.marginTop,mr:st.marginRight,me:st.marginInlineEnd,marginEnd:st.marginInlineEnd,mb:st.marginBottom,ml:st.marginLeft,ms:st.marginInlineStart,marginStart:st.marginInlineStart,mx:st.marginX,my:st.marginY,p:st.padding,pt:st.paddingTop,py:st.paddingY,px:st.paddingX,pb:st.paddingBottom,pl:st.paddingLeft,ps:st.paddingInlineStart,paddingStart:st.paddingInlineStart,pr:st.paddingRight,pe:st.paddingInlineEnd,paddingEnd:st.paddingInlineEnd});var f8={textDecorationColor:B.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:B.shadows("textShadow")},d8={clipPath:!0,transform:B.propT("transform",Fe.transform),transformOrigin:!0,translateX:B.spaceT("--chakra-translate-x"),translateY:B.spaceT("--chakra-translate-y"),skewX:B.degreeT("--chakra-skew-x"),skewY:B.degreeT("--chakra-skew-y"),scaleX:B.prop("--chakra-scale-x"),scaleY:B.prop("--chakra-scale-y"),scale:B.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:B.degreeT("--chakra-rotate")},h8={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:B.prop("transitionDuration","transition.duration"),transitionProperty:B.prop("transitionProperty","transition.property"),transitionTimingFunction:B.prop("transitionTimingFunction","transition.easing")},p8={fontFamily:B.prop("fontFamily","fonts"),fontSize:B.prop("fontSize","fontSizes",Fe.px),fontWeight:B.prop("fontWeight","fontWeights"),lineHeight:B.prop("lineHeight","lineHeights"),letterSpacing:B.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(t){if(t===!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"}},g8={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:B.spaceT("scrollMargin"),scrollMarginTop:B.spaceT("scrollMarginTop"),scrollMarginBottom:B.spaceT("scrollMarginBottom"),scrollMarginLeft:B.spaceT("scrollMarginLeft"),scrollMarginRight:B.spaceT("scrollMarginRight"),scrollMarginX:B.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:B.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:B.spaceT("scrollPadding"),scrollPaddingTop:B.spaceT("scrollPaddingTop"),scrollPaddingBottom:B.spaceT("scrollPaddingBottom"),scrollPaddingLeft:B.spaceT("scrollPaddingLeft"),scrollPaddingRight:B.spaceT("scrollPaddingRight"),scrollPaddingX:B.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:B.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function jE(t){return zr(t)&&t.reference?t.reference:String(t)}var ap=(t,...e)=>e.map(jE).join(` ${t} `).replace(/calc/g,""),n2=(...t)=>`calc(${ap("+",...t)})`,r2=(...t)=>`calc(${ap("-",...t)})`,hy=(...t)=>`calc(${ap("*",...t)})`,i2=(...t)=>`calc(${ap("/",...t)})`,a2=t=>{const e=jE(t);return e!=null&&!Number.isNaN(parseFloat(e))?String(e).startsWith("-")?String(e).slice(1):`-${e}`:hy(e,-1)},eo=Object.assign(t=>({add:(...e)=>eo(n2(t,...e)),subtract:(...e)=>eo(r2(t,...e)),multiply:(...e)=>eo(hy(t,...e)),divide:(...e)=>eo(i2(t,...e)),negate:()=>eo(a2(t)),toString:()=>t.toString()}),{add:n2,subtract:r2,multiply:hy,divide:i2,negate:a2});function m8(t,e="-"){return t.replace(/\s+/g,e)}function v8(t){const e=m8(t.toString());return S8(y8(e))}function y8(t){return t.includes("\\.")?t:!Number.isInteger(parseFloat(t.toString()))?t.replace(".","\\."):t}function S8(t){return t.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function _8(t,e=""){return[e,t].filter(Boolean).join("-")}function w8(t,e){return`var(${t}${e?`, ${e}`:""})`}function b8(t,e=""){return v8(`--${_8(t,e)}`)}function C8(t,e,n){const r=b8(t,n);return{variable:r,reference:w8(r,e)}}function x8(t){const e=t==null?0:t.length;return e?t[e-1]:void 0}function k8(t){const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}}function py(t){if(t==null)return t;const{unitless:e}=k8(t);return e||typeof t=="number"?`${t}px`:t}var HE=(t,e)=>parseInt(t[1],10)>parseInt(e[1],10)?1:-1,U0=t=>Object.fromEntries(Object.entries(t).sort(HE));function o2(t){const e=U0(t);return Object.assign(Object.values(e),e)}function E8(t){const e=Object.keys(U0(t));return new Set(e)}function s2(t){var e;if(!t)return t;t=(e=py(t))!=null?e:t;const n=-.02;return typeof t=="number"?`${t+n}`:t.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function au(t,e){const n=["@media screen"];return t&&n.push("and",`(min-width: ${py(t)})`),e&&n.push("and",`(max-width: ${py(e)})`),n.join(" ")}function P8(t){var e;if(!t)return null;t.base=(e=t.base)!=null?e:"0px";const n=o2(t),r=Object.entries(t).sort(HE).map(([s,u],c,f)=>{var h;let[,p]=(h=f[c+1])!=null?h:[];return p=parseFloat(p)>0?s2(p):void 0,{_minW:s2(u),breakpoint:s,minW:u,maxW:p,maxWQuery:au(null,p),minWQuery:au(u),minMaxQuery:au(u,p)}}),i=E8(t),a=Array.from(i.values());return{keys:i,normalized:n,isResponsive(s){const u=Object.keys(s);return u.length>0&&u.every(c=>i.has(c))},asObject:U0(t),asArray:o2(t),details:r,get(s){return r.find(u=>u.breakpoint===s)},media:[null,...n.map(s=>au(s)).slice(1)],toArrayValue(s){if(!zr(s))throw new Error("toArrayValue: value must be an object");const u=a.map(c=>{var f;return(f=s[c])!=null?f:null});for(;x8(u)===null;)u.pop();return u},toObjectValue(s){if(!Array.isArray(s))throw new Error("toObjectValue: value must be an array");return s.reduce((u,c,f)=>{const h=a[f];return h!=null&&c!=null&&(u[h]=c),u},{})}}}var Qt={hover:(t,e)=>`${t}:hover ${e}, ${t}[data-hover] ${e}`,focus:(t,e)=>`${t}:focus ${e}, ${t}[data-focus] ${e}`,focusVisible:(t,e)=>`${t}:focus-visible ${e}`,focusWithin:(t,e)=>`${t}:focus-within ${e}`,active:(t,e)=>`${t}:active ${e}, ${t}[data-active] ${e}`,disabled:(t,e)=>`${t}:disabled ${e}, ${t}[data-disabled] ${e}`,invalid:(t,e)=>`${t}:invalid ${e}, ${t}[data-invalid] ${e}`,checked:(t,e)=>`${t}:checked ${e}, ${t}[data-checked] ${e}`,indeterminate:(t,e)=>`${t}:indeterminate ${e}, ${t}[aria-checked=mixed] ${e}, ${t}[data-indeterminate] ${e}`,readOnly:(t,e)=>`${t}:read-only ${e}, ${t}[readonly] ${e}, ${t}[data-read-only] ${e}`,expanded:(t,e)=>`${t}:read-only ${e}, ${t}[aria-expanded=true] ${e}, ${t}[data-expanded] ${e}`,placeholderShown:(t,e)=>`${t}:placeholder-shown ${e}`},la=t=>WE(e=>t(e,"&"),"[role=group]","[data-group]",".group"),Ai=t=>WE(e=>t(e,"~ &"),"[data-peer]",".peer"),WE=(t,...e)=>e.map(t).join(", "),op={_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",_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:la(Qt.hover),_peerHover:Ai(Qt.hover),_groupFocus:la(Qt.focus),_peerFocus:Ai(Qt.focus),_groupFocusVisible:la(Qt.focusVisible),_peerFocusVisible:Ai(Qt.focusVisible),_groupActive:la(Qt.active),_peerActive:Ai(Qt.active),_groupDisabled:la(Qt.disabled),_peerDisabled:Ai(Qt.disabled),_groupInvalid:la(Qt.invalid),_peerInvalid:Ai(Qt.invalid),_groupChecked:la(Qt.checked),_peerChecked:Ai(Qt.checked),_groupFocusWithin:la(Qt.focusWithin),_peerFocusWithin:Ai(Qt.focusWithin),_peerPlaceholderShown:Ai(Qt.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]"},O8=Object.keys(op);function l2(t,e){return C8(String(t).replace(/\./g,"-"),void 0,e)}function T8(t,e){let n={};const r={};for(const[i,a]of Object.entries(t)){const{isSemantic:s,value:u}=a,{variable:c,reference:f}=l2(i,e==null?void 0:e.cssVarPrefix);if(!s){if(i.startsWith("space")){const g=i.split("."),[y,...v]=g,w=`${y}.-${v.join(".")}`,x=eo.negate(u),_=eo.negate(f);r[w]={value:x,var:c,varRef:_}}n[c]=u,r[i]={value:u,var:c,varRef:f};continue}const h=g=>{const v=[String(i).split(".")[0],g].join(".");if(!t[v])return g;const{reference:x}=l2(v,e==null?void 0:e.cssVarPrefix);return x},p=zr(u)?u:{default:u};n=ai(n,Object.entries(p).reduce((g,[y,v])=>{var w,x;const _=h(v);if(y==="default")return g[c]=_,g;const S=(x=(w=op)==null?void 0:w[y])!=null?x:y;return g[S]={[c]:_},g},{})),r[i]={value:f,var:c,varRef:f}}return{cssVars:n,cssMap:r}}function R8(t,e=[]){const n=Object.assign({},t);for(const r of e)r in n&&delete n[r];return n}function A8(t,e){const n={};for(const r of e)r in t&&(n[r]=t[r]);return n}var I8=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function L8(t){return A8(t,I8)}function M8(t){return t.semanticTokens}function D8(t){const{__cssMap:e,__cssVars:n,__breakpoints:r,...i}=t;return i}function N8({tokens:t,semanticTokens:e}){var n,r;const i=Object.entries((n=gy(t))!=null?n:{}).map(([s,u])=>[s,{isSemantic:!1,value:u}]),a=Object.entries((r=gy(e,1))!=null?r:{}).map(([s,u])=>[s,{isSemantic:!0,value:u}]);return Object.fromEntries([...i,...a])}function gy(t,e=1/0){return!zr(t)&&!Array.isArray(t)||!e?t:Object.entries(t).reduce((n,[r,i])=>(zr(i)||Array.isArray(i)?Object.entries(gy(i,e-1)).forEach(([a,s])=>{n[`${r}.${a}`]=s}):n[r]=i,n),{})}function nW(t){var e;const n=D8(t),r=L8(n),i=M8(n),a=N8({tokens:r,semanticTokens:i}),s=(e=n.config)==null?void 0:e.cssVarPrefix,{cssMap:u,cssVars:c}=T8(a,{cssVarPrefix:s});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"},...c},__cssMap:u,__breakpoints:P8(n.breakpoints)}),n}var j0=ai({},Cd,He,e8,ch,lr,t8,c8,n8,UE,u8,Su,dy,st,g8,p8,f8,d8,r8,h8),B8=Object.assign({},st,lr,ch,UE,Su),rW=Object.keys(B8),F8=[...Object.keys(j0),...O8],$8={...j0,...op},z8=t=>t in $8,G8=t=>e=>{if(!e.__breakpoints)return t;const{isResponsive:n,toArrayValue:r,media:i}=e.__breakpoints,a={};for(const s in t){let u=io(t[s],e);if(u==null)continue;if(u=zr(u)&&n(u)?r(u):u,!Array.isArray(u)){a[s]=u;continue}const c=u.slice(0,i.length).length;for(let f=0;ft.startsWith("--")&&typeof e=="string"&&!j8(e),W8=(t,e)=>{var n,r;if(e==null)return e;const i=c=>{var f,h;return(h=(f=t.__cssMap)==null?void 0:f[c])==null?void 0:h.varRef},a=c=>{var f;return(f=i(c))!=null?f:c},[s,u]=U8(e);return e=(r=(n=i(s))!=null?n:a(u))!=null?r:a(e),e};function V8(t){const{configs:e={},pseudos:n={},theme:r}=t,i=(a,s=!1)=>{var u,c,f;const h=io(a,r),p=G8(h)(r);let g={};for(let y in p){const v=p[y];let w=io(v,r);y in n&&(y=n[y]),H8(y,w)&&(w=W8(r,w));let x=e[y];if(x===!0&&(x={property:y}),zr(w)){g[y]=(u=g[y])!=null?u:{},g[y]=ai({},g[y],i(w,!0));continue}let _=(f=(c=x==null?void 0:x.transform)==null?void 0:c.call(x,w,r,h))!=null?f:w;_=x!=null&&x.processResult?i(_,!0):_;const S=io(x==null?void 0:x.property,r);if(!s&&(x!=null&&x.static)){const C=io(x.static,r);g=ai({},g,C)}if(S&&Array.isArray(S)){for(const C of S)g[C]=_;continue}if(S){S==="&"&&zr(_)?g=ai({},g,_):g[S]=_;continue}if(zr(_)){g=ai({},g,_);continue}g[y]=_}return g};return i}var q8=t=>e=>V8({theme:e,pseudos:op,configs:j0})(t);function iW(t){return t}function aW(t){return t}function oW(t){return{definePartsStyle(e){return e},defineMultiStyleConfig(e){return{parts:t,...e}}}}function K8(t,e){if(Array.isArray(t))return t;if(zr(t))return e(t);if(t!=null)return[t]}function Y8(t,e){for(let n=e+1;n{ai(f,{[C]:g?S[C]:{[_]:S[C]}})});continue}if(!y){g?ai(f,S):f[_]=S;continue}f[_]=S}}return f}}function Q8(t){return e=>{var n;const{variant:r,size:i,theme:a}=e,s=X8(a);return ai({},io((n=t.baseStyle)!=null?n:{},e),s(t,"sizes",i,e),s(t,"variants",r,e))}}function sW(t,e,n){var r,i,a;return(a=(i=(r=t.__cssMap)==null?void 0:r[`${e}.${n}`])==null?void 0:i.varRef)!=null?a:n}function VE(t){return R8(t,["styleConfig","size","variant","colorScheme"])}function J8(t,e){const n={};return Object.keys(t).forEach(r=>{e.includes(r)||(n[r]=t[r])}),n}function Z8(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},tG=eG(Z8);function qE(t,e){const n={};return Object.keys(t).forEach(r=>{const i=t[r];e(i,r,t)&&(n[r]=i)}),n}var KE=t=>qE(t,e=>e!=null);function nG(t){return typeof t=="function"}function rG(t,...e){return nG(t)?t(...e):t}function lW(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var iG=typeof Element<"u",aG=typeof Map=="function",oG=typeof Set=="function",sG=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function xd(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!xd(t[r],e[r]))return!1;return!0}var a;if(aG&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;for(a=t.entries();!(r=a.next()).done;)if(!xd(r.value[1],e.get(r.value[0])))return!1;return!0}if(oG&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(sG&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;if(iG&&t instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&t.$$typeof)&&!xd(t[i[r]],e[i[r]]))return!1;return!0}return t!==t&&e!==e}var lG=function(e,n){try{return xd(e,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};function YE(t,e={}){var n;const{styleConfig:r,...i}=e,{theme:a,colorMode:s}=M6(),u=t?tG(a,`components.${t}`):void 0,c=r||u,f=ai({theme:a,colorMode:s},(n=c==null?void 0:c.defaultProps)!=null?n:{},KE(J8(i,["children"]))),h=be.useRef({});if(c){const g=Q8(c)(f);lG(h.current,g)||(h.current=g)}return h.current}function XE(t,e={}){return YE(t,e)}function uW(t,e={}){return YE(t,e)}var uG=new Set([...F8,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),cG=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function fG(t){return cG.has(t)||!uG.has(t)}function dG(t){const e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function hG(t,...e){if(t==null)throw new TypeError("Cannot convert undefined or null to object");const n={...t};for(const r of e)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}var pG=/^((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)-.*))$/,gG=OE(function(t){return pG.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),mG=gG,vG=function(e){return e!=="theme"},u2=function(e){return typeof e=="string"&&e.charCodeAt(0)>96?mG:vG},c2=function(e,n,r){var i;if(n){var a=n.shouldForwardProp;i=e.__emotion_forwardProp&&a?function(s){return e.__emotion_forwardProp(s)&&a(s)}:a}return typeof i!="function"&&r&&(i=e.__emotion_forwardProp),i},yG=function(e){var n=e.cache,r=e.serialized,i=e.isStringTag;return RE(n,r,i),O6(function(){return AE(n,r,i)}),null},SG=function t(e,n){var r=e.__emotion_real===e,i=r&&e.__emotion_base||e,a,s;n!==void 0&&(a=n.label,s=n.target);var u=c2(e,n,r),c=u||u2(i),f=!c("as");return function(){var h=arguments,p=r&&e.__emotion_styles!==void 0?e.__emotion_styles.slice(0):[];if(a!==void 0&&p.push("label:"+a+";"),h[0]==null||h[0].raw===void 0)p.push.apply(p,h);else{p.push(h[0][0]);for(var g=h.length,y=1;ye=>{const{theme:n,css:r,__css:i,sx:a,...s}=e,u=qE(s,(p,g)=>z8(g)),c=rG(t,e),f=hG({},i,c,KE(u),a),h=q8(f)(e.theme);return r?[h,r]:h};function Bm(t,e){const{baseStyle:n,...r}=e??{};r.shouldForwardProp||(r.shouldForwardProp=fG);const i=bG({baseStyle:n}),a=wG(t,r)(i);return As.forwardRef(function(c,f){const{colorMode:h,forced:p}=BE();return As.createElement(a,{ref:f,"data-theme":p?h:void 0,...c})})}function CG(){const t=new Map;return new Proxy(Bm,{apply(e,n,r){return Bm(...r)},get(e,n){return t.has(n)||t.set(n,Bm(n)),t.get(n)}})}var dh=CG();function H0(t){return be.forwardRef(t)}var xG=I6({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),QE=H0((t,e)=>{const n=XE("Spinner",t),{label:r="Loading...",thickness:i="2px",speed:a="0.45s",emptyColor:s="transparent",className:u,...c}=VE(t),f=FE("chakra-spinner",u),h={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:s,borderLeftColor:s,animation:`${xG} ${a} linear infinite`,...n};return jt.jsx(dh.div,{ref:e,__css:h,className:f,...c,children:r&&jt.jsx(dh.span,{srOnly:!0,children:r})})});QE.displayName="Spinner";var JE=H0(function(e,n){const r=XE("Text",e),{className:i,align:a,decoration:s,casing:u,...c}=VE(e),f=dG({textAlign:e.align,textDecoration:e.decoration,textTransform:e.casing});return jt.jsx(dh.p,{ref:n,className:FE("chakra-text",e.className),...f,...c,__css:r})});JE.displayName="Text";var ZE=H0(function(e,n){const{direction:r,align:i,justify:a,wrap:s,basis:u,grow:c,shrink:f,...h}=e,p={display:"flex",flexDirection:r,alignItems:i,justifyContent:a,flexWrap:s,flexBasis:u,flexGrow:c,flexShrink:f};return jt.jsx(dh.div,{ref:n,__css:p,...h})});ZE.displayName="Flex";const d2=t=>{const{t:e}=sB(),{showText:n=!1,text:r=e("common.loadingInvokeAI")}=t;return jt.jsxs(ZE,{width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#121212",flexDirection:"column",rowGap:4,children:[jt.jsx(QE,{color:"grey",w:"5rem",h:"5rem"}),n&&jt.jsx(JE,{color:"grey",fontWeight:"semibold",fontFamily:"'Inter', sans-serif",children:r})]})},kG=be.lazy(()=>Cx(()=>import("./App-2afdb3c5.js"),["./App-2afdb3c5.js","./scrollbar-7e342734.js","./App-06f6cac1.css"],import.meta.url)),EG=be.lazy(()=>Cx(()=>import("./ThemeLocaleProvider-20e303dd.js"),["./ThemeLocaleProvider-20e303dd.js","./scrollbar-7e342734.js"],import.meta.url));function PG(){return jt.jsx(As.StrictMode,{children:jt.jsx(K3,{store:wE,children:jt.jsx(Ix,{loading:jt.jsx(d2,{}),persistor:Wz,children:jt.jsx(As.Suspense,{fallback:jt.jsx(d2,{showText:!0}),children:jt.jsx(EG,{children:jt.jsx(kG,{})})})})})})}Fm.createRoot(document.getElementById("root")).render(jt.jsx(PG,{}));export{hj as $,qf as A,Tf as B,gU as C,M5 as D,sB as E,ZE as F,RH as G,Wj as H,Hj as I,jj as J,Jj as K,Zj as L,Qj as M,Pw as N,$H as O,rH as P,hd as Q,As as R,QE as S,JE as T,TH as U,P5 as V,wj as W,bj as X,lj as Y,pH as Z,Xd as _,FE as a,vH as a$,Tj as a0,BH as a1,FH as a2,_H as a3,pU as a4,_u as a5,OG as a6,rU as a7,dj as a8,XU as a9,zH as aA,hH as aB,dH as aC,T5 as aD,uj as aE,NH as aF,SH as aG,I5 as aH,Xj as aI,zj as aJ,Gj as aK,$j as aL,Lj as aM,xz as aN,cF as aO,uF as aP,Yj as aQ,Ij as aR,Bj as aS,OH as aT,yj as aU,EH as aV,kH as aW,PH as aX,iH as aY,Kj as aZ,mH as a_,ej as aa,rj as ab,oj as ac,tj as ad,aj as ae,nj as af,ij as ag,sj as ah,ZU as ai,Wb as aj,JU as ak,QU as al,Dj as am,_j as an,Cj as ao,Mj as ap,gj as aq,Ow as ar,Rj as as,kj as at,Vj as au,Fj as av,mj as aw,D5 as ax,vj as ay,Aj as az,eW as b,eU as b$,yH as b0,qj as b1,$m as b2,p2 as b3,pe as b4,Lb as b5,bU as b6,UU as b7,GU as b8,tU as b9,$U as bA,qH as bB,KG as bC,aU as bD,oU as bE,Of as bF,va as bG,CU as bH,wU as bI,yU as bJ,LG as bK,MG as bL,LH as bM,MH as bN,fU as bO,iU as bP,ZG as bQ,qU as bR,cH as bS,If as bT,ei as bU,zl as bV,Ae as bW,EU as bX,ns as bY,DG as bZ,xU as b_,IU as ba,HU as bb,DH as bc,WG as bd,vU as be,Vl as bf,dU as bg,VG as bh,bz as bi,mU as bj,UG as bk,hU as bl,jG as bm,XG as bn,RG as bo,AG as bp,IG as bq,jU as br,Jx as bs,BG as bt,FG as bu,$G as bv,zU as bw,JG as bx,QG as by,qG as bz,dh as c,nU as c0,GG as c1,zG as c2,KH as c3,HG as c4,FU as c5,PU as c6,OU as c7,DU as c8,cU as c9,jH as cA,WH as cB,AH as cC,eH as cD,aH as cE,wH as cF,CH as cG,lH as cH,Wz as cI,sH as cJ,gH as cK,uH as cL,XH as cM,NE as cN,iW as cO,oW as cP,C8 as cQ,aW as cR,ai as cS,nW as cT,YH as cU,BE as cV,tG as cW,q8 as cX,Yd as cY,O3 as cZ,TG as c_,uU as ca,kU as cb,YU as cc,AU as cd,TU as ce,BU as cf,NG as cg,L5 as ch,Nj as ci,KU as cj,lU as ck,xj as cl,Ej as cm,Pj as cn,Oj as co,tH as cp,oH as cq,HH as cr,UH as cs,GH as ct,bH as cu,mB as cv,vB as cw,xH as cx,VH as cy,fH as cz,uW as d,XE as e,H0 as f,JH as g,ZH as h,tW as i,jt as j,I6 as k,jv as l,Ur as m,rG as n,VE as o,lW as p,zr as q,be as r,L6 as s,io as t,M6 as u,rW as v,QH as w,sW as x,bk as y,_t as z}; diff --git a/invokeai/frontend/web/dist/assets/scrollbar-7e342734.js b/invokeai/frontend/web/dist/assets/scrollbar-7e342734.js deleted file mode 100644 index 0a4e9fe3d0..0000000000 --- a/invokeai/frontend/web/dist/assets/scrollbar-7e342734.js +++ /dev/null @@ -1,9 +0,0 @@ -import{cY as zt,cZ as Ji,r as m,j as C,a5 as Cs,R as Ss,c as G,t as Te,f as Mt,a as Dt,e as As,S as Qi,o as Vs,d as to,c_ as eo}from"./index-61f10aa8.js";function ws(t=zt){const e=t===zt?Ji:()=>m.useContext(t);return function(){const{store:s}=e();return s}}const no=ws();function so(t=zt){const e=t===zt?no:ws(t);return function(){return e().dispatch}}const io=so();function oo(t,e){return`${t} returned \`undefined\`. Seems you forgot to wrap component within ${e}`}function Rt(t={}){const{name:e,strict:n=!0,hookName:s="useContext",providerName:i="Provider",errorMessage:r}=t,o=m.createContext(void 0);o.displayName=e;function a(){var c;const l=m.useContext(o);if(!l&&n){const u=new Error(r??oo(s,i));throw u.name="ContextError",(c=Error.captureStackTrace)==null||c.call(Error,u,a),u}return l}return[o.Provider,a,o]}var[ro,ao]=Rt({strict:!1,name:"PortalManagerContext"});function co(t){const{children:e,zIndex:n}=t;return C.jsx(ro,{value:{zIndex:n},children:e})}co.displayName="PortalManager";var Ce=Boolean(globalThis==null?void 0:globalThis.document)?m.useLayoutEffect:m.useEffect,[Ms,lo]=Rt({strict:!1,name:"PortalContext"}),ze="chakra-portal",uo=".chakra-portal",fo=t=>C.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:t.zIndex,top:0,left:0,right:0},children:t.children}),ho=t=>{const{appendToParentPortal:e,children:n}=t,[s,i]=m.useState(null),r=m.useRef(null),[,o]=m.useState({});m.useEffect(()=>o({}),[]);const a=lo(),c=ao();Ce(()=>{if(!s)return;const u=s.ownerDocument,f=e?a??u.body:u.body;if(!f)return;r.current=u.createElement("div"),r.current.className=ze,f.appendChild(r.current),o({});const h=r.current;return()=>{f.contains(h)&&f.removeChild(h)}},[s]);const l=c!=null&&c.zIndex?C.jsx(fo,{zIndex:c==null?void 0:c.zIndex,children:n}):n;return r.current?Cs.createPortal(C.jsx(Ms,{value:r.current,children:l}),r.current):C.jsx("span",{ref:u=>{u&&i(u)}})},po=t=>{const{children:e,containerRef:n,appendToParentPortal:s}=t,i=n.current,r=i??(typeof window<"u"?document.body:void 0),o=m.useMemo(()=>{const c=i==null?void 0:i.ownerDocument.createElement("div");return c&&(c.className=ze),c},[i]),[,a]=m.useState({});return Ce(()=>a({}),[]),Ce(()=>{if(!(!o||!r))return r.appendChild(o),()=>{r.removeChild(o)}},[o,r]),r&&o?Cs.createPortal(C.jsx(Ms,{value:s?o:null,children:e}),o):null};function Jt(t){const e={appendToParentPortal:!0,...t},{containerRef:n,...s}=e;return n?C.jsx(po,{containerRef:n,...s}):C.jsx(ho,{...s})}Jt.className=ze;Jt.selector=uo;Jt.displayName="Portal";var mo=(t,e)=>t.find(n=>n.id===e);function yn(t,e){const n=Ds(t,e),s=n?t[n].findIndex(i=>i.id===e):-1;return{position:n,index:s}}function Ds(t,e){for(const[n,s]of Object.entries(t))if(mo(s,e))return n}function go(t){const e=t.includes("right"),n=t.includes("left");let s="center";return e&&(s="flex-end"),n&&(s="flex-start"),{display:"flex",flexDirection:"column",alignItems:s}}function yo(t){const n=t==="top"||t==="bottom"?"0 auto":void 0,s=t.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=t.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,r=t.includes("left")?void 0:"env(safe-area-inset-right, 0px)",o=t.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:5500,pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:s,bottom:i,right:r,left:o}}function vo(t,e=[]){const n=m.useRef(t);return m.useEffect(()=>{n.current=t}),m.useCallback((...s)=>{var i;return(i=n.current)==null?void 0:i.call(n,...s)},e)}function xo(t,e){const n=vo(t);m.useEffect(()=>{if(e==null)return;let s=null;return s=window.setTimeout(()=>{n()},e),()=>{s&&window.clearTimeout(s)}},[e,n])}function vn(t,e){const n=m.useRef(!1),s=m.useRef(!1);m.useEffect(()=>{if(n.current&&s.current)return t();s.current=!0},e),m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const Rs=m.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Qt=m.createContext({});function bo(){return m.useContext(Qt).visualElement}const Et=m.createContext(null),te=typeof document<"u",$t=te?m.useLayoutEffect:m.useEffect,Es=m.createContext({strict:!1});function Po(t,e,n,s){const i=bo(),r=m.useContext(Es),o=m.useContext(Et),a=m.useContext(Rs).reducedMotion,c=m.useRef();s=s||r.renderer,!c.current&&s&&(c.current=s(t,{visualState:e,parent:i,props:n,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:a}));const l=c.current;return m.useInsertionEffect(()=>{l&&l.update(n,o)}),$t(()=>{l&&l.render()}),m.useEffect(()=>{l&&l.updateFeatures()}),(window.HandoffAppearAnimations?$t:m.useEffect)(()=>{l&&l.animationState&&l.animationState.animateChanges()}),l}function lt(t){return typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function To(t,e,n){return m.useCallback(s=>{s&&t.mount&&t.mount(s),e&&(s?e.mount(s):e.unmount()),n&&(typeof n=="function"?n(s):lt(n)&&(n.current=s))},[e])}function Ct(t){return typeof t=="string"||Array.isArray(t)}function ee(t){return typeof t=="object"&&typeof t.start=="function"}const $e=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],We=["initial",...$e];function ne(t){return ee(t.animate)||We.some(e=>Ct(t[e]))}function Ls(t){return Boolean(ne(t)||t.variants)}function Co(t,e){if(ne(t)){const{initial:n,animate:s}=t;return{initial:n===!1||Ct(n)?n:void 0,animate:Ct(s)?s:void 0}}return t.inherit!==!1?e:{}}function So(t){const{initial:e,animate:n}=Co(t,m.useContext(Qt));return m.useMemo(()=>({initial:e,animate:n}),[xn(e),xn(n)])}function xn(t){return Array.isArray(t)?t.join(" "):t}const bn={animation:["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"],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"]},St={};for(const t in bn)St[t]={isEnabled:e=>bn[t].some(n=>!!e[n])};function Ao(t){for(const e in t)St[e]={...St[e],...t[e]}}function He(t){const e=m.useRef(null);return e.current===null&&(e.current=t()),e.current}const yt={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let Vo=1;function wo(){return He(()=>{if(yt.hasEverUpdated)return Vo++})}const Ge=m.createContext({}),ks=m.createContext({}),Mo=Symbol.for("motionComponentSymbol");function Do({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:s,Component:i}){t&&Ao(t);function r(a,c){let l;const u={...m.useContext(Rs),...a,layoutId:Ro(a)},{isStatic:f}=u,h=So(a),d=f?void 0:wo(),p=s(a,f);if(!f&&te){h.visualElement=Po(i,p,u,e);const g=m.useContext(ks),T=m.useContext(Es).strict;h.visualElement&&(l=h.visualElement.loadFeatures(u,T,t,d,g))}return m.createElement(Qt.Provider,{value:h},l&&h.visualElement?m.createElement(l,{visualElement:h.visualElement,...u}):null,n(i,a,d,To(p,h.visualElement,c),p,f,h.visualElement))}const o=m.forwardRef(r);return o[Mo]=i,o}function Ro({layoutId:t}){const e=m.useContext(Ge).id;return e&&t!==void 0?e+"-"+t:t}function Eo(t){function e(s,i={}){return Do(t(s,i))}if(typeof Proxy>"u")return e;const n=new Map;return new Proxy(e,{get:(s,i)=>(n.has(i)||n.set(i,e(i)),n.get(i))})}const Lo=["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 Ke(t){return typeof t!="string"||t.includes("-")?!1:!!(Lo.indexOf(t)>-1||/[A-Z]/.test(t))}const Wt={};function ko(t){Object.assign(Wt,t)}const se=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ot=new Set(se);function js(t,{layout:e,layoutId:n}){return ot.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Wt[t]||t==="opacity")}const k=t=>Boolean(t&&t.getVelocity),jo={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Bo=se.length;function Fo(t,{enableHardwareAcceleration:e=!0,allowTransformNone:n=!0},s,i){let r="";for(let o=0;oe=>typeof e=="string"&&e.startsWith(t),Fs=Bs("--"),Se=Bs("var(--"),Io=(t,e)=>e&&typeof t=="number"?e.transform(t):t,ht=(t,e,n)=>Math.min(Math.max(n,t),e),rt={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},vt={...rt,transform:t=>ht(0,1,t)},It={...rt,default:1},xt=t=>Math.round(t*1e5)/1e5,At=/(-)?([\d]*\.?[\d])+/g,Ae=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Oo=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Lt(t){return typeof t=="string"}const kt=t=>({test:e=>Lt(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),q=kt("deg"),z=kt("%"),P=kt("px"),No=kt("vh"),Uo=kt("vw"),Pn={...z,parse:t=>z.parse(t)/100,transform:t=>z.transform(t*100)},Tn={...rt,transform:Math.round},Is={borderWidth:P,borderTopWidth:P,borderRightWidth:P,borderBottomWidth:P,borderLeftWidth:P,borderRadius:P,radius:P,borderTopLeftRadius:P,borderTopRightRadius:P,borderBottomRightRadius:P,borderBottomLeftRadius:P,width:P,maxWidth:P,height:P,maxHeight:P,size:P,top:P,right:P,bottom:P,left:P,padding:P,paddingTop:P,paddingRight:P,paddingBottom:P,paddingLeft:P,margin:P,marginTop:P,marginRight:P,marginBottom:P,marginLeft:P,rotate:q,rotateX:q,rotateY:q,rotateZ:q,scale:It,scaleX:It,scaleY:It,scaleZ:It,skew:q,skewX:q,skewY:q,distance:P,translateX:P,translateY:P,translateZ:P,x:P,y:P,z:P,perspective:P,transformPerspective:P,opacity:vt,originX:Pn,originY:Pn,originZ:P,zIndex:Tn,fillOpacity:vt,strokeOpacity:vt,numOctaves:Tn};function Ze(t,e,n,s){const{style:i,vars:r,transform:o,transformOrigin:a}=t;let c=!1,l=!1,u=!0;for(const f in e){const h=e[f];if(Fs(f)){r[f]=h;continue}const d=Is[f],p=Io(h,d);if(ot.has(f)){if(c=!0,o[f]=p,!u)continue;h!==(d.default||0)&&(u=!1)}else f.startsWith("origin")?(l=!0,a[f]=p):i[f]=p}if(e.transform||(c||s?i.transform=Fo(t.transform,n,u,s):i.transform&&(i.transform="none")),l){const{originX:f="50%",originY:h="50%",originZ:d=0}=a;i.transformOrigin=`${f} ${h} ${d}`}}const qe=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Os(t,e,n){for(const s in e)!k(e[s])&&!js(s,n)&&(t[s]=e[s])}function _o({transformTemplate:t},e,n){return m.useMemo(()=>{const s=qe();return Ze(s,e,{enableHardwareAcceleration:!n},t),Object.assign({},s.vars,s.style)},[e])}function zo(t,e,n){const s=t.style||{},i={};return Os(i,s,t),Object.assign(i,_o(t,e,n)),t.transformValues?t.transformValues(i):i}function $o(t,e,n){const s={},i=zo(t,e,n);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=i,s}const Wo=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 Ht(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||Wo.has(t)}let Ns=t=>!Ht(t);function Ho(t){t&&(Ns=e=>e.startsWith("on")?!Ht(e):t(e))}try{Ho(require("@emotion/is-prop-valid").default)}catch{}function Go(t,e,n){const s={};for(const i in t)i==="values"&&typeof t.values=="object"||(Ns(i)||n===!0&&Ht(i)||!e&&!Ht(i)||t.draggable&&i.startsWith("onDrag"))&&(s[i]=t[i]);return s}function Cn(t,e,n){return typeof t=="string"?t:P.transform(e+n*t)}function Ko(t,e,n){const s=Cn(e,t.x,t.width),i=Cn(n,t.y,t.height);return`${s} ${i}`}const Zo={offset:"stroke-dashoffset",array:"stroke-dasharray"},qo={offset:"strokeDashoffset",array:"strokeDasharray"};function Yo(t,e,n=1,s=0,i=!0){t.pathLength=1;const r=i?Zo:qo;t[r.offset]=P.transform(-s);const o=P.transform(e),a=P.transform(n);t[r.array]=`${o} ${a}`}function Ye(t,{attrX:e,attrY:n,originX:s,originY:i,pathLength:r,pathSpacing:o=1,pathOffset:a=0,...c},l,u,f){if(Ze(t,c,l,f),u){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:d,dimensions:p}=t;h.transform&&(p&&(d.transform=h.transform),delete h.transform),p&&(s!==void 0||i!==void 0||d.transform)&&(d.transformOrigin=Ko(p,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&Yo(h,r,o,a,!1)}const Us=()=>({...qe(),attrs:{}}),Xe=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Xo(t,e,n,s){const i=m.useMemo(()=>{const r=Us();return Ye(r,e,{enableHardwareAcceleration:!1},Xe(s),t.transformTemplate),{...r.attrs,style:{...r.style}}},[e]);if(t.style){const r={};Os(r,t.style,t),i.style={...r,...i.style}}return i}function Jo(t=!1){return(n,s,i,r,{latestValues:o},a)=>{const l=(Ke(n)?Xo:$o)(s,o,a,n),f={...Go(s,typeof n=="string",t),...l,ref:r},{children:h}=s,d=m.useMemo(()=>k(h)?h.get():h,[h]);return i&&(f["data-projection-id"]=i),m.createElement(n,{...f,children:d})}}const Je=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function _s(t,{style:e,vars:n},s,i){Object.assign(t.style,e,i&&i.getProjectionStyles(s));for(const r in n)t.style.setProperty(r,n[r])}const zs=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 $s(t,e,n,s){_s(t,e,void 0,s);for(const i in e.attrs)t.setAttribute(zs.has(i)?i:Je(i),e.attrs[i])}function Qe(t,e){const{style:n}=t,s={};for(const i in n)(k(n[i])||e.style&&k(e.style[i])||js(i,t))&&(s[i]=n[i]);return s}function Ws(t,e){const n=Qe(t,e);for(const s in t)if(k(t[s])||k(e[s])){const i=s==="x"||s==="y"?"attr"+s.toUpperCase():s;n[i]=t[s]}return n}function tn(t,e,n,s={},i={}){return typeof e=="function"&&(e=e(n!==void 0?n:t.custom,s,i)),typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"&&(e=e(n!==void 0?n:t.custom,s,i)),e}const Gt=t=>Array.isArray(t),Qo=t=>Boolean(t&&typeof t=="object"&&t.mix&&t.toValue),tr=t=>Gt(t)?t[t.length-1]||0:t;function Ut(t){const e=k(t)?t.get():t;return Qo(e)?e.toValue():e}function er({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},s,i,r){const o={latestValues:nr(s,i,r,t),renderState:e()};return n&&(o.mount=a=>n(s,a,o)),o}const Hs=t=>(e,n)=>{const s=m.useContext(Qt),i=m.useContext(Et),r=()=>er(t,e,s,i);return n?r():He(r)};function nr(t,e,n,s){const i={},r=s(t,{});for(const h in r)i[h]=Ut(r[h]);let{initial:o,animate:a}=t;const c=ne(t),l=Ls(t);e&&l&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const f=u?a:o;return f&&typeof f!="boolean"&&!ee(f)&&(Array.isArray(f)?f:[f]).forEach(d=>{const p=tn(t,d);if(!p)return;const{transitionEnd:g,transition:T,...b}=p;for(const x in b){let y=b[x];if(Array.isArray(y)){const v=u?y.length-1:0;y=y[v]}y!==null&&(i[x]=y)}for(const x in g)i[x]=g[x]}),i}const sr={useVisualState:Hs({scrapeMotionValuesFromProps:Ws,createRenderState:Us,onMount:(t,e,{renderState:n,latestValues:s})=>{try{n.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}Ye(n,s,{enableHardwareAcceleration:!1},Xe(e.tagName),t.transformTemplate),$s(e,n)}})},ir={useVisualState:Hs({scrapeMotionValuesFromProps:Qe,createRenderState:qe})};function or(t,{forwardMotionProps:e=!1},n,s){return{...Ke(t)?sr:ir,preloadedFeatures:n,useRender:Jo(e),createVisualElement:s,Component:t}}function $(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}const Gs=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function ie(t,e="page"){return{point:{x:t[e+"X"],y:t[e+"Y"]}}}const rr=t=>e=>Gs(e)&&t(e,ie(e));function W(t,e,n,s){return $(t,e,rr(n),s)}const ar=(t,e)=>n=>e(t(n)),X=(...t)=>t.reduce(ar);function Ks(t){let e=null;return()=>{const n=()=>{e=null};return e===null?(e=t,n):!1}}const Sn=Ks("dragHorizontal"),An=Ks("dragVertical");function Zs(t){let e=!1;if(t==="y")e=An();else if(t==="x")e=Sn();else{const n=Sn(),s=An();n&&s?e=()=>{n(),s()}:(n&&n(),s&&s())}return e}function qs(){const t=Zs(!0);return t?(t(),!1):!0}class tt{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Vn(t,e){const n="pointer"+(e?"enter":"leave"),s="onHover"+(e?"Start":"End"),i=(r,o)=>{if(r.type==="touch"||qs())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e),a[s]&&a[s](r,o)};return W(t.current,n,i,{passive:!t.getProps()[s]})}class cr extends tt{mount(){this.unmount=X(Vn(this.node,!0),Vn(this.node,!1))}unmount(){}}class lr extends tt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!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=X($(this.node.current,"focus",()=>this.onFocus()),$(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Ys=(t,e)=>e?t===e?!0:Ys(t,e.parentElement):!1,I=t=>t;function le(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,ie(n))}class ur extends tt{constructor(){super(...arguments),this.removeStartListeners=I,this.removeEndListeners=I,this.removeAccessibleListeners=I,this.startPointerPress=(e,n)=>{if(this.removeEndListeners(),this.isPressing)return;const s=this.node.getProps(),r=W(window,"pointerup",(a,c)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:u}=this.node.getProps();Ys(this.node.current,a.target)?l&&l(a,c):u&&u(a,c)},{passive:!(s.onTap||s.onPointerUp)}),o=W(window,"pointercancel",(a,c)=>this.cancelPress(a,c),{passive:!(s.onTapCancel||s.onPointerCancel)});this.removeEndListeners=X(r,o),this.startPress(e,n)},this.startAccessiblePress=()=>{const e=r=>{if(r.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||le("up",this.node.getProps().onTap)};this.removeEndListeners(),this.removeEndListeners=$(this.node.current,"keyup",o),le("down",(a,c)=>{this.startPress(a,c)})},n=$(this.node.current,"keydown",e),s=()=>{this.isPressing&&le("cancel",(r,o)=>this.cancelPress(r,o))},i=$(this.node.current,"blur",s);this.removeAccessibleListeners=X(n,i)}}startPress(e,n){this.isPressing=!0;const{onTapStart:s,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),s&&s(e,n)}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!qs()}cancelPress(e,n){if(!this.checkPressEnd())return;const{onTapCancel:s}=this.node.getProps();s&&s(e,n)}mount(){const e=this.node.getProps(),n=W(this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),s=$(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=X(n,s)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const Ve=new WeakMap,ue=new WeakMap,fr=t=>{const e=Ve.get(t.target);e&&e(t)},hr=t=>{t.forEach(fr)};function dr({root:t,...e}){const n=t||document;ue.has(n)||ue.set(n,{});const s=ue.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(hr,{root:t,...e})),s[i]}function pr(t,e,n){const s=dr(e);return Ve.set(t,n),s.observe(t),()=>{Ve.delete(t),s.unobserve(t)}}const mr={some:0,all:1};class gr extends tt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}viewportFallback(){requestAnimationFrame(()=>{this.hasEnteredView=!0;const{onViewportEnter:e}=this.node.getProps();e&&e(null),this.node.animationState&&this.node.animationState.setActive("whileInView",!0)})}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r,fallback:o=!0}=e;if(typeof IntersectionObserver>"u"){o&&this.viewportFallback();return}const a={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:mr[i]},c=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,r&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:f,onViewportLeave:h}=this.node.getProps(),d=u?f:h;d&&d(l)};return pr(this.node.current,a,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(yr(e,n))&&this.startObserver()}unmount(){}}function yr({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const vr={inView:{Feature:gr},tap:{Feature:ur},focus:{Feature:lr},hover:{Feature:cr}};function Xs(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s/^\-?\d*\.?\d+$/.test(t),br=t=>/^0[^.\s]+$/.test(t),H={delta:0,timestamp:0},Js=1/60*1e3,Pr=typeof performance<"u"?()=>performance.now():()=>Date.now(),Qs=typeof window<"u"?t=>window.requestAnimationFrame(t):t=>setTimeout(()=>t(Pr()),Js);function Tr(t){let e=[],n=[],s=0,i=!1,r=!1;const o=new WeakSet,a={schedule:(c,l=!1,u=!1)=>{const f=u&&i,h=f?e:n;return l&&o.add(c),h.indexOf(c)===-1&&(h.push(c),f&&i&&(s=e.length)),c},cancel:c=>{const l=n.indexOf(c);l!==-1&&n.splice(l,1),o.delete(c)},process:c=>{if(i){r=!0;return}if(i=!0,[e,n]=[n,e],n.length=0,s=e.length,s)for(let l=0;l(t[e]=Tr(()=>Vt=!0),t),{}),R=jt.reduce((t,e)=>{const n=oe[e];return t[e]=(s,i=!1,r=!1)=>(Vt||Ar(),n.schedule(s,i,r)),t},{}),J=jt.reduce((t,e)=>(t[e]=oe[e].cancel,t),{}),fe=jt.reduce((t,e)=>(t[e]=()=>oe[e].process(H),t),{}),Sr=t=>oe[t].process(H),ti=t=>{Vt=!1,H.delta=we?Js:Math.max(Math.min(t-H.timestamp,Cr),1),H.timestamp=t,Me=!0,jt.forEach(Sr),Me=!1,Vt&&(we=!1,Qs(ti))},Ar=()=>{Vt=!0,we=!0,Me||Qs(ti)};function en(t,e){t.indexOf(e)===-1&&t.push(e)}function nn(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class sn{constructor(){this.subscriptions=[]}add(e){return en(this.subscriptions,e),()=>nn(this.subscriptions,e)}notify(e,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,s);else for(let r=0;r!isNaN(parseFloat(t));class wr{constructor(e,n={}){this.version="9.1.7",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(s,i=!0)=>{this.prev=this.current,this.current=s;const{delta:r,timestamp:o}=H;this.lastUpdated!==o&&(this.timeDelta=r,this.lastUpdated=o,R.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=()=>R.postRender(this.velocityCheck),this.velocityCheck=({timestamp:s})=>{s!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=Vr(this.current),this.owner=n.owner}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new sn);const s=this.events[e].add(n);return e==="change"?()=>{s(),R.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,s){this.set(n),this.prev=e,this.timeDelta=s}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?on(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n)||null,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(){this.animation=null}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function dt(t,e){return new wr(t,e)}const rn=(t,e)=>n=>Boolean(Lt(n)&&Oo.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),ei=(t,e,n)=>s=>{if(!Lt(s))return s;const[i,r,o,a]=s.match(At);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Mr=t=>ht(0,255,t),he={...rt,transform:t=>Math.round(Mr(t))},it={test:rn("rgb","red"),parse:ei("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+he.transform(t)+", "+he.transform(e)+", "+he.transform(n)+", "+xt(vt.transform(s))+")"};function Dr(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const De={test:rn("#"),parse:Dr,transform:it.transform},ut={test:rn("hsl","hue"),parse:ei("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+z.transform(xt(e))+", "+z.transform(xt(n))+", "+xt(vt.transform(s))+")"},E={test:t=>it.test(t)||De.test(t)||ut.test(t),parse:t=>it.test(t)?it.parse(t):ut.test(t)?ut.parse(t):De.parse(t),transform:t=>Lt(t)?t:t.hasOwnProperty("red")?it.transform(t):ut.transform(t)},ni="${c}",si="${n}";function Rr(t){var e,n;return isNaN(t)&&Lt(t)&&(((e=t.match(At))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Ae))===null||n===void 0?void 0:n.length)||0)>0}function Kt(t){typeof t=="number"&&(t=`${t}`);const e=[];let n=0,s=0;const i=t.match(Ae);i&&(n=i.length,t=t.replace(Ae,ni),e.push(...i.map(E.parse)));const r=t.match(At);return r&&(s=r.length,t=t.replace(At,si),e.push(...r.map(rt.parse))),{values:e,numColors:n,numNumbers:s,tokenised:t}}function ii(t){return Kt(t).values}function oi(t){const{values:e,numColors:n,tokenised:s}=Kt(t),i=e.length;return r=>{let o=s;for(let a=0;atypeof t=="number"?0:t;function Lr(t){const e=ii(t);return oi(t)(e.map(Er))}const Q={test:Rr,parse:ii,createTransformer:oi,getAnimatableNone:Lr},kr=new Set(["brightness","contrast","saturate","opacity"]);function jr(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[s]=n.match(At)||[];if(!s)return t;const i=n.replace(s,"");let r=kr.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const Br=/([a-z-]*)\(.*?\)/g,Re={...Q,getAnimatableNone:t=>{const e=t.match(Br);return e?e.map(jr).join(" "):t}},Fr={...Is,color:E,backgroundColor:E,outlineColor:E,fill:E,stroke:E,borderColor:E,borderTopColor:E,borderRightColor:E,borderBottomColor:E,borderLeftColor:E,filter:Re,WebkitFilter:Re},an=t=>Fr[t];function cn(t,e){let n=an(t);return n!==Re&&(n=Q),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ri=t=>e=>e.test(t),Ir={test:t=>t==="auto",parse:t=>t},ai=[rt,P,z,q,Uo,No,Ir],pt=t=>ai.find(ri(t)),Or=[...ai,E,Q],Nr=t=>Or.find(ri(t));function Ur(t){const e={};return t.values.forEach((n,s)=>e[s]=n.get()),e}function _r(t){const e={};return t.values.forEach((n,s)=>e[s]=n.getVelocity()),e}function re(t,e,n){const s=t.getProps();return tn(s,e,n!==void 0?n:s.custom,Ur(t),_r(t))}function zr(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,dt(n))}function $r(t,e){const n=re(t,e);let{transitionEnd:s={},transition:i={},...r}=n?t.makeTargetAnimatable(n,!1):{};r={...r,...s};for(const o in r){const a=tr(r[o]);zr(t,o,a)}}function Wr(t,e,n){var s,i;const r=Object.keys(e).filter(a=>!t.hasValue(a)),o=r.length;if(o)for(let a=0;at*1e3,Yr={current:!1},ln=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,un=t=>e=>1-t(1-e),fn=t=>t*t,Xr=un(fn),hn=ln(fn),A=(t,e,n)=>-n*t+n*e+t;function de(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Jr({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,e/=100,n/=100;let i=0,r=0,o=0;if(!e)i=r=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,c=2*n-a;i=de(c,a,t+1/3),r=de(c,a,t),o=de(c,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:s}}const pe=(t,e,n)=>{const s=t*t;return Math.sqrt(Math.max(0,n*(e*e-s)+s))},Qr=[De,it,ut],ta=t=>Qr.find(e=>e.test(t));function wn(t){const e=ta(t);let n=e.parse(t);return e===ut&&(n=Jr(n)),n}const ci=(t,e)=>{const n=wn(t),s=wn(e),i={...n};return r=>(i.red=pe(n.red,s.red,r),i.green=pe(n.green,s.green,r),i.blue=pe(n.blue,s.blue,r),i.alpha=A(n.alpha,s.alpha,r),it.transform(i))};function li(t,e){return typeof t=="number"?n=>A(t,e,n):E.test(t)?ci(t,e):fi(t,e)}const ui=(t,e)=>{const n=[...t],s=n.length,i=t.map((r,o)=>li(r,e[o]));return r=>{for(let o=0;o{const n={...t,...e},s={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(s[i]=li(t[i],e[i]));return i=>{for(const r in s)n[r]=s[r](i);return n}},fi=(t,e)=>{const n=Q.createTransformer(e),s=Kt(t),i=Kt(e);return s.numColors===i.numColors&&s.numNumbers>=i.numNumbers?X(ui(s.values,i.values),n):o=>`${o>0?e:t}`},wt=(t,e,n)=>{const s=e-t;return s===0?1:(n-t)/s},Mn=(t,e)=>n=>A(t,e,n);function na(t){return typeof t=="number"?Mn:typeof t=="string"?E.test(t)?ci:fi:Array.isArray(t)?ui:typeof t=="object"?ea:Mn}function sa(t,e,n){const s=[],i=n||na(t[0]),r=t.length-1;for(let o=0;ot[r-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=sa(e,s,i),a=o.length,c=l=>{let u=0;if(a>1)for(;uc(ht(t[0],t[r-1],l)):c}function ia(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=wt(0,e,s);t.push(A(n,1,i))}}function oa(t){const e=[0];return ia(e,t.length-1),e}function ra(t,e){return t.map(n=>n*e)}const di=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,aa=1e-7,ca=12;function la(t,e,n,s,i){let r,o,a=0;do o=e+(n-e)/2,r=di(o,s,i)-t,r>0?n=o:e=o;while(Math.abs(r)>aa&&++ala(r,0,1,t,n);return r=>r===0||r===1?r:di(i(r),e,s)}const mi=t=>1-Math.sin(Math.acos(t)),dn=un(mi),ua=ln(dn),gi=pi(.33,1.53,.69,.99),pn=un(gi),fa=ln(pn),ha=t=>(t*=2)<1?.5*pn(t):.5*(2-Math.pow(2,-10*(t-1))),da={linear:I,easeIn:fn,easeInOut:hn,easeOut:Xr,circIn:mi,circInOut:ua,circOut:dn,backIn:pn,backInOut:fa,backOut:gi,anticipate:ha},Dn=t=>{if(Array.isArray(t)){qt(t.length===4);const[e,n,s,i]=t;return pi(e,n,s,i)}else if(typeof t=="string")return da[t];return t},pa=t=>Array.isArray(t)&&typeof t[0]!="number";function ma(t,e){return t.map(()=>e||hn).splice(0,t.length-1)}function Ee({keyframes:t,ease:e=hn,times:n,duration:s=300}){t=[...t];const i=pa(e)?e.map(Dn):Dn(e),r={done:!1,value:t[0]},o=ra(n&&n.length===t.length?n:oa(t),s);function a(){return hi(o,t,{ease:Array.isArray(i)?i:ma(t,i)})}let c=a();return{next:l=>(r.value=c(l),r.done=l>=s,r),flipTarget:()=>{t.reverse(),c=a()}}}const me=.001,ga=.01,Rn=10,ya=.05,va=1;function xa({duration:t=800,bounce:e=.25,velocity:n=0,mass:s=1}){let i,r;qr(t<=Rn*1e3);let o=1-e;o=ht(ya,va,o),t=ht(ga,Rn,t/1e3),o<1?(i=l=>{const u=l*o,f=u*t,h=u-n,d=Le(l,o),p=Math.exp(-f);return me-h/d*p},r=l=>{const f=l*o*t,h=f*n+n,d=Math.pow(o,2)*Math.pow(l,2)*t,p=Math.exp(-f),g=Le(Math.pow(l,2),o);return(-i(l)+me>0?-1:1)*((h-d)*p)/g}):(i=l=>{const u=Math.exp(-l*t),f=(l-n)*t+1;return-me+u*f},r=l=>{const u=Math.exp(-l*t),f=(n-l)*(t*t);return u*f});const a=5/t,c=Pa(i,r,a);if(t=t*1e3,isNaN(c))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(c,2)*s;return{stiffness:l,damping:o*2*Math.sqrt(s*l),duration:t}}}const ba=12;function Pa(t,e,n){let s=n;for(let i=1;it[n]!==void 0)}function Sa(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!En(t,Ca)&&En(t,Ta)){const n=xa(t);e={...e,...n,velocity:0,mass:1},e.isResolvedFromDuration=!0}return e}const Aa=5;function yi({keyframes:t,restDelta:e,restSpeed:n,...s}){let i=t[0],r=t[t.length-1];const o={done:!1,value:i},{stiffness:a,damping:c,mass:l,velocity:u,duration:f,isResolvedFromDuration:h}=Sa(s);let d=Va,p=u?-(u/1e3):0;const g=c/(2*Math.sqrt(a*l));function T(){const b=r-i,x=Math.sqrt(a/l)/1e3,y=Math.abs(b)<5;if(n||(n=y?.01:2),e||(e=y?.005:.5),g<1){const v=Le(x,g);d=S=>{const w=Math.exp(-g*x*S);return r-w*((p+g*x*b)/v*Math.sin(v*S)+b*Math.cos(v*S))}}else if(g===1)d=v=>r-Math.exp(-x*v)*(b+(p+x*b)*v);else{const v=x*Math.sqrt(g*g-1);d=S=>{const w=Math.exp(-g*x*S),D=Math.min(v*S,300);return r-w*((p+g*x*b)*Math.sinh(D)+v*b*Math.cosh(D))/v}}}return T(),{next:b=>{const x=d(b);if(h)o.done=b>=f;else{let y=p;if(b!==0)if(g<1){const w=Math.max(0,b-Aa);y=on(x-d(w),b-w)}else y=0;const v=Math.abs(y)<=n,S=Math.abs(r-x)<=e;o.done=v&&S}return o.value=o.done?r:x,o},flipTarget:()=>{p=-p,[i,r]=[r,i],T()}}}yi.needsInterpolation=(t,e)=>typeof t=="string"||typeof e=="string";const Va=t=>0;function wa({keyframes:t=[0],velocity:e=0,power:n=.8,timeConstant:s=350,restDelta:i=.5,modifyTarget:r}){const o=t[0],a={done:!1,value:o};let c=n*e;const l=o+c,u=r===void 0?l:r(l);return u!==l&&(c=u-o),{next:f=>{const h=-c*Math.exp(-f/s);return a.done=!(h>i||h<-i),a.value=a.done?u:u+h,a},flipTarget:()=>{}}}const Ma={decay:wa,keyframes:Ee,tween:Ee,spring:yi};function vi(t,e,n=0){return t-e-n}function Da(t,e=0,n=0,s=!0){return s?vi(e+-t,e,n):e-(t-e)+n}function Ra(t,e,n,s){return s?t>=e+n:t<=-n}const Ea=t=>{const e=({delta:n})=>t(n);return{start:()=>R.update(e,!0),stop:()=>J.update(e)}};function Yt({duration:t,driver:e=Ea,elapsed:n=0,repeat:s=0,repeatType:i="loop",repeatDelay:r=0,keyframes:o,autoplay:a=!0,onPlay:c,onStop:l,onComplete:u,onRepeat:f,onUpdate:h,type:d="keyframes",...p}){const g=n;let T,b=0,x=t,y=!1,v=!0,S;const w=Ma[o.length>2?"keyframes":d]||Ee,D=o[0],N=o[o.length-1];let B={done:!1,value:D};const{needsInterpolation:O}=w;O&&O(D,N)&&(S=hi([0,100],[D,N],{clamp:!1}),o=[0,100]);const K=w({...p,duration:t,keyframes:o});function Ft(){b++,i==="reverse"?(v=b%2===0,n=Da(n,x,r,v)):(n=vi(n,x,r),i==="mirror"&&K.flipTarget()),y=!1,f&&f()}function ae(){T&&T.stop(),u&&u()}function Z(L){v||(L=-L),n+=L,y||(B=K.next(Math.max(0,n)),S&&(B.value=S(B.value)),y=v?B.done:n<=0),h&&h(B.value),y&&(b===0&&(x=x!==void 0?x:n),b{l&&l(),T&&T.stop()},set currentTime(L){n=g,Z(L)},sample:L=>{n=g;const at=t&&typeof t=="number"?Math.max(t*.5,50):50;let ce=0;for(Z(0);ce<=L;){const Xi=L-ce;Z(Math.min(Xi,at)),ce+=at}return B}}}function La(t){return!t||Array.isArray(t)||typeof t=="string"&&xi[t]}const gt=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,xi={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:gt([0,.65,.55,1]),circOut:gt([.55,0,1,.45]),backIn:gt([.31,.01,.66,-.59]),backOut:gt([.33,1.53,.69,.99])};function ka(t){if(t)return Array.isArray(t)?gt(t):xi[t]}function ja(t,e,n,{delay:s=0,duration:i,repeat:r=0,repeatType:o="loop",ease:a,times:c}={}){return t.animate({[e]:n,offset:c},{delay:s,duration:i,easing:ka(a),fill:"both",iterations:r+1,direction:o==="reverse"?"alternate":"normal"})}const Ln={waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate")},ge={},bi={};for(const t in Ln)bi[t]=()=>(ge[t]===void 0&&(ge[t]=Ln[t]()),ge[t]);function Ba(t,{repeat:e,repeatType:n="loop"}){const s=e&&n!=="loop"&&e%2===1?0:t.length-1;return t[s]}const Fa=new Set(["opacity","clipPath","filter","transform"]),Ot=10;function Ia(t,e,{onUpdate:n,onComplete:s,...i}){if(!(bi.waapi()&&Fa.has(e)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0))return!1;let{keyframes:o,duration:a=300,elapsed:c=0,ease:l}=i;if(i.type==="spring"||!La(i.ease)){if(i.repeat===1/0)return;const f=Yt({...i,elapsed:0});let h={done:!1,value:o[0]};const d=[];let p=0;for(;!h.done&&p<2e4;)h=f.sample(p),d.push(h.value),p+=Ot;o=d,a=p-Ot,l="linear"}const u=ja(t.owner.current,e,o,{...i,delay:-c,duration:a,ease:l});return u.onfinish=()=>{t.set(Ba(o,i)),R.update(()=>u.cancel()),s&&s()},{get currentTime(){return u.currentTime||0},set currentTime(f){u.currentTime=f},stop:()=>{const{currentTime:f}=u;if(f){const h=Yt({...i,autoplay:!1});t.setWithVelocity(h.sample(f-Ot).value,h.sample(f).value,Ot)}R.update(()=>u.cancel())}}}function Pi(t,e){const n=performance.now(),s=({timestamp:i})=>{const r=i-n;r>=e&&(J.read(s),t(r-e))};return R.read(s,!0),()=>J.read(s)}function Oa({keyframes:t,elapsed:e,onUpdate:n,onComplete:s}){const i=()=>{n&&n(t[t.length-1]),s&&s()};return e?{stop:Pi(i,-e)}:i()}function Na({keyframes:t,velocity:e=0,min:n,max:s,power:i=.8,timeConstant:r=750,bounceStiffness:o=500,bounceDamping:a=10,restDelta:c=1,modifyTarget:l,driver:u,onUpdate:f,onComplete:h,onStop:d}){const p=t[0];let g;function T(v){return n!==void 0&&vs}function b(v){return n===void 0?s:s===void 0||Math.abs(n-v){f&&f(S),v.onUpdate&&v.onUpdate(S)},onComplete:h,onStop:d})}function y(v){x({type:"spring",stiffness:o,damping:a,restDelta:c,...v})}if(T(p))y({velocity:e,keyframes:[p,b(p)]});else{let v=i*e+p;typeof l<"u"&&(v=l(v));const S=b(v),w=S===n?-1:1;let D,N;const B=O=>{D=N,N=O,e=on(O-D,H.delta),(w===1&&O>S||w===-1&&Og&&g.stop()}}const Ua={type:"spring",stiffness:500,damping:25,restSpeed:10},_a=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),za={type:"keyframes",duration:.8},$a={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Wa=(t,{keyframes:e})=>e.length>2?za:ot.has(t)?t.startsWith("scale")?_a(e[1]):Ua:$a,ke=(t,e)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&Q.test(e)&&!e.startsWith("url("));function Ha({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:o,repeatDelay:a,from:c,elapsed:l,...u}){return!!Object.keys(u).length}function kn(t){return t===0||typeof t=="string"&&parseFloat(t)===0&&t.indexOf(" ")===-1}function jn(t){return typeof t=="number"?0:cn("",t)}function Ti(t,e){return t[e]||t.default||t}function Ga(t,e,n,s){const i=ke(e,n);let r=s.from!==void 0?s.from:t.get();return r==="none"&&i&&typeof n=="string"?r=cn(e,n):kn(r)&&typeof n=="string"?r=jn(n):!Array.isArray(n)&&kn(n)&&typeof r=="string"&&(n=jn(r)),Array.isArray(n)?(n[0]===null&&(n[0]=r),n):[r,n]}const mn=(t,e,n,s={})=>i=>{const r=Ti(s,t)||{},o=r.delay||s.delay||0;let{elapsed:a=0}=s;a=a-_t(o);const c=Ga(e,t,n,r),l=c[0],u=c[c.length-1],f=ke(t,l),h=ke(t,u);let d={keyframes:c,velocity:e.getVelocity(),...r,elapsed:a,onUpdate:p=>{e.set(p),r.onUpdate&&r.onUpdate(p)},onComplete:()=>{i(),r.onComplete&&r.onComplete()}};if(!f||!h||Yr.current||r.type===!1)return Oa(d);if(r.type==="inertia")return Na(d);if(Ha(r)||(d={...d,...Wa(t,d)}),d.duration&&(d.duration=_t(d.duration)),d.repeatDelay&&(d.repeatDelay=_t(d.repeatDelay)),e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate){const p=Ia(e,t,d);if(p)return p}return Yt(d)};function Ka(t,e,n={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const i=e.map(r=>je(t,r,n));s=Promise.all(i)}else if(typeof e=="string")s=je(t,e,n);else{const i=typeof e=="function"?re(t,e,n.custom):e;s=Ci(t,i,n)}return s.then(()=>t.notify("AnimationComplete",e))}function je(t,e,n={}){const s=re(t,e,n.custom);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const r=s?()=>Ci(t,s,n):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:l=0,staggerChildren:u,staggerDirection:f}=i;return Za(t,e,l+c,u,f,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[c,l]=a==="beforeChildren"?[r,o]:[o,r];return c().then(l)}else return Promise.all([r(),o(n.delay)])}function Ci(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:r=t.getDefaultTransition(),transitionEnd:o,...a}=t.makeTargetAnimatable(e);const c=t.getValue("willChange");s&&(r=s);const l=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const f in a){const h=t.getValue(f),d=a[f];if(!h||d===void 0||u&&Ya(u,f))continue;const p={delay:n,elapsed:0,...r};if(window.HandoffAppearAnimations&&!h.hasAnimated){const T=t.getProps()[Zr];T&&(p.elapsed=window.HandoffAppearAnimations(T,f,h,R))}let g=h.start(mn(f,h,d,t.shouldReduceMotion&&ot.has(f)?{type:!1}:p));Zt(c)&&(c.add(f),g=g.then(()=>c.remove(f))),l.push(g)}return Promise.all(l).then(()=>{o&&$r(t,o)})}function Za(t,e,n=0,s=0,i=1,r){const o=[],a=(t.variantChildren.size-1)*s,c=i===1?(l=0)=>l*s:(l=0)=>a-l*s;return Array.from(t.variantChildren).sort(qa).forEach((l,u)=>{l.notify("AnimationStart",e),o.push(je(l,e,{...r,delay:n+c(u)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function qa(t,e){return t.sortNodePosition(e)}function Ya({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,s}const Xa=[...$e].reverse(),Ja=$e.length;function Qa(t){return e=>Promise.all(e.map(({animation:n,options:s})=>Ka(t,n,s)))}function tc(t){let e=Qa(t);const n=nc();let s=!0;const i=(c,l)=>{const u=re(t,l);if(u){const{transition:f,transitionEnd:h,...d}=u;c={...c,...d,...h}}return c};function r(c){e=c(t)}function o(c,l){const u=t.getProps(),f=t.getVariantContext(!0)||{},h=[],d=new Set;let p={},g=1/0;for(let b=0;bg&&S;const O=Array.isArray(v)?v:[v];let K=O.reduce(i,{});w===!1&&(K={});const{prevResolvedValues:Ft={}}=y,ae={...Ft,...K},Z=M=>{B=!0,d.delete(M),y.needsAnimating[M]=!0};for(const M in ae){const L=K[M],at=Ft[M];p.hasOwnProperty(M)||(L!==at?Gt(L)&&Gt(at)?!Xs(L,at)||N?Z(M):y.protectedKeys[M]=!0:L!==void 0?Z(M):d.add(M):L!==void 0&&d.has(M)?Z(M):y.protectedKeys[M]=!0)}y.prevProp=v,y.prevResolvedValues=K,y.isActive&&(p={...p,...K}),s&&t.blockInitialAnimation&&(B=!1),B&&!D&&h.push(...O.map(M=>({animation:M,options:{type:x,...c}})))}if(d.size){const b={};d.forEach(x=>{const y=t.getBaseTarget(x);y!==void 0&&(b[x]=y)}),h.push({animation:b})}let T=Boolean(h.length);return s&&u.initial===!1&&!t.manuallyAnimateOnMount&&(T=!1),s=!1,T?e(h):Promise.resolve()}function a(c,l,u){var f;if(n[c].isActive===l)return Promise.resolve();(f=t.variantChildren)===null||f===void 0||f.forEach(d=>{var p;return(p=d.animationState)===null||p===void 0?void 0:p.setActive(c,l)}),n[c].isActive=l;const h=o(u,c);for(const d in n)n[d].protectedKeys={};return h}return{animateChanges:o,setActive:a,setAnimateFunction:r,getState:()=>n}}function ec(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Xs(e,t):!1}function et(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function nc(){return{animate:et(!0),whileInView:et(),whileHover:et(),whileTap:et(),whileDrag:et(),whileFocus:et(),exit:et()}}class sc extends tt{constructor(e){super(e),e.animationState||(e.animationState=tc(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),ee(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let ic=0;class oc extends tt{constructor(){super(...arguments),this.id=ic++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n,custom:s}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const r=this.node.animationState.setActive("exit",!e,{custom:s??this.node.getProps().custom});n&&!e&&r.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const rc={animation:{Feature:sc},exit:{Feature:oc}},Bn=(t,e)=>Math.abs(t-e);function ac(t,e){const n=Bn(t.x,e.x),s=Bn(t.y,e.y);return Math.sqrt(n**2+s**2)}class Si{constructor(e,n,{transformPagePoint:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const l=ve(this.lastMoveEventInfo,this.history),u=this.startEvent!==null,f=ac(l.offset,{x:0,y:0})>=3;if(!u&&!f)return;const{point:h}=l,{timestamp:d}=H;this.history.push({...h,timestamp:d});const{onStart:p,onMove:g}=this.handlers;u||(p&&p(this.lastMoveEvent,l),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,l)},this.handlePointerMove=(l,u)=>{this.lastMoveEvent=l,this.lastMoveEventInfo=ye(u,this.transformPagePoint),R.update(this.updatePoint,!0)},this.handlePointerUp=(l,u)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:f,onSessionEnd:h}=this.handlers,d=ve(l.type==="pointercancel"?this.lastMoveEventInfo:ye(u,this.transformPagePoint),this.history);this.startEvent&&f&&f(l,d),h&&h(l,d)},!Gs(e))return;this.handlers=n,this.transformPagePoint=s;const i=ie(e),r=ye(i,this.transformPagePoint),{point:o}=r,{timestamp:a}=H;this.history=[{...o,timestamp:a}];const{onSessionStart:c}=n;c&&c(e,ve(r,this.history)),this.removeListeners=X(W(window,"pointermove",this.handlePointerMove),W(window,"pointerup",this.handlePointerUp),W(window,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),J.update(this.updatePoint)}}function ye(t,e){return e?{point:e(t.point)}:t}function Fn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function ve({point:t},e){return{point:t,delta:Fn(t,Ai(e)),offset:Fn(t,cc(e)),velocity:lc(e,.1)}}function cc(t){return t[0]}function Ai(t){return t[t.length-1]}function lc(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const i=Ai(t);for(;n>=0&&(s=t[n],!(i.timestamp-s.timestamp>_t(e)));)n--;if(!s)return{x:0,y:0};const r=(i.timestamp-s.timestamp)/1e3;if(r===0)return{x:0,y:0};const o={x:(i.x-s.x)/r,y:(i.y-s.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function j(t){return t.max-t.min}function Be(t,e=0,n=.01){return Math.abs(t-e)<=n}function In(t,e,n,s=.5){t.origin=s,t.originPoint=A(e.min,e.max,t.origin),t.scale=j(n)/j(e),(Be(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=A(n.min,n.max,t.origin)-t.originPoint,(Be(t.translate)||isNaN(t.translate))&&(t.translate=0)}function bt(t,e,n,s){In(t.x,e.x,n.x,s?s.originX:void 0),In(t.y,e.y,n.y,s?s.originY:void 0)}function On(t,e,n){t.min=n.min+e.min,t.max=t.min+j(e)}function uc(t,e,n){On(t.x,e.x,n.x),On(t.y,e.y,n.y)}function Nn(t,e,n){t.min=e.min-n.min,t.max=t.min+j(e)}function Pt(t,e,n){Nn(t.x,e.x,n.x),Nn(t.y,e.y,n.y)}function fc(t,{min:e,max:n},s){return e!==void 0&&tn&&(t=s?A(n,t,s.max):Math.min(t,n)),t}function Un(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function hc(t,{top:e,left:n,bottom:s,right:i}){return{x:Un(t.x,n,i),y:Un(t.y,e,s)}}function _n(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.mins?n=wt(e.min,e.max-s,t.min):s>i&&(n=wt(t.min,t.max-i,e.min)),ht(0,1,n)}function mc(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Fe=.35;function gc(t=Fe){return t===!1?t=0:t===!0&&(t=Fe),{x:zn(t,"left","right"),y:zn(t,"top","bottom")}}function zn(t,e,n){return{min:$n(t,e),max:$n(t,n)}}function $n(t,e){return typeof t=="number"?t:t[e]||0}const Wn=()=>({translate:0,scale:1,origin:0,originPoint:0}),Tt=()=>({x:Wn(),y:Wn()}),Hn=()=>({min:0,max:0}),V=()=>({x:Hn(),y:Hn()});function U(t){return[t("x"),t("y")]}function Vi({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function yc({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function vc(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function xe(t){return t===void 0||t===1}function Ie({scale:t,scaleX:e,scaleY:n}){return!xe(t)||!xe(e)||!xe(n)}function nt(t){return Ie(t)||wi(t)||t.z||t.rotate||t.rotateX||t.rotateY}function wi(t){return Gn(t.x)||Gn(t.y)}function Gn(t){return t&&t!=="0%"}function Xt(t,e,n){const s=t-n,i=e*s;return n+i}function Kn(t,e,n,s,i){return i!==void 0&&(t=Xt(t,i,s)),Xt(t,n,s)+e}function Oe(t,e=0,n=1,s,i){t.min=Kn(t.min,e,n,s,i),t.max=Kn(t.max,e,n,s,i)}function Mi(t,{x:e,y:n}){Oe(t.x,e.translate,e.scale,e.originPoint),Oe(t.y,n.translate,n.scale,n.originPoint)}function xc(t,e,n,s=!1){const i=n.length;if(!i)return;e.x=e.y=1;let r,o;for(let a=0;a1.0000000000001||t<.999999999999?t:1}function Y(t,e){t.min=t.min+e,t.max=t.max+e}function qn(t,e,[n,s,i]){const r=e[i]!==void 0?e[i]:.5,o=A(t.min,t.max,r);Oe(t,e[n],e[s],o,e.scale)}const bc=["x","scaleX","originX"],Pc=["y","scaleY","originY"];function ft(t,e){qn(t.x,e,bc),qn(t.y,e,Pc)}function Di(t,e){return Vi(vc(t.getBoundingClientRect(),e))}function Tc(t,e,n){const s=Di(t,n),{scroll:i}=e;return i&&(Y(s.x,i.offset.x),Y(s.y,i.offset.y)),s}const Cc=new WeakMap;class Sc{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=V(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=c=>{this.stopAnimation(),n&&this.snapToCursor(ie(c,"page").point)},r=(c,l)=>{const{drag:u,dragPropagation:f,onDragStart:h}=this.getProps();if(u&&!f&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Zs(u),!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),U(p=>{let g=this.getAxisMotionValue(p).get()||0;if(z.test(g)){const{projection:T}=this.visualElement;if(T&&T.layout){const b=T.layout.layoutBox[p];b&&(g=j(b)*(parseFloat(g)/100))}}this.originPoint[p]=g}),h&&h(c,l);const{animationState:d}=this.visualElement;d&&d.setActive("whileDrag",!0)},o=(c,l)=>{const{dragPropagation:u,dragDirectionLock:f,onDirectionLock:h,onDrag:d}=this.getProps();if(!u&&!this.openGlobalLock)return;const{offset:p}=l;if(f&&this.currentDirection===null){this.currentDirection=Ac(p),this.currentDirection!==null&&h&&h(this.currentDirection);return}this.updateAxis("x",l.point,p),this.updateAxis("y",l.point,p),this.visualElement.render(),d&&d(c,l)},a=(c,l)=>this.stop(c,l);this.panSession=new Si(e,{onSessionStart:i,onStart:r,onMove:o,onSessionEnd:a},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(e,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:r}=this.getProps();r&&r(e,n)}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,s){const{drag:i}=this.getProps();if(!s||!Nt(e,i,this.currentDirection))return;const r=this.getAxisMotionValue(e);let o=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(o=fc(o,this.constraints[e],this.elastic[e])),r.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),{layout:s}=this.visualElement.projection||{},i=this.constraints;e&<(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=hc(s.layoutBox,e):this.constraints=!1,this.elastic=gc(n),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&U(r=>{this.getAxisMotionValue(r)&&(this.constraints[r]=mc(s.layoutBox[r],this.constraints[r]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!lt(e))return!1;const s=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const r=Tc(s,i.root,this.visualElement.getTransformPagePoint());let o=dc(i.layout.layoutBox,r);if(n){const a=n(yc(o));this.hasMutatedConstraints=!!a,a&&(o=Vi(a))}return o}startAnimation(e){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=U(u=>{if(!Nt(u,n,this.currentDirection))return;let f=c&&c[u]||{};o&&(f={min:0,max:0});const h=i?200:1e6,d=i?40:1e7,p={type:"inertia",velocity:s?e[u]:0,bounceStiffness:h,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...r,...f};return this.startAxisValueAnimation(u,p)});return Promise.all(l).then(a)}startAxisValueAnimation(e,n){const s=this.getAxisMotionValue(e);return s.start(mn(e,s,0,n))}stopAnimation(){U(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n="_drag"+e.toUpperCase(),s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){U(n=>{const{drag:s}=this.getProps();if(!Nt(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,r=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[n];r.set(e[n]-A(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!lt(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};U(o=>{const a=this.getAxisMotionValue(o);if(a){const c=a.get();i[o]=pc({min:c,max:c},this.constraints[o])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),U(o=>{if(!Nt(o,e,null))return;const a=this.getAxisMotionValue(o),{min:c,max:l}=this.constraints[o];a.set(A(c,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;Cc.set(this.visualElement,this);const e=this.visualElement.current,n=W(e,"pointerdown",c=>{const{drag:l,dragListener:u=!0}=this.getProps();l&&u&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();lt(c)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,r=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),s();const o=$(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:l})=>{this.isDragging&&l&&(U(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=c[u].translate,f.set(f.get()+c[u].translate))}),this.visualElement.render())});return()=>{o(),n(),r(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:o=Fe,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:o,dragMomentum:a}}}function Nt(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Ac(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class Vc extends tt{constructor(e){super(e),this.removeGroupControls=I,this.removeListeners=I,this.controls=new Sc(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||I}unmount(){this.removeGroupControls(),this.removeListeners()}}class wc extends tt{constructor(){super(...arguments),this.removePointerDownListener=I}onPointerDown(e){this.session=new Si(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:e,onStart:n,onMove:s,onEnd:(r,o)=>{delete this.session,i&&i(r,o)}}}mount(){this.removePointerDownListener=W(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function Mc(){const t=m.useContext(Et);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:n,register:s}=t,i=m.useId();return m.useEffect(()=>s(i),[]),!e&&n?[!1,()=>n&&n(i)]:[!0]}function Dc(){return Rc(m.useContext(Et))}function Rc(t){return t===null?!0:t.isPresent}function Yn(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const mt={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(P.test(t))t=parseFloat(t);else return t;const n=Yn(t,e.target.x),s=Yn(t,e.target.y);return`${n}% ${s}%`}},Ri=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Ec(t){const e=Ri.exec(t);if(!e)return[,];const[,n,s]=e;return[n,s]}function Ne(t,e,n=1){const[s,i]=Ec(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);return r?r.trim():Se(i)?Ne(i,e,n+1):i}function Lc(t,{...e},n){const s=t.current;if(!(s instanceof Element))return{target:e,transitionEnd:n};n&&(n={...n}),t.values.forEach(i=>{const r=i.get();if(!Se(r))return;const o=Ne(r,s);o&&i.set(o)});for(const i in e){const r=e[i];if(!Se(r))continue;const o=Ne(r,s);o&&(e[i]=o,n&&n[i]===void 0&&(n[i]=r))}return{target:e,transitionEnd:n}}const Xn="_$css",kc={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,i=t.includes("var("),r=[];i&&(t=t.replace(Ri,d=>(r.push(d),Xn)));const o=Q.parse(t);if(o.length>5)return s;const a=Q.createTransformer(t),c=typeof o[0]!="number"?1:0,l=n.x.scale*e.x,u=n.y.scale*e.y;o[0+c]/=l,o[1+c]/=u;const f=A(l,u,.5);typeof o[2+c]=="number"&&(o[2+c]/=f),typeof o[3+c]=="number"&&(o[3+c]/=f);let h=a(o);if(i){let d=0;h=h.replace(Xn,()=>{const p=r[d];return d++,p})}return h}};class jc extends Ss.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=e;ko(Bc),r&&(n.group&&n.group.add(r),s&&s.register&&i&&s.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),yt.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:s,drag:i,isPresent:r}=this.props,o=s.projection;return o&&(o.isPresent=r,i||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==r&&(r?o.promote():o.relegate()||R.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),!e.currentAnimation&&e.isLead()&&this.safeToRemove())}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Ei(t){const[e,n]=Mc(),s=m.useContext(Ge);return Ss.createElement(jc,{...t,layoutGroup:s,switchLayoutGroup:m.useContext(ks),isPresent:e,safeToRemove:n})}const Bc={borderRadius:{...mt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:mt,borderTopRightRadius:mt,borderBottomLeftRadius:mt,borderBottomRightRadius:mt,boxShadow:kc};function Fc(t,e,n={}){const s=k(t)?t:dt(t);return s.start(mn("",s,e,n)),{stop:()=>s.stop(),isAnimating:()=>s.isAnimating()}}const Li=["TopLeft","TopRight","BottomLeft","BottomRight"],Ic=Li.length,Jn=t=>typeof t=="string"?parseFloat(t):t,Qn=t=>typeof t=="number"||P.test(t);function Oc(t,e,n,s,i,r){i?(t.opacity=A(0,n.opacity!==void 0?n.opacity:1,Nc(s)),t.opacityExit=A(e.opacity!==void 0?e.opacity:1,0,Uc(s))):r&&(t.opacity=A(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,s));for(let o=0;ose?1:n(wt(t,e,s))}function es(t,e){t.min=e.min,t.max=e.max}function F(t,e){es(t.x,e.x),es(t.y,e.y)}function ns(t,e,n,s,i){return t-=e,t=Xt(t,1/n,s),i!==void 0&&(t=Xt(t,1/i,s)),t}function _c(t,e=0,n=1,s=.5,i,r=t,o=t){if(z.test(e)&&(e=parseFloat(e),e=A(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=A(r.min,r.max,s);t===r&&(a-=e),t.min=ns(t.min,e,n,a,i),t.max=ns(t.max,e,n,a,i)}function ss(t,e,[n,s,i],r,o){_c(t,e[n],e[s],e[i],e.scale,r,o)}const zc=["x","scaleX","originX"],$c=["y","scaleY","originY"];function is(t,e,n,s){ss(t.x,e,zc,n?n.x:void 0,s?s.x:void 0),ss(t.y,e,$c,n?n.y:void 0,s?s.y:void 0)}function os(t){return t.translate===0&&t.scale===1}function ji(t){return os(t.x)&&os(t.y)}function Ue(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function rs(t){return j(t.x)/j(t.y)}class Wc{constructor(){this.members=[]}add(e){en(this.members,e),e.scheduleRender()}remove(e){if(nn(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(i=>e===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const r=this.members[i];if(r.isPresent!==!1){s=r;break}}return s?(this.promote(s),!0):!1}promote(e,n){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender(),e.resumeFrom=s,n&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:s}=e;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function as(t,e,n){let s="";const i=t.x.translate/e.x,r=t.y.translate/e.y;if((i||r)&&(s=`translate3d(${i}px, ${r}px, 0) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),n){const{rotate:c,rotateX:l,rotateY:u}=n;c&&(s+=`rotate(${c}deg) `),l&&(s+=`rotateX(${l}deg) `),u&&(s+=`rotateY(${u}deg) `)}const o=t.x.scale*e.x,a=t.y.scale*e.y;return(o!==1||a!==1)&&(s+=`scale(${o}, ${a})`),s||"none"}const Hc=(t,e)=>t.depth-e.depth;class Gc{constructor(){this.children=[],this.isDirty=!1}add(e){en(this.children,e),this.isDirty=!0}remove(e){nn(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Hc),this.isDirty=!1,this.children.forEach(e)}}function Kc(t){window.MotionDebug&&window.MotionDebug.record(t)}const cs=["","X","Y","Z"],ls=1e3;let Zc=0;const st={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function Bi({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(o,a={},c=e==null?void 0:e()){this.id=Zc++,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.potentialNodes=new Map,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{st.totalNodes=st.resolvedTargetDeltas=st.recalculatedProjection=0,this.nodes.forEach(Xc),this.nodes.forEach(el),this.nodes.forEach(nl),this.nodes.forEach(Jc),Kc(st)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.elementId=o,this.latestValues=a,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0,o&&this.root.registerPotentialNode(o,this);for(let l=0;lthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=Pi(h,250),yt.hasAnimatedSinceResize&&(yt.hasAnimatedSinceResize=!1,this.nodes.forEach(fs))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&u&&(c||l)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:d,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||al,{onLayoutAnimationStart:T,onLayoutAnimationComplete:b}=u.getProps(),x=!this.targetLayout||!Ue(this.targetLayout,p)||d,y=!h&&d;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||y||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,y);const v={...Ti(g,"layout"),onPlay:T,onComplete:b};(u.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v)}else!h&&this.animationProgress===0&&fs(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,J.preRender(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(sl),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(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 u=0;u{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 c=0;c{const S=v/1e3;hs(f.x,o.x,S),hs(f.y,o.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Pt(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ol(this.relativeTarget,this.relativeTargetOrigin,h,S),y&&Ue(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=V()),F(y,this.relativeTarget)),g&&(this.animationValues=u,Oc(u,l,this.latestValues,S,x,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(J.update(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=R.update(()=>{yt.hasAnimatedSinceResize=!0,this.currentAnimation=Fc(0,ls,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.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 o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ls),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:c,layout:l,latestValues:u}=o;if(!(!a||!c||!l)){if(this!==o&&this.layout&&l&&Fi(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||V();const f=j(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const h=j(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}F(a,c),ft(a,u),bt(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Wc),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:c}=o;if((c.rotate||c.rotateX||c.rotateY||c.rotateZ)&&(a=!0),!a)return;const l={};for(let u=0;u{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(us),this.root.sharedNodes.clear()}}}function qc(t){t.updateLayout()}function Yc(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=t.layout,{animationType:r}=t.options,o=n.source!==t.layout.source;r==="size"?U(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],d=j(h);h.min=s[f].min,h.max=h.min+d}):Fi(r,n.layoutBox,s)&&U(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],d=j(s[f]);h.max=h.min+d});const a=Tt();bt(a,s,n.layoutBox);const c=Tt();o?bt(c,t.applyTransform(i,!0),n.measuredBox):bt(c,s,n.layoutBox);const l=!ji(a);let u=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:d}=f;if(h&&d){const p=V();Pt(p,n.layoutBox,h.layoutBox);const g=V();Pt(g,s,d.layoutBox),Ue(p,g)||(u=!0),f.options.layoutRoot&&(t.relativeTarget=g,t.relativeTargetOrigin=p,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:n,delta:c,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:u})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function Xc(t){st.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Jc(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Qc(t){t.clearSnapshot()}function us(t){t.clearMeasurements()}function tl(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function fs(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0}function el(t){t.resolveTargetDelta()}function nl(t){t.calcProjection()}function sl(t){t.resetRotation()}function il(t){t.removeLeadSnapshot()}function hs(t,e,n){t.translate=A(e.translate,0,n),t.scale=A(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function ds(t,e,n,s){t.min=A(e.min,n.min,s),t.max=A(e.max,n.max,s)}function ol(t,e,n,s){ds(t.x,e.x,n.x,s),ds(t.y,e.y,n.y,s)}function rl(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const al={duration:.45,ease:[.4,0,.1,1]};function cl(t,e){let n=t.root;for(let r=t.path.length-1;r>=0;r--)if(Boolean(t.path[r].instance)){n=t.path[r];break}const i=(n&&n!==t.root?n.instance:document).querySelector(`[data-projection-id="${e}"]`);i&&t.mount(i,!0)}function ps(t){t.min=Math.round(t.min),t.max=Math.round(t.max)}function ll(t){ps(t.x),ps(t.y)}function Fi(t,e,n){return t==="position"||t==="preserve-aspect"&&!Be(rs(e),rs(n),.2)}const ul=Bi({attachResizeListener:(t,e)=>$(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),be={current:void 0},Ii=Bi({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!be.current){const t=new ul(0,{});t.mount(window),t.setOptions({layoutScroll:!0}),be.current=t}return be.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>Boolean(window.getComputedStyle(t).position==="fixed")}),fl={pan:{Feature:wc},drag:{Feature:Vc,ProjectionNode:Ii,MeasureLayout:Ei}},hl=new Set(["width","height","top","left","right","bottom","x","y"]),Oi=t=>hl.has(t),dl=t=>Object.keys(t).some(Oi),ms=t=>t===rt||t===P,gs=(t,e)=>parseFloat(t.split(", ")[e]),ys=(t,e)=>(n,{transform:s})=>{if(s==="none"||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/);if(i)return gs(i[1],e);{const r=s.match(/^matrix\((.+)\)$/);return r?gs(r[1],t):0}},pl=new Set(["x","y","z"]),ml=se.filter(t=>!pl.has(t));function gl(t){const e=[];return ml.forEach(n=>{const s=t.getValue(n);s!==void 0&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e.length&&t.render(),e}const vs={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:ys(4,13),y:ys(5,14)},yl=(t,e,n)=>{const s=e.measureViewportBox(),i=e.current,r=getComputedStyle(i),{display:o}=r,a={};o==="none"&&e.setStaticValue("display",t.display||"block"),n.forEach(l=>{a[l]=vs[l](s,r)}),e.render();const c=e.measureViewportBox();return n.forEach(l=>{const u=e.getValue(l);u&&u.jump(a[l]),t[l]=vs[l](c,r)}),t},vl=(t,e,n={},s={})=>{e={...e},s={...s};const i=Object.keys(e).filter(Oi);let r=[],o=!1;const a=[];if(i.forEach(c=>{const l=t.getValue(c);if(!t.hasValue(c))return;let u=n[c],f=pt(u);const h=e[c];let d;if(Gt(h)){const p=h.length,g=h[0]===null?1:0;u=h[g],f=pt(u);for(let T=g;T=0?window.pageYOffset:null,l=yl(e,t,a);return r.length&&r.forEach(([u,f])=>{t.getValue(u).set(f)}),t.render(),te&&c!==null&&window.scrollTo({top:c}),{target:l,transitionEnd:s}}else return{target:e,transitionEnd:s}};function xl(t,e,n,s){return dl(e)?vl(t,e,n,s):{target:e,transitionEnd:s}}const bl=(t,e,n,s)=>{const i=Lc(t,e,s);return e=i.target,s=i.transitionEnd,xl(t,e,n,s)},_e={current:null},Ni={current:!1};function Pl(){if(Ni.current=!0,!!te)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_e.current=t.matches;t.addListener(e),e()}else _e.current=!1}function Tl(t,e,n){const{willChange:s}=e;for(const i in e){const r=e[i],o=n[i];if(k(r))t.addValue(i,r),Zt(s)&&s.add(i);else if(k(o))t.addValue(i,dt(r,{owner:t})),Zt(s)&&s.remove(i);else if(o!==r)if(t.hasValue(i)){const a=t.getValue(i);!a.hasAnimated&&a.set(r)}else{const a=t.getStaticValue(i);t.addValue(i,dt(a!==void 0?a:r,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const Ui=Object.keys(St),Cl=Ui.length,xs=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Sl=We.length;class Al{constructor({parent:e,props:n,presenceContext:s,reducedMotionConfig:i,visualState:r},o={}){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=()=>R.render(this.render,!1,!0);const{latestValues:a,renderState:c}=r;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=c,this.parent=e,this.props=n,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=o,this.isControllingVariants=ne(n),this.isVariantNode=Ls(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:l,...u}=this.scrapeMotionValuesFromProps(n,{});for(const f in u){const h=u[f];a[f]!==void 0&&k(h)&&(h.set(a[f],!1),Zt(l)&&l.add(f))}}scrapeMotionValuesFromProps(e,n){return{}}mount(e){this.current=e,this.projection&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),Ni.current||Pl(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_e.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),J.update(this.notifyUpdate),J.render(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,n){const s=ot.has(e),i=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&R.update(this.notifyUpdate,!1,!0),s&&this.projection&&(this.projection.isTransformDirty=!0)}),r=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{i(),r()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}loadFeatures({children:e,...n},s,i,r,o){let a,c;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:d,layoutRoot:p})}return c}updateFeatures(){for(const e in this.features){const n=this.features[e];n.isMounted?n.update(this.props,this.prevProps):(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):V()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}makeTargetAnimatable(e,n=!0){return this.makeTargetAnimatableFromInstance(e,this.props,n)}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;sn.variantChildren.delete(e)}addValue(e,n){n!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,n)),this.values.set(e,n),this.latestValues[e]=n.get()}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&n!==void 0&&(s=dt(n,{owner:this}),this.addValue(e,s)),s}readValue(e){return this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.readValueFromInstance(this.current,e,this.options)}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:s}=this.props,i=typeof s=="string"||typeof s=="object"?(n=tn(this.props,s))===null||n===void 0?void 0:n[e]:void 0;if(s&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!k(r)?r:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new sn),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class _i extends Al{sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:s}){delete n[e],delete s[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:n,...s},{transformValues:i},r){let o=Gr(s,e||{},this);if(i&&(n&&(n=i(n)),s&&(s=i(s)),o&&(o=i(o))),r){Wr(this,s,o);const a=bl(this,s,o,n);n=a.transitionEnd,s=a.target}return{transition:e,transitionEnd:n,...s}}}function Vl(t){return window.getComputedStyle(t)}class wl extends _i{readValueFromInstance(e,n){if(ot.has(n)){const s=an(n);return s&&s.default||0}else{const s=Vl(e),i=(Fs(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Di(e,n)}build(e,n,s,i){Ze(e,n,s,i.transformTemplate)}scrapeMotionValuesFromProps(e,n){return Qe(e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;k(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(e,n,s,i){_s(e,n,s,i)}}class Ml extends _i{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(ot.has(n)){const s=an(n);return s&&s.default||0}return n=zs.has(n)?n:Je(n),e.getAttribute(n)}measureInstanceViewportBox(){return V()}scrapeMotionValuesFromProps(e,n){return Ws(e,n)}build(e,n,s,i){Ye(e,n,s,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,s,i){$s(e,n,s,i)}mount(e){this.isSVGTag=Xe(e.tagName),super.mount(e)}}const Dl=(t,e)=>Ke(t)?new Ml(e,{enableHardwareAcceleration:!1}):new wl(e,{enableHardwareAcceleration:!0}),Rl={layout:{ProjectionNode:Ii,MeasureLayout:Ei}},El={...rc,...vr,...fl,...Rl},Ll=Eo((t,e)=>or(t,e,El,Dl));function zi(){const t=m.useRef(!1);return $t(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function kl(){const t=zi(),[e,n]=m.useState(0),s=m.useCallback(()=>{t.current&&n(e+1)},[e]);return[m.useCallback(()=>R.postRender(s),[s]),e]}class jl extends m.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Bl({children:t,isPresent:e}){const n=m.useId(),s=m.useRef(null),i=m.useRef({width:0,height:0,top:0,left:0});return m.useInsertionEffect(()=>{const{width:r,height:o,top:a,left:c}=i.current;if(e||!s.current||!r||!o)return;s.current.dataset.motionPopId=n;const l=document.createElement("style");return document.head.appendChild(l),l.sheet&&l.sheet.insertRule(` - [data-motion-pop-id="${n}"] { - position: absolute !important; - width: ${r}px !important; - height: ${o}px !important; - top: ${a}px !important; - left: ${c}px !important; - } - `),()=>{document.head.removeChild(l)}},[e]),m.createElement(jl,{isPresent:e,childRef:s,sizeRef:i},m.cloneElement(t,{ref:s}))}const Pe=({children:t,initial:e,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:r,mode:o})=>{const a=He(Fl),c=m.useId(),l=m.useMemo(()=>({id:c,initial:e,isPresent:n,custom:i,onExitComplete:u=>{a.set(u,!0);for(const f of a.values())if(!f)return;s&&s()},register:u=>(a.set(u,!1),()=>a.delete(u))}),r?void 0:[n]);return m.useMemo(()=>{a.forEach((u,f)=>a.set(f,!1))},[n]),m.useEffect(()=>{!n&&!a.size&&s&&s()},[n]),o==="popLayout"&&(t=m.createElement(Bl,{isPresent:n},t)),m.createElement(Et.Provider,{value:l},t)};function Fl(){return new Map}function Il(t){return m.useEffect(()=>()=>t(),[])}const ct=t=>t.key||"";function Ol(t,e){t.forEach(n=>{const s=ct(n);e.set(s,n)})}function Nl(t){const e=[];return m.Children.forEach(t,n=>{m.isValidElement(n)&&e.push(n)}),e}const Ul=({children:t,custom:e,initial:n=!0,onExitComplete:s,exitBeforeEnter:i,presenceAffectsLayout:r=!0,mode:o="sync"})=>{i&&(o="wait");let[a]=kl();const c=m.useContext(Ge).forceRender;c&&(a=c);const l=zi(),u=Nl(t);let f=u;const h=new Set,d=m.useRef(f),p=m.useRef(new Map).current,g=m.useRef(!0);if($t(()=>{g.current=!1,Ol(u,p),d.current=f}),Il(()=>{g.current=!0,p.clear(),h.clear()}),g.current)return m.createElement(m.Fragment,null,f.map(y=>m.createElement(Pe,{key:ct(y),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:r,mode:o},y)));f=[...f];const T=d.current.map(ct),b=u.map(ct),x=T.length;for(let y=0;y{if(b.indexOf(y)!==-1)return;const v=p.get(y);if(!v)return;const S=T.indexOf(y),w=()=>{p.delete(y),h.delete(y);const D=d.current.findIndex(N=>N.key===y);if(d.current.splice(D,1),!h.size){if(d.current=u,l.current===!1)return;a(),s&&s()}};f.splice(S,0,m.createElement(Pe,{key:ct(v),isPresent:!1,onExitComplete:w,custom:e,presenceAffectsLayout:r,mode:o},v))}),f=f.map(y=>{const v=y.key;return h.has(v)?y:m.createElement(Pe,{key:ct(y),isPresent:!0,presenceAffectsLayout:r,mode:o},y)}),m.createElement(m.Fragment,null,h.size?f:f.map(y=>m.cloneElement(y)))};var _l={initial:t=>{const{position:e}=t,n=["top","bottom"].includes(e)?"y":"x";let s=["top-right","bottom-right"].includes(e)?1:-1;return e==="bottom"&&(s=1),{opacity:0,[n]:s*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]}}},$i=m.memo(t=>{const{id:e,message:n,onCloseComplete:s,onRequestRemove:i,requestClose:r=!1,position:o="bottom",duration:a=5e3,containerStyle:c,motionVariants:l=_l,toastSpacing:u="0.5rem"}=t,[f,h]=m.useState(a),d=Dc();vn(()=>{d||s==null||s()},[d]),vn(()=>{h(a)},[a]);const p=()=>h(null),g=()=>h(a),T=()=>{d&&i()};m.useEffect(()=>{d&&r&&i()},[d,r,i]),xo(T,f);const b=m.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:u,...c}),[c,u]),x=m.useMemo(()=>go(o),[o]);return C.jsx(Ll.li,{layout:!0,className:"chakra-toast",variants:l,initial:"initial",animate:"animate",exit:"exit",onHoverStart:p,onHoverEnd:g,custom:{position:o},style:x,children:C.jsx(G.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:b,children:Te(n,{id:e,onClose:T})})})});$i.displayName="ToastComponent";function zl(t,e){var n;const s=t??"bottom",r={"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"}}[s];return(n=r==null?void 0:r[e])!=null?n:s}var bs={path:C.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[C.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"}),C.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"}),C.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Bt=Mt((t,e)=>{const{as:n,viewBox:s,color:i="currentColor",focusable:r=!1,children:o,className:a,__css:c,...l}=t,u=Dt("chakra-icon",a),f=As("Icon",t),h={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:i,...c,...f},d={ref:e,focusable:r,className:u,__css:h},p=s??bs.viewBox;if(n&&typeof n!="string")return C.jsx(G.svg,{as:n,...d,...l});const g=o??bs.path;return C.jsx(G.svg,{verticalAlign:"middle",viewBox:p,...d,...l,children:g})});Bt.displayName="Icon";function $l(t){return C.jsx(Bt,{viewBox:"0 0 24 24",...t,children:C.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 Wl(t){return C.jsx(Bt,{viewBox:"0 0 24 24",...t,children:C.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 Ps(t){return C.jsx(Bt,{viewBox:"0 0 24 24",...t,children:C.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[Hl,Gl]=Rt({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[Kl,gn]=Rt({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),Wi={info:{icon:Wl,colorScheme:"blue"},warning:{icon:Ps,colorScheme:"orange"},success:{icon:$l,colorScheme:"green"},error:{icon:Ps,colorScheme:"red"},loading:{icon:Qi,colorScheme:"blue"}};function Zl(t){return Wi[t].colorScheme}function ql(t){return Wi[t].icon}var Hi=Mt(function(e,n){const i={display:"inline",...gn().description};return C.jsx(G.div,{ref:n,...e,className:Dt("chakra-alert__desc",e.className),__css:i})});Hi.displayName="AlertDescription";function Gi(t){const{status:e}=Gl(),n=ql(e),s=gn(),i=e==="loading"?s.spinner:s.icon;return C.jsx(G.span,{display:"inherit",...t,className:Dt("chakra-alert__icon",t.className),__css:i,children:t.children||C.jsx(n,{h:"100%",w:"100%"})})}Gi.displayName="AlertIcon";var Ki=Mt(function(e,n){const s=gn();return C.jsx(G.div,{ref:n,...e,className:Dt("chakra-alert__title",e.className),__css:s.title})});Ki.displayName="AlertTitle";var Zi=Mt(function(e,n){var s;const{status:i="info",addRole:r=!0,...o}=Vs(e),a=(s=e.colorScheme)!=null?s:Zl(i),c=to("Alert",{...e,colorScheme:a}),l={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...c.container};return C.jsx(Hl,{value:{status:i},children:C.jsx(Kl,{value:c,children:C.jsx(G.div,{role:r?"alert":void 0,ref:n,...o,className:Dt("chakra-alert",e.className),__css:l})})})});Zi.displayName="Alert";function Yl(t){return C.jsx(Bt,{focusable:"false","aria-hidden":!0,...t,children:C.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 qi=Mt(function(e,n){const s=As("CloseButton",e),{children:i,isDisabled:r,__css:o,...a}=Vs(e),c={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return C.jsx(G.button,{type:"button","aria-label":"Close",ref:n,disabled:r,__css:{...c,...s,...o},...a,children:i||C.jsx(Yl,{width:"1em",height:"1em"})})});qi.displayName="CloseButton";var Xl={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},_=Jl(Xl);function Jl(t){let e=t;const n=new Set,s=i=>{e=i(e),n.forEach(r=>r())};return{getState:()=>e,subscribe:i=>(n.add(i),()=>{s(()=>t),n.delete(i)}),removeToast:(i,r)=>{s(o=>({...o,[r]:o[r].filter(a=>a.id!=i)}))},notify:(i,r)=>{const o=Ql(i,r),{position:a,id:c}=o;return s(l=>{var u,f;const d=a.includes("top")?[o,...(u=l[a])!=null?u:[]]:[...(f=l[a])!=null?f:[],o];return{...l,[a]:d}}),c},update:(i,r)=>{i&&s(o=>{const a={...o},{position:c,index:l}=yn(a,i);return c&&l!==-1&&(a[c][l]={...a[c][l],...r,message:Yi(r)}),a})},closeAll:({positions:i}={})=>{s(r=>(i??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((c,l)=>(c[l]=r[l].map(u=>({...u,requestClose:!0})),c),{...r}))},close:i=>{s(r=>{const o=Ds(r,i);return o?{...r,[o]:r[o].map(a=>a.id==i?{...a,requestClose:!0}:a)}:r})},isActive:i=>Boolean(yn(_.getState(),i).position)}}var Ts=0;function Ql(t,e={}){var n,s;Ts+=1;const i=(n=e.id)!=null?n:Ts,r=(s=e.position)!=null?s:"bottom";return{id:i,message:t,position:r,duration:e.duration,onCloseComplete:e.onCloseComplete,onRequestRemove:()=>_.removeToast(String(i),r),status:e.status,requestClose:!1,containerStyle:e.containerStyle}}var tu=t=>{const{status:e,variant:n="solid",id:s,title:i,isClosable:r,onClose:o,description:a,icon:c}=t,l=s?{root:`toast-${s}`,title:`toast-${s}-title`,description:`toast-${s}-description`}:void 0;return C.jsxs(Zi,{addRole:!1,status:e,variant:n,id:l==null?void 0:l.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",children:[C.jsx(Gi,{children:c}),C.jsxs(G.div,{flex:"1",maxWidth:"100%",children:[i&&C.jsx(Ki,{id:l==null?void 0:l.title,children:i}),a&&C.jsx(Hi,{id:l==null?void 0:l.description,display:"block",children:a})]}),r&&C.jsx(qi,{size:"sm",onClick:o,position:"absolute",insetEnd:1,top:1})]})};function Yi(t={}){const{render:e,toastComponent:n=tu}=t;return i=>typeof e=="function"?e({...i,...t}):C.jsx(n,{...i,...t})}function su(t,e){const n=i=>{var r;return{...e,...i,position:zl((r=i==null?void 0:i.position)!=null?r:e==null?void 0:e.position,t)}},s=i=>{const r=n(i),o=Yi(r);return _.notify(o,r)};return s.update=(i,r)=>{_.update(i,n(r))},s.promise=(i,r)=>{const o=s({...r.loading,status:"loading",duration:null});i.then(a=>s.update(o,{status:"success",duration:5e3,...Te(r.success,a)})).catch(a=>s.update(o,{status:"error",duration:5e3,...Te(r.error,a)}))},s.closeAll=_.closeAll,s.close=_.close,s.isActive=_.isActive,s}var[iu,ou]=Rt({name:"ToastOptionsContext",strict:!1}),ru=t=>{const e=m.useSyncExternalStore(_.subscribe,_.getState,_.getState),{motionVariants:n,component:s=$i,portalProps:i}=t,o=Object.keys(e).map(a=>{const c=e[a];return C.jsx("ul",{role:"region","aria-live":"polite",id:`chakra-toast-manager-${a}`,style:yo(a),children:C.jsx(Ul,{initial:!1,children:c.map(l=>C.jsx(s,{motionVariants:n,...l},l.id))})},a)});return C.jsx(Jt,{...i,children:o})};const au=io,cu=eo,lu={"::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},uu={scrollbarColor:"accent.600 transparent",scrollbarWidth:"thick","::-webkit-scrollbar":{width:"6px",height:"6px"},"::-webkit-scrollbar-track":{background:"transparent"},"::-webkit-scrollbar-thumb":{background:"accent.600",borderRadius:"8px",borderWidth:"4px",borderColor:"accent.600"},"::-webkit-scrollbar-thumb:hover":{background:"accent.500",borderColor:"accent.500"},"::-webkit-scrollbar-button":{background:"transaprent"}};export{Ul as A,qi as C,Bt as I,Jt as P,iu as T,Rt as a,vo as b,su as c,Ce as d,vn as e,Mc as f,cu as g,au as h,co as i,ru as j,Ll as m,lu as n,uu as s,ou as u}; diff --git a/invokeai/frontend/web/dist/assets/storeHooks-e63a2dc4.js b/invokeai/frontend/web/dist/assets/storeHooks-e63a2dc4.js new file mode 100644 index 0000000000..2393fec999 --- /dev/null +++ b/invokeai/frontend/web/dist/assets/storeHooks-e63a2dc4.js @@ -0,0 +1,9 @@ +import{cY as zt,cZ as Ji,r as m,j as C,G as Cs,R as Ss,c as G,t as Te,f as Mt,a as Dt,e as As,S as Qi,o as Vs,d as to,c_ as eo}from"./index-2ad84bef.js";function ws(t=zt){const e=t===zt?Ji:()=>m.useContext(t);return function(){const{store:s}=e();return s}}const no=ws();function so(t=zt){const e=t===zt?no:ws(t);return function(){return e().dispatch}}const io=so();function oo(t,e){return`${t} returned \`undefined\`. Seems you forgot to wrap component within ${e}`}function Rt(t={}){const{name:e,strict:n=!0,hookName:s="useContext",providerName:i="Provider",errorMessage:r}=t,o=m.createContext(void 0);o.displayName=e;function a(){var c;const l=m.useContext(o);if(!l&&n){const u=new Error(r??oo(s,i));throw u.name="ContextError",(c=Error.captureStackTrace)==null||c.call(Error,u,a),u}return l}return[o.Provider,a,o]}var[ro,ao]=Rt({strict:!1,name:"PortalManagerContext"});function co(t){const{children:e,zIndex:n}=t;return C.jsx(ro,{value:{zIndex:n},children:e})}co.displayName="PortalManager";var Ce=Boolean(globalThis==null?void 0:globalThis.document)?m.useLayoutEffect:m.useEffect,[Ms,lo]=Rt({strict:!1,name:"PortalContext"}),ze="chakra-portal",uo=".chakra-portal",fo=t=>C.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:t.zIndex,top:0,left:0,right:0},children:t.children}),ho=t=>{const{appendToParentPortal:e,children:n}=t,[s,i]=m.useState(null),r=m.useRef(null),[,o]=m.useState({});m.useEffect(()=>o({}),[]);const a=lo(),c=ao();Ce(()=>{if(!s)return;const u=s.ownerDocument,f=e?a??u.body:u.body;if(!f)return;r.current=u.createElement("div"),r.current.className=ze,f.appendChild(r.current),o({});const h=r.current;return()=>{f.contains(h)&&f.removeChild(h)}},[s]);const l=c!=null&&c.zIndex?C.jsx(fo,{zIndex:c==null?void 0:c.zIndex,children:n}):n;return r.current?Cs.createPortal(C.jsx(Ms,{value:r.current,children:l}),r.current):C.jsx("span",{ref:u=>{u&&i(u)}})},po=t=>{const{children:e,containerRef:n,appendToParentPortal:s}=t,i=n.current,r=i??(typeof window<"u"?document.body:void 0),o=m.useMemo(()=>{const c=i==null?void 0:i.ownerDocument.createElement("div");return c&&(c.className=ze),c},[i]),[,a]=m.useState({});return Ce(()=>a({}),[]),Ce(()=>{if(!(!o||!r))return r.appendChild(o),()=>{r.removeChild(o)}},[o,r]),r&&o?Cs.createPortal(C.jsx(Ms,{value:s?o:null,children:e}),o):null};function Jt(t){const e={appendToParentPortal:!0,...t},{containerRef:n,...s}=e;return n?C.jsx(po,{containerRef:n,...s}):C.jsx(ho,{...s})}Jt.className=ze;Jt.selector=uo;Jt.displayName="Portal";var mo=(t,e)=>t.find(n=>n.id===e);function yn(t,e){const n=Ds(t,e),s=n?t[n].findIndex(i=>i.id===e):-1;return{position:n,index:s}}function Ds(t,e){for(const[n,s]of Object.entries(t))if(mo(s,e))return n}function go(t){const e=t.includes("right"),n=t.includes("left");let s="center";return e&&(s="flex-end"),n&&(s="flex-start"),{display:"flex",flexDirection:"column",alignItems:s}}function yo(t){const n=t==="top"||t==="bottom"?"0 auto":void 0,s=t.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=t.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,r=t.includes("left")?void 0:"env(safe-area-inset-right, 0px)",o=t.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:5500,pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:s,bottom:i,right:r,left:o}}function vo(t,e=[]){const n=m.useRef(t);return m.useEffect(()=>{n.current=t}),m.useCallback((...s)=>{var i;return(i=n.current)==null?void 0:i.call(n,...s)},e)}function xo(t,e){const n=vo(t);m.useEffect(()=>{if(e==null)return;let s=null;return s=window.setTimeout(()=>{n()},e),()=>{s&&window.clearTimeout(s)}},[e,n])}function vn(t,e){const n=m.useRef(!1),s=m.useRef(!1);m.useEffect(()=>{if(n.current&&s.current)return t();s.current=!0},e),m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const Rs=m.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Qt=m.createContext({});function Po(){return m.useContext(Qt).visualElement}const Et=m.createContext(null),te=typeof document<"u",$t=te?m.useLayoutEffect:m.useEffect,Es=m.createContext({strict:!1});function bo(t,e,n,s){const i=Po(),r=m.useContext(Es),o=m.useContext(Et),a=m.useContext(Rs).reducedMotion,c=m.useRef();s=s||r.renderer,!c.current&&s&&(c.current=s(t,{visualState:e,parent:i,props:n,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:a}));const l=c.current;return m.useInsertionEffect(()=>{l&&l.update(n,o)}),$t(()=>{l&&l.render()}),m.useEffect(()=>{l&&l.updateFeatures()}),(window.HandoffAppearAnimations?$t:m.useEffect)(()=>{l&&l.animationState&&l.animationState.animateChanges()}),l}function lt(t){return typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function To(t,e,n){return m.useCallback(s=>{s&&t.mount&&t.mount(s),e&&(s?e.mount(s):e.unmount()),n&&(typeof n=="function"?n(s):lt(n)&&(n.current=s))},[e])}function Ct(t){return typeof t=="string"||Array.isArray(t)}function ee(t){return typeof t=="object"&&typeof t.start=="function"}const $e=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],He=["initial",...$e];function ne(t){return ee(t.animate)||He.some(e=>Ct(t[e]))}function Ls(t){return Boolean(ne(t)||t.variants)}function Co(t,e){if(ne(t)){const{initial:n,animate:s}=t;return{initial:n===!1||Ct(n)?n:void 0,animate:Ct(s)?s:void 0}}return t.inherit!==!1?e:{}}function So(t){const{initial:e,animate:n}=Co(t,m.useContext(Qt));return m.useMemo(()=>({initial:e,animate:n}),[xn(e),xn(n)])}function xn(t){return Array.isArray(t)?t.join(" "):t}const Pn={animation:["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"],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"]},St={};for(const t in Pn)St[t]={isEnabled:e=>Pn[t].some(n=>!!e[n])};function Ao(t){for(const e in t)St[e]={...St[e],...t[e]}}function We(t){const e=m.useRef(null);return e.current===null&&(e.current=t()),e.current}const yt={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let Vo=1;function wo(){return We(()=>{if(yt.hasEverUpdated)return Vo++})}const Ge=m.createContext({}),js=m.createContext({}),Mo=Symbol.for("motionComponentSymbol");function Do({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:s,Component:i}){t&&Ao(t);function r(a,c){let l;const u={...m.useContext(Rs),...a,layoutId:Ro(a)},{isStatic:f}=u,h=So(a),d=f?void 0:wo(),p=s(a,f);if(!f&&te){h.visualElement=bo(i,p,u,e);const g=m.useContext(js),T=m.useContext(Es).strict;h.visualElement&&(l=h.visualElement.loadFeatures(u,T,t,d,g))}return m.createElement(Qt.Provider,{value:h},l&&h.visualElement?m.createElement(l,{visualElement:h.visualElement,...u}):null,n(i,a,d,To(p,h.visualElement,c),p,f,h.visualElement))}const o=m.forwardRef(r);return o[Mo]=i,o}function Ro({layoutId:t}){const e=m.useContext(Ge).id;return e&&t!==void 0?e+"-"+t:t}function Eo(t){function e(s,i={}){return Do(t(s,i))}if(typeof Proxy>"u")return e;const n=new Map;return new Proxy(e,{get:(s,i)=>(n.has(i)||n.set(i,e(i)),n.get(i))})}const Lo=["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 Ke(t){return typeof t!="string"||t.includes("-")?!1:!!(Lo.indexOf(t)>-1||/[A-Z]/.test(t))}const Ht={};function jo(t){Object.assign(Ht,t)}const se=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ot=new Set(se);function Bs(t,{layout:e,layoutId:n}){return ot.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Ht[t]||t==="opacity")}const j=t=>Boolean(t&&t.getVelocity),Bo={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ko=se.length;function Fo(t,{enableHardwareAcceleration:e=!0,allowTransformNone:n=!0},s,i){let r="";for(let o=0;oe=>typeof e=="string"&&e.startsWith(t),Fs=ks("--"),Se=ks("var(--"),Io=(t,e)=>e&&typeof t=="number"?e.transform(t):t,ht=(t,e,n)=>Math.min(Math.max(n,t),e),rt={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},vt={...rt,transform:t=>ht(0,1,t)},It={...rt,default:1},xt=t=>Math.round(t*1e5)/1e5,At=/(-)?([\d]*\.?[\d])+/g,Ae=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Oo=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Lt(t){return typeof t=="string"}const jt=t=>({test:e=>Lt(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),q=jt("deg"),z=jt("%"),b=jt("px"),No=jt("vh"),Uo=jt("vw"),bn={...z,parse:t=>z.parse(t)/100,transform:t=>z.transform(t*100)},Tn={...rt,transform:Math.round},Is={borderWidth:b,borderTopWidth:b,borderRightWidth:b,borderBottomWidth:b,borderLeftWidth:b,borderRadius:b,radius:b,borderTopLeftRadius:b,borderTopRightRadius:b,borderBottomRightRadius:b,borderBottomLeftRadius:b,width:b,maxWidth:b,height:b,maxHeight:b,size:b,top:b,right:b,bottom:b,left:b,padding:b,paddingTop:b,paddingRight:b,paddingBottom:b,paddingLeft:b,margin:b,marginTop:b,marginRight:b,marginBottom:b,marginLeft:b,rotate:q,rotateX:q,rotateY:q,rotateZ:q,scale:It,scaleX:It,scaleY:It,scaleZ:It,skew:q,skewX:q,skewY:q,distance:b,translateX:b,translateY:b,translateZ:b,x:b,y:b,z:b,perspective:b,transformPerspective:b,opacity:vt,originX:bn,originY:bn,originZ:b,zIndex:Tn,fillOpacity:vt,strokeOpacity:vt,numOctaves:Tn};function Ze(t,e,n,s){const{style:i,vars:r,transform:o,transformOrigin:a}=t;let c=!1,l=!1,u=!0;for(const f in e){const h=e[f];if(Fs(f)){r[f]=h;continue}const d=Is[f],p=Io(h,d);if(ot.has(f)){if(c=!0,o[f]=p,!u)continue;h!==(d.default||0)&&(u=!1)}else f.startsWith("origin")?(l=!0,a[f]=p):i[f]=p}if(e.transform||(c||s?i.transform=Fo(t.transform,n,u,s):i.transform&&(i.transform="none")),l){const{originX:f="50%",originY:h="50%",originZ:d=0}=a;i.transformOrigin=`${f} ${h} ${d}`}}const qe=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Os(t,e,n){for(const s in e)!j(e[s])&&!Bs(s,n)&&(t[s]=e[s])}function _o({transformTemplate:t},e,n){return m.useMemo(()=>{const s=qe();return Ze(s,e,{enableHardwareAcceleration:!n},t),Object.assign({},s.vars,s.style)},[e])}function zo(t,e,n){const s=t.style||{},i={};return Os(i,s,t),Object.assign(i,_o(t,e,n)),t.transformValues?t.transformValues(i):i}function $o(t,e,n){const s={},i=zo(t,e,n);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=i,s}const Ho=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 Wt(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||Ho.has(t)}let Ns=t=>!Wt(t);function Wo(t){t&&(Ns=e=>e.startsWith("on")?!Wt(e):t(e))}try{Wo(require("@emotion/is-prop-valid").default)}catch{}function Go(t,e,n){const s={};for(const i in t)i==="values"&&typeof t.values=="object"||(Ns(i)||n===!0&&Wt(i)||!e&&!Wt(i)||t.draggable&&i.startsWith("onDrag"))&&(s[i]=t[i]);return s}function Cn(t,e,n){return typeof t=="string"?t:b.transform(e+n*t)}function Ko(t,e,n){const s=Cn(e,t.x,t.width),i=Cn(n,t.y,t.height);return`${s} ${i}`}const Zo={offset:"stroke-dashoffset",array:"stroke-dasharray"},qo={offset:"strokeDashoffset",array:"strokeDasharray"};function Yo(t,e,n=1,s=0,i=!0){t.pathLength=1;const r=i?Zo:qo;t[r.offset]=b.transform(-s);const o=b.transform(e),a=b.transform(n);t[r.array]=`${o} ${a}`}function Ye(t,{attrX:e,attrY:n,originX:s,originY:i,pathLength:r,pathSpacing:o=1,pathOffset:a=0,...c},l,u,f){if(Ze(t,c,l,f),u){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:d,dimensions:p}=t;h.transform&&(p&&(d.transform=h.transform),delete h.transform),p&&(s!==void 0||i!==void 0||d.transform)&&(d.transformOrigin=Ko(p,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&Yo(h,r,o,a,!1)}const Us=()=>({...qe(),attrs:{}}),Xe=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Xo(t,e,n,s){const i=m.useMemo(()=>{const r=Us();return Ye(r,e,{enableHardwareAcceleration:!1},Xe(s),t.transformTemplate),{...r.attrs,style:{...r.style}}},[e]);if(t.style){const r={};Os(r,t.style,t),i.style={...r,...i.style}}return i}function Jo(t=!1){return(n,s,i,r,{latestValues:o},a)=>{const l=(Ke(n)?Xo:$o)(s,o,a,n),f={...Go(s,typeof n=="string",t),...l,ref:r},{children:h}=s,d=m.useMemo(()=>j(h)?h.get():h,[h]);return i&&(f["data-projection-id"]=i),m.createElement(n,{...f,children:d})}}const Je=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function _s(t,{style:e,vars:n},s,i){Object.assign(t.style,e,i&&i.getProjectionStyles(s));for(const r in n)t.style.setProperty(r,n[r])}const zs=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 $s(t,e,n,s){_s(t,e,void 0,s);for(const i in e.attrs)t.setAttribute(zs.has(i)?i:Je(i),e.attrs[i])}function Qe(t,e){const{style:n}=t,s={};for(const i in n)(j(n[i])||e.style&&j(e.style[i])||Bs(i,t))&&(s[i]=n[i]);return s}function Hs(t,e){const n=Qe(t,e);for(const s in t)if(j(t[s])||j(e[s])){const i=s==="x"||s==="y"?"attr"+s.toUpperCase():s;n[i]=t[s]}return n}function tn(t,e,n,s={},i={}){return typeof e=="function"&&(e=e(n!==void 0?n:t.custom,s,i)),typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"&&(e=e(n!==void 0?n:t.custom,s,i)),e}const Gt=t=>Array.isArray(t),Qo=t=>Boolean(t&&typeof t=="object"&&t.mix&&t.toValue),tr=t=>Gt(t)?t[t.length-1]||0:t;function Ut(t){const e=j(t)?t.get():t;return Qo(e)?e.toValue():e}function er({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},s,i,r){const o={latestValues:nr(s,i,r,t),renderState:e()};return n&&(o.mount=a=>n(s,a,o)),o}const Ws=t=>(e,n)=>{const s=m.useContext(Qt),i=m.useContext(Et),r=()=>er(t,e,s,i);return n?r():We(r)};function nr(t,e,n,s){const i={},r=s(t,{});for(const h in r)i[h]=Ut(r[h]);let{initial:o,animate:a}=t;const c=ne(t),l=Ls(t);e&&l&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const f=u?a:o;return f&&typeof f!="boolean"&&!ee(f)&&(Array.isArray(f)?f:[f]).forEach(d=>{const p=tn(t,d);if(!p)return;const{transitionEnd:g,transition:T,...P}=p;for(const x in P){let y=P[x];if(Array.isArray(y)){const v=u?y.length-1:0;y=y[v]}y!==null&&(i[x]=y)}for(const x in g)i[x]=g[x]}),i}const sr={useVisualState:Ws({scrapeMotionValuesFromProps:Hs,createRenderState:Us,onMount:(t,e,{renderState:n,latestValues:s})=>{try{n.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}Ye(n,s,{enableHardwareAcceleration:!1},Xe(e.tagName),t.transformTemplate),$s(e,n)}})},ir={useVisualState:Ws({scrapeMotionValuesFromProps:Qe,createRenderState:qe})};function or(t,{forwardMotionProps:e=!1},n,s){return{...Ke(t)?sr:ir,preloadedFeatures:n,useRender:Jo(e),createVisualElement:s,Component:t}}function $(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}const Gs=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function ie(t,e="page"){return{point:{x:t[e+"X"],y:t[e+"Y"]}}}const rr=t=>e=>Gs(e)&&t(e,ie(e));function H(t,e,n,s){return $(t,e,rr(n),s)}const ar=(t,e)=>n=>e(t(n)),X=(...t)=>t.reduce(ar);function Ks(t){let e=null;return()=>{const n=()=>{e=null};return e===null?(e=t,n):!1}}const Sn=Ks("dragHorizontal"),An=Ks("dragVertical");function Zs(t){let e=!1;if(t==="y")e=An();else if(t==="x")e=Sn();else{const n=Sn(),s=An();n&&s?e=()=>{n(),s()}:(n&&n(),s&&s())}return e}function qs(){const t=Zs(!0);return t?(t(),!1):!0}class tt{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Vn(t,e){const n="pointer"+(e?"enter":"leave"),s="onHover"+(e?"Start":"End"),i=(r,o)=>{if(r.type==="touch"||qs())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e),a[s]&&a[s](r,o)};return H(t.current,n,i,{passive:!t.getProps()[s]})}class cr extends tt{mount(){this.unmount=X(Vn(this.node,!0),Vn(this.node,!1))}unmount(){}}class lr extends tt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!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=X($(this.node.current,"focus",()=>this.onFocus()),$(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Ys=(t,e)=>e?t===e?!0:Ys(t,e.parentElement):!1,I=t=>t;function le(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,ie(n))}class ur extends tt{constructor(){super(...arguments),this.removeStartListeners=I,this.removeEndListeners=I,this.removeAccessibleListeners=I,this.startPointerPress=(e,n)=>{if(this.removeEndListeners(),this.isPressing)return;const s=this.node.getProps(),r=H(window,"pointerup",(a,c)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:u}=this.node.getProps();Ys(this.node.current,a.target)?l&&l(a,c):u&&u(a,c)},{passive:!(s.onTap||s.onPointerUp)}),o=H(window,"pointercancel",(a,c)=>this.cancelPress(a,c),{passive:!(s.onTapCancel||s.onPointerCancel)});this.removeEndListeners=X(r,o),this.startPress(e,n)},this.startAccessiblePress=()=>{const e=r=>{if(r.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||le("up",this.node.getProps().onTap)};this.removeEndListeners(),this.removeEndListeners=$(this.node.current,"keyup",o),le("down",(a,c)=>{this.startPress(a,c)})},n=$(this.node.current,"keydown",e),s=()=>{this.isPressing&&le("cancel",(r,o)=>this.cancelPress(r,o))},i=$(this.node.current,"blur",s);this.removeAccessibleListeners=X(n,i)}}startPress(e,n){this.isPressing=!0;const{onTapStart:s,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),s&&s(e,n)}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!qs()}cancelPress(e,n){if(!this.checkPressEnd())return;const{onTapCancel:s}=this.node.getProps();s&&s(e,n)}mount(){const e=this.node.getProps(),n=H(this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),s=$(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=X(n,s)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const Ve=new WeakMap,ue=new WeakMap,fr=t=>{const e=Ve.get(t.target);e&&e(t)},hr=t=>{t.forEach(fr)};function dr({root:t,...e}){const n=t||document;ue.has(n)||ue.set(n,{});const s=ue.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(hr,{root:t,...e})),s[i]}function pr(t,e,n){const s=dr(e);return Ve.set(t,n),s.observe(t),()=>{Ve.delete(t),s.unobserve(t)}}const mr={some:0,all:1};class gr extends tt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}viewportFallback(){requestAnimationFrame(()=>{this.hasEnteredView=!0;const{onViewportEnter:e}=this.node.getProps();e&&e(null),this.node.animationState&&this.node.animationState.setActive("whileInView",!0)})}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r,fallback:o=!0}=e;if(typeof IntersectionObserver>"u"){o&&this.viewportFallback();return}const a={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:mr[i]},c=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,r&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:f,onViewportLeave:h}=this.node.getProps(),d=u?f:h;d&&d(l)};return pr(this.node.current,a,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(yr(e,n))&&this.startObserver()}unmount(){}}function yr({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const vr={inView:{Feature:gr},tap:{Feature:ur},focus:{Feature:lr},hover:{Feature:cr}};function Xs(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s/^\-?\d*\.?\d+$/.test(t),Pr=t=>/^0[^.\s]+$/.test(t),W={delta:0,timestamp:0},Js=1/60*1e3,br=typeof performance<"u"?()=>performance.now():()=>Date.now(),Qs=typeof window<"u"?t=>window.requestAnimationFrame(t):t=>setTimeout(()=>t(br()),Js);function Tr(t){let e=[],n=[],s=0,i=!1,r=!1;const o=new WeakSet,a={schedule:(c,l=!1,u=!1)=>{const f=u&&i,h=f?e:n;return l&&o.add(c),h.indexOf(c)===-1&&(h.push(c),f&&i&&(s=e.length)),c},cancel:c=>{const l=n.indexOf(c);l!==-1&&n.splice(l,1),o.delete(c)},process:c=>{if(i){r=!0;return}if(i=!0,[e,n]=[n,e],n.length=0,s=e.length,s)for(let l=0;l(t[e]=Tr(()=>Vt=!0),t),{}),R=Bt.reduce((t,e)=>{const n=oe[e];return t[e]=(s,i=!1,r=!1)=>(Vt||Ar(),n.schedule(s,i,r)),t},{}),J=Bt.reduce((t,e)=>(t[e]=oe[e].cancel,t),{}),fe=Bt.reduce((t,e)=>(t[e]=()=>oe[e].process(W),t),{}),Sr=t=>oe[t].process(W),ti=t=>{Vt=!1,W.delta=we?Js:Math.max(Math.min(t-W.timestamp,Cr),1),W.timestamp=t,Me=!0,Bt.forEach(Sr),Me=!1,Vt&&(we=!1,Qs(ti))},Ar=()=>{Vt=!0,we=!0,Me||Qs(ti)};function en(t,e){t.indexOf(e)===-1&&t.push(e)}function nn(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class sn{constructor(){this.subscriptions=[]}add(e){return en(this.subscriptions,e),()=>nn(this.subscriptions,e)}notify(e,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,s);else for(let r=0;r!isNaN(parseFloat(t));class wr{constructor(e,n={}){this.version="9.1.7",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(s,i=!0)=>{this.prev=this.current,this.current=s;const{delta:r,timestamp:o}=W;this.lastUpdated!==o&&(this.timeDelta=r,this.lastUpdated=o,R.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=()=>R.postRender(this.velocityCheck),this.velocityCheck=({timestamp:s})=>{s!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=Vr(this.current),this.owner=n.owner}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new sn);const s=this.events[e].add(n);return e==="change"?()=>{s(),R.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,s){this.set(n),this.prev=e,this.timeDelta=s}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?on(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n)||null,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(){this.animation=null}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function dt(t,e){return new wr(t,e)}const rn=(t,e)=>n=>Boolean(Lt(n)&&Oo.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),ei=(t,e,n)=>s=>{if(!Lt(s))return s;const[i,r,o,a]=s.match(At);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Mr=t=>ht(0,255,t),he={...rt,transform:t=>Math.round(Mr(t))},it={test:rn("rgb","red"),parse:ei("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+he.transform(t)+", "+he.transform(e)+", "+he.transform(n)+", "+xt(vt.transform(s))+")"};function Dr(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const De={test:rn("#"),parse:Dr,transform:it.transform},ut={test:rn("hsl","hue"),parse:ei("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+z.transform(xt(e))+", "+z.transform(xt(n))+", "+xt(vt.transform(s))+")"},E={test:t=>it.test(t)||De.test(t)||ut.test(t),parse:t=>it.test(t)?it.parse(t):ut.test(t)?ut.parse(t):De.parse(t),transform:t=>Lt(t)?t:t.hasOwnProperty("red")?it.transform(t):ut.transform(t)},ni="${c}",si="${n}";function Rr(t){var e,n;return isNaN(t)&&Lt(t)&&(((e=t.match(At))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Ae))===null||n===void 0?void 0:n.length)||0)>0}function Kt(t){typeof t=="number"&&(t=`${t}`);const e=[];let n=0,s=0;const i=t.match(Ae);i&&(n=i.length,t=t.replace(Ae,ni),e.push(...i.map(E.parse)));const r=t.match(At);return r&&(s=r.length,t=t.replace(At,si),e.push(...r.map(rt.parse))),{values:e,numColors:n,numNumbers:s,tokenised:t}}function ii(t){return Kt(t).values}function oi(t){const{values:e,numColors:n,tokenised:s}=Kt(t),i=e.length;return r=>{let o=s;for(let a=0;atypeof t=="number"?0:t;function Lr(t){const e=ii(t);return oi(t)(e.map(Er))}const Q={test:Rr,parse:ii,createTransformer:oi,getAnimatableNone:Lr},jr=new Set(["brightness","contrast","saturate","opacity"]);function Br(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[s]=n.match(At)||[];if(!s)return t;const i=n.replace(s,"");let r=jr.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const kr=/([a-z-]*)\(.*?\)/g,Re={...Q,getAnimatableNone:t=>{const e=t.match(kr);return e?e.map(Br).join(" "):t}},Fr={...Is,color:E,backgroundColor:E,outlineColor:E,fill:E,stroke:E,borderColor:E,borderTopColor:E,borderRightColor:E,borderBottomColor:E,borderLeftColor:E,filter:Re,WebkitFilter:Re},an=t=>Fr[t];function cn(t,e){let n=an(t);return n!==Re&&(n=Q),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ri=t=>e=>e.test(t),Ir={test:t=>t==="auto",parse:t=>t},ai=[rt,b,z,q,Uo,No,Ir],pt=t=>ai.find(ri(t)),Or=[...ai,E,Q],Nr=t=>Or.find(ri(t));function Ur(t){const e={};return t.values.forEach((n,s)=>e[s]=n.get()),e}function _r(t){const e={};return t.values.forEach((n,s)=>e[s]=n.getVelocity()),e}function re(t,e,n){const s=t.getProps();return tn(s,e,n!==void 0?n:s.custom,Ur(t),_r(t))}function zr(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,dt(n))}function $r(t,e){const n=re(t,e);let{transitionEnd:s={},transition:i={},...r}=n?t.makeTargetAnimatable(n,!1):{};r={...r,...s};for(const o in r){const a=tr(r[o]);zr(t,o,a)}}function Hr(t,e,n){var s,i;const r=Object.keys(e).filter(a=>!t.hasValue(a)),o=r.length;if(o)for(let a=0;at*1e3,Yr={current:!1},ln=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,un=t=>e=>1-t(1-e),fn=t=>t*t,Xr=un(fn),hn=ln(fn),A=(t,e,n)=>-n*t+n*e+t;function de(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Jr({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,e/=100,n/=100;let i=0,r=0,o=0;if(!e)i=r=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,c=2*n-a;i=de(c,a,t+1/3),r=de(c,a,t),o=de(c,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:s}}const pe=(t,e,n)=>{const s=t*t;return Math.sqrt(Math.max(0,n*(e*e-s)+s))},Qr=[De,it,ut],ta=t=>Qr.find(e=>e.test(t));function wn(t){const e=ta(t);let n=e.parse(t);return e===ut&&(n=Jr(n)),n}const ci=(t,e)=>{const n=wn(t),s=wn(e),i={...n};return r=>(i.red=pe(n.red,s.red,r),i.green=pe(n.green,s.green,r),i.blue=pe(n.blue,s.blue,r),i.alpha=A(n.alpha,s.alpha,r),it.transform(i))};function li(t,e){return typeof t=="number"?n=>A(t,e,n):E.test(t)?ci(t,e):fi(t,e)}const ui=(t,e)=>{const n=[...t],s=n.length,i=t.map((r,o)=>li(r,e[o]));return r=>{for(let o=0;o{const n={...t,...e},s={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(s[i]=li(t[i],e[i]));return i=>{for(const r in s)n[r]=s[r](i);return n}},fi=(t,e)=>{const n=Q.createTransformer(e),s=Kt(t),i=Kt(e);return s.numColors===i.numColors&&s.numNumbers>=i.numNumbers?X(ui(s.values,i.values),n):o=>`${o>0?e:t}`},wt=(t,e,n)=>{const s=e-t;return s===0?1:(n-t)/s},Mn=(t,e)=>n=>A(t,e,n);function na(t){return typeof t=="number"?Mn:typeof t=="string"?E.test(t)?ci:fi:Array.isArray(t)?ui:typeof t=="object"?ea:Mn}function sa(t,e,n){const s=[],i=n||na(t[0]),r=t.length-1;for(let o=0;ot[r-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=sa(e,s,i),a=o.length,c=l=>{let u=0;if(a>1)for(;uc(ht(t[0],t[r-1],l)):c}function ia(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=wt(0,e,s);t.push(A(n,1,i))}}function oa(t){const e=[0];return ia(e,t.length-1),e}function ra(t,e){return t.map(n=>n*e)}const di=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,aa=1e-7,ca=12;function la(t,e,n,s,i){let r,o,a=0;do o=e+(n-e)/2,r=di(o,s,i)-t,r>0?n=o:e=o;while(Math.abs(r)>aa&&++ala(r,0,1,t,n);return r=>r===0||r===1?r:di(i(r),e,s)}const mi=t=>1-Math.sin(Math.acos(t)),dn=un(mi),ua=ln(dn),gi=pi(.33,1.53,.69,.99),pn=un(gi),fa=ln(pn),ha=t=>(t*=2)<1?.5*pn(t):.5*(2-Math.pow(2,-10*(t-1))),da={linear:I,easeIn:fn,easeInOut:hn,easeOut:Xr,circIn:mi,circInOut:ua,circOut:dn,backIn:pn,backInOut:fa,backOut:gi,anticipate:ha},Dn=t=>{if(Array.isArray(t)){qt(t.length===4);const[e,n,s,i]=t;return pi(e,n,s,i)}else if(typeof t=="string")return da[t];return t},pa=t=>Array.isArray(t)&&typeof t[0]!="number";function ma(t,e){return t.map(()=>e||hn).splice(0,t.length-1)}function Ee({keyframes:t,ease:e=hn,times:n,duration:s=300}){t=[...t];const i=pa(e)?e.map(Dn):Dn(e),r={done:!1,value:t[0]},o=ra(n&&n.length===t.length?n:oa(t),s);function a(){return hi(o,t,{ease:Array.isArray(i)?i:ma(t,i)})}let c=a();return{next:l=>(r.value=c(l),r.done=l>=s,r),flipTarget:()=>{t.reverse(),c=a()}}}const me=.001,ga=.01,Rn=10,ya=.05,va=1;function xa({duration:t=800,bounce:e=.25,velocity:n=0,mass:s=1}){let i,r;qr(t<=Rn*1e3);let o=1-e;o=ht(ya,va,o),t=ht(ga,Rn,t/1e3),o<1?(i=l=>{const u=l*o,f=u*t,h=u-n,d=Le(l,o),p=Math.exp(-f);return me-h/d*p},r=l=>{const f=l*o*t,h=f*n+n,d=Math.pow(o,2)*Math.pow(l,2)*t,p=Math.exp(-f),g=Le(Math.pow(l,2),o);return(-i(l)+me>0?-1:1)*((h-d)*p)/g}):(i=l=>{const u=Math.exp(-l*t),f=(l-n)*t+1;return-me+u*f},r=l=>{const u=Math.exp(-l*t),f=(n-l)*(t*t);return u*f});const a=5/t,c=ba(i,r,a);if(t=t*1e3,isNaN(c))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(c,2)*s;return{stiffness:l,damping:o*2*Math.sqrt(s*l),duration:t}}}const Pa=12;function ba(t,e,n){let s=n;for(let i=1;it[n]!==void 0)}function Sa(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!En(t,Ca)&&En(t,Ta)){const n=xa(t);e={...e,...n,velocity:0,mass:1},e.isResolvedFromDuration=!0}return e}const Aa=5;function yi({keyframes:t,restDelta:e,restSpeed:n,...s}){let i=t[0],r=t[t.length-1];const o={done:!1,value:i},{stiffness:a,damping:c,mass:l,velocity:u,duration:f,isResolvedFromDuration:h}=Sa(s);let d=Va,p=u?-(u/1e3):0;const g=c/(2*Math.sqrt(a*l));function T(){const P=r-i,x=Math.sqrt(a/l)/1e3,y=Math.abs(P)<5;if(n||(n=y?.01:2),e||(e=y?.005:.5),g<1){const v=Le(x,g);d=S=>{const w=Math.exp(-g*x*S);return r-w*((p+g*x*P)/v*Math.sin(v*S)+P*Math.cos(v*S))}}else if(g===1)d=v=>r-Math.exp(-x*v)*(P+(p+x*P)*v);else{const v=x*Math.sqrt(g*g-1);d=S=>{const w=Math.exp(-g*x*S),D=Math.min(v*S,300);return r-w*((p+g*x*P)*Math.sinh(D)+v*P*Math.cosh(D))/v}}}return T(),{next:P=>{const x=d(P);if(h)o.done=P>=f;else{let y=p;if(P!==0)if(g<1){const w=Math.max(0,P-Aa);y=on(x-d(w),P-w)}else y=0;const v=Math.abs(y)<=n,S=Math.abs(r-x)<=e;o.done=v&&S}return o.value=o.done?r:x,o},flipTarget:()=>{p=-p,[i,r]=[r,i],T()}}}yi.needsInterpolation=(t,e)=>typeof t=="string"||typeof e=="string";const Va=t=>0;function wa({keyframes:t=[0],velocity:e=0,power:n=.8,timeConstant:s=350,restDelta:i=.5,modifyTarget:r}){const o=t[0],a={done:!1,value:o};let c=n*e;const l=o+c,u=r===void 0?l:r(l);return u!==l&&(c=u-o),{next:f=>{const h=-c*Math.exp(-f/s);return a.done=!(h>i||h<-i),a.value=a.done?u:u+h,a},flipTarget:()=>{}}}const Ma={decay:wa,keyframes:Ee,tween:Ee,spring:yi};function vi(t,e,n=0){return t-e-n}function Da(t,e=0,n=0,s=!0){return s?vi(e+-t,e,n):e-(t-e)+n}function Ra(t,e,n,s){return s?t>=e+n:t<=-n}const Ea=t=>{const e=({delta:n})=>t(n);return{start:()=>R.update(e,!0),stop:()=>J.update(e)}};function Yt({duration:t,driver:e=Ea,elapsed:n=0,repeat:s=0,repeatType:i="loop",repeatDelay:r=0,keyframes:o,autoplay:a=!0,onPlay:c,onStop:l,onComplete:u,onRepeat:f,onUpdate:h,type:d="keyframes",...p}){const g=n;let T,P=0,x=t,y=!1,v=!0,S;const w=Ma[o.length>2?"keyframes":d]||Ee,D=o[0],N=o[o.length-1];let k={done:!1,value:D};const{needsInterpolation:O}=w;O&&O(D,N)&&(S=hi([0,100],[D,N],{clamp:!1}),o=[0,100]);const K=w({...p,duration:t,keyframes:o});function Ft(){P++,i==="reverse"?(v=P%2===0,n=Da(n,x,r,v)):(n=vi(n,x,r),i==="mirror"&&K.flipTarget()),y=!1,f&&f()}function ae(){T&&T.stop(),u&&u()}function Z(L){v||(L=-L),n+=L,y||(k=K.next(Math.max(0,n)),S&&(k.value=S(k.value)),y=v?k.done:n<=0),h&&h(k.value),y&&(P===0&&(x=x!==void 0?x:n),P{l&&l(),T&&T.stop()},set currentTime(L){n=g,Z(L)},sample:L=>{n=g;const at=t&&typeof t=="number"?Math.max(t*.5,50):50;let ce=0;for(Z(0);ce<=L;){const Xi=L-ce;Z(Math.min(Xi,at)),ce+=at}return k}}}function La(t){return!t||Array.isArray(t)||typeof t=="string"&&xi[t]}const gt=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,xi={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:gt([0,.65,.55,1]),circOut:gt([.55,0,1,.45]),backIn:gt([.31,.01,.66,-.59]),backOut:gt([.33,1.53,.69,.99])};function ja(t){if(t)return Array.isArray(t)?gt(t):xi[t]}function Ba(t,e,n,{delay:s=0,duration:i,repeat:r=0,repeatType:o="loop",ease:a,times:c}={}){return t.animate({[e]:n,offset:c},{delay:s,duration:i,easing:ja(a),fill:"both",iterations:r+1,direction:o==="reverse"?"alternate":"normal"})}const Ln={waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate")},ge={},Pi={};for(const t in Ln)Pi[t]=()=>(ge[t]===void 0&&(ge[t]=Ln[t]()),ge[t]);function ka(t,{repeat:e,repeatType:n="loop"}){const s=e&&n!=="loop"&&e%2===1?0:t.length-1;return t[s]}const Fa=new Set(["opacity","clipPath","filter","transform"]),Ot=10;function Ia(t,e,{onUpdate:n,onComplete:s,...i}){if(!(Pi.waapi()&&Fa.has(e)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0))return!1;let{keyframes:o,duration:a=300,elapsed:c=0,ease:l}=i;if(i.type==="spring"||!La(i.ease)){if(i.repeat===1/0)return;const f=Yt({...i,elapsed:0});let h={done:!1,value:o[0]};const d=[];let p=0;for(;!h.done&&p<2e4;)h=f.sample(p),d.push(h.value),p+=Ot;o=d,a=p-Ot,l="linear"}const u=Ba(t.owner.current,e,o,{...i,delay:-c,duration:a,ease:l});return u.onfinish=()=>{t.set(ka(o,i)),R.update(()=>u.cancel()),s&&s()},{get currentTime(){return u.currentTime||0},set currentTime(f){u.currentTime=f},stop:()=>{const{currentTime:f}=u;if(f){const h=Yt({...i,autoplay:!1});t.setWithVelocity(h.sample(f-Ot).value,h.sample(f).value,Ot)}R.update(()=>u.cancel())}}}function bi(t,e){const n=performance.now(),s=({timestamp:i})=>{const r=i-n;r>=e&&(J.read(s),t(r-e))};return R.read(s,!0),()=>J.read(s)}function Oa({keyframes:t,elapsed:e,onUpdate:n,onComplete:s}){const i=()=>{n&&n(t[t.length-1]),s&&s()};return e?{stop:bi(i,-e)}:i()}function Na({keyframes:t,velocity:e=0,min:n,max:s,power:i=.8,timeConstant:r=750,bounceStiffness:o=500,bounceDamping:a=10,restDelta:c=1,modifyTarget:l,driver:u,onUpdate:f,onComplete:h,onStop:d}){const p=t[0];let g;function T(v){return n!==void 0&&vs}function P(v){return n===void 0?s:s===void 0||Math.abs(n-v){f&&f(S),v.onUpdate&&v.onUpdate(S)},onComplete:h,onStop:d})}function y(v){x({type:"spring",stiffness:o,damping:a,restDelta:c,...v})}if(T(p))y({velocity:e,keyframes:[p,P(p)]});else{let v=i*e+p;typeof l<"u"&&(v=l(v));const S=P(v),w=S===n?-1:1;let D,N;const k=O=>{D=N,N=O,e=on(O-D,W.delta),(w===1&&O>S||w===-1&&Og&&g.stop()}}const Ua={type:"spring",stiffness:500,damping:25,restSpeed:10},_a=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),za={type:"keyframes",duration:.8},$a={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ha=(t,{keyframes:e})=>e.length>2?za:ot.has(t)?t.startsWith("scale")?_a(e[1]):Ua:$a,je=(t,e)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&Q.test(e)&&!e.startsWith("url("));function Wa({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:o,repeatDelay:a,from:c,elapsed:l,...u}){return!!Object.keys(u).length}function jn(t){return t===0||typeof t=="string"&&parseFloat(t)===0&&t.indexOf(" ")===-1}function Bn(t){return typeof t=="number"?0:cn("",t)}function Ti(t,e){return t[e]||t.default||t}function Ga(t,e,n,s){const i=je(e,n);let r=s.from!==void 0?s.from:t.get();return r==="none"&&i&&typeof n=="string"?r=cn(e,n):jn(r)&&typeof n=="string"?r=Bn(n):!Array.isArray(n)&&jn(n)&&typeof r=="string"&&(n=Bn(r)),Array.isArray(n)?(n[0]===null&&(n[0]=r),n):[r,n]}const mn=(t,e,n,s={})=>i=>{const r=Ti(s,t)||{},o=r.delay||s.delay||0;let{elapsed:a=0}=s;a=a-_t(o);const c=Ga(e,t,n,r),l=c[0],u=c[c.length-1],f=je(t,l),h=je(t,u);let d={keyframes:c,velocity:e.getVelocity(),...r,elapsed:a,onUpdate:p=>{e.set(p),r.onUpdate&&r.onUpdate(p)},onComplete:()=>{i(),r.onComplete&&r.onComplete()}};if(!f||!h||Yr.current||r.type===!1)return Oa(d);if(r.type==="inertia")return Na(d);if(Wa(r)||(d={...d,...Ha(t,d)}),d.duration&&(d.duration=_t(d.duration)),d.repeatDelay&&(d.repeatDelay=_t(d.repeatDelay)),e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate){const p=Ia(e,t,d);if(p)return p}return Yt(d)};function Ka(t,e,n={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const i=e.map(r=>Be(t,r,n));s=Promise.all(i)}else if(typeof e=="string")s=Be(t,e,n);else{const i=typeof e=="function"?re(t,e,n.custom):e;s=Ci(t,i,n)}return s.then(()=>t.notify("AnimationComplete",e))}function Be(t,e,n={}){const s=re(t,e,n.custom);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const r=s?()=>Ci(t,s,n):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:l=0,staggerChildren:u,staggerDirection:f}=i;return Za(t,e,l+c,u,f,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[c,l]=a==="beforeChildren"?[r,o]:[o,r];return c().then(l)}else return Promise.all([r(),o(n.delay)])}function Ci(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:r=t.getDefaultTransition(),transitionEnd:o,...a}=t.makeTargetAnimatable(e);const c=t.getValue("willChange");s&&(r=s);const l=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const f in a){const h=t.getValue(f),d=a[f];if(!h||d===void 0||u&&Ya(u,f))continue;const p={delay:n,elapsed:0,...r};if(window.HandoffAppearAnimations&&!h.hasAnimated){const T=t.getProps()[Zr];T&&(p.elapsed=window.HandoffAppearAnimations(T,f,h,R))}let g=h.start(mn(f,h,d,t.shouldReduceMotion&&ot.has(f)?{type:!1}:p));Zt(c)&&(c.add(f),g=g.then(()=>c.remove(f))),l.push(g)}return Promise.all(l).then(()=>{o&&$r(t,o)})}function Za(t,e,n=0,s=0,i=1,r){const o=[],a=(t.variantChildren.size-1)*s,c=i===1?(l=0)=>l*s:(l=0)=>a-l*s;return Array.from(t.variantChildren).sort(qa).forEach((l,u)=>{l.notify("AnimationStart",e),o.push(Be(l,e,{...r,delay:n+c(u)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function qa(t,e){return t.sortNodePosition(e)}function Ya({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,s}const Xa=[...$e].reverse(),Ja=$e.length;function Qa(t){return e=>Promise.all(e.map(({animation:n,options:s})=>Ka(t,n,s)))}function tc(t){let e=Qa(t);const n=nc();let s=!0;const i=(c,l)=>{const u=re(t,l);if(u){const{transition:f,transitionEnd:h,...d}=u;c={...c,...d,...h}}return c};function r(c){e=c(t)}function o(c,l){const u=t.getProps(),f=t.getVariantContext(!0)||{},h=[],d=new Set;let p={},g=1/0;for(let P=0;Pg&&S;const O=Array.isArray(v)?v:[v];let K=O.reduce(i,{});w===!1&&(K={});const{prevResolvedValues:Ft={}}=y,ae={...Ft,...K},Z=M=>{k=!0,d.delete(M),y.needsAnimating[M]=!0};for(const M in ae){const L=K[M],at=Ft[M];p.hasOwnProperty(M)||(L!==at?Gt(L)&&Gt(at)?!Xs(L,at)||N?Z(M):y.protectedKeys[M]=!0:L!==void 0?Z(M):d.add(M):L!==void 0&&d.has(M)?Z(M):y.protectedKeys[M]=!0)}y.prevProp=v,y.prevResolvedValues=K,y.isActive&&(p={...p,...K}),s&&t.blockInitialAnimation&&(k=!1),k&&!D&&h.push(...O.map(M=>({animation:M,options:{type:x,...c}})))}if(d.size){const P={};d.forEach(x=>{const y=t.getBaseTarget(x);y!==void 0&&(P[x]=y)}),h.push({animation:P})}let T=Boolean(h.length);return s&&u.initial===!1&&!t.manuallyAnimateOnMount&&(T=!1),s=!1,T?e(h):Promise.resolve()}function a(c,l,u){var f;if(n[c].isActive===l)return Promise.resolve();(f=t.variantChildren)===null||f===void 0||f.forEach(d=>{var p;return(p=d.animationState)===null||p===void 0?void 0:p.setActive(c,l)}),n[c].isActive=l;const h=o(u,c);for(const d in n)n[d].protectedKeys={};return h}return{animateChanges:o,setActive:a,setAnimateFunction:r,getState:()=>n}}function ec(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Xs(e,t):!1}function et(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function nc(){return{animate:et(!0),whileInView:et(),whileHover:et(),whileTap:et(),whileDrag:et(),whileFocus:et(),exit:et()}}class sc extends tt{constructor(e){super(e),e.animationState||(e.animationState=tc(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),ee(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let ic=0;class oc extends tt{constructor(){super(...arguments),this.id=ic++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n,custom:s}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const r=this.node.animationState.setActive("exit",!e,{custom:s??this.node.getProps().custom});n&&!e&&r.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const rc={animation:{Feature:sc},exit:{Feature:oc}},kn=(t,e)=>Math.abs(t-e);function ac(t,e){const n=kn(t.x,e.x),s=kn(t.y,e.y);return Math.sqrt(n**2+s**2)}class Si{constructor(e,n,{transformPagePoint:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const l=ve(this.lastMoveEventInfo,this.history),u=this.startEvent!==null,f=ac(l.offset,{x:0,y:0})>=3;if(!u&&!f)return;const{point:h}=l,{timestamp:d}=W;this.history.push({...h,timestamp:d});const{onStart:p,onMove:g}=this.handlers;u||(p&&p(this.lastMoveEvent,l),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,l)},this.handlePointerMove=(l,u)=>{this.lastMoveEvent=l,this.lastMoveEventInfo=ye(u,this.transformPagePoint),R.update(this.updatePoint,!0)},this.handlePointerUp=(l,u)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:f,onSessionEnd:h}=this.handlers,d=ve(l.type==="pointercancel"?this.lastMoveEventInfo:ye(u,this.transformPagePoint),this.history);this.startEvent&&f&&f(l,d),h&&h(l,d)},!Gs(e))return;this.handlers=n,this.transformPagePoint=s;const i=ie(e),r=ye(i,this.transformPagePoint),{point:o}=r,{timestamp:a}=W;this.history=[{...o,timestamp:a}];const{onSessionStart:c}=n;c&&c(e,ve(r,this.history)),this.removeListeners=X(H(window,"pointermove",this.handlePointerMove),H(window,"pointerup",this.handlePointerUp),H(window,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),J.update(this.updatePoint)}}function ye(t,e){return e?{point:e(t.point)}:t}function Fn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function ve({point:t},e){return{point:t,delta:Fn(t,Ai(e)),offset:Fn(t,cc(e)),velocity:lc(e,.1)}}function cc(t){return t[0]}function Ai(t){return t[t.length-1]}function lc(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const i=Ai(t);for(;n>=0&&(s=t[n],!(i.timestamp-s.timestamp>_t(e)));)n--;if(!s)return{x:0,y:0};const r=(i.timestamp-s.timestamp)/1e3;if(r===0)return{x:0,y:0};const o={x:(i.x-s.x)/r,y:(i.y-s.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function B(t){return t.max-t.min}function ke(t,e=0,n=.01){return Math.abs(t-e)<=n}function In(t,e,n,s=.5){t.origin=s,t.originPoint=A(e.min,e.max,t.origin),t.scale=B(n)/B(e),(ke(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=A(n.min,n.max,t.origin)-t.originPoint,(ke(t.translate)||isNaN(t.translate))&&(t.translate=0)}function Pt(t,e,n,s){In(t.x,e.x,n.x,s?s.originX:void 0),In(t.y,e.y,n.y,s?s.originY:void 0)}function On(t,e,n){t.min=n.min+e.min,t.max=t.min+B(e)}function uc(t,e,n){On(t.x,e.x,n.x),On(t.y,e.y,n.y)}function Nn(t,e,n){t.min=e.min-n.min,t.max=t.min+B(e)}function bt(t,e,n){Nn(t.x,e.x,n.x),Nn(t.y,e.y,n.y)}function fc(t,{min:e,max:n},s){return e!==void 0&&tn&&(t=s?A(n,t,s.max):Math.min(t,n)),t}function Un(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function hc(t,{top:e,left:n,bottom:s,right:i}){return{x:Un(t.x,n,i),y:Un(t.y,e,s)}}function _n(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.mins?n=wt(e.min,e.max-s,t.min):s>i&&(n=wt(t.min,t.max-i,e.min)),ht(0,1,n)}function mc(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Fe=.35;function gc(t=Fe){return t===!1?t=0:t===!0&&(t=Fe),{x:zn(t,"left","right"),y:zn(t,"top","bottom")}}function zn(t,e,n){return{min:$n(t,e),max:$n(t,n)}}function $n(t,e){return typeof t=="number"?t:t[e]||0}const Hn=()=>({translate:0,scale:1,origin:0,originPoint:0}),Tt=()=>({x:Hn(),y:Hn()}),Wn=()=>({min:0,max:0}),V=()=>({x:Wn(),y:Wn()});function U(t){return[t("x"),t("y")]}function Vi({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function yc({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function vc(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function xe(t){return t===void 0||t===1}function Ie({scale:t,scaleX:e,scaleY:n}){return!xe(t)||!xe(e)||!xe(n)}function nt(t){return Ie(t)||wi(t)||t.z||t.rotate||t.rotateX||t.rotateY}function wi(t){return Gn(t.x)||Gn(t.y)}function Gn(t){return t&&t!=="0%"}function Xt(t,e,n){const s=t-n,i=e*s;return n+i}function Kn(t,e,n,s,i){return i!==void 0&&(t=Xt(t,i,s)),Xt(t,n,s)+e}function Oe(t,e=0,n=1,s,i){t.min=Kn(t.min,e,n,s,i),t.max=Kn(t.max,e,n,s,i)}function Mi(t,{x:e,y:n}){Oe(t.x,e.translate,e.scale,e.originPoint),Oe(t.y,n.translate,n.scale,n.originPoint)}function xc(t,e,n,s=!1){const i=n.length;if(!i)return;e.x=e.y=1;let r,o;for(let a=0;a1.0000000000001||t<.999999999999?t:1}function Y(t,e){t.min=t.min+e,t.max=t.max+e}function qn(t,e,[n,s,i]){const r=e[i]!==void 0?e[i]:.5,o=A(t.min,t.max,r);Oe(t,e[n],e[s],o,e.scale)}const Pc=["x","scaleX","originX"],bc=["y","scaleY","originY"];function ft(t,e){qn(t.x,e,Pc),qn(t.y,e,bc)}function Di(t,e){return Vi(vc(t.getBoundingClientRect(),e))}function Tc(t,e,n){const s=Di(t,n),{scroll:i}=e;return i&&(Y(s.x,i.offset.x),Y(s.y,i.offset.y)),s}const Cc=new WeakMap;class Sc{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=V(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=c=>{this.stopAnimation(),n&&this.snapToCursor(ie(c,"page").point)},r=(c,l)=>{const{drag:u,dragPropagation:f,onDragStart:h}=this.getProps();if(u&&!f&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Zs(u),!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),U(p=>{let g=this.getAxisMotionValue(p).get()||0;if(z.test(g)){const{projection:T}=this.visualElement;if(T&&T.layout){const P=T.layout.layoutBox[p];P&&(g=B(P)*(parseFloat(g)/100))}}this.originPoint[p]=g}),h&&h(c,l);const{animationState:d}=this.visualElement;d&&d.setActive("whileDrag",!0)},o=(c,l)=>{const{dragPropagation:u,dragDirectionLock:f,onDirectionLock:h,onDrag:d}=this.getProps();if(!u&&!this.openGlobalLock)return;const{offset:p}=l;if(f&&this.currentDirection===null){this.currentDirection=Ac(p),this.currentDirection!==null&&h&&h(this.currentDirection);return}this.updateAxis("x",l.point,p),this.updateAxis("y",l.point,p),this.visualElement.render(),d&&d(c,l)},a=(c,l)=>this.stop(c,l);this.panSession=new Si(e,{onSessionStart:i,onStart:r,onMove:o,onSessionEnd:a},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(e,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:r}=this.getProps();r&&r(e,n)}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,s){const{drag:i}=this.getProps();if(!s||!Nt(e,i,this.currentDirection))return;const r=this.getAxisMotionValue(e);let o=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(o=fc(o,this.constraints[e],this.elastic[e])),r.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),{layout:s}=this.visualElement.projection||{},i=this.constraints;e&<(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=hc(s.layoutBox,e):this.constraints=!1,this.elastic=gc(n),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&U(r=>{this.getAxisMotionValue(r)&&(this.constraints[r]=mc(s.layoutBox[r],this.constraints[r]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!lt(e))return!1;const s=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const r=Tc(s,i.root,this.visualElement.getTransformPagePoint());let o=dc(i.layout.layoutBox,r);if(n){const a=n(yc(o));this.hasMutatedConstraints=!!a,a&&(o=Vi(a))}return o}startAnimation(e){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=U(u=>{if(!Nt(u,n,this.currentDirection))return;let f=c&&c[u]||{};o&&(f={min:0,max:0});const h=i?200:1e6,d=i?40:1e7,p={type:"inertia",velocity:s?e[u]:0,bounceStiffness:h,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...r,...f};return this.startAxisValueAnimation(u,p)});return Promise.all(l).then(a)}startAxisValueAnimation(e,n){const s=this.getAxisMotionValue(e);return s.start(mn(e,s,0,n))}stopAnimation(){U(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n="_drag"+e.toUpperCase(),s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){U(n=>{const{drag:s}=this.getProps();if(!Nt(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,r=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[n];r.set(e[n]-A(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!lt(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};U(o=>{const a=this.getAxisMotionValue(o);if(a){const c=a.get();i[o]=pc({min:c,max:c},this.constraints[o])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),U(o=>{if(!Nt(o,e,null))return;const a=this.getAxisMotionValue(o),{min:c,max:l}=this.constraints[o];a.set(A(c,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;Cc.set(this.visualElement,this);const e=this.visualElement.current,n=H(e,"pointerdown",c=>{const{drag:l,dragListener:u=!0}=this.getProps();l&&u&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();lt(c)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,r=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),s();const o=$(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:l})=>{this.isDragging&&l&&(U(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=c[u].translate,f.set(f.get()+c[u].translate))}),this.visualElement.render())});return()=>{o(),n(),r(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:o=Fe,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:o,dragMomentum:a}}}function Nt(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Ac(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class Vc extends tt{constructor(e){super(e),this.removeGroupControls=I,this.removeListeners=I,this.controls=new Sc(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||I}unmount(){this.removeGroupControls(),this.removeListeners()}}class wc extends tt{constructor(){super(...arguments),this.removePointerDownListener=I}onPointerDown(e){this.session=new Si(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:e,onStart:n,onMove:s,onEnd:(r,o)=>{delete this.session,i&&i(r,o)}}}mount(){this.removePointerDownListener=H(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function Mc(){const t=m.useContext(Et);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:n,register:s}=t,i=m.useId();return m.useEffect(()=>s(i),[]),!e&&n?[!1,()=>n&&n(i)]:[!0]}function Dc(){return Rc(m.useContext(Et))}function Rc(t){return t===null?!0:t.isPresent}function Yn(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const mt={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(b.test(t))t=parseFloat(t);else return t;const n=Yn(t,e.target.x),s=Yn(t,e.target.y);return`${n}% ${s}%`}},Ri=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Ec(t){const e=Ri.exec(t);if(!e)return[,];const[,n,s]=e;return[n,s]}function Ne(t,e,n=1){const[s,i]=Ec(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);return r?r.trim():Se(i)?Ne(i,e,n+1):i}function Lc(t,{...e},n){const s=t.current;if(!(s instanceof Element))return{target:e,transitionEnd:n};n&&(n={...n}),t.values.forEach(i=>{const r=i.get();if(!Se(r))return;const o=Ne(r,s);o&&i.set(o)});for(const i in e){const r=e[i];if(!Se(r))continue;const o=Ne(r,s);o&&(e[i]=o,n&&n[i]===void 0&&(n[i]=r))}return{target:e,transitionEnd:n}}const Xn="_$css",jc={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,i=t.includes("var("),r=[];i&&(t=t.replace(Ri,d=>(r.push(d),Xn)));const o=Q.parse(t);if(o.length>5)return s;const a=Q.createTransformer(t),c=typeof o[0]!="number"?1:0,l=n.x.scale*e.x,u=n.y.scale*e.y;o[0+c]/=l,o[1+c]/=u;const f=A(l,u,.5);typeof o[2+c]=="number"&&(o[2+c]/=f),typeof o[3+c]=="number"&&(o[3+c]/=f);let h=a(o);if(i){let d=0;h=h.replace(Xn,()=>{const p=r[d];return d++,p})}return h}};class Bc extends Ss.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=e;jo(kc),r&&(n.group&&n.group.add(r),s&&s.register&&i&&s.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),yt.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:s,drag:i,isPresent:r}=this.props,o=s.projection;return o&&(o.isPresent=r,i||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==r&&(r?o.promote():o.relegate()||R.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),!e.currentAnimation&&e.isLead()&&this.safeToRemove())}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Ei(t){const[e,n]=Mc(),s=m.useContext(Ge);return Ss.createElement(Bc,{...t,layoutGroup:s,switchLayoutGroup:m.useContext(js),isPresent:e,safeToRemove:n})}const kc={borderRadius:{...mt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:mt,borderTopRightRadius:mt,borderBottomLeftRadius:mt,borderBottomRightRadius:mt,boxShadow:jc};function Fc(t,e,n={}){const s=j(t)?t:dt(t);return s.start(mn("",s,e,n)),{stop:()=>s.stop(),isAnimating:()=>s.isAnimating()}}const Li=["TopLeft","TopRight","BottomLeft","BottomRight"],Ic=Li.length,Jn=t=>typeof t=="string"?parseFloat(t):t,Qn=t=>typeof t=="number"||b.test(t);function Oc(t,e,n,s,i,r){i?(t.opacity=A(0,n.opacity!==void 0?n.opacity:1,Nc(s)),t.opacityExit=A(e.opacity!==void 0?e.opacity:1,0,Uc(s))):r&&(t.opacity=A(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,s));for(let o=0;ose?1:n(wt(t,e,s))}function es(t,e){t.min=e.min,t.max=e.max}function F(t,e){es(t.x,e.x),es(t.y,e.y)}function ns(t,e,n,s,i){return t-=e,t=Xt(t,1/n,s),i!==void 0&&(t=Xt(t,1/i,s)),t}function _c(t,e=0,n=1,s=.5,i,r=t,o=t){if(z.test(e)&&(e=parseFloat(e),e=A(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=A(r.min,r.max,s);t===r&&(a-=e),t.min=ns(t.min,e,n,a,i),t.max=ns(t.max,e,n,a,i)}function ss(t,e,[n,s,i],r,o){_c(t,e[n],e[s],e[i],e.scale,r,o)}const zc=["x","scaleX","originX"],$c=["y","scaleY","originY"];function is(t,e,n,s){ss(t.x,e,zc,n?n.x:void 0,s?s.x:void 0),ss(t.y,e,$c,n?n.y:void 0,s?s.y:void 0)}function os(t){return t.translate===0&&t.scale===1}function Bi(t){return os(t.x)&&os(t.y)}function Ue(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function rs(t){return B(t.x)/B(t.y)}class Hc{constructor(){this.members=[]}add(e){en(this.members,e),e.scheduleRender()}remove(e){if(nn(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(i=>e===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const r=this.members[i];if(r.isPresent!==!1){s=r;break}}return s?(this.promote(s),!0):!1}promote(e,n){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender(),e.resumeFrom=s,n&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:s}=e;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function as(t,e,n){let s="";const i=t.x.translate/e.x,r=t.y.translate/e.y;if((i||r)&&(s=`translate3d(${i}px, ${r}px, 0) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),n){const{rotate:c,rotateX:l,rotateY:u}=n;c&&(s+=`rotate(${c}deg) `),l&&(s+=`rotateX(${l}deg) `),u&&(s+=`rotateY(${u}deg) `)}const o=t.x.scale*e.x,a=t.y.scale*e.y;return(o!==1||a!==1)&&(s+=`scale(${o}, ${a})`),s||"none"}const Wc=(t,e)=>t.depth-e.depth;class Gc{constructor(){this.children=[],this.isDirty=!1}add(e){en(this.children,e),this.isDirty=!0}remove(e){nn(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Wc),this.isDirty=!1,this.children.forEach(e)}}function Kc(t){window.MotionDebug&&window.MotionDebug.record(t)}const cs=["","X","Y","Z"],ls=1e3;let Zc=0;const st={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function ki({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(o,a={},c=e==null?void 0:e()){this.id=Zc++,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.potentialNodes=new Map,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{st.totalNodes=st.resolvedTargetDeltas=st.recalculatedProjection=0,this.nodes.forEach(Xc),this.nodes.forEach(el),this.nodes.forEach(nl),this.nodes.forEach(Jc),Kc(st)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.elementId=o,this.latestValues=a,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0,o&&this.root.registerPotentialNode(o,this);for(let l=0;lthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=bi(h,250),yt.hasAnimatedSinceResize&&(yt.hasAnimatedSinceResize=!1,this.nodes.forEach(fs))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&u&&(c||l)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:d,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||al,{onLayoutAnimationStart:T,onLayoutAnimationComplete:P}=u.getProps(),x=!this.targetLayout||!Ue(this.targetLayout,p)||d,y=!h&&d;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||y||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,y);const v={...Ti(g,"layout"),onPlay:T,onComplete:P};(u.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v)}else!h&&this.animationProgress===0&&fs(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,J.preRender(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(sl),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(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 u=0;u{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 c=0;c{const S=v/1e3;hs(f.x,o.x,S),hs(f.y,o.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(bt(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ol(this.relativeTarget,this.relativeTargetOrigin,h,S),y&&Ue(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=V()),F(y,this.relativeTarget)),g&&(this.animationValues=u,Oc(u,l,this.latestValues,S,x,P)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(J.update(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=R.update(()=>{yt.hasAnimatedSinceResize=!0,this.currentAnimation=Fc(0,ls,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.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 o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ls),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:c,layout:l,latestValues:u}=o;if(!(!a||!c||!l)){if(this!==o&&this.layout&&l&&Fi(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||V();const f=B(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const h=B(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}F(a,c),ft(a,u),Pt(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Hc),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:c}=o;if((c.rotate||c.rotateX||c.rotateY||c.rotateZ)&&(a=!0),!a)return;const l={};for(let u=0;u{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(us),this.root.sharedNodes.clear()}}}function qc(t){t.updateLayout()}function Yc(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=t.layout,{animationType:r}=t.options,o=n.source!==t.layout.source;r==="size"?U(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],d=B(h);h.min=s[f].min,h.max=h.min+d}):Fi(r,n.layoutBox,s)&&U(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],d=B(s[f]);h.max=h.min+d});const a=Tt();Pt(a,s,n.layoutBox);const c=Tt();o?Pt(c,t.applyTransform(i,!0),n.measuredBox):Pt(c,s,n.layoutBox);const l=!Bi(a);let u=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:d}=f;if(h&&d){const p=V();bt(p,n.layoutBox,h.layoutBox);const g=V();bt(g,s,d.layoutBox),Ue(p,g)||(u=!0),f.options.layoutRoot&&(t.relativeTarget=g,t.relativeTargetOrigin=p,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:n,delta:c,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:u})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function Xc(t){st.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Jc(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Qc(t){t.clearSnapshot()}function us(t){t.clearMeasurements()}function tl(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function fs(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0}function el(t){t.resolveTargetDelta()}function nl(t){t.calcProjection()}function sl(t){t.resetRotation()}function il(t){t.removeLeadSnapshot()}function hs(t,e,n){t.translate=A(e.translate,0,n),t.scale=A(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function ds(t,e,n,s){t.min=A(e.min,n.min,s),t.max=A(e.max,n.max,s)}function ol(t,e,n,s){ds(t.x,e.x,n.x,s),ds(t.y,e.y,n.y,s)}function rl(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const al={duration:.45,ease:[.4,0,.1,1]};function cl(t,e){let n=t.root;for(let r=t.path.length-1;r>=0;r--)if(Boolean(t.path[r].instance)){n=t.path[r];break}const i=(n&&n!==t.root?n.instance:document).querySelector(`[data-projection-id="${e}"]`);i&&t.mount(i,!0)}function ps(t){t.min=Math.round(t.min),t.max=Math.round(t.max)}function ll(t){ps(t.x),ps(t.y)}function Fi(t,e,n){return t==="position"||t==="preserve-aspect"&&!ke(rs(e),rs(n),.2)}const ul=ki({attachResizeListener:(t,e)=>$(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Pe={current:void 0},Ii=ki({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Pe.current){const t=new ul(0,{});t.mount(window),t.setOptions({layoutScroll:!0}),Pe.current=t}return Pe.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>Boolean(window.getComputedStyle(t).position==="fixed")}),fl={pan:{Feature:wc},drag:{Feature:Vc,ProjectionNode:Ii,MeasureLayout:Ei}},hl=new Set(["width","height","top","left","right","bottom","x","y"]),Oi=t=>hl.has(t),dl=t=>Object.keys(t).some(Oi),ms=t=>t===rt||t===b,gs=(t,e)=>parseFloat(t.split(", ")[e]),ys=(t,e)=>(n,{transform:s})=>{if(s==="none"||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/);if(i)return gs(i[1],e);{const r=s.match(/^matrix\((.+)\)$/);return r?gs(r[1],t):0}},pl=new Set(["x","y","z"]),ml=se.filter(t=>!pl.has(t));function gl(t){const e=[];return ml.forEach(n=>{const s=t.getValue(n);s!==void 0&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e.length&&t.render(),e}const vs={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:ys(4,13),y:ys(5,14)},yl=(t,e,n)=>{const s=e.measureViewportBox(),i=e.current,r=getComputedStyle(i),{display:o}=r,a={};o==="none"&&e.setStaticValue("display",t.display||"block"),n.forEach(l=>{a[l]=vs[l](s,r)}),e.render();const c=e.measureViewportBox();return n.forEach(l=>{const u=e.getValue(l);u&&u.jump(a[l]),t[l]=vs[l](c,r)}),t},vl=(t,e,n={},s={})=>{e={...e},s={...s};const i=Object.keys(e).filter(Oi);let r=[],o=!1;const a=[];if(i.forEach(c=>{const l=t.getValue(c);if(!t.hasValue(c))return;let u=n[c],f=pt(u);const h=e[c];let d;if(Gt(h)){const p=h.length,g=h[0]===null?1:0;u=h[g],f=pt(u);for(let T=g;T=0?window.pageYOffset:null,l=yl(e,t,a);return r.length&&r.forEach(([u,f])=>{t.getValue(u).set(f)}),t.render(),te&&c!==null&&window.scrollTo({top:c}),{target:l,transitionEnd:s}}else return{target:e,transitionEnd:s}};function xl(t,e,n,s){return dl(e)?vl(t,e,n,s):{target:e,transitionEnd:s}}const Pl=(t,e,n,s)=>{const i=Lc(t,e,s);return e=i.target,s=i.transitionEnd,xl(t,e,n,s)},_e={current:null},Ni={current:!1};function bl(){if(Ni.current=!0,!!te)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_e.current=t.matches;t.addListener(e),e()}else _e.current=!1}function Tl(t,e,n){const{willChange:s}=e;for(const i in e){const r=e[i],o=n[i];if(j(r))t.addValue(i,r),Zt(s)&&s.add(i);else if(j(o))t.addValue(i,dt(r,{owner:t})),Zt(s)&&s.remove(i);else if(o!==r)if(t.hasValue(i)){const a=t.getValue(i);!a.hasAnimated&&a.set(r)}else{const a=t.getStaticValue(i);t.addValue(i,dt(a!==void 0?a:r,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const Ui=Object.keys(St),Cl=Ui.length,xs=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Sl=He.length;class Al{constructor({parent:e,props:n,presenceContext:s,reducedMotionConfig:i,visualState:r},o={}){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=()=>R.render(this.render,!1,!0);const{latestValues:a,renderState:c}=r;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=c,this.parent=e,this.props=n,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=o,this.isControllingVariants=ne(n),this.isVariantNode=Ls(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:l,...u}=this.scrapeMotionValuesFromProps(n,{});for(const f in u){const h=u[f];a[f]!==void 0&&j(h)&&(h.set(a[f],!1),Zt(l)&&l.add(f))}}scrapeMotionValuesFromProps(e,n){return{}}mount(e){this.current=e,this.projection&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),Ni.current||bl(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_e.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),J.update(this.notifyUpdate),J.render(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,n){const s=ot.has(e),i=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&R.update(this.notifyUpdate,!1,!0),s&&this.projection&&(this.projection.isTransformDirty=!0)}),r=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{i(),r()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}loadFeatures({children:e,...n},s,i,r,o){let a,c;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:d,layoutRoot:p})}return c}updateFeatures(){for(const e in this.features){const n=this.features[e];n.isMounted?n.update(this.props,this.prevProps):(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):V()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}makeTargetAnimatable(e,n=!0){return this.makeTargetAnimatableFromInstance(e,this.props,n)}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;sn.variantChildren.delete(e)}addValue(e,n){n!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,n)),this.values.set(e,n),this.latestValues[e]=n.get()}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&n!==void 0&&(s=dt(n,{owner:this}),this.addValue(e,s)),s}readValue(e){return this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.readValueFromInstance(this.current,e,this.options)}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:s}=this.props,i=typeof s=="string"||typeof s=="object"?(n=tn(this.props,s))===null||n===void 0?void 0:n[e]:void 0;if(s&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!j(r)?r:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new sn),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class _i extends Al{sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:s}){delete n[e],delete s[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:n,...s},{transformValues:i},r){let o=Gr(s,e||{},this);if(i&&(n&&(n=i(n)),s&&(s=i(s)),o&&(o=i(o))),r){Hr(this,s,o);const a=Pl(this,s,o,n);n=a.transitionEnd,s=a.target}return{transition:e,transitionEnd:n,...s}}}function Vl(t){return window.getComputedStyle(t)}class wl extends _i{readValueFromInstance(e,n){if(ot.has(n)){const s=an(n);return s&&s.default||0}else{const s=Vl(e),i=(Fs(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Di(e,n)}build(e,n,s,i){Ze(e,n,s,i.transformTemplate)}scrapeMotionValuesFromProps(e,n){return Qe(e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;j(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(e,n,s,i){_s(e,n,s,i)}}class Ml extends _i{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(ot.has(n)){const s=an(n);return s&&s.default||0}return n=zs.has(n)?n:Je(n),e.getAttribute(n)}measureInstanceViewportBox(){return V()}scrapeMotionValuesFromProps(e,n){return Hs(e,n)}build(e,n,s,i){Ye(e,n,s,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,s,i){$s(e,n,s,i)}mount(e){this.isSVGTag=Xe(e.tagName),super.mount(e)}}const Dl=(t,e)=>Ke(t)?new Ml(e,{enableHardwareAcceleration:!1}):new wl(e,{enableHardwareAcceleration:!0}),Rl={layout:{ProjectionNode:Ii,MeasureLayout:Ei}},El={...rc,...vr,...fl,...Rl},Ll=Eo((t,e)=>or(t,e,El,Dl));function zi(){const t=m.useRef(!1);return $t(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function jl(){const t=zi(),[e,n]=m.useState(0),s=m.useCallback(()=>{t.current&&n(e+1)},[e]);return[m.useCallback(()=>R.postRender(s),[s]),e]}class Bl extends m.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function kl({children:t,isPresent:e}){const n=m.useId(),s=m.useRef(null),i=m.useRef({width:0,height:0,top:0,left:0});return m.useInsertionEffect(()=>{const{width:r,height:o,top:a,left:c}=i.current;if(e||!s.current||!r||!o)return;s.current.dataset.motionPopId=n;const l=document.createElement("style");return document.head.appendChild(l),l.sheet&&l.sheet.insertRule(` + [data-motion-pop-id="${n}"] { + position: absolute !important; + width: ${r}px !important; + height: ${o}px !important; + top: ${a}px !important; + left: ${c}px !important; + } + `),()=>{document.head.removeChild(l)}},[e]),m.createElement(Bl,{isPresent:e,childRef:s,sizeRef:i},m.cloneElement(t,{ref:s}))}const be=({children:t,initial:e,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:r,mode:o})=>{const a=We(Fl),c=m.useId(),l=m.useMemo(()=>({id:c,initial:e,isPresent:n,custom:i,onExitComplete:u=>{a.set(u,!0);for(const f of a.values())if(!f)return;s&&s()},register:u=>(a.set(u,!1),()=>a.delete(u))}),r?void 0:[n]);return m.useMemo(()=>{a.forEach((u,f)=>a.set(f,!1))},[n]),m.useEffect(()=>{!n&&!a.size&&s&&s()},[n]),o==="popLayout"&&(t=m.createElement(kl,{isPresent:n},t)),m.createElement(Et.Provider,{value:l},t)};function Fl(){return new Map}function Il(t){return m.useEffect(()=>()=>t(),[])}const ct=t=>t.key||"";function Ol(t,e){t.forEach(n=>{const s=ct(n);e.set(s,n)})}function Nl(t){const e=[];return m.Children.forEach(t,n=>{m.isValidElement(n)&&e.push(n)}),e}const Ul=({children:t,custom:e,initial:n=!0,onExitComplete:s,exitBeforeEnter:i,presenceAffectsLayout:r=!0,mode:o="sync"})=>{i&&(o="wait");let[a]=jl();const c=m.useContext(Ge).forceRender;c&&(a=c);const l=zi(),u=Nl(t);let f=u;const h=new Set,d=m.useRef(f),p=m.useRef(new Map).current,g=m.useRef(!0);if($t(()=>{g.current=!1,Ol(u,p),d.current=f}),Il(()=>{g.current=!0,p.clear(),h.clear()}),g.current)return m.createElement(m.Fragment,null,f.map(y=>m.createElement(be,{key:ct(y),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:r,mode:o},y)));f=[...f];const T=d.current.map(ct),P=u.map(ct),x=T.length;for(let y=0;y{if(P.indexOf(y)!==-1)return;const v=p.get(y);if(!v)return;const S=T.indexOf(y),w=()=>{p.delete(y),h.delete(y);const D=d.current.findIndex(N=>N.key===y);if(d.current.splice(D,1),!h.size){if(d.current=u,l.current===!1)return;a(),s&&s()}};f.splice(S,0,m.createElement(be,{key:ct(v),isPresent:!1,onExitComplete:w,custom:e,presenceAffectsLayout:r,mode:o},v))}),f=f.map(y=>{const v=y.key;return h.has(v)?y:m.createElement(be,{key:ct(y),isPresent:!0,presenceAffectsLayout:r,mode:o},y)}),m.createElement(m.Fragment,null,h.size?f:f.map(y=>m.cloneElement(y)))};var _l={initial:t=>{const{position:e}=t,n=["top","bottom"].includes(e)?"y":"x";let s=["top-right","bottom-right"].includes(e)?1:-1;return e==="bottom"&&(s=1),{opacity:0,[n]:s*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]}}},$i=m.memo(t=>{const{id:e,message:n,onCloseComplete:s,onRequestRemove:i,requestClose:r=!1,position:o="bottom",duration:a=5e3,containerStyle:c,motionVariants:l=_l,toastSpacing:u="0.5rem"}=t,[f,h]=m.useState(a),d=Dc();vn(()=>{d||s==null||s()},[d]),vn(()=>{h(a)},[a]);const p=()=>h(null),g=()=>h(a),T=()=>{d&&i()};m.useEffect(()=>{d&&r&&i()},[d,r,i]),xo(T,f);const P=m.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:u,...c}),[c,u]),x=m.useMemo(()=>go(o),[o]);return C.jsx(Ll.li,{layout:!0,className:"chakra-toast",variants:l,initial:"initial",animate:"animate",exit:"exit",onHoverStart:p,onHoverEnd:g,custom:{position:o},style:x,children:C.jsx(G.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:P,children:Te(n,{id:e,onClose:T})})})});$i.displayName="ToastComponent";function zl(t,e){var n;const s=t??"bottom",r={"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"}}[s];return(n=r==null?void 0:r[e])!=null?n:s}var Ps={path:C.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[C.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"}),C.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"}),C.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},kt=Mt((t,e)=>{const{as:n,viewBox:s,color:i="currentColor",focusable:r=!1,children:o,className:a,__css:c,...l}=t,u=Dt("chakra-icon",a),f=As("Icon",t),h={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:i,...c,...f},d={ref:e,focusable:r,className:u,__css:h},p=s??Ps.viewBox;if(n&&typeof n!="string")return C.jsx(G.svg,{as:n,...d,...l});const g=o??Ps.path;return C.jsx(G.svg,{verticalAlign:"middle",viewBox:p,...d,...l,children:g})});kt.displayName="Icon";function $l(t){return C.jsx(kt,{viewBox:"0 0 24 24",...t,children:C.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 Hl(t){return C.jsx(kt,{viewBox:"0 0 24 24",...t,children:C.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 bs(t){return C.jsx(kt,{viewBox:"0 0 24 24",...t,children:C.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[Wl,Gl]=Rt({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[Kl,gn]=Rt({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),Hi={info:{icon:Hl,colorScheme:"blue"},warning:{icon:bs,colorScheme:"orange"},success:{icon:$l,colorScheme:"green"},error:{icon:bs,colorScheme:"red"},loading:{icon:Qi,colorScheme:"blue"}};function Zl(t){return Hi[t].colorScheme}function ql(t){return Hi[t].icon}var Wi=Mt(function(e,n){const i={display:"inline",...gn().description};return C.jsx(G.div,{ref:n,...e,className:Dt("chakra-alert__desc",e.className),__css:i})});Wi.displayName="AlertDescription";function Gi(t){const{status:e}=Gl(),n=ql(e),s=gn(),i=e==="loading"?s.spinner:s.icon;return C.jsx(G.span,{display:"inherit",...t,className:Dt("chakra-alert__icon",t.className),__css:i,children:t.children||C.jsx(n,{h:"100%",w:"100%"})})}Gi.displayName="AlertIcon";var Ki=Mt(function(e,n){const s=gn();return C.jsx(G.div,{ref:n,...e,className:Dt("chakra-alert__title",e.className),__css:s.title})});Ki.displayName="AlertTitle";var Zi=Mt(function(e,n){var s;const{status:i="info",addRole:r=!0,...o}=Vs(e),a=(s=e.colorScheme)!=null?s:Zl(i),c=to("Alert",{...e,colorScheme:a}),l={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...c.container};return C.jsx(Wl,{value:{status:i},children:C.jsx(Kl,{value:c,children:C.jsx(G.div,{role:r?"alert":void 0,ref:n,...o,className:Dt("chakra-alert",e.className),__css:l})})})});Zi.displayName="Alert";function Yl(t){return C.jsx(kt,{focusable:"false","aria-hidden":!0,...t,children:C.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 qi=Mt(function(e,n){const s=As("CloseButton",e),{children:i,isDisabled:r,__css:o,...a}=Vs(e),c={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return C.jsx(G.button,{type:"button","aria-label":"Close",ref:n,disabled:r,__css:{...c,...s,...o},...a,children:i||C.jsx(Yl,{width:"1em",height:"1em"})})});qi.displayName="CloseButton";var Xl={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},_=Jl(Xl);function Jl(t){let e=t;const n=new Set,s=i=>{e=i(e),n.forEach(r=>r())};return{getState:()=>e,subscribe:i=>(n.add(i),()=>{s(()=>t),n.delete(i)}),removeToast:(i,r)=>{s(o=>({...o,[r]:o[r].filter(a=>a.id!=i)}))},notify:(i,r)=>{const o=Ql(i,r),{position:a,id:c}=o;return s(l=>{var u,f;const d=a.includes("top")?[o,...(u=l[a])!=null?u:[]]:[...(f=l[a])!=null?f:[],o];return{...l,[a]:d}}),c},update:(i,r)=>{i&&s(o=>{const a={...o},{position:c,index:l}=yn(a,i);return c&&l!==-1&&(a[c][l]={...a[c][l],...r,message:Yi(r)}),a})},closeAll:({positions:i}={})=>{s(r=>(i??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((c,l)=>(c[l]=r[l].map(u=>({...u,requestClose:!0})),c),{...r}))},close:i=>{s(r=>{const o=Ds(r,i);return o?{...r,[o]:r[o].map(a=>a.id==i?{...a,requestClose:!0}:a)}:r})},isActive:i=>Boolean(yn(_.getState(),i).position)}}var Ts=0;function Ql(t,e={}){var n,s;Ts+=1;const i=(n=e.id)!=null?n:Ts,r=(s=e.position)!=null?s:"bottom";return{id:i,message:t,position:r,duration:e.duration,onCloseComplete:e.onCloseComplete,onRequestRemove:()=>_.removeToast(String(i),r),status:e.status,requestClose:!1,containerStyle:e.containerStyle}}var tu=t=>{const{status:e,variant:n="solid",id:s,title:i,isClosable:r,onClose:o,description:a,icon:c}=t,l=s?{root:`toast-${s}`,title:`toast-${s}-title`,description:`toast-${s}-description`}:void 0;return C.jsxs(Zi,{addRole:!1,status:e,variant:n,id:l==null?void 0:l.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",children:[C.jsx(Gi,{children:c}),C.jsxs(G.div,{flex:"1",maxWidth:"100%",children:[i&&C.jsx(Ki,{id:l==null?void 0:l.title,children:i}),a&&C.jsx(Wi,{id:l==null?void 0:l.description,display:"block",children:a})]}),r&&C.jsx(qi,{size:"sm",onClick:o,position:"absolute",insetEnd:1,top:1})]})};function Yi(t={}){const{render:e,toastComponent:n=tu}=t;return i=>typeof e=="function"?e({...i,...t}):C.jsx(n,{...i,...t})}function su(t,e){const n=i=>{var r;return{...e,...i,position:zl((r=i==null?void 0:i.position)!=null?r:e==null?void 0:e.position,t)}},s=i=>{const r=n(i),o=Yi(r);return _.notify(o,r)};return s.update=(i,r)=>{_.update(i,n(r))},s.promise=(i,r)=>{const o=s({...r.loading,status:"loading",duration:null});i.then(a=>s.update(o,{status:"success",duration:5e3,...Te(r.success,a)})).catch(a=>s.update(o,{status:"error",duration:5e3,...Te(r.error,a)}))},s.closeAll=_.closeAll,s.close=_.close,s.isActive=_.isActive,s}var[iu,ou]=Rt({name:"ToastOptionsContext",strict:!1}),ru=t=>{const e=m.useSyncExternalStore(_.subscribe,_.getState,_.getState),{motionVariants:n,component:s=$i,portalProps:i}=t,o=Object.keys(e).map(a=>{const c=e[a];return C.jsx("ul",{role:"region","aria-live":"polite",id:`chakra-toast-manager-${a}`,style:yo(a),children:C.jsx(Ul,{initial:!1,children:c.map(l=>C.jsx(s,{motionVariants:n,...l},l.id))})},a)});return C.jsx(Jt,{...i,children:o})};const au=io,cu=eo;export{Ul as A,qi as C,kt as I,Jt as P,iu as T,Rt as a,vo as b,su as c,Ce as d,vn as e,Mc as f,au as g,cu as h,co as i,ru as j,Ll as m,ou as u}; diff --git a/invokeai/frontend/web/dist/index.html b/invokeai/frontend/web/dist/index.html index d8aa3ec535..c044d48134 100644 --- a/invokeai/frontend/web/dist/index.html +++ b/invokeai/frontend/web/dist/index.html @@ -12,7 +12,7 @@ margin: 0; } - + diff --git a/invokeai/frontend/web/dist/locales/en.json b/invokeai/frontend/web/dist/locales/en.json index 3b6faf8497..22e6a089e2 100644 --- a/invokeai/frontend/web/dist/locales/en.json +++ b/invokeai/frontend/web/dist/locales/en.json @@ -1,7 +1,25 @@ { "accessibility": { "modelSelect": "Model Select", - "invokeProgressBar": "Invoke progress bar" + "invokeProgressBar": "Invoke progress bar", + "reset": "Reset", + "uploadImage": "Upload Image", + "previousImage": "Previous Image", + "nextImage": "Next Image", + "useThisParameter": "Use this parameter", + "copyMetadataJson": "Copy metadata JSON", + "exitViewer": "ExitViewer", + "zoomIn": "Zoom In", + "zoomOut": "Zoom Out", + "rotateCounterClockwise": "Rotate Counter-Clockwise", + "rotateClockwise": "Rotate Clockwise", + "flipHorizontally": "Flip Horizontally", + "flipVertically": "Flip Vertically", + "modifyConfig": "Modify Config", + "toggleAutoscroll": "Toggle autoscroll", + "toggleLogViewer": "Toggle Log Viewer", + "showGallery": "Show Gallery", + "showOptionsPanel": "Show Options Panel" }, "common": { "hotkeysLabel": "Hotkeys", @@ -31,10 +49,11 @@ "langSimplifiedChinese": "简体中文", "langUkranian": "Украї́нська", "langSpanish": "Español", - "text2img": "Text To Image", + "txt2img": "Text To Image", "img2img": "Image To Image", "unifiedCanvas": "Unified Canvas", "nodes": "Nodes", + "postprocessing": "Post Processing", "nodesDesc": "A node based system for the generation of images is under development currently. Stay tuned for updates about this amazing feature.", "postProcessing": "Post Processing", "postProcessDesc1": "Invoke AI offers a wide variety of post processing features. Image Upscaling and Face Restoration are already available in the WebUI. You can access them from the Advanced Options menu of the Text To Image and Image To Image tabs. You can also process images directly, using the image action buttons above the current image display or in the viewer.", @@ -578,7 +597,7 @@ "autoSaveToGallery": "Auto Save to Gallery", "saveBoxRegionOnly": "Save Box Region Only", "limitStrokesToBox": "Limit Strokes to Box", - "showCanvasDebugInfo": "Show Canvas Debug Info", + "showCanvasDebugInfo": "Show Additional Canvas Info", "clearCanvasHistory": "Clear Canvas History", "clearHistory": "Clear History", "clearCanvasHistoryMessage": "Clearing the canvas history leaves your current canvas intact, but irreversibly clears the undo and redo history.", diff --git a/invokeai/frontend/web/dist/locales/es.json b/invokeai/frontend/web/dist/locales/es.json index a52d9c10ec..ad3fdaf3ed 100644 --- a/invokeai/frontend/web/dist/locales/es.json +++ b/invokeai/frontend/web/dist/locales/es.json @@ -63,7 +63,14 @@ "back": "Atrás", "statusConvertingModel": "Convertir el modelo", "statusModelConverted": "Modelo adaptado", - "statusMergingModels": "Fusionar modelos" + "statusMergingModels": "Fusionar modelos", + "oceanTheme": "Océano", + "langPortuguese": "Portugués", + "langKorean": "Coreano", + "langHebrew": "Hebreo", + "pinOptionsPanel": "Pin del panel de opciones", + "loading": "Cargando", + "loadingInvokeAI": "Cargando invocar a la IA" }, "gallery": { "generations": "Generaciones", @@ -385,14 +392,19 @@ "modelMergeAlphaHelp": "Alfa controla la fuerza de mezcla de los modelos. Los valores alfa más bajos reducen la influencia del segundo modelo.", "modelMergeInterpAddDifferenceHelp": "En este modo, el Modelo 3 se sustrae primero del Modelo 2. La versión resultante se mezcla con el Modelo 1 con la tasa alfa establecida anteriormente. La versión resultante se mezcla con el Modelo 1 con la tasa alfa establecida anteriormente.", "ignoreMismatch": "Ignorar discrepancias entre modelos seleccionados", - "modelMergeHeaderHelp1": "Puede combinar hasta tres modelos diferentes para crear una mezcla que se adapte a sus necesidades.", + "modelMergeHeaderHelp1": "Puede unir hasta tres modelos diferentes para crear una combinación que se adapte a sus necesidades.", "inverseSigmoid": "Sigmoideo inverso", "weightedSum": "Modelo de suma ponderada", "sigmoid": "Función sigmoide", "allModels": "Todos los modelos", "repo_id": "Identificador del repositorio", "pathToCustomConfig": "Ruta a la configuración personalizada", - "customConfig": "Configuración personalizada" + "customConfig": "Configuración personalizada", + "v2_base": "v2 (512px)", + "none": "ninguno", + "pickModelType": "Elige el tipo de modelo", + "v2_768": "v2 (768px)", + "addDifference": "Añadir una diferencia" }, "parameters": { "images": "Imágenes", @@ -588,5 +600,27 @@ "betaDarkenOutside": "Oscurecer fuera", "betaLimitToBox": "Limitar a caja", "betaPreserveMasked": "Preservar área enmascarada" + }, + "accessibility": { + "invokeProgressBar": "Activar la barra de progreso", + "modelSelect": "Seleccionar modelo", + "reset": "Reiniciar", + "uploadImage": "Cargar imagen", + "previousImage": "Imagen anterior", + "nextImage": "Siguiente imagen", + "useThisParameter": "Utiliza este parámetro", + "copyMetadataJson": "Copiar los metadatos JSON", + "exitViewer": "Salir del visor", + "zoomIn": "Acercar", + "zoomOut": "Alejar", + "rotateCounterClockwise": "Girar en sentido antihorario", + "rotateClockwise": "Girar en sentido horario", + "flipHorizontally": "Voltear horizontalmente", + "flipVertically": "Voltear verticalmente", + "modifyConfig": "Modificar la configuración", + "toggleAutoscroll": "Activar el autodesplazamiento", + "toggleLogViewer": "Alternar el visor de registros", + "showGallery": "Mostrar galería", + "showOptionsPanel": "Mostrar el panel de opciones" } } diff --git a/invokeai/frontend/web/dist/locales/it.json b/invokeai/frontend/web/dist/locales/it.json index 9bdf5b7798..61aa5c6a08 100644 --- a/invokeai/frontend/web/dist/locales/it.json +++ b/invokeai/frontend/web/dist/locales/it.json @@ -63,7 +63,14 @@ "langSimplifiedChinese": "Cinese semplificato", "langDutch": "Olandese", "statusModelConverted": "Modello Convertito", - "statusConvertingModel": "Conversione Modello" + "statusConvertingModel": "Conversione Modello", + "langKorean": "Coreano", + "langPortuguese": "Portoghese", + "pinOptionsPanel": "Blocca il pannello Opzioni", + "loading": "Caricamento in corso", + "oceanTheme": "Oceano", + "langHebrew": "Ebraico", + "loadingInvokeAI": "Caricamento Invoke AI" }, "gallery": { "generations": "Generazioni", @@ -392,7 +399,12 @@ "customSaveLocation": "Ubicazione salvataggio personalizzata", "weightedSum": "Somma pesata", "sigmoid": "Sigmoide", - "inverseSigmoid": "Sigmoide inverso" + "inverseSigmoid": "Sigmoide inverso", + "v2_base": "v2 (512px)", + "v2_768": "v2 (768px)", + "none": "niente", + "addDifference": "Aggiungi differenza", + "pickModelType": "Scegli il tipo di modello" }, "parameters": { "images": "Immagini", @@ -588,5 +600,27 @@ "betaDarkenOutside": "Oscura all'esterno", "betaLimitToBox": "Limita al rettangolo", "betaPreserveMasked": "Conserva quanto mascherato" + }, + "accessibility": { + "modelSelect": "Seleziona modello", + "invokeProgressBar": "Barra di avanzamento generazione", + "uploadImage": "Carica immagine", + "previousImage": "Immagine precedente", + "nextImage": "Immagine successiva", + "useThisParameter": "Usa questo parametro", + "reset": "Reimposta", + "copyMetadataJson": "Copia i metadati JSON", + "exitViewer": "Esci dal visualizzatore", + "zoomIn": "Zoom avanti", + "zoomOut": "Zoom Indietro", + "rotateCounterClockwise": "Ruotare in senso antiorario", + "rotateClockwise": "Ruotare in senso orario", + "flipHorizontally": "Capovolgi orizzontalmente", + "toggleLogViewer": "Attiva/disattiva visualizzatore registro", + "showGallery": "Mostra la galleria immagini", + "showOptionsPanel": "Mostra il pannello opzioni", + "flipVertically": "Capovolgi verticalmente", + "toggleAutoscroll": "Attiva/disattiva lo scorrimento automatico", + "modifyConfig": "Modifica configurazione" } } diff --git a/invokeai/frontend/web/dist/locales/pt.json b/invokeai/frontend/web/dist/locales/pt.json index 39d383e37f..6e26b9ea56 100644 --- a/invokeai/frontend/web/dist/locales/pt.json +++ b/invokeai/frontend/web/dist/locales/pt.json @@ -63,6 +63,560 @@ "statusGeneratingOutpainting": "Geração de Ampliação", "statusGenerationComplete": "Geração Completa", "statusMergingModels": "Mesclando Modelos", - "statusMergedModels": "Modelos Mesclados" + "statusMergedModels": "Modelos Mesclados", + "oceanTheme": "Oceano", + "pinOptionsPanel": "Fixar painel de opções", + "loading": "A carregar", + "loadingInvokeAI": "A carregar Invoke AI", + "langPortuguese": "Português" + }, + "gallery": { + "galleryImageResetSize": "Resetar Imagem", + "gallerySettings": "Configurações de Galeria", + "maintainAspectRatio": "Mater Proporções", + "autoSwitchNewImages": "Trocar para Novas Imagens Automaticamente", + "pinGallery": "Fixar Galeria", + "singleColumnLayout": "Disposição em Coluna Única", + "allImagesLoaded": "Todas as Imagens Carregadas", + "loadMore": "Carregar Mais", + "noImagesInGallery": "Sem Imagens na Galeria", + "generations": "Gerações", + "showGenerations": "Mostrar Gerações", + "uploads": "Enviados", + "showUploads": "Mostrar Enviados", + "galleryImageSize": "Tamanho da Imagem" + }, + "hotkeys": { + "generalHotkeys": "Atalhos Gerais", + "galleryHotkeys": "Atalhos da Galeria", + "toggleViewer": { + "title": "Ativar Visualizador", + "desc": "Abrir e fechar o Visualizador de Imagens" + }, + "maximizeWorkSpace": { + "desc": "Fechar painéis e maximixar área de trabalho", + "title": "Maximizar a Área de Trabalho" + }, + "changeTabs": { + "title": "Mudar Guias", + "desc": "Trocar para outra área de trabalho" + }, + "consoleToggle": { + "desc": "Abrir e fechar console", + "title": "Ativar Console" + }, + "setPrompt": { + "title": "Definir Prompt", + "desc": "Usar o prompt da imagem atual" + }, + "sendToImageToImage": { + "desc": "Manda a imagem atual para Imagem Para Imagem", + "title": "Mandar para Imagem Para Imagem" + }, + "previousImage": { + "desc": "Mostra a imagem anterior na galeria", + "title": "Imagem Anterior" + }, + "nextImage": { + "title": "Próxima Imagem", + "desc": "Mostra a próxima imagem na galeria" + }, + "decreaseGalleryThumbSize": { + "desc": "Diminui o tamanho das thumbs na galeria", + "title": "Diminuir Tamanho da Galeria de Imagem" + }, + "selectBrush": { + "title": "Selecionar Pincel", + "desc": "Seleciona o pincel" + }, + "selectEraser": { + "title": "Selecionar Apagador", + "desc": "Seleciona o apagador" + }, + "decreaseBrushSize": { + "title": "Diminuir Tamanho do Pincel", + "desc": "Diminui o tamanho do pincel/apagador" + }, + "increaseBrushOpacity": { + "desc": "Aumenta a opacidade do pincel", + "title": "Aumentar Opacidade do Pincel" + }, + "moveTool": { + "title": "Ferramenta Mover", + "desc": "Permite navegar pela tela" + }, + "decreaseBrushOpacity": { + "desc": "Diminui a opacidade do pincel", + "title": "Diminuir Opacidade do Pincel" + }, + "toggleSnap": { + "title": "Ativar Encaixe", + "desc": "Ativa Encaixar na Grade" + }, + "quickToggleMove": { + "title": "Ativar Mover Rapidamente", + "desc": "Temporariamente ativa o modo Mover" + }, + "toggleLayer": { + "title": "Ativar Camada", + "desc": "Ativa a seleção de camada de máscara/base" + }, + "clearMask": { + "title": "Limpar Máscara", + "desc": "Limpa toda a máscara" + }, + "hideMask": { + "title": "Esconder Máscara", + "desc": "Esconde e Revela a máscara" + }, + "mergeVisible": { + "title": "Fundir Visível", + "desc": "Fundir todas as camadas visíveis das telas" + }, + "downloadImage": { + "desc": "Descarregar a tela atual", + "title": "Descarregar Imagem" + }, + "undoStroke": { + "title": "Desfazer Traço", + "desc": "Desfaz um traço de pincel" + }, + "redoStroke": { + "title": "Refazer Traço", + "desc": "Refaz o traço de pincel" + }, + "keyboardShortcuts": "Atalhos de Teclado", + "appHotkeys": "Atalhos do app", + "invoke": { + "title": "Invocar", + "desc": "Gerar uma imagem" + }, + "cancel": { + "title": "Cancelar", + "desc": "Cancelar geração de imagem" + }, + "focusPrompt": { + "title": "Foco do Prompt", + "desc": "Foco da área de texto do prompt" + }, + "toggleOptions": { + "title": "Ativar Opções", + "desc": "Abrir e fechar o painel de opções" + }, + "pinOptions": { + "title": "Fixar Opções", + "desc": "Fixar o painel de opções" + }, + "closePanels": { + "title": "Fechar Painéis", + "desc": "Fecha os painéis abertos" + }, + "unifiedCanvasHotkeys": "Atalhos da Tela Unificada", + "toggleGallery": { + "title": "Ativar Galeria", + "desc": "Abrir e fechar a gaveta da galeria" + }, + "setSeed": { + "title": "Definir Seed", + "desc": "Usar seed da imagem atual" + }, + "setParameters": { + "title": "Definir Parâmetros", + "desc": "Usar todos os parâmetros da imagem atual" + }, + "restoreFaces": { + "title": "Restaurar Rostos", + "desc": "Restaurar a imagem atual" + }, + "upscale": { + "title": "Redimensionar", + "desc": "Redimensionar a imagem atual" + }, + "showInfo": { + "title": "Mostrar Informações", + "desc": "Mostrar metadados de informações da imagem atual" + }, + "deleteImage": { + "title": "Apagar Imagem", + "desc": "Apaga a imagem atual" + }, + "toggleGalleryPin": { + "title": "Ativar Fixar Galeria", + "desc": "Fixa e desafixa a galeria na interface" + }, + "increaseGalleryThumbSize": { + "title": "Aumentar Tamanho da Galeria de Imagem", + "desc": "Aumenta o tamanho das thumbs na galeria" + }, + "increaseBrushSize": { + "title": "Aumentar Tamanho do Pincel", + "desc": "Aumenta o tamanho do pincel/apagador" + }, + "fillBoundingBox": { + "title": "Preencher Caixa Delimitadora", + "desc": "Preenche a caixa delimitadora com a cor do pincel" + }, + "eraseBoundingBox": { + "title": "Apagar Caixa Delimitadora", + "desc": "Apaga a área da caixa delimitadora" + }, + "colorPicker": { + "title": "Selecionar Seletor de Cor", + "desc": "Seleciona o seletor de cores" + }, + "showHideBoundingBox": { + "title": "Mostrar/Esconder Caixa Delimitadora", + "desc": "Ativa a visibilidade da caixa delimitadora" + }, + "saveToGallery": { + "title": "Gravara Na Galeria", + "desc": "Grava a tela atual na galeria" + }, + "copyToClipboard": { + "title": "Copiar para a Área de Transferência", + "desc": "Copia a tela atual para a área de transferência" + }, + "resetView": { + "title": "Resetar Visualização", + "desc": "Reseta Visualização da Tela" + }, + "previousStagingImage": { + "title": "Imagem de Preparação Anterior", + "desc": "Área de Imagem de Preparação Anterior" + }, + "nextStagingImage": { + "title": "Próxima Imagem de Preparação Anterior", + "desc": "Próxima Área de Imagem de Preparação Anterior" + }, + "acceptStagingImage": { + "title": "Aceitar Imagem de Preparação Anterior", + "desc": "Aceitar Área de Imagem de Preparação Anterior" + } + }, + "modelManager": { + "modelAdded": "Modelo Adicionado", + "modelUpdated": "Modelo Atualizado", + "modelEntryDeleted": "Entrada de modelo excluída", + "description": "Descrição", + "modelLocationValidationMsg": "Caminho para onde o seu modelo está localizado.", + "repo_id": "Repo ID", + "vaeRepoIDValidationMsg": "Repositório Online do seu VAE", + "width": "Largura", + "widthValidationMsg": "Largura padrão do seu modelo.", + "height": "Altura", + "heightValidationMsg": "Altura padrão do seu modelo.", + "findModels": "Encontrar Modelos", + "scanAgain": "Digitalize Novamente", + "deselectAll": "Deselecionar Tudo", + "showExisting": "Mostrar Existente", + "deleteConfig": "Apagar Config", + "convertToDiffusersHelpText6": "Deseja converter este modelo?", + "mergedModelName": "Nome do modelo mesclado", + "alpha": "Alpha", + "interpolationType": "Tipo de Interpolação", + "modelMergeHeaderHelp1": "Pode mesclar até três modelos diferentes para criar uma mistura que atenda às suas necessidades.", + "modelMergeHeaderHelp2": "Apenas Diffusers estão disponíveis para mesclagem. Se deseja mesclar um modelo de checkpoint, por favor, converta-o para Diffusers primeiro.", + "modelMergeInterpAddDifferenceHelp": "Neste modo, o Modelo 3 é primeiro subtraído do Modelo 2. A versão resultante é mesclada com o Modelo 1 com a taxa alpha definida acima.", + "nameValidationMsg": "Insira um nome para o seu modelo", + "descriptionValidationMsg": "Adicione uma descrição para o seu modelo", + "config": "Configuração", + "modelExists": "Modelo Existe", + "selectAndAdd": "Selecione e Adicione Modelos Listados Abaixo", + "noModelsFound": "Nenhum Modelo Encontrado", + "v2_768": "v2 (768px)", + "inpainting": "v1 Inpainting", + "customConfig": "Configuração personalizada", + "pathToCustomConfig": "Caminho para configuração personalizada", + "statusConverting": "A converter", + "modelConverted": "Modelo Convertido", + "ignoreMismatch": "Ignorar Divergências entre Modelos Selecionados", + "addDifference": "Adicionar diferença", + "pickModelType": "Escolha o tipo de modelo", + "safetensorModels": "SafeTensors", + "cannotUseSpaces": "Não pode usar espaços", + "addNew": "Adicionar Novo", + "addManually": "Adicionar Manualmente", + "manual": "Manual", + "name": "Nome", + "configValidationMsg": "Caminho para o ficheiro de configuração do seu modelo.", + "modelLocation": "Localização do modelo", + "repoIDValidationMsg": "Repositório Online do seu Modelo", + "updateModel": "Atualizar Modelo", + "availableModels": "Modelos Disponíveis", + "load": "Carregar", + "active": "Ativado", + "notLoaded": "Não carregado", + "deleteModel": "Apagar modelo", + "deleteMsg1": "Tem certeza de que deseja apagar esta entrada do modelo de InvokeAI?", + "deleteMsg2": "Isso não vai apagar o ficheiro de modelo checkpoint do seu disco. Pode lê-los, se desejar.", + "convertToDiffusers": "Converter para Diffusers", + "convertToDiffusersHelpText1": "Este modelo será convertido ao formato 🧨 Diffusers.", + "convertToDiffusersHelpText2": "Este processo irá substituir a sua entrada de Gestor de Modelos por uma versão Diffusers do mesmo modelo.", + "convertToDiffusersHelpText3": "O seu ficheiro de ponto de verificação no disco NÃO será excluído ou modificado de forma alguma. Pode adicionar o seu ponto de verificação ao Gestor de modelos novamente, se desejar.", + "convertToDiffusersSaveLocation": "Local para Gravar", + "v2_base": "v2 (512px)", + "mergeModels": "Mesclar modelos", + "modelOne": "Modelo 1", + "modelTwo": "Modelo 2", + "modelThree": "Modelo 3", + "mergedModelSaveLocation": "Local de Salvamento", + "merge": "Mesclar", + "modelsMerged": "Modelos mesclados", + "mergedModelCustomSaveLocation": "Caminho Personalizado", + "invokeAIFolder": "Pasta Invoke AI", + "inverseSigmoid": "Sigmóide Inversa", + "none": "nenhum", + "modelManager": "Gerente de Modelo", + "model": "Modelo", + "allModels": "Todos os Modelos", + "checkpointModels": "Checkpoints", + "diffusersModels": "Diffusers", + "addNewModel": "Adicionar Novo modelo", + "addCheckpointModel": "Adicionar Modelo de Checkpoint/Safetensor", + "addDiffuserModel": "Adicionar Diffusers", + "vaeLocation": "Localização VAE", + "vaeLocationValidationMsg": "Caminho para onde o seu VAE está localizado.", + "vaeRepoID": "VAE Repo ID", + "addModel": "Adicionar Modelo", + "search": "Procurar", + "cached": "Em cache", + "checkpointFolder": "Pasta de Checkpoint", + "clearCheckpointFolder": "Apagar Pasta de Checkpoint", + "modelsFound": "Modelos Encontrados", + "selectFolder": "Selecione a Pasta", + "selected": "Selecionada", + "selectAll": "Selecionar Tudo", + "addSelected": "Adicione Selecionado", + "delete": "Apagar", + "formMessageDiffusersModelLocation": "Localização dos Modelos Diffusers", + "formMessageDiffusersModelLocationDesc": "Por favor entre com ao menos um.", + "formMessageDiffusersVAELocation": "Localização do VAE", + "formMessageDiffusersVAELocationDesc": "Se não provido, InvokeAI irá procurar pelo ficheiro VAE dentro do local do modelo.", + "convert": "Converter", + "convertToDiffusersHelpText4": "Este é um processo único. Pode levar cerca de 30 a 60s, a depender das especificações do seu computador.", + "convertToDiffusersHelpText5": "Por favor, certifique-se de que tenha espaço suficiente no disco. Os modelos geralmente variam entre 4GB e 7GB de tamanho.", + "v1": "v1", + "sameFolder": "Mesma pasta", + "invokeRoot": "Pasta do InvokeAI", + "custom": "Personalizado", + "customSaveLocation": "Local de salvamento personalizado", + "modelMergeAlphaHelp": "Alpha controla a força da mistura dos modelos. Valores de alpha mais baixos resultam numa influência menor do segundo modelo.", + "sigmoid": "Sigmóide", + "weightedSum": "Soma Ponderada" + }, + "parameters": { + "width": "Largura", + "seed": "Seed", + "hiresStrength": "Força da Alta Resolução", + "negativePrompts": "Indicações negativas", + "general": "Geral", + "randomizeSeed": "Seed Aleatório", + "shuffle": "Embaralhar", + "noiseThreshold": "Limite de Ruído", + "perlinNoise": "Ruído de Perlin", + "variations": "Variatções", + "seedWeights": "Pesos da Seed", + "restoreFaces": "Restaurar Rostos", + "faceRestoration": "Restauração de Rosto", + "type": "Tipo", + "denoisingStrength": "A força de remoção de ruído", + "scale": "Escala", + "otherOptions": "Outras Opções", + "seamlessTiling": "Ladrilho Sem Fronteira", + "hiresOptim": "Otimização de Alta Res", + "imageFit": "Caber Imagem Inicial No Tamanho de Saída", + "codeformerFidelity": "Fidelidade", + "seamSize": "Tamanho da Fronteira", + "seamBlur": "Desfoque da Fronteira", + "seamStrength": "Força da Fronteira", + "seamSteps": "Passos da Fronteira", + "tileSize": "Tamanho do Ladrilho", + "boundingBoxHeader": "Caixa Delimitadora", + "seamCorrectionHeader": "Correção de Fronteira", + "infillScalingHeader": "Preencimento e Escala", + "img2imgStrength": "Força de Imagem Para Imagem", + "toggleLoopback": "Ativar Loopback", + "symmetry": "Simetria", + "promptPlaceholder": "Digite o prompt aqui. [tokens negativos], (upweight)++, (downweight)--, trocar e misturar estão disponíveis (veja docs)", + "sendTo": "Mandar para", + "openInViewer": "Abrir No Visualizador", + "closeViewer": "Fechar Visualizador", + "usePrompt": "Usar Prompt", + "deleteImage": "Apagar Imagem", + "initialImage": "Imagem inicial", + "showOptionsPanel": "Mostrar Painel de Opções", + "strength": "Força", + "upscaling": "Redimensionando", + "upscale": "Redimensionar", + "upscaleImage": "Redimensionar Imagem", + "scaleBeforeProcessing": "Escala Antes do Processamento", + "invoke": "Invocar", + "images": "Imagems", + "steps": "Passos", + "cfgScale": "Escala CFG", + "height": "Altura", + "sampler": "Amostrador", + "imageToImage": "Imagem para Imagem", + "variationAmount": "Quntidade de Variatções", + "scaledWidth": "L Escalada", + "scaledHeight": "A Escalada", + "infillMethod": "Método de Preenchimento", + "hSymmetryStep": "H Passo de Simetria", + "vSymmetryStep": "V Passo de Simetria", + "cancel": { + "immediate": "Cancelar imediatamente", + "schedule": "Cancelar após a iteração atual", + "isScheduled": "A cancelar", + "setType": "Definir tipo de cancelamento" + }, + "sendToImg2Img": "Mandar para Imagem Para Imagem", + "sendToUnifiedCanvas": "Mandar para Tela Unificada", + "copyImage": "Copiar imagem", + "copyImageToLink": "Copiar Imagem Para a Ligação", + "downloadImage": "Descarregar Imagem", + "useSeed": "Usar Seed", + "useAll": "Usar Todos", + "useInitImg": "Usar Imagem Inicial", + "info": "Informações" + }, + "settings": { + "confirmOnDelete": "Confirmar Antes de Apagar", + "displayHelpIcons": "Mostrar Ícones de Ajuda", + "useCanvasBeta": "Usar Layout de Telas Beta", + "enableImageDebugging": "Ativar Depuração de Imagem", + "useSlidersForAll": "Usar deslizadores para todas as opções", + "resetWebUIDesc1": "Reiniciar a interface apenas reinicia o cache local do broswer para imagens e configurações lembradas. Não apaga nenhuma imagem do disco.", + "models": "Modelos", + "displayInProgress": "Mostrar Progresso de Imagens Em Andamento", + "saveSteps": "Gravar imagens a cada n passos", + "resetWebUI": "Reiniciar Interface", + "resetWebUIDesc2": "Se as imagens não estão a aparecer na galeria ou algo mais não está a funcionar, favor tentar reiniciar antes de postar um problema no GitHub.", + "resetComplete": "A interface foi reiniciada. Atualize a página para carregar." + }, + "toast": { + "uploadFailed": "Envio Falhou", + "uploadFailedMultipleImagesDesc": "Várias imagens copiadas, só é permitido uma imagem de cada vez", + "uploadFailedUnableToLoadDesc": "Não foj possível carregar o ficheiro", + "downloadImageStarted": "Download de Imagem Começou", + "imageNotLoadedDesc": "Nenhuma imagem encontrada a enviar para o módulo de imagem para imagem", + "imageLinkCopied": "Ligação de Imagem Copiada", + "imageNotLoaded": "Nenhuma Imagem Carregada", + "parametersFailed": "Problema ao carregar parâmetros", + "parametersFailedDesc": "Não foi possível carregar imagem incial.", + "seedSet": "Seed Definida", + "upscalingFailed": "Redimensionamento Falhou", + "promptNotSet": "Prompt Não Definido", + "tempFoldersEmptied": "Pasta de Ficheiros Temporários Esvaziada", + "imageCopied": "Imagem Copiada", + "imageSavedToGallery": "Imagem Salva na Galeria", + "canvasMerged": "Tela Fundida", + "sentToImageToImage": "Mandar Para Imagem Para Imagem", + "sentToUnifiedCanvas": "Enviada para a Tela Unificada", + "parametersSet": "Parâmetros Definidos", + "parametersNotSet": "Parâmetros Não Definidos", + "parametersNotSetDesc": "Nenhum metadado foi encontrado para essa imagem.", + "seedNotSet": "Seed Não Definida", + "seedNotSetDesc": "Não foi possível achar a seed para a imagem.", + "promptSet": "Prompt Definido", + "promptNotSetDesc": "Não foi possível achar prompt para essa imagem.", + "faceRestoreFailed": "Restauração de Rosto Falhou", + "metadataLoadFailed": "Falha ao tentar carregar metadados", + "initialImageSet": "Imagem Inicial Definida", + "initialImageNotSet": "Imagem Inicial Não Definida", + "initialImageNotSetDesc": "Não foi possível carregar imagem incial" + }, + "tooltip": { + "feature": { + "prompt": "Este é o campo de prompt. O prompt inclui objetos de geração e termos estilísticos. Também pode adicionar peso (importância do token) no prompt, mas comandos e parâmetros de CLI não funcionarão.", + "other": "Essas opções ativam modos alternativos de processamento para o Invoke. 'Seamless tiling' criará padrões repetidos na saída. 'High resolution' é uma geração em duas etapas com img2img: use essa configuração quando desejar uma imagem maior e mais coerente sem artefatos. Levará mais tempo do que o txt2img usual.", + "seed": "O valor da semente afeta o ruído inicial a partir do qual a imagem é formada. Pode usar as sementes já existentes de imagens anteriores. 'Limiar de ruído' é usado para mitigar artefatos em valores CFG altos (experimente a faixa de 0-10) e o Perlin para adicionar ruído Perlin durante a geração: ambos servem para adicionar variação às suas saídas.", + "imageToImage": "Image to Image carrega qualquer imagem como inicial, que é então usada para gerar uma nova junto com o prompt. Quanto maior o valor, mais a imagem resultante mudará. Valores de 0.0 a 1.0 são possíveis, a faixa recomendada é de 0.25 a 0.75", + "faceCorrection": "Correção de rosto com GFPGAN ou Codeformer: o algoritmo detecta rostos na imagem e corrige quaisquer defeitos. Um valor alto mudará mais a imagem, a resultar em rostos mais atraentes. Codeformer com uma fidelidade maior preserva a imagem original às custas de uma correção de rosto mais forte.", + "seamCorrection": "Controla o tratamento das emendas visíveis que ocorrem entre as imagens geradas no canvas.", + "gallery": "A galeria exibe as gerações da pasta de saída conforme elas são criadas. As configurações são armazenadas em ficheiros e acessadas pelo menu de contexto.", + "variations": "Experimente uma variação com um valor entre 0,1 e 1,0 para mudar o resultado para uma determinada semente. Variações interessantes da semente estão entre 0,1 e 0,3.", + "upscale": "Use o ESRGAN para ampliar a imagem imediatamente após a geração.", + "boundingBox": "A caixa delimitadora é a mesma que as configurações de largura e altura para Texto para Imagem ou Imagem para Imagem. Apenas a área na caixa será processada.", + "infillAndScaling": "Gira os métodos de preenchimento (usados em áreas mascaradas ou apagadas do canvas) e a escala (útil para tamanhos de caixa delimitadora pequenos)." + } + }, + "unifiedCanvas": { + "emptyTempImagesFolderMessage": "Esvaziar a pasta de ficheiros de imagem temporários também reseta completamente a Tela Unificada. Isso inclui todo o histórico de desfazer/refazer, imagens na área de preparação e a camada base da tela.", + "scaledBoundingBox": "Caixa Delimitadora Escalada", + "boundingBoxPosition": "Posição da Caixa Delimitadora", + "next": "Próximo", + "accept": "Aceitar", + "showHide": "Mostrar/Esconder", + "discardAll": "Descartar Todos", + "betaClear": "Limpar", + "betaDarkenOutside": "Escurecer Externamente", + "base": "Base", + "brush": "Pincel", + "showIntermediates": "Mostrar Intermediários", + "showGrid": "Mostrar Grade", + "clearCanvasHistoryConfirm": "Tem certeza que quer limpar o histórico de tela?", + "boundingBox": "Caixa Delimitadora", + "canvasDimensions": "Dimensões da Tela", + "canvasPosition": "Posição da Tela", + "cursorPosition": "Posição do cursor", + "previous": "Anterior", + "betaLimitToBox": "Limitar á Caixa", + "layer": "Camada", + "mask": "Máscara", + "maskingOptions": "Opções de Mascaramento", + "enableMask": "Ativar Máscara", + "preserveMaskedArea": "Preservar Área da Máscara", + "clearMask": "Limpar Máscara", + "eraser": "Apagador", + "fillBoundingBox": "Preencher Caixa Delimitadora", + "eraseBoundingBox": "Apagar Caixa Delimitadora", + "colorPicker": "Seletor de Cor", + "brushOptions": "Opções de Pincel", + "brushSize": "Tamanho", + "move": "Mover", + "resetView": "Resetar Visualização", + "mergeVisible": "Fundir Visível", + "saveToGallery": "Gravar na Galeria", + "copyToClipboard": "Copiar para a Área de Transferência", + "downloadAsImage": "Descarregar Como Imagem", + "undo": "Desfazer", + "redo": "Refazer", + "clearCanvas": "Limpar Tela", + "canvasSettings": "Configurações de Tela", + "snapToGrid": "Encaixar na Grade", + "darkenOutsideSelection": "Escurecer Seleção Externa", + "autoSaveToGallery": "Gravar Automaticamente na Galeria", + "saveBoxRegionOnly": "Gravar Apenas a Região da Caixa", + "limitStrokesToBox": "Limitar Traços à Caixa", + "showCanvasDebugInfo": "Mostrar Informações de Depuração daTela", + "clearCanvasHistory": "Limpar o Histórico da Tela", + "clearHistory": "Limpar Históprico", + "clearCanvasHistoryMessage": "Limpar o histórico de tela deixa a sua tela atual intacta, mas limpa de forma irreversível o histórico de desfazer e refazer.", + "emptyTempImageFolder": "Esvaziar a Pasta de Ficheiros de Imagem Temporários", + "emptyFolder": "Esvaziar Pasta", + "emptyTempImagesFolderConfirm": "Tem certeza que quer esvaziar a pasta de ficheiros de imagem temporários?", + "activeLayer": "Camada Ativa", + "canvasScale": "Escala da Tela", + "betaPreserveMasked": "Preservar Máscarado" + }, + "accessibility": { + "invokeProgressBar": "Invocar barra de progresso", + "reset": "Repôr", + "nextImage": "Próxima imagem", + "useThisParameter": "Usar este parâmetro", + "copyMetadataJson": "Copiar metadados JSON", + "zoomIn": "Ampliar", + "zoomOut": "Reduzir", + "rotateCounterClockwise": "Girar no sentido anti-horário", + "rotateClockwise": "Girar no sentido horário", + "flipVertically": "Espelhar verticalmente", + "modifyConfig": "Modificar config", + "toggleAutoscroll": "Alternar rolagem automática", + "showGallery": "Mostrar galeria", + "showOptionsPanel": "Mostrar painel de opções", + "uploadImage": "Enviar imagem", + "previousImage": "Imagem anterior", + "flipHorizontally": "Espelhar horizontalmente", + "toggleLogViewer": "Alternar visualizador de registo" } } diff --git a/invokeai/frontend/web/dist/locales/pt_BR.json b/invokeai/frontend/web/dist/locales/pt_BR.json index 7d433aa430..18b7ab57e1 100644 --- a/invokeai/frontend/web/dist/locales/pt_BR.json +++ b/invokeai/frontend/web/dist/locales/pt_BR.json @@ -63,7 +63,10 @@ "statusMergingModels": "Mesclando Modelos", "statusMergedModels": "Modelos Mesclados", "langRussian": "Russo", - "langSpanish": "Espanhol" + "langSpanish": "Espanhol", + "pinOptionsPanel": "Fixar painel de opções", + "loadingInvokeAI": "Carregando Invoke AI", + "loading": "Carregando" }, "gallery": { "generations": "Gerações", diff --git a/invokeai/frontend/web/dist/locales/ru.json b/invokeai/frontend/web/dist/locales/ru.json index e08540809b..d4178119e4 100644 --- a/invokeai/frontend/web/dist/locales/ru.json +++ b/invokeai/frontend/web/dist/locales/ru.json @@ -46,7 +46,15 @@ "statusLoadingModel": "Загрузка модели", "statusModelChanged": "Модель изменена", "githubLabel": "Github", - "discordLabel": "Discord" + "discordLabel": "Discord", + "statusMergingModels": "Слияние моделей", + "statusModelConverted": "Модель сконвертирована", + "statusMergedModels": "Модели объединены", + "pinOptionsPanel": "Закрепить панель настроек", + "loading": "Загрузка", + "loadingInvokeAI": "Загрузка Invoke AI", + "back": "Назад", + "statusConvertingModel": "Конвертация модели" }, "gallery": { "generations": "Генерации", @@ -323,7 +331,30 @@ "deleteConfig": "Удалить конфигурацию", "deleteMsg1": "Вы точно хотите удалить модель из InvokeAI?", "deleteMsg2": "Это не удалит файл модели с диска. Позже вы можете добавить его снова.", - "repoIDValidationMsg": "Онлайн-репозиторий модели" + "repoIDValidationMsg": "Онлайн-репозиторий модели", + "convertToDiffusersHelpText5": "Пожалуйста, убедитесь, что у вас достаточно места на диске. Модели обычно занимают 4 – 7 Гб.", + "invokeAIFolder": "Каталог InvokeAI", + "ignoreMismatch": "Игнорировать несоответствия между выбранными моделями", + "addCheckpointModel": "Добавить модель Checkpoint/Safetensor", + "formMessageDiffusersModelLocationDesc": "Укажите хотя бы одно.", + "convertToDiffusersHelpText3": "Файл модели на диске НЕ будет удалён или изменён. Вы сможете заново добавить его в Model Manager при необходимости.", + "vaeRepoID": "ID репозитория VAE", + "mergedModelName": "Название объединенной модели", + "checkpointModels": "Checkpoints", + "allModels": "Все модели", + "addDiffuserModel": "Добавить Diffusers", + "repo_id": "ID репозитория", + "formMessageDiffusersVAELocationDesc": "Если не указано, InvokeAI будет искать файл VAE рядом с моделью.", + "convert": "Преобразовать", + "convertToDiffusers": "Преобразовать в Diffusers", + "convertToDiffusersHelpText1": "Модель будет преобразована в формат 🧨 Diffusers.", + "convertToDiffusersHelpText4": "Это единоразовое действие. Оно может занять 30—60 секунд в зависимости от характеристик вашего компьютера.", + "convertToDiffusersHelpText6": "Вы хотите преобразовать эту модель?", + "statusConverting": "Преобразование", + "modelConverted": "Модель преобразована", + "invokeRoot": "Каталог InvokeAI", + "modelsMerged": "Модели объединены", + "mergeModels": "Объединить модели" }, "parameters": { "images": "Изображения", @@ -503,5 +534,8 @@ "betaDarkenOutside": "Затемнить снаружи", "betaLimitToBox": "Ограничить выделением", "betaPreserveMasked": "Сохранять маскируемую область" + }, + "accessibility": { + "modelSelect": "Выбор модели" } } diff --git a/invokeai/frontend/web/dist/locales/zh_Hant.json b/invokeai/frontend/web/dist/locales/zh_Hant.json index b0ae670e01..af7b0cf328 100644 --- a/invokeai/frontend/web/dist/locales/zh_Hant.json +++ b/invokeai/frontend/web/dist/locales/zh_Hant.json @@ -19,6 +19,21 @@ "discordLabel": "Discord", "nodesDesc": "使用Node生成圖像的系統正在開發中。敬請期待有關於這項功能的更新。", "reportBugLabel": "回報錯誤", - "githubLabel": "GitHub" + "githubLabel": "GitHub", + "langKorean": "韓語", + "langPortuguese": "葡萄牙語", + "hotkeysLabel": "快捷鍵", + "languagePickerLabel": "切換語言", + "langDutch": "荷蘭語", + "langFrench": "法語", + "langGerman": "德語", + "langItalian": "義大利語", + "langJapanese": "日語", + "langPolish": "波蘭語", + "langBrPortuguese": "巴西葡萄牙語", + "langRussian": "俄語", + "langSpanish": "西班牙語", + "text2img": "文字到圖像", + "unifiedCanvas": "統一畫布" } } diff --git a/invokeai/frontend/web/index.d.ts b/invokeai/frontend/web/index.d.ts index a1cfa5a0c7..7c40c796dd 100644 --- a/invokeai/frontend/web/index.d.ts +++ b/invokeai/frontend/web/index.d.ts @@ -39,3 +39,6 @@ declare global { } /* eslint-enable @typescript-eslint/no-explicit-any */ } + +declare function Invoke(): React.JSX; +export = Invoke; diff --git a/invokeai/frontend/web/package.json b/invokeai/frontend/web/package.json index d61c46a2d3..1c37b68156 100644 --- a/invokeai/frontend/web/package.json +++ b/invokeai/frontend/web/package.json @@ -6,9 +6,10 @@ "prepare": "cd ../../../ && husky install invokeai/frontend/web/.husky", "dev": "concurrently \"vite dev\" \"yarn run theme:watch\"", "build": "yarn run lint && vite build", + "build:package": "vite build --mode=package", "preview": "vite preview", "lint:madge": "madge --circular src/main.tsx", - "lint:eslint": "eslint --max-warnings=0", + "lint:eslint": "eslint --max-warnings=0 .", "lint:prettier": "prettier --check .", "lint:tsc": "tsc --noEmit", "lint": "yarn run lint:eslint && yarn run lint:prettier && yarn run lint:tsc && yarn run lint:madge", @@ -36,6 +37,7 @@ }, "dependencies": { "@chakra-ui/anatomy": "^2.1.1", + "@chakra-ui/cli": "^2.3.0", "@chakra-ui/icons": "^2.0.17", "@chakra-ui/react": "^2.5.1", "@chakra-ui/styled-system": "^2.6.1", @@ -52,6 +54,7 @@ "i18next-http-backend": "^2.1.1", "konva": "^8.4.2", "lodash": "^4.17.21", + "patch-package": "^6.5.1", "re-resizable": "^6.9.9", "react": "^18.2.0", "react-colorful": "^5.6.1", @@ -72,7 +75,6 @@ "uuid": "^9.0.0" }, "devDependencies": { - "@chakra-ui/cli": "^2.3.0", "@fontsource/inter": "^4.5.15", "@types/dateformat": "^5.0.0", "@types/react": "^18.0.28", @@ -92,7 +94,6 @@ "husky": "^8.0.3", "lint-staged": "^13.1.2", "madge": "^6.0.0", - "patch-package": "^6.5.1", "postinstall-postinstall": "^2.1.0", "prettier": "^2.8.4", "rollup-plugin-visualizer": "^5.9.0", diff --git a/invokeai/frontend/web/public/locales/en.json b/invokeai/frontend/web/public/locales/en.json index 3b6faf8497..22e6a089e2 100644 --- a/invokeai/frontend/web/public/locales/en.json +++ b/invokeai/frontend/web/public/locales/en.json @@ -1,7 +1,25 @@ { "accessibility": { "modelSelect": "Model Select", - "invokeProgressBar": "Invoke progress bar" + "invokeProgressBar": "Invoke progress bar", + "reset": "Reset", + "uploadImage": "Upload Image", + "previousImage": "Previous Image", + "nextImage": "Next Image", + "useThisParameter": "Use this parameter", + "copyMetadataJson": "Copy metadata JSON", + "exitViewer": "ExitViewer", + "zoomIn": "Zoom In", + "zoomOut": "Zoom Out", + "rotateCounterClockwise": "Rotate Counter-Clockwise", + "rotateClockwise": "Rotate Clockwise", + "flipHorizontally": "Flip Horizontally", + "flipVertically": "Flip Vertically", + "modifyConfig": "Modify Config", + "toggleAutoscroll": "Toggle autoscroll", + "toggleLogViewer": "Toggle Log Viewer", + "showGallery": "Show Gallery", + "showOptionsPanel": "Show Options Panel" }, "common": { "hotkeysLabel": "Hotkeys", @@ -31,10 +49,11 @@ "langSimplifiedChinese": "简体中文", "langUkranian": "Украї́нська", "langSpanish": "Español", - "text2img": "Text To Image", + "txt2img": "Text To Image", "img2img": "Image To Image", "unifiedCanvas": "Unified Canvas", "nodes": "Nodes", + "postprocessing": "Post Processing", "nodesDesc": "A node based system for the generation of images is under development currently. Stay tuned for updates about this amazing feature.", "postProcessing": "Post Processing", "postProcessDesc1": "Invoke AI offers a wide variety of post processing features. Image Upscaling and Face Restoration are already available in the WebUI. You can access them from the Advanced Options menu of the Text To Image and Image To Image tabs. You can also process images directly, using the image action buttons above the current image display or in the viewer.", @@ -578,7 +597,7 @@ "autoSaveToGallery": "Auto Save to Gallery", "saveBoxRegionOnly": "Save Box Region Only", "limitStrokesToBox": "Limit Strokes to Box", - "showCanvasDebugInfo": "Show Canvas Debug Info", + "showCanvasDebugInfo": "Show Additional Canvas Info", "clearCanvasHistory": "Clear Canvas History", "clearHistory": "Clear History", "clearCanvasHistoryMessage": "Clearing the canvas history leaves your current canvas intact, but irreversibly clears the undo and redo history.", diff --git a/invokeai/frontend/web/public/locales/es.json b/invokeai/frontend/web/public/locales/es.json index a52d9c10ec..ad3fdaf3ed 100644 --- a/invokeai/frontend/web/public/locales/es.json +++ b/invokeai/frontend/web/public/locales/es.json @@ -63,7 +63,14 @@ "back": "Atrás", "statusConvertingModel": "Convertir el modelo", "statusModelConverted": "Modelo adaptado", - "statusMergingModels": "Fusionar modelos" + "statusMergingModels": "Fusionar modelos", + "oceanTheme": "Océano", + "langPortuguese": "Portugués", + "langKorean": "Coreano", + "langHebrew": "Hebreo", + "pinOptionsPanel": "Pin del panel de opciones", + "loading": "Cargando", + "loadingInvokeAI": "Cargando invocar a la IA" }, "gallery": { "generations": "Generaciones", @@ -385,14 +392,19 @@ "modelMergeAlphaHelp": "Alfa controla la fuerza de mezcla de los modelos. Los valores alfa más bajos reducen la influencia del segundo modelo.", "modelMergeInterpAddDifferenceHelp": "En este modo, el Modelo 3 se sustrae primero del Modelo 2. La versión resultante se mezcla con el Modelo 1 con la tasa alfa establecida anteriormente. La versión resultante se mezcla con el Modelo 1 con la tasa alfa establecida anteriormente.", "ignoreMismatch": "Ignorar discrepancias entre modelos seleccionados", - "modelMergeHeaderHelp1": "Puede combinar hasta tres modelos diferentes para crear una mezcla que se adapte a sus necesidades.", + "modelMergeHeaderHelp1": "Puede unir hasta tres modelos diferentes para crear una combinación que se adapte a sus necesidades.", "inverseSigmoid": "Sigmoideo inverso", "weightedSum": "Modelo de suma ponderada", "sigmoid": "Función sigmoide", "allModels": "Todos los modelos", "repo_id": "Identificador del repositorio", "pathToCustomConfig": "Ruta a la configuración personalizada", - "customConfig": "Configuración personalizada" + "customConfig": "Configuración personalizada", + "v2_base": "v2 (512px)", + "none": "ninguno", + "pickModelType": "Elige el tipo de modelo", + "v2_768": "v2 (768px)", + "addDifference": "Añadir una diferencia" }, "parameters": { "images": "Imágenes", @@ -588,5 +600,27 @@ "betaDarkenOutside": "Oscurecer fuera", "betaLimitToBox": "Limitar a caja", "betaPreserveMasked": "Preservar área enmascarada" + }, + "accessibility": { + "invokeProgressBar": "Activar la barra de progreso", + "modelSelect": "Seleccionar modelo", + "reset": "Reiniciar", + "uploadImage": "Cargar imagen", + "previousImage": "Imagen anterior", + "nextImage": "Siguiente imagen", + "useThisParameter": "Utiliza este parámetro", + "copyMetadataJson": "Copiar los metadatos JSON", + "exitViewer": "Salir del visor", + "zoomIn": "Acercar", + "zoomOut": "Alejar", + "rotateCounterClockwise": "Girar en sentido antihorario", + "rotateClockwise": "Girar en sentido horario", + "flipHorizontally": "Voltear horizontalmente", + "flipVertically": "Voltear verticalmente", + "modifyConfig": "Modificar la configuración", + "toggleAutoscroll": "Activar el autodesplazamiento", + "toggleLogViewer": "Alternar el visor de registros", + "showGallery": "Mostrar galería", + "showOptionsPanel": "Mostrar el panel de opciones" } } diff --git a/invokeai/frontend/web/public/locales/it.json b/invokeai/frontend/web/public/locales/it.json index 9bdf5b7798..61aa5c6a08 100644 --- a/invokeai/frontend/web/public/locales/it.json +++ b/invokeai/frontend/web/public/locales/it.json @@ -63,7 +63,14 @@ "langSimplifiedChinese": "Cinese semplificato", "langDutch": "Olandese", "statusModelConverted": "Modello Convertito", - "statusConvertingModel": "Conversione Modello" + "statusConvertingModel": "Conversione Modello", + "langKorean": "Coreano", + "langPortuguese": "Portoghese", + "pinOptionsPanel": "Blocca il pannello Opzioni", + "loading": "Caricamento in corso", + "oceanTheme": "Oceano", + "langHebrew": "Ebraico", + "loadingInvokeAI": "Caricamento Invoke AI" }, "gallery": { "generations": "Generazioni", @@ -392,7 +399,12 @@ "customSaveLocation": "Ubicazione salvataggio personalizzata", "weightedSum": "Somma pesata", "sigmoid": "Sigmoide", - "inverseSigmoid": "Sigmoide inverso" + "inverseSigmoid": "Sigmoide inverso", + "v2_base": "v2 (512px)", + "v2_768": "v2 (768px)", + "none": "niente", + "addDifference": "Aggiungi differenza", + "pickModelType": "Scegli il tipo di modello" }, "parameters": { "images": "Immagini", @@ -588,5 +600,27 @@ "betaDarkenOutside": "Oscura all'esterno", "betaLimitToBox": "Limita al rettangolo", "betaPreserveMasked": "Conserva quanto mascherato" + }, + "accessibility": { + "modelSelect": "Seleziona modello", + "invokeProgressBar": "Barra di avanzamento generazione", + "uploadImage": "Carica immagine", + "previousImage": "Immagine precedente", + "nextImage": "Immagine successiva", + "useThisParameter": "Usa questo parametro", + "reset": "Reimposta", + "copyMetadataJson": "Copia i metadati JSON", + "exitViewer": "Esci dal visualizzatore", + "zoomIn": "Zoom avanti", + "zoomOut": "Zoom Indietro", + "rotateCounterClockwise": "Ruotare in senso antiorario", + "rotateClockwise": "Ruotare in senso orario", + "flipHorizontally": "Capovolgi orizzontalmente", + "toggleLogViewer": "Attiva/disattiva visualizzatore registro", + "showGallery": "Mostra la galleria immagini", + "showOptionsPanel": "Mostra il pannello opzioni", + "flipVertically": "Capovolgi verticalmente", + "toggleAutoscroll": "Attiva/disattiva lo scorrimento automatico", + "modifyConfig": "Modifica configurazione" } } diff --git a/invokeai/frontend/web/public/locales/pt.json b/invokeai/frontend/web/public/locales/pt.json index 39d383e37f..6e26b9ea56 100644 --- a/invokeai/frontend/web/public/locales/pt.json +++ b/invokeai/frontend/web/public/locales/pt.json @@ -63,6 +63,560 @@ "statusGeneratingOutpainting": "Geração de Ampliação", "statusGenerationComplete": "Geração Completa", "statusMergingModels": "Mesclando Modelos", - "statusMergedModels": "Modelos Mesclados" + "statusMergedModels": "Modelos Mesclados", + "oceanTheme": "Oceano", + "pinOptionsPanel": "Fixar painel de opções", + "loading": "A carregar", + "loadingInvokeAI": "A carregar Invoke AI", + "langPortuguese": "Português" + }, + "gallery": { + "galleryImageResetSize": "Resetar Imagem", + "gallerySettings": "Configurações de Galeria", + "maintainAspectRatio": "Mater Proporções", + "autoSwitchNewImages": "Trocar para Novas Imagens Automaticamente", + "pinGallery": "Fixar Galeria", + "singleColumnLayout": "Disposição em Coluna Única", + "allImagesLoaded": "Todas as Imagens Carregadas", + "loadMore": "Carregar Mais", + "noImagesInGallery": "Sem Imagens na Galeria", + "generations": "Gerações", + "showGenerations": "Mostrar Gerações", + "uploads": "Enviados", + "showUploads": "Mostrar Enviados", + "galleryImageSize": "Tamanho da Imagem" + }, + "hotkeys": { + "generalHotkeys": "Atalhos Gerais", + "galleryHotkeys": "Atalhos da Galeria", + "toggleViewer": { + "title": "Ativar Visualizador", + "desc": "Abrir e fechar o Visualizador de Imagens" + }, + "maximizeWorkSpace": { + "desc": "Fechar painéis e maximixar área de trabalho", + "title": "Maximizar a Área de Trabalho" + }, + "changeTabs": { + "title": "Mudar Guias", + "desc": "Trocar para outra área de trabalho" + }, + "consoleToggle": { + "desc": "Abrir e fechar console", + "title": "Ativar Console" + }, + "setPrompt": { + "title": "Definir Prompt", + "desc": "Usar o prompt da imagem atual" + }, + "sendToImageToImage": { + "desc": "Manda a imagem atual para Imagem Para Imagem", + "title": "Mandar para Imagem Para Imagem" + }, + "previousImage": { + "desc": "Mostra a imagem anterior na galeria", + "title": "Imagem Anterior" + }, + "nextImage": { + "title": "Próxima Imagem", + "desc": "Mostra a próxima imagem na galeria" + }, + "decreaseGalleryThumbSize": { + "desc": "Diminui o tamanho das thumbs na galeria", + "title": "Diminuir Tamanho da Galeria de Imagem" + }, + "selectBrush": { + "title": "Selecionar Pincel", + "desc": "Seleciona o pincel" + }, + "selectEraser": { + "title": "Selecionar Apagador", + "desc": "Seleciona o apagador" + }, + "decreaseBrushSize": { + "title": "Diminuir Tamanho do Pincel", + "desc": "Diminui o tamanho do pincel/apagador" + }, + "increaseBrushOpacity": { + "desc": "Aumenta a opacidade do pincel", + "title": "Aumentar Opacidade do Pincel" + }, + "moveTool": { + "title": "Ferramenta Mover", + "desc": "Permite navegar pela tela" + }, + "decreaseBrushOpacity": { + "desc": "Diminui a opacidade do pincel", + "title": "Diminuir Opacidade do Pincel" + }, + "toggleSnap": { + "title": "Ativar Encaixe", + "desc": "Ativa Encaixar na Grade" + }, + "quickToggleMove": { + "title": "Ativar Mover Rapidamente", + "desc": "Temporariamente ativa o modo Mover" + }, + "toggleLayer": { + "title": "Ativar Camada", + "desc": "Ativa a seleção de camada de máscara/base" + }, + "clearMask": { + "title": "Limpar Máscara", + "desc": "Limpa toda a máscara" + }, + "hideMask": { + "title": "Esconder Máscara", + "desc": "Esconde e Revela a máscara" + }, + "mergeVisible": { + "title": "Fundir Visível", + "desc": "Fundir todas as camadas visíveis das telas" + }, + "downloadImage": { + "desc": "Descarregar a tela atual", + "title": "Descarregar Imagem" + }, + "undoStroke": { + "title": "Desfazer Traço", + "desc": "Desfaz um traço de pincel" + }, + "redoStroke": { + "title": "Refazer Traço", + "desc": "Refaz o traço de pincel" + }, + "keyboardShortcuts": "Atalhos de Teclado", + "appHotkeys": "Atalhos do app", + "invoke": { + "title": "Invocar", + "desc": "Gerar uma imagem" + }, + "cancel": { + "title": "Cancelar", + "desc": "Cancelar geração de imagem" + }, + "focusPrompt": { + "title": "Foco do Prompt", + "desc": "Foco da área de texto do prompt" + }, + "toggleOptions": { + "title": "Ativar Opções", + "desc": "Abrir e fechar o painel de opções" + }, + "pinOptions": { + "title": "Fixar Opções", + "desc": "Fixar o painel de opções" + }, + "closePanels": { + "title": "Fechar Painéis", + "desc": "Fecha os painéis abertos" + }, + "unifiedCanvasHotkeys": "Atalhos da Tela Unificada", + "toggleGallery": { + "title": "Ativar Galeria", + "desc": "Abrir e fechar a gaveta da galeria" + }, + "setSeed": { + "title": "Definir Seed", + "desc": "Usar seed da imagem atual" + }, + "setParameters": { + "title": "Definir Parâmetros", + "desc": "Usar todos os parâmetros da imagem atual" + }, + "restoreFaces": { + "title": "Restaurar Rostos", + "desc": "Restaurar a imagem atual" + }, + "upscale": { + "title": "Redimensionar", + "desc": "Redimensionar a imagem atual" + }, + "showInfo": { + "title": "Mostrar Informações", + "desc": "Mostrar metadados de informações da imagem atual" + }, + "deleteImage": { + "title": "Apagar Imagem", + "desc": "Apaga a imagem atual" + }, + "toggleGalleryPin": { + "title": "Ativar Fixar Galeria", + "desc": "Fixa e desafixa a galeria na interface" + }, + "increaseGalleryThumbSize": { + "title": "Aumentar Tamanho da Galeria de Imagem", + "desc": "Aumenta o tamanho das thumbs na galeria" + }, + "increaseBrushSize": { + "title": "Aumentar Tamanho do Pincel", + "desc": "Aumenta o tamanho do pincel/apagador" + }, + "fillBoundingBox": { + "title": "Preencher Caixa Delimitadora", + "desc": "Preenche a caixa delimitadora com a cor do pincel" + }, + "eraseBoundingBox": { + "title": "Apagar Caixa Delimitadora", + "desc": "Apaga a área da caixa delimitadora" + }, + "colorPicker": { + "title": "Selecionar Seletor de Cor", + "desc": "Seleciona o seletor de cores" + }, + "showHideBoundingBox": { + "title": "Mostrar/Esconder Caixa Delimitadora", + "desc": "Ativa a visibilidade da caixa delimitadora" + }, + "saveToGallery": { + "title": "Gravara Na Galeria", + "desc": "Grava a tela atual na galeria" + }, + "copyToClipboard": { + "title": "Copiar para a Área de Transferência", + "desc": "Copia a tela atual para a área de transferência" + }, + "resetView": { + "title": "Resetar Visualização", + "desc": "Reseta Visualização da Tela" + }, + "previousStagingImage": { + "title": "Imagem de Preparação Anterior", + "desc": "Área de Imagem de Preparação Anterior" + }, + "nextStagingImage": { + "title": "Próxima Imagem de Preparação Anterior", + "desc": "Próxima Área de Imagem de Preparação Anterior" + }, + "acceptStagingImage": { + "title": "Aceitar Imagem de Preparação Anterior", + "desc": "Aceitar Área de Imagem de Preparação Anterior" + } + }, + "modelManager": { + "modelAdded": "Modelo Adicionado", + "modelUpdated": "Modelo Atualizado", + "modelEntryDeleted": "Entrada de modelo excluída", + "description": "Descrição", + "modelLocationValidationMsg": "Caminho para onde o seu modelo está localizado.", + "repo_id": "Repo ID", + "vaeRepoIDValidationMsg": "Repositório Online do seu VAE", + "width": "Largura", + "widthValidationMsg": "Largura padrão do seu modelo.", + "height": "Altura", + "heightValidationMsg": "Altura padrão do seu modelo.", + "findModels": "Encontrar Modelos", + "scanAgain": "Digitalize Novamente", + "deselectAll": "Deselecionar Tudo", + "showExisting": "Mostrar Existente", + "deleteConfig": "Apagar Config", + "convertToDiffusersHelpText6": "Deseja converter este modelo?", + "mergedModelName": "Nome do modelo mesclado", + "alpha": "Alpha", + "interpolationType": "Tipo de Interpolação", + "modelMergeHeaderHelp1": "Pode mesclar até três modelos diferentes para criar uma mistura que atenda às suas necessidades.", + "modelMergeHeaderHelp2": "Apenas Diffusers estão disponíveis para mesclagem. Se deseja mesclar um modelo de checkpoint, por favor, converta-o para Diffusers primeiro.", + "modelMergeInterpAddDifferenceHelp": "Neste modo, o Modelo 3 é primeiro subtraído do Modelo 2. A versão resultante é mesclada com o Modelo 1 com a taxa alpha definida acima.", + "nameValidationMsg": "Insira um nome para o seu modelo", + "descriptionValidationMsg": "Adicione uma descrição para o seu modelo", + "config": "Configuração", + "modelExists": "Modelo Existe", + "selectAndAdd": "Selecione e Adicione Modelos Listados Abaixo", + "noModelsFound": "Nenhum Modelo Encontrado", + "v2_768": "v2 (768px)", + "inpainting": "v1 Inpainting", + "customConfig": "Configuração personalizada", + "pathToCustomConfig": "Caminho para configuração personalizada", + "statusConverting": "A converter", + "modelConverted": "Modelo Convertido", + "ignoreMismatch": "Ignorar Divergências entre Modelos Selecionados", + "addDifference": "Adicionar diferença", + "pickModelType": "Escolha o tipo de modelo", + "safetensorModels": "SafeTensors", + "cannotUseSpaces": "Não pode usar espaços", + "addNew": "Adicionar Novo", + "addManually": "Adicionar Manualmente", + "manual": "Manual", + "name": "Nome", + "configValidationMsg": "Caminho para o ficheiro de configuração do seu modelo.", + "modelLocation": "Localização do modelo", + "repoIDValidationMsg": "Repositório Online do seu Modelo", + "updateModel": "Atualizar Modelo", + "availableModels": "Modelos Disponíveis", + "load": "Carregar", + "active": "Ativado", + "notLoaded": "Não carregado", + "deleteModel": "Apagar modelo", + "deleteMsg1": "Tem certeza de que deseja apagar esta entrada do modelo de InvokeAI?", + "deleteMsg2": "Isso não vai apagar o ficheiro de modelo checkpoint do seu disco. Pode lê-los, se desejar.", + "convertToDiffusers": "Converter para Diffusers", + "convertToDiffusersHelpText1": "Este modelo será convertido ao formato 🧨 Diffusers.", + "convertToDiffusersHelpText2": "Este processo irá substituir a sua entrada de Gestor de Modelos por uma versão Diffusers do mesmo modelo.", + "convertToDiffusersHelpText3": "O seu ficheiro de ponto de verificação no disco NÃO será excluído ou modificado de forma alguma. Pode adicionar o seu ponto de verificação ao Gestor de modelos novamente, se desejar.", + "convertToDiffusersSaveLocation": "Local para Gravar", + "v2_base": "v2 (512px)", + "mergeModels": "Mesclar modelos", + "modelOne": "Modelo 1", + "modelTwo": "Modelo 2", + "modelThree": "Modelo 3", + "mergedModelSaveLocation": "Local de Salvamento", + "merge": "Mesclar", + "modelsMerged": "Modelos mesclados", + "mergedModelCustomSaveLocation": "Caminho Personalizado", + "invokeAIFolder": "Pasta Invoke AI", + "inverseSigmoid": "Sigmóide Inversa", + "none": "nenhum", + "modelManager": "Gerente de Modelo", + "model": "Modelo", + "allModels": "Todos os Modelos", + "checkpointModels": "Checkpoints", + "diffusersModels": "Diffusers", + "addNewModel": "Adicionar Novo modelo", + "addCheckpointModel": "Adicionar Modelo de Checkpoint/Safetensor", + "addDiffuserModel": "Adicionar Diffusers", + "vaeLocation": "Localização VAE", + "vaeLocationValidationMsg": "Caminho para onde o seu VAE está localizado.", + "vaeRepoID": "VAE Repo ID", + "addModel": "Adicionar Modelo", + "search": "Procurar", + "cached": "Em cache", + "checkpointFolder": "Pasta de Checkpoint", + "clearCheckpointFolder": "Apagar Pasta de Checkpoint", + "modelsFound": "Modelos Encontrados", + "selectFolder": "Selecione a Pasta", + "selected": "Selecionada", + "selectAll": "Selecionar Tudo", + "addSelected": "Adicione Selecionado", + "delete": "Apagar", + "formMessageDiffusersModelLocation": "Localização dos Modelos Diffusers", + "formMessageDiffusersModelLocationDesc": "Por favor entre com ao menos um.", + "formMessageDiffusersVAELocation": "Localização do VAE", + "formMessageDiffusersVAELocationDesc": "Se não provido, InvokeAI irá procurar pelo ficheiro VAE dentro do local do modelo.", + "convert": "Converter", + "convertToDiffusersHelpText4": "Este é um processo único. Pode levar cerca de 30 a 60s, a depender das especificações do seu computador.", + "convertToDiffusersHelpText5": "Por favor, certifique-se de que tenha espaço suficiente no disco. Os modelos geralmente variam entre 4GB e 7GB de tamanho.", + "v1": "v1", + "sameFolder": "Mesma pasta", + "invokeRoot": "Pasta do InvokeAI", + "custom": "Personalizado", + "customSaveLocation": "Local de salvamento personalizado", + "modelMergeAlphaHelp": "Alpha controla a força da mistura dos modelos. Valores de alpha mais baixos resultam numa influência menor do segundo modelo.", + "sigmoid": "Sigmóide", + "weightedSum": "Soma Ponderada" + }, + "parameters": { + "width": "Largura", + "seed": "Seed", + "hiresStrength": "Força da Alta Resolução", + "negativePrompts": "Indicações negativas", + "general": "Geral", + "randomizeSeed": "Seed Aleatório", + "shuffle": "Embaralhar", + "noiseThreshold": "Limite de Ruído", + "perlinNoise": "Ruído de Perlin", + "variations": "Variatções", + "seedWeights": "Pesos da Seed", + "restoreFaces": "Restaurar Rostos", + "faceRestoration": "Restauração de Rosto", + "type": "Tipo", + "denoisingStrength": "A força de remoção de ruído", + "scale": "Escala", + "otherOptions": "Outras Opções", + "seamlessTiling": "Ladrilho Sem Fronteira", + "hiresOptim": "Otimização de Alta Res", + "imageFit": "Caber Imagem Inicial No Tamanho de Saída", + "codeformerFidelity": "Fidelidade", + "seamSize": "Tamanho da Fronteira", + "seamBlur": "Desfoque da Fronteira", + "seamStrength": "Força da Fronteira", + "seamSteps": "Passos da Fronteira", + "tileSize": "Tamanho do Ladrilho", + "boundingBoxHeader": "Caixa Delimitadora", + "seamCorrectionHeader": "Correção de Fronteira", + "infillScalingHeader": "Preencimento e Escala", + "img2imgStrength": "Força de Imagem Para Imagem", + "toggleLoopback": "Ativar Loopback", + "symmetry": "Simetria", + "promptPlaceholder": "Digite o prompt aqui. [tokens negativos], (upweight)++, (downweight)--, trocar e misturar estão disponíveis (veja docs)", + "sendTo": "Mandar para", + "openInViewer": "Abrir No Visualizador", + "closeViewer": "Fechar Visualizador", + "usePrompt": "Usar Prompt", + "deleteImage": "Apagar Imagem", + "initialImage": "Imagem inicial", + "showOptionsPanel": "Mostrar Painel de Opções", + "strength": "Força", + "upscaling": "Redimensionando", + "upscale": "Redimensionar", + "upscaleImage": "Redimensionar Imagem", + "scaleBeforeProcessing": "Escala Antes do Processamento", + "invoke": "Invocar", + "images": "Imagems", + "steps": "Passos", + "cfgScale": "Escala CFG", + "height": "Altura", + "sampler": "Amostrador", + "imageToImage": "Imagem para Imagem", + "variationAmount": "Quntidade de Variatções", + "scaledWidth": "L Escalada", + "scaledHeight": "A Escalada", + "infillMethod": "Método de Preenchimento", + "hSymmetryStep": "H Passo de Simetria", + "vSymmetryStep": "V Passo de Simetria", + "cancel": { + "immediate": "Cancelar imediatamente", + "schedule": "Cancelar após a iteração atual", + "isScheduled": "A cancelar", + "setType": "Definir tipo de cancelamento" + }, + "sendToImg2Img": "Mandar para Imagem Para Imagem", + "sendToUnifiedCanvas": "Mandar para Tela Unificada", + "copyImage": "Copiar imagem", + "copyImageToLink": "Copiar Imagem Para a Ligação", + "downloadImage": "Descarregar Imagem", + "useSeed": "Usar Seed", + "useAll": "Usar Todos", + "useInitImg": "Usar Imagem Inicial", + "info": "Informações" + }, + "settings": { + "confirmOnDelete": "Confirmar Antes de Apagar", + "displayHelpIcons": "Mostrar Ícones de Ajuda", + "useCanvasBeta": "Usar Layout de Telas Beta", + "enableImageDebugging": "Ativar Depuração de Imagem", + "useSlidersForAll": "Usar deslizadores para todas as opções", + "resetWebUIDesc1": "Reiniciar a interface apenas reinicia o cache local do broswer para imagens e configurações lembradas. Não apaga nenhuma imagem do disco.", + "models": "Modelos", + "displayInProgress": "Mostrar Progresso de Imagens Em Andamento", + "saveSteps": "Gravar imagens a cada n passos", + "resetWebUI": "Reiniciar Interface", + "resetWebUIDesc2": "Se as imagens não estão a aparecer na galeria ou algo mais não está a funcionar, favor tentar reiniciar antes de postar um problema no GitHub.", + "resetComplete": "A interface foi reiniciada. Atualize a página para carregar." + }, + "toast": { + "uploadFailed": "Envio Falhou", + "uploadFailedMultipleImagesDesc": "Várias imagens copiadas, só é permitido uma imagem de cada vez", + "uploadFailedUnableToLoadDesc": "Não foj possível carregar o ficheiro", + "downloadImageStarted": "Download de Imagem Começou", + "imageNotLoadedDesc": "Nenhuma imagem encontrada a enviar para o módulo de imagem para imagem", + "imageLinkCopied": "Ligação de Imagem Copiada", + "imageNotLoaded": "Nenhuma Imagem Carregada", + "parametersFailed": "Problema ao carregar parâmetros", + "parametersFailedDesc": "Não foi possível carregar imagem incial.", + "seedSet": "Seed Definida", + "upscalingFailed": "Redimensionamento Falhou", + "promptNotSet": "Prompt Não Definido", + "tempFoldersEmptied": "Pasta de Ficheiros Temporários Esvaziada", + "imageCopied": "Imagem Copiada", + "imageSavedToGallery": "Imagem Salva na Galeria", + "canvasMerged": "Tela Fundida", + "sentToImageToImage": "Mandar Para Imagem Para Imagem", + "sentToUnifiedCanvas": "Enviada para a Tela Unificada", + "parametersSet": "Parâmetros Definidos", + "parametersNotSet": "Parâmetros Não Definidos", + "parametersNotSetDesc": "Nenhum metadado foi encontrado para essa imagem.", + "seedNotSet": "Seed Não Definida", + "seedNotSetDesc": "Não foi possível achar a seed para a imagem.", + "promptSet": "Prompt Definido", + "promptNotSetDesc": "Não foi possível achar prompt para essa imagem.", + "faceRestoreFailed": "Restauração de Rosto Falhou", + "metadataLoadFailed": "Falha ao tentar carregar metadados", + "initialImageSet": "Imagem Inicial Definida", + "initialImageNotSet": "Imagem Inicial Não Definida", + "initialImageNotSetDesc": "Não foi possível carregar imagem incial" + }, + "tooltip": { + "feature": { + "prompt": "Este é o campo de prompt. O prompt inclui objetos de geração e termos estilísticos. Também pode adicionar peso (importância do token) no prompt, mas comandos e parâmetros de CLI não funcionarão.", + "other": "Essas opções ativam modos alternativos de processamento para o Invoke. 'Seamless tiling' criará padrões repetidos na saída. 'High resolution' é uma geração em duas etapas com img2img: use essa configuração quando desejar uma imagem maior e mais coerente sem artefatos. Levará mais tempo do que o txt2img usual.", + "seed": "O valor da semente afeta o ruído inicial a partir do qual a imagem é formada. Pode usar as sementes já existentes de imagens anteriores. 'Limiar de ruído' é usado para mitigar artefatos em valores CFG altos (experimente a faixa de 0-10) e o Perlin para adicionar ruído Perlin durante a geração: ambos servem para adicionar variação às suas saídas.", + "imageToImage": "Image to Image carrega qualquer imagem como inicial, que é então usada para gerar uma nova junto com o prompt. Quanto maior o valor, mais a imagem resultante mudará. Valores de 0.0 a 1.0 são possíveis, a faixa recomendada é de 0.25 a 0.75", + "faceCorrection": "Correção de rosto com GFPGAN ou Codeformer: o algoritmo detecta rostos na imagem e corrige quaisquer defeitos. Um valor alto mudará mais a imagem, a resultar em rostos mais atraentes. Codeformer com uma fidelidade maior preserva a imagem original às custas de uma correção de rosto mais forte.", + "seamCorrection": "Controla o tratamento das emendas visíveis que ocorrem entre as imagens geradas no canvas.", + "gallery": "A galeria exibe as gerações da pasta de saída conforme elas são criadas. As configurações são armazenadas em ficheiros e acessadas pelo menu de contexto.", + "variations": "Experimente uma variação com um valor entre 0,1 e 1,0 para mudar o resultado para uma determinada semente. Variações interessantes da semente estão entre 0,1 e 0,3.", + "upscale": "Use o ESRGAN para ampliar a imagem imediatamente após a geração.", + "boundingBox": "A caixa delimitadora é a mesma que as configurações de largura e altura para Texto para Imagem ou Imagem para Imagem. Apenas a área na caixa será processada.", + "infillAndScaling": "Gira os métodos de preenchimento (usados em áreas mascaradas ou apagadas do canvas) e a escala (útil para tamanhos de caixa delimitadora pequenos)." + } + }, + "unifiedCanvas": { + "emptyTempImagesFolderMessage": "Esvaziar a pasta de ficheiros de imagem temporários também reseta completamente a Tela Unificada. Isso inclui todo o histórico de desfazer/refazer, imagens na área de preparação e a camada base da tela.", + "scaledBoundingBox": "Caixa Delimitadora Escalada", + "boundingBoxPosition": "Posição da Caixa Delimitadora", + "next": "Próximo", + "accept": "Aceitar", + "showHide": "Mostrar/Esconder", + "discardAll": "Descartar Todos", + "betaClear": "Limpar", + "betaDarkenOutside": "Escurecer Externamente", + "base": "Base", + "brush": "Pincel", + "showIntermediates": "Mostrar Intermediários", + "showGrid": "Mostrar Grade", + "clearCanvasHistoryConfirm": "Tem certeza que quer limpar o histórico de tela?", + "boundingBox": "Caixa Delimitadora", + "canvasDimensions": "Dimensões da Tela", + "canvasPosition": "Posição da Tela", + "cursorPosition": "Posição do cursor", + "previous": "Anterior", + "betaLimitToBox": "Limitar á Caixa", + "layer": "Camada", + "mask": "Máscara", + "maskingOptions": "Opções de Mascaramento", + "enableMask": "Ativar Máscara", + "preserveMaskedArea": "Preservar Área da Máscara", + "clearMask": "Limpar Máscara", + "eraser": "Apagador", + "fillBoundingBox": "Preencher Caixa Delimitadora", + "eraseBoundingBox": "Apagar Caixa Delimitadora", + "colorPicker": "Seletor de Cor", + "brushOptions": "Opções de Pincel", + "brushSize": "Tamanho", + "move": "Mover", + "resetView": "Resetar Visualização", + "mergeVisible": "Fundir Visível", + "saveToGallery": "Gravar na Galeria", + "copyToClipboard": "Copiar para a Área de Transferência", + "downloadAsImage": "Descarregar Como Imagem", + "undo": "Desfazer", + "redo": "Refazer", + "clearCanvas": "Limpar Tela", + "canvasSettings": "Configurações de Tela", + "snapToGrid": "Encaixar na Grade", + "darkenOutsideSelection": "Escurecer Seleção Externa", + "autoSaveToGallery": "Gravar Automaticamente na Galeria", + "saveBoxRegionOnly": "Gravar Apenas a Região da Caixa", + "limitStrokesToBox": "Limitar Traços à Caixa", + "showCanvasDebugInfo": "Mostrar Informações de Depuração daTela", + "clearCanvasHistory": "Limpar o Histórico da Tela", + "clearHistory": "Limpar Históprico", + "clearCanvasHistoryMessage": "Limpar o histórico de tela deixa a sua tela atual intacta, mas limpa de forma irreversível o histórico de desfazer e refazer.", + "emptyTempImageFolder": "Esvaziar a Pasta de Ficheiros de Imagem Temporários", + "emptyFolder": "Esvaziar Pasta", + "emptyTempImagesFolderConfirm": "Tem certeza que quer esvaziar a pasta de ficheiros de imagem temporários?", + "activeLayer": "Camada Ativa", + "canvasScale": "Escala da Tela", + "betaPreserveMasked": "Preservar Máscarado" + }, + "accessibility": { + "invokeProgressBar": "Invocar barra de progresso", + "reset": "Repôr", + "nextImage": "Próxima imagem", + "useThisParameter": "Usar este parâmetro", + "copyMetadataJson": "Copiar metadados JSON", + "zoomIn": "Ampliar", + "zoomOut": "Reduzir", + "rotateCounterClockwise": "Girar no sentido anti-horário", + "rotateClockwise": "Girar no sentido horário", + "flipVertically": "Espelhar verticalmente", + "modifyConfig": "Modificar config", + "toggleAutoscroll": "Alternar rolagem automática", + "showGallery": "Mostrar galeria", + "showOptionsPanel": "Mostrar painel de opções", + "uploadImage": "Enviar imagem", + "previousImage": "Imagem anterior", + "flipHorizontally": "Espelhar horizontalmente", + "toggleLogViewer": "Alternar visualizador de registo" } } diff --git a/invokeai/frontend/web/public/locales/pt_BR.json b/invokeai/frontend/web/public/locales/pt_BR.json index 7d433aa430..18b7ab57e1 100644 --- a/invokeai/frontend/web/public/locales/pt_BR.json +++ b/invokeai/frontend/web/public/locales/pt_BR.json @@ -63,7 +63,10 @@ "statusMergingModels": "Mesclando Modelos", "statusMergedModels": "Modelos Mesclados", "langRussian": "Russo", - "langSpanish": "Espanhol" + "langSpanish": "Espanhol", + "pinOptionsPanel": "Fixar painel de opções", + "loadingInvokeAI": "Carregando Invoke AI", + "loading": "Carregando" }, "gallery": { "generations": "Gerações", diff --git a/invokeai/frontend/web/public/locales/ru.json b/invokeai/frontend/web/public/locales/ru.json index e08540809b..d4178119e4 100644 --- a/invokeai/frontend/web/public/locales/ru.json +++ b/invokeai/frontend/web/public/locales/ru.json @@ -46,7 +46,15 @@ "statusLoadingModel": "Загрузка модели", "statusModelChanged": "Модель изменена", "githubLabel": "Github", - "discordLabel": "Discord" + "discordLabel": "Discord", + "statusMergingModels": "Слияние моделей", + "statusModelConverted": "Модель сконвертирована", + "statusMergedModels": "Модели объединены", + "pinOptionsPanel": "Закрепить панель настроек", + "loading": "Загрузка", + "loadingInvokeAI": "Загрузка Invoke AI", + "back": "Назад", + "statusConvertingModel": "Конвертация модели" }, "gallery": { "generations": "Генерации", @@ -323,7 +331,30 @@ "deleteConfig": "Удалить конфигурацию", "deleteMsg1": "Вы точно хотите удалить модель из InvokeAI?", "deleteMsg2": "Это не удалит файл модели с диска. Позже вы можете добавить его снова.", - "repoIDValidationMsg": "Онлайн-репозиторий модели" + "repoIDValidationMsg": "Онлайн-репозиторий модели", + "convertToDiffusersHelpText5": "Пожалуйста, убедитесь, что у вас достаточно места на диске. Модели обычно занимают 4 – 7 Гб.", + "invokeAIFolder": "Каталог InvokeAI", + "ignoreMismatch": "Игнорировать несоответствия между выбранными моделями", + "addCheckpointModel": "Добавить модель Checkpoint/Safetensor", + "formMessageDiffusersModelLocationDesc": "Укажите хотя бы одно.", + "convertToDiffusersHelpText3": "Файл модели на диске НЕ будет удалён или изменён. Вы сможете заново добавить его в Model Manager при необходимости.", + "vaeRepoID": "ID репозитория VAE", + "mergedModelName": "Название объединенной модели", + "checkpointModels": "Checkpoints", + "allModels": "Все модели", + "addDiffuserModel": "Добавить Diffusers", + "repo_id": "ID репозитория", + "formMessageDiffusersVAELocationDesc": "Если не указано, InvokeAI будет искать файл VAE рядом с моделью.", + "convert": "Преобразовать", + "convertToDiffusers": "Преобразовать в Diffusers", + "convertToDiffusersHelpText1": "Модель будет преобразована в формат 🧨 Diffusers.", + "convertToDiffusersHelpText4": "Это единоразовое действие. Оно может занять 30—60 секунд в зависимости от характеристик вашего компьютера.", + "convertToDiffusersHelpText6": "Вы хотите преобразовать эту модель?", + "statusConverting": "Преобразование", + "modelConverted": "Модель преобразована", + "invokeRoot": "Каталог InvokeAI", + "modelsMerged": "Модели объединены", + "mergeModels": "Объединить модели" }, "parameters": { "images": "Изображения", @@ -503,5 +534,8 @@ "betaDarkenOutside": "Затемнить снаружи", "betaLimitToBox": "Ограничить выделением", "betaPreserveMasked": "Сохранять маскируемую область" + }, + "accessibility": { + "modelSelect": "Выбор модели" } } diff --git a/invokeai/frontend/web/public/locales/zh_Hant.json b/invokeai/frontend/web/public/locales/zh_Hant.json index b0ae670e01..af7b0cf328 100644 --- a/invokeai/frontend/web/public/locales/zh_Hant.json +++ b/invokeai/frontend/web/public/locales/zh_Hant.json @@ -19,6 +19,21 @@ "discordLabel": "Discord", "nodesDesc": "使用Node生成圖像的系統正在開發中。敬請期待有關於這項功能的更新。", "reportBugLabel": "回報錯誤", - "githubLabel": "GitHub" + "githubLabel": "GitHub", + "langKorean": "韓語", + "langPortuguese": "葡萄牙語", + "hotkeysLabel": "快捷鍵", + "languagePickerLabel": "切換語言", + "langDutch": "荷蘭語", + "langFrench": "法語", + "langGerman": "德語", + "langItalian": "義大利語", + "langJapanese": "日語", + "langPolish": "波蘭語", + "langBrPortuguese": "巴西葡萄牙語", + "langRussian": "俄語", + "langSpanish": "西班牙語", + "text2img": "文字到圖像", + "unifiedCanvas": "統一畫布" } } diff --git a/invokeai/frontend/web/src/app/App.tsx b/invokeai/frontend/web/src/app/App.tsx index 3599577ca1..4be90f0892 100644 --- a/invokeai/frontend/web/src/app/App.tsx +++ b/invokeai/frontend/web/src/app/App.tsx @@ -9,34 +9,53 @@ import useToastWatcher from 'features/system/hooks/useToastWatcher'; import FloatingGalleryButton from 'features/ui/components/FloatingGalleryButton'; import FloatingParametersPanelButtons from 'features/ui/components/FloatingParametersPanelButtons'; -import { Box, Grid } from '@chakra-ui/react'; -import { APP_HEIGHT, APP_PADDING, APP_WIDTH } from 'theme/util/constants'; +import { Box, Flex, Grid, Portal, useColorMode } from '@chakra-ui/react'; +import { APP_HEIGHT, APP_WIDTH } from 'theme/util/constants'; +import ImageGalleryPanel from 'features/gallery/components/ImageGalleryPanel'; +import Lightbox from 'features/lightbox/components/Lightbox'; +import { useAppSelector } from './storeHooks'; +import { useEffect } from 'react'; keepGUIAlive(); const App = () => { useToastWatcher(); + const currentTheme = useAppSelector((state) => state.ui.currentTheme); + const { setColorMode } = useColorMode(); + + useEffect(() => { + setColorMode(['light'].includes(currentTheme) ? 'light' : 'dark'); + }, [setColorMode, currentTheme]); + return ( + - + + + + - - + + + + + + ); }; diff --git a/invokeai/frontend/web/src/app/ThemeLocaleProvider.tsx b/invokeai/frontend/web/src/app/ThemeLocaleProvider.tsx index 51fad5a431..e7054edcc4 100644 --- a/invokeai/frontend/web/src/app/ThemeLocaleProvider.tsx +++ b/invokeai/frontend/web/src/app/ThemeLocaleProvider.tsx @@ -9,6 +9,15 @@ import { greenTeaThemeColors } from 'theme/colors/greenTea'; import { invokeAIThemeColors } from 'theme/colors/invokeAI'; import { lightThemeColors } from 'theme/colors/lightTheme'; import { oceanBlueColors } from 'theme/colors/oceanBlue'; +import '@fontsource/inter/100.css'; +import '@fontsource/inter/200.css'; +import '@fontsource/inter/300.css'; +import '@fontsource/inter/400.css'; +import '@fontsource/inter/500.css'; +import '@fontsource/inter/600.css'; +import '@fontsource/inter/700.css'; +import '@fontsource/inter/800.css'; +import '@fontsource/inter/900.css'; type ThemeLocaleProviderProps = { children: ReactNode; diff --git a/invokeai/frontend/web/src/app/store.ts b/invokeai/frontend/web/src/app/store.ts index eaf1fcd42b..29dbff3fba 100644 --- a/invokeai/frontend/web/src/app/store.ts +++ b/invokeai/frontend/web/src/app/store.ts @@ -57,10 +57,13 @@ const galleryBlacklist = [ 'currentImage', 'currentImageUuid', 'shouldAutoSwitchToNewImages', - 'shouldHoldGalleryOpen', 'intermediateImage', ].map((blacklistItem) => `gallery.${blacklistItem}`); +const lightboxBlacklist = ['isLightboxOpen'].map( + (blacklistItem) => `lightbox.${blacklistItem}` +); + const rootReducer = combineReducers({ generation: generationReducer, postprocessing: postprocessingReducer, @@ -75,7 +78,12 @@ const rootPersistConfig = getPersistConfig({ key: 'root', storage, rootReducer, - blacklist: [...canvasBlacklist, ...systemBlacklist, ...galleryBlacklist], + blacklist: [ + ...canvasBlacklist, + ...systemBlacklist, + ...galleryBlacklist, + ...lightboxBlacklist, + ], debounce: 300, }); diff --git a/invokeai/frontend/web/src/common/components/GuideIcon.tsx b/invokeai/frontend/web/src/common/components/GuideIcon.tsx index 1816d9f30b..d8ac9dda0e 100644 --- a/invokeai/frontend/web/src/common/components/GuideIcon.tsx +++ b/invokeai/frontend/web/src/common/components/GuideIcon.tsx @@ -1,5 +1,6 @@ import { Box, forwardRef, Icon } from '@chakra-ui/react'; import { Feature } from 'app/features'; +import { memo } from 'react'; import { IconType } from 'react-icons'; import { MdHelp } from 'react-icons/md'; import GuidePopover from './GuidePopover'; @@ -19,4 +20,4 @@ const GuideIcon = forwardRef( ) ); -export default GuideIcon; +export default memo(GuideIcon); diff --git a/invokeai/frontend/web/src/common/components/GuidePopover.tsx b/invokeai/frontend/web/src/common/components/GuidePopover.tsx index ee376901e0..7fa0709321 100644 --- a/invokeai/frontend/web/src/common/components/GuidePopover.tsx +++ b/invokeai/frontend/web/src/common/components/GuidePopover.tsx @@ -11,7 +11,7 @@ import { Feature, useFeatureHelpInfo } from 'app/features'; import { useAppSelector } from 'app/storeHooks'; import { systemSelector } from 'features/system/store/systemSelectors'; import { SystemState } from 'features/system/store/systemSlice'; -import { ReactElement } from 'react'; +import { memo, ReactElement } from 'react'; type GuideProps = { children: ReactElement; @@ -30,7 +30,7 @@ const GuidePopover = ({ children, feature }: GuideProps) => { if (!shouldDisplayGuides) return null; return ( - + {children} @@ -46,4 +46,4 @@ const GuidePopover = ({ children, feature }: GuideProps) => { ); }; -export default GuidePopover; +export default memo(GuidePopover); diff --git a/invokeai/frontend/web/src/common/components/IAIAlertDialog.tsx b/invokeai/frontend/web/src/common/components/IAIAlertDialog.tsx index b1ddaf45d2..29ab35b049 100644 --- a/invokeai/frontend/web/src/common/components/IAIAlertDialog.tsx +++ b/invokeai/frontend/web/src/common/components/IAIAlertDialog.tsx @@ -8,7 +8,7 @@ import { forwardRef, useDisclosure, } from '@chakra-ui/react'; -import { cloneElement, ReactElement, ReactNode, useRef } from 'react'; +import { cloneElement, memo, ReactElement, ReactNode, useRef } from 'react'; import IAIButton from './IAIButton'; type Props = { @@ -79,4 +79,4 @@ const IAIAlertDialog = forwardRef((props: Props, ref) => { ); }); -export default IAIAlertDialog; +export default memo(IAIAlertDialog); diff --git a/invokeai/frontend/web/src/common/components/IAIButton.tsx b/invokeai/frontend/web/src/common/components/IAIButton.tsx index ca06e51bf0..3efae76d1e 100644 --- a/invokeai/frontend/web/src/common/components/IAIButton.tsx +++ b/invokeai/frontend/web/src/common/components/IAIButton.tsx @@ -5,7 +5,7 @@ import { Tooltip, TooltipProps, } from '@chakra-ui/react'; -import { ReactNode } from 'react'; +import { memo, ReactNode } from 'react'; export interface IAIButtonProps extends ButtonProps { tooltip?: string; @@ -25,4 +25,4 @@ const IAIButton = forwardRef((props: IAIButtonProps, forwardedRef) => { ); }); -export default IAIButton; +export default memo(IAIButton); diff --git a/invokeai/frontend/web/src/common/components/IAICheckbox.tsx b/invokeai/frontend/web/src/common/components/IAICheckbox.tsx index c04a383767..eb423b2b27 100644 --- a/invokeai/frontend/web/src/common/components/IAICheckbox.tsx +++ b/invokeai/frontend/web/src/common/components/IAICheckbox.tsx @@ -1,5 +1,5 @@ import { Checkbox, CheckboxProps } from '@chakra-ui/react'; -import type { ReactNode } from 'react'; +import { memo, ReactNode } from 'react'; type IAICheckboxProps = CheckboxProps & { label: string | ReactNode; @@ -14,4 +14,4 @@ const IAICheckbox = (props: IAICheckboxProps) => { ); }; -export default IAICheckbox; +export default memo(IAICheckbox); diff --git a/invokeai/frontend/web/src/common/components/IAIColorPicker.tsx b/invokeai/frontend/web/src/common/components/IAIColorPicker.tsx index 406966bf88..f6a05c86b1 100644 --- a/invokeai/frontend/web/src/common/components/IAIColorPicker.tsx +++ b/invokeai/frontend/web/src/common/components/IAIColorPicker.tsx @@ -1,4 +1,5 @@ import { chakra, ChakraProps } from '@chakra-ui/react'; +import { memo } from 'react'; import { RgbaColorPicker } from 'react-colorful'; import { ColorPickerBaseProps, RgbaColor } from 'react-colorful/dist/types'; @@ -35,4 +36,4 @@ const IAIColorPicker = (props: IAIColorPickerProps) => { ); }; -export default IAIColorPicker; +export default memo(IAIColorPicker); diff --git a/invokeai/frontend/web/src/common/components/IAIForms/IAIFormErrorMessage.tsx b/invokeai/frontend/web/src/common/components/IAIForms/IAIFormErrorMessage.tsx new file mode 100644 index 0000000000..22aa10cb06 --- /dev/null +++ b/invokeai/frontend/web/src/common/components/IAIForms/IAIFormErrorMessage.tsx @@ -0,0 +1,15 @@ +import { FormErrorMessage, FormErrorMessageProps } from '@chakra-ui/react'; +import { ReactNode } from 'react'; + +type IAIFormErrorMessageProps = FormErrorMessageProps & { + children: ReactNode | string; +}; + +export default function IAIFormErrorMessage(props: IAIFormErrorMessageProps) { + const { children, ...rest } = props; + return ( + + {children} + + ); +} diff --git a/invokeai/frontend/web/src/common/components/IAIForms/IAIFormHelperText.tsx b/invokeai/frontend/web/src/common/components/IAIForms/IAIFormHelperText.tsx new file mode 100644 index 0000000000..4d48ac991c --- /dev/null +++ b/invokeai/frontend/web/src/common/components/IAIForms/IAIFormHelperText.tsx @@ -0,0 +1,15 @@ +import { FormHelperText, FormHelperTextProps } from '@chakra-ui/react'; +import { ReactNode } from 'react'; + +type IAIFormHelperTextProps = FormHelperTextProps & { + children: ReactNode | string; +}; + +export default function IAIFormHelperText(props: IAIFormHelperTextProps) { + const { children, ...rest } = props; + return ( + + {children} + + ); +} diff --git a/invokeai/frontend/web/src/common/components/IAIIconButton.tsx b/invokeai/frontend/web/src/common/components/IAIIconButton.tsx index 4e6e3d7643..8ea06a1328 100644 --- a/invokeai/frontend/web/src/common/components/IAIIconButton.tsx +++ b/invokeai/frontend/web/src/common/components/IAIIconButton.tsx @@ -5,15 +5,17 @@ import { Tooltip, TooltipProps, } from '@chakra-ui/react'; +import { memo } from 'react'; export type IAIIconButtonProps = IconButtonProps & { + role?: string; tooltip?: string; tooltipProps?: Omit; isChecked?: boolean; }; const IAIIconButton = forwardRef((props: IAIIconButtonProps, forwardedRef) => { - const { tooltip = '', tooltipProps, isChecked, ...rest } = props; + const { role, tooltip = '', tooltipProps, isChecked, ...rest } = props; return ( { > @@ -33,4 +36,5 @@ const IAIIconButton = forwardRef((props: IAIIconButtonProps, forwardedRef) => { ); }); -export default IAIIconButton; +IAIIconButton.displayName = 'IAIIconButton'; +export default memo(IAIIconButton); diff --git a/invokeai/frontend/web/src/common/components/IAIInput.tsx b/invokeai/frontend/web/src/common/components/IAIInput.tsx index e0d0536c03..3e90dca83a 100644 --- a/invokeai/frontend/web/src/common/components/IAIInput.tsx +++ b/invokeai/frontend/web/src/common/components/IAIInput.tsx @@ -5,7 +5,7 @@ import { Input, InputProps, } from '@chakra-ui/react'; -import { ChangeEvent } from 'react'; +import { ChangeEvent, memo } from 'react'; interface IAIInputProps extends InputProps { label?: string; @@ -15,7 +15,7 @@ interface IAIInputProps extends InputProps { formControlProps?: Omit; } -export default function IAIInput(props: IAIInputProps) { +const IAIInput = (props: IAIInputProps) => { const { label = '', isDisabled = false, @@ -34,4 +34,6 @@ export default function IAIInput(props: IAIInputProps) { ); -} +}; + +export default memo(IAIInput); diff --git a/invokeai/frontend/web/src/common/components/IAINumberInput.tsx b/invokeai/frontend/web/src/common/components/IAINumberInput.tsx index cfe06aa727..4f468eb354 100644 --- a/invokeai/frontend/web/src/common/components/IAINumberInput.tsx +++ b/invokeai/frontend/web/src/common/components/IAINumberInput.tsx @@ -16,7 +16,7 @@ import { } from '@chakra-ui/react'; import { clamp } from 'lodash'; -import { FocusEvent, useEffect, useState } from 'react'; +import { FocusEvent, memo, useEffect, useState } from 'react'; const numberStringRegex = /^-?(0\.)?\.?$/; @@ -139,4 +139,4 @@ const IAINumberInput = (props: Props) => { ); }; -export default IAINumberInput; +export default memo(IAINumberInput); diff --git a/invokeai/frontend/web/src/common/components/IAIOption.tsx b/invokeai/frontend/web/src/common/components/IAIOption.tsx new file mode 100644 index 0000000000..9c8a611160 --- /dev/null +++ b/invokeai/frontend/web/src/common/components/IAIOption.tsx @@ -0,0 +1,18 @@ +import { useToken } from '@chakra-ui/react'; +import { ReactNode } from 'react'; + +type IAIOptionProps = { + children: ReactNode | string | number; + value: string | number; +}; + +export default function IAIOption(props: IAIOptionProps) { + const { children, value } = props; + const [base800, base200] = useToken('colors', ['base.800', 'base.200']); + + return ( + + ); +} diff --git a/invokeai/frontend/web/src/common/components/IAIPopover.tsx b/invokeai/frontend/web/src/common/components/IAIPopover.tsx index c58accebe4..46a08e97e3 100644 --- a/invokeai/frontend/web/src/common/components/IAIPopover.tsx +++ b/invokeai/frontend/web/src/common/components/IAIPopover.tsx @@ -6,7 +6,7 @@ import { PopoverProps, PopoverTrigger, } from '@chakra-ui/react'; -import { ReactNode } from 'react'; +import { memo, ReactNode } from 'react'; type IAIPopoverProps = PopoverProps & { triggerComponent: ReactNode; @@ -35,4 +35,4 @@ const IAIPopover = (props: IAIPopoverProps) => { ); }; -export default IAIPopover; +export default memo(IAIPopover); diff --git a/invokeai/frontend/web/src/common/components/IAISelect.tsx b/invokeai/frontend/web/src/common/components/IAISelect.tsx index caff77ed17..f0998b8937 100644 --- a/invokeai/frontend/web/src/common/components/IAISelect.tsx +++ b/invokeai/frontend/web/src/common/components/IAISelect.tsx @@ -6,7 +6,8 @@ import { Tooltip, TooltipProps, } from '@chakra-ui/react'; -import { MouseEvent } from 'react'; +import { memo, MouseEvent } from 'react'; +import IAIOption from './IAIOption'; type IAISelectProps = SelectProps & { label?: string; @@ -37,13 +38,13 @@ const IAISelect = (props: IAISelectProps) => { @@ -52,4 +53,4 @@ const IAISelect = (props: IAISelectProps) => { ); }; -export default IAISelect; +export default memo(IAISelect); diff --git a/invokeai/frontend/web/src/common/components/IAISimpleMenu.tsx b/invokeai/frontend/web/src/common/components/IAISimpleMenu.tsx index bbb0772eb2..83a60887b5 100644 --- a/invokeai/frontend/web/src/common/components/IAISimpleMenu.tsx +++ b/invokeai/frontend/web/src/common/components/IAISimpleMenu.tsx @@ -11,7 +11,7 @@ import { IconButtonProps, ButtonProps, } from '@chakra-ui/react'; -import { MouseEventHandler, ReactNode } from 'react'; +import { memo, MouseEventHandler, ReactNode } from 'react'; import { MdArrowDropDown, MdArrowDropUp } from 'react-icons/md'; interface IAIMenuItem { @@ -31,7 +31,7 @@ interface IAIMenuProps { menuItemProps?: MenuItemProps; } -export default function IAISimpleMenu(props: IAIMenuProps) { +const IAISimpleMenu = (props: IAIMenuProps) => { const { menuType = 'icon', iconTooltip, @@ -83,4 +83,6 @@ export default function IAISimpleMenu(props: IAIMenuProps) { )}
); -} +}; + +export default memo(IAISimpleMenu); diff --git a/invokeai/frontend/web/src/common/components/IAISlider.tsx b/invokeai/frontend/web/src/common/components/IAISlider.tsx index 1acc64db23..03742c0100 100644 --- a/invokeai/frontend/web/src/common/components/IAISlider.tsx +++ b/invokeai/frontend/web/src/common/components/IAISlider.tsx @@ -25,7 +25,8 @@ import { } from '@chakra-ui/react'; import { clamp } from 'lodash'; -import { FocusEvent, useEffect, useMemo, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { FocusEvent, memo, useEffect, useMemo, useState } from 'react'; import { BiReset } from 'react-icons/bi'; import IAIIconButton, { IAIIconButtonProps } from './IAIIconButton'; @@ -61,7 +62,7 @@ export type IAIFullSliderProps = { sliderIAIIconButtonProps?: IAIIconButtonProps; }; -export default function IAISlider(props: IAIFullSliderProps) { +const IAISlider = (props: IAIFullSliderProps) => { const [showTooltip, setShowTooltip] = useState(false); const { label, @@ -96,6 +97,8 @@ export default function IAISlider(props: IAIFullSliderProps) { ...rest } = props; + const { t } = useTranslation(); + const [localInputValue, setLocalInputValue] = useState< string | number | undefined >(String(value)); @@ -171,16 +174,22 @@ export default function IAISlider(props: IAIFullSliderProps) { <> {min} {max} @@ -234,7 +243,7 @@ export default function IAISlider(props: IAIFullSliderProps) { {withReset && ( } onClick={handleResetDisable} @@ -245,4 +254,6 @@ export default function IAISlider(props: IAIFullSliderProps) { ); -} +}; + +export default memo(IAISlider); diff --git a/invokeai/frontend/web/src/common/components/IAISwitch.tsx b/invokeai/frontend/web/src/common/components/IAISwitch.tsx index 5ef568f28a..c03fc17d51 100644 --- a/invokeai/frontend/web/src/common/components/IAISwitch.tsx +++ b/invokeai/frontend/web/src/common/components/IAISwitch.tsx @@ -6,6 +6,7 @@ import { Switch, SwitchProps, } from '@chakra-ui/react'; +import { memo } from 'react'; interface Props extends SwitchProps { label?: string; @@ -44,4 +45,4 @@ const IAISwitch = (props: Props) => { ); }; -export default IAISwitch; +export default memo(IAISwitch); diff --git a/invokeai/frontend/web/src/common/components/ImageUploader.tsx b/invokeai/frontend/web/src/common/components/ImageUploader.tsx index 5397de6ea6..c4f4dca9df 100644 --- a/invokeai/frontend/web/src/common/components/ImageUploader.tsx +++ b/invokeai/frontend/web/src/common/components/ImageUploader.tsx @@ -3,10 +3,11 @@ import { ImageUploaderTriggerContext } from 'app/contexts/ImageUploaderTriggerCo import { useAppDispatch, useAppSelector } from 'app/storeHooks'; import useImageUploader from 'common/hooks/useImageUploader'; import { uploadImage } from 'features/gallery/store/thunks/uploadImage'; -import { tabDict } from 'features/ui/components/InvokeTabs'; import { activeTabNameSelector } from 'features/ui/store/uiSelectors'; +import { ResourceKey } from 'i18next'; import { KeyboardEvent, + memo, ReactNode, useCallback, useEffect, @@ -134,7 +135,7 @@ const ImageUploader = (props: ImageUploaderProps) => { const overlaySecondaryText = ['img2img', 'unifiedCanvas'].includes( activeTabName ) - ? ` to ${tabDict[activeTabName as keyof typeof tabDict].tooltip}` + ? ` to ${String(t(`common.${activeTabName}` as ResourceKey))}` : ``; return ( @@ -161,4 +162,4 @@ const ImageUploader = (props: ImageUploaderProps) => { ); }; -export default ImageUploader; +export default memo(ImageUploader); diff --git a/invokeai/frontend/web/src/common/components/ImageUploaderIconButton.tsx b/invokeai/frontend/web/src/common/components/ImageUploaderIconButton.tsx index d3c7e4f7b4..169651cbc8 100644 --- a/invokeai/frontend/web/src/common/components/ImageUploaderIconButton.tsx +++ b/invokeai/frontend/web/src/common/components/ImageUploaderIconButton.tsx @@ -1,14 +1,16 @@ import { ImageUploaderTriggerContext } from 'app/contexts/ImageUploaderTriggerContext'; import { useContext } from 'react'; +import { useTranslation } from 'react-i18next'; import { FaUpload } from 'react-icons/fa'; import IAIIconButton from './IAIIconButton'; const ImageUploaderIconButton = () => { + const { t } = useTranslation(); const openImageUploader = useContext(ImageUploaderTriggerContext); return ( } onClick={openImageUploader || undefined} diff --git a/invokeai/frontend/web/src/features/canvas/components/IAICanvasGrid.tsx b/invokeai/frontend/web/src/features/canvas/components/IAICanvasGrid.tsx index e38debae83..26fb6f7823 100644 --- a/invokeai/frontend/web/src/features/canvas/components/IAICanvasGrid.tsx +++ b/invokeai/frontend/web/src/features/canvas/components/IAICanvasGrid.tsx @@ -1,5 +1,6 @@ // Grid drawing adapted from https://longviewcoder.com/2021/12/08/konva-a-better-grid/ +import { useToken } from '@chakra-ui/react'; import { createSelector } from '@reduxjs/toolkit'; import { RootState } from 'app/store'; import { useAppSelector } from 'app/storeHooks'; @@ -22,13 +23,6 @@ const selector = createSelector( } ); -const gridLinesColor = { - dark: 'rgba(255, 255, 255, 0.2)', - green: 'rgba(255, 255, 255, 0.2)', - light: 'rgba(0, 0, 0, 0.2)', - ocean: 'rgba(136, 148, 184, 0.2)', -}; - const IAICanvasGrid = () => { const currentTheme = useAppSelector( (state: RootState) => state.ui.currentTheme @@ -37,6 +31,8 @@ const IAICanvasGrid = () => { useAppSelector(selector); const [gridLines, setGridLines] = useState([]); + const [gridLineColor] = useToken('colors', ['gridLineColor']); + const unscale = useCallback( (value: number) => { return value / stageScale; @@ -45,9 +41,6 @@ const IAICanvasGrid = () => { ); useLayoutEffect(() => { - const gridLineColor = - gridLinesColor[currentTheme as keyof typeof gridLinesColor]; - const { width, height } = stageDimensions; const { x, y } = stageCoordinates; @@ -112,7 +105,14 @@ const IAICanvasGrid = () => { )); setGridLines(xLines.concat(yLines)); - }, [stageScale, stageCoordinates, stageDimensions, currentTheme, unscale]); + }, [ + stageScale, + stageCoordinates, + stageDimensions, + currentTheme, + unscale, + gridLineColor, + ]); return {gridLines}; }; diff --git a/invokeai/frontend/web/src/features/canvas/components/IAICanvasStatusText.tsx b/invokeai/frontend/web/src/features/canvas/components/IAICanvasStatusText.tsx index e886a3ad5d..72f532217f 100644 --- a/invokeai/frontend/web/src/features/canvas/components/IAICanvasStatusText.tsx +++ b/invokeai/frontend/web/src/features/canvas/components/IAICanvasStatusText.tsx @@ -104,7 +104,7 @@ const IAICanvasStatusText = () => { margin: 1, borderRadius: 'base', pointerEvents: 'none', - bg: 'blackAlpha.500', + bg: 'base.800', }} > { + dispatch(setDoesCanvasNeedScaling(true)); +}, 300); + +export const requestCanvasRescale = + () => (dispatch: AppDispatch, getState: AppGetState) => { + const activeTabName = activeTabNameSelector(getState()); + if (activeTabName === 'unifiedCanvas') { + debouncedCanvasScale(dispatch); + } + }; diff --git a/invokeai/frontend/web/src/features/gallery/components/CurrentImageButtons.tsx b/invokeai/frontend/web/src/features/gallery/components/CurrentImageButtons.tsx index be59962556..c0d82a5942 100644 --- a/invokeai/frontend/web/src/features/gallery/components/CurrentImageButtons.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/CurrentImageButtons.tsx @@ -7,10 +7,7 @@ import { useAppDispatch, useAppSelector } from 'app/storeHooks'; import IAIButton from 'common/components/IAIButton'; import IAIIconButton from 'common/components/IAIIconButton'; import IAIPopover from 'common/components/IAIPopover'; -import { - setDoesCanvasNeedScaling, - setInitialCanvasImage, -} from 'features/canvas/store/canvasSlice'; +import { setInitialCanvasImage } from 'features/canvas/store/canvasSlice'; import { GalleryState } from 'features/gallery/store/gallerySlice'; import { lightboxSelector } from 'features/lightbox/store/lightboxSelectors'; import { setIsLightboxOpen } from 'features/lightbox/store/lightboxSlice'; @@ -52,6 +49,7 @@ import { gallerySelector } from '../store/gallerySelectors'; import DeleteImageModal from './DeleteImageModal'; import { useCallback } from 'react'; import useSetBothPrompts from 'features/parameters/hooks/usePrompt'; +import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale'; const currentImageButtonsSelector = createSelector( [ @@ -361,7 +359,7 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => { if (isLightboxOpen) dispatch(setIsLightboxOpen(false)); dispatch(setInitialCanvasImage(currentImage)); - dispatch(setDoesCanvasNeedScaling(true)); + dispatch(requestCanvasRescale()); if (activeTabName !== 'unifiedCanvas') { dispatch(setActiveTab('unifiedCanvas')); @@ -419,7 +417,6 @@ const CurrentImageButtons = (props: CurrentImageButtonsProps) => { sx={{ flexDirection: 'column', rowGap: 2, - w: 52, }} > )} {!shouldShowImageDetails && } {shouldShowImageDetails && imageToDisplay && ( - + + + )} ); diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageGallery.tsx b/invokeai/frontend/web/src/features/gallery/components/ImageGallery.tsx index 1b14d9ff67..dbd621aa83 100644 --- a/invokeai/frontend/web/src/features/gallery/components/ImageGallery.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/ImageGallery.tsx @@ -1,609 +1,442 @@ -import { NumberSize, Resizable } from 're-resizable'; +// import { NumberSize, Resizable } from 're-resizable'; -import { - Box, - ButtonGroup, - Flex, - Grid, - Icon, - chakra, - useTheme, -} from '@chakra-ui/react'; -import { requestImages } from 'app/socketio/actions'; -import { useAppDispatch, useAppSelector } from 'app/storeHooks'; -import IAIButton from 'common/components/IAIButton'; -import IAICheckbox from 'common/components/IAICheckbox'; -import IAIIconButton from 'common/components/IAIIconButton'; -import IAIPopover from 'common/components/IAIPopover'; -import IAISlider from 'common/components/IAISlider'; -import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice'; -import { imageGallerySelector } from 'features/gallery/store/gallerySelectors'; -import { - selectNextImage, - selectPrevImage, - setCurrentCategory, - setGalleryImageMinimumWidth, - setGalleryImageObjectFit, - setGalleryWidth, - setShouldAutoSwitchToNewImages, - setShouldHoldGalleryOpen, - setShouldPinGallery, - setShouldShowGallery, - setShouldUseSingleGalleryColumn, -} from 'features/gallery/store/gallerySlice'; -import { InvokeTabName } from 'features/ui/store/tabMap'; +// import { +// Box, +// ButtonGroup, +// Flex, +// Grid, +// Icon, +// chakra, +// useTheme, +// } from '@chakra-ui/react'; +// import { requestImages } from 'app/socketio/actions'; +// import { useAppDispatch, useAppSelector } from 'app/storeHooks'; +// import IAIButton from 'common/components/IAIButton'; +// import IAICheckbox from 'common/components/IAICheckbox'; +// import IAIIconButton from 'common/components/IAIIconButton'; +// import IAIPopover from 'common/components/IAIPopover'; +// import IAISlider from 'common/components/IAISlider'; +// import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice'; +// import { imageGallerySelector } from 'features/gallery/store/gallerySelectors'; +// import { +// selectNextImage, +// selectPrevImage, +// setCurrentCategory, +// setGalleryImageMinimumWidth, +// setGalleryImageObjectFit, +// setGalleryWidth, +// setShouldAutoSwitchToNewImages, +// setShouldHoldGalleryOpen, +// setShouldUseSingleGalleryColumn, +// } from 'features/gallery/store/gallerySlice'; +// import { +// setShouldPinGallery, +// setShouldShowGallery, +// } from 'features/ui/store/uiSlice'; +// import { InvokeTabName } from 'features/ui/store/tabMap'; -import { clamp } from 'lodash'; -import { Direction } from 're-resizable/lib/resizer'; -import React, { - ChangeEvent, - useCallback, - useEffect, - useRef, - useState, -} from 'react'; -import { useHotkeys } from 'react-hotkeys-hook'; -import { useTranslation } from 'react-i18next'; -import { BsPinAngle, BsPinAngleFill } from 'react-icons/bs'; -import { FaImage, FaUser, FaWrench } from 'react-icons/fa'; -import { MdPhotoLibrary } from 'react-icons/md'; -import { CSSTransition } from 'react-transition-group'; -import HoverableImage from './HoverableImage'; -import { APP_GALLERY_HEIGHT_PINNED } from 'theme/util/constants'; +// import { clamp } from 'lodash'; +// import { Direction } from 're-resizable/lib/resizer'; +// import React, { +// ChangeEvent, +// useCallback, +// useEffect, +// useRef, +// useState, +// } from 'react'; +// import { useHotkeys } from 'react-hotkeys-hook'; +// import { useTranslation } from 'react-i18next'; +// import { BsPinAngle, BsPinAngleFill } from 'react-icons/bs'; +// import { FaImage, FaUser, FaWrench } from 'react-icons/fa'; +// import { MdPhotoLibrary } from 'react-icons/md'; +// import { CSSTransition } from 'react-transition-group'; +// import HoverableImage from './HoverableImage'; +// import { APP_GALLERY_HEIGHT_PINNED } from 'theme/util/constants'; -import './ImageGallery.css'; -import { no_scrollbar } from 'theme/components/scrollbar'; +// import './ImageGallery.css'; +// import { no_scrollbar } from 'theme/components/scrollbar'; +// import ImageGalleryContent from './ImageGalleryContent'; -const ChakraResizeable = chakra(Resizable, { - shouldForwardProp: (prop) => !['sx'].includes(prop), -}); +// const ChakraResizeable = chakra(Resizable, { +// shouldForwardProp: (prop) => !['sx'].includes(prop), +// }); -const GALLERY_SHOW_BUTTONS_MIN_WIDTH = 320; -const GALLERY_IMAGE_WIDTH_OFFSET = 40; +// const GALLERY_SHOW_BUTTONS_MIN_WIDTH = 320; +// const GALLERY_IMAGE_WIDTH_OFFSET = 40; -const GALLERY_TAB_WIDTHS: Record< - InvokeTabName, - { galleryMinWidth: number; galleryMaxWidth: number } -> = { - txt2img: { galleryMinWidth: 200, galleryMaxWidth: 500 }, - img2img: { galleryMinWidth: 200, galleryMaxWidth: 500 }, - unifiedCanvas: { galleryMinWidth: 200, galleryMaxWidth: 200 }, - nodes: { galleryMinWidth: 200, galleryMaxWidth: 500 }, - postprocess: { galleryMinWidth: 200, galleryMaxWidth: 500 }, - training: { galleryMinWidth: 200, galleryMaxWidth: 500 }, -}; +// const GALLERY_TAB_WIDTHS: Record< +// InvokeTabName, +// { galleryMinWidth: number; galleryMaxWidth: number } +// > = { +// txt2img: { galleryMinWidth: 200, galleryMaxWidth: 500 }, +// img2img: { galleryMinWidth: 200, galleryMaxWidth: 500 }, +// unifiedCanvas: { galleryMinWidth: 200, galleryMaxWidth: 200 }, +// nodes: { galleryMinWidth: 200, galleryMaxWidth: 500 }, +// postprocess: { galleryMinWidth: 200, galleryMaxWidth: 500 }, +// training: { galleryMinWidth: 200, galleryMaxWidth: 500 }, +// }; -const LIGHTBOX_GALLERY_WIDTH = 400; +// const LIGHTBOX_GALLERY_WIDTH = 400; -export default function ImageGallery() { - const dispatch = useAppDispatch(); - const { direction } = useTheme(); +// export default function ImageGallery() { +// const dispatch = useAppDispatch(); +// const { direction } = useTheme(); - const { t } = useTranslation(); +// const { t } = useTranslation(); - const { - images, - currentCategory, - currentImageUuid, - shouldPinGallery, - shouldShowGallery, - galleryImageMinimumWidth, - galleryGridTemplateColumns, - activeTabName, - galleryImageObjectFit, - shouldHoldGalleryOpen, - shouldAutoSwitchToNewImages, - areMoreImagesAvailable, - galleryWidth, - isLightboxOpen, - isStaging, - shouldEnableResize, - shouldUseSingleGalleryColumn, - } = useAppSelector(imageGallerySelector); +// const { +// images, +// currentCategory, +// currentImageUuid, +// shouldPinGallery, +// shouldShowGallery, +// galleryImageMinimumWidth, +// galleryGridTemplateColumns, +// activeTabName, +// galleryImageObjectFit, +// shouldHoldGalleryOpen, +// shouldAutoSwitchToNewImages, +// areMoreImagesAvailable, +// galleryWidth, +// isLightboxOpen, +// isStaging, +// shouldEnableResize, +// shouldUseSingleGalleryColumn, +// } = useAppSelector(imageGallerySelector); - const { galleryMinWidth, galleryMaxWidth } = isLightboxOpen - ? { - galleryMinWidth: LIGHTBOX_GALLERY_WIDTH, - galleryMaxWidth: LIGHTBOX_GALLERY_WIDTH, - } - : GALLERY_TAB_WIDTHS[activeTabName]; +// const { galleryMinWidth, galleryMaxWidth } = isLightboxOpen +// ? { +// galleryMinWidth: LIGHTBOX_GALLERY_WIDTH, +// galleryMaxWidth: LIGHTBOX_GALLERY_WIDTH, +// } +// : GALLERY_TAB_WIDTHS[activeTabName]; - const [shouldShowButtons, setShouldShowButtons] = useState( - galleryWidth >= GALLERY_SHOW_BUTTONS_MIN_WIDTH - ); +// const [shouldShowButtons, setShouldShowButtons] = useState( +// galleryWidth >= GALLERY_SHOW_BUTTONS_MIN_WIDTH +// ); - const [isResizing, setIsResizing] = useState(false); - const [galleryResizeHeight, setGalleryResizeHeight] = useState(0); +// const [isResizing, setIsResizing] = useState(false); +// const [galleryResizeHeight, setGalleryResizeHeight] = useState(0); - const galleryRef = useRef(null); - const galleryContainerRef = useRef(null); - const timeoutIdRef = useRef(null); +// const galleryRef = useRef(null); +// const galleryContainerRef = useRef(null); +// const timeoutIdRef = useRef(null); - useEffect(() => { - setShouldShowButtons(galleryWidth >= GALLERY_SHOW_BUTTONS_MIN_WIDTH); - }, [galleryWidth]); +// useEffect(() => { +// setShouldShowButtons(galleryWidth >= GALLERY_SHOW_BUTTONS_MIN_WIDTH); +// }, [galleryWidth]); - const handleSetShouldPinGallery = () => { - !shouldPinGallery && dispatch(setShouldShowGallery(true)); - dispatch(setShouldPinGallery(!shouldPinGallery)); - dispatch(setDoesCanvasNeedScaling(true)); - }; +// const handleSetShouldPinGallery = () => { +// !shouldPinGallery && dispatch(setShouldShowGallery(true)); +// dispatch(setShouldPinGallery(!shouldPinGallery)); +// dispatch(setDoesCanvasNeedScaling(true)); +// }; - const handleToggleGallery = () => { - shouldShowGallery ? handleCloseGallery() : handleOpenGallery(); - }; +// const handleToggleGallery = () => { +// shouldShowGallery ? handleCloseGallery() : handleOpenGallery(); +// }; - const handleOpenGallery = () => { - dispatch(setShouldShowGallery(true)); - shouldPinGallery && dispatch(setDoesCanvasNeedScaling(true)); - }; +// const handleOpenGallery = () => { +// dispatch(setShouldShowGallery(true)); +// shouldPinGallery && dispatch(setDoesCanvasNeedScaling(true)); +// }; - const handleCloseGallery = useCallback(() => { - dispatch(setShouldShowGallery(false)); - dispatch(setShouldHoldGalleryOpen(false)); - setTimeout( - () => shouldPinGallery && dispatch(setDoesCanvasNeedScaling(true)), - 400 - ); - }, [dispatch, shouldPinGallery]); +// const handleCloseGallery = useCallback(() => { +// dispatch(setShouldShowGallery(false)); +// dispatch(setShouldHoldGalleryOpen(false)); +// setTimeout( +// () => shouldPinGallery && dispatch(setDoesCanvasNeedScaling(true)), +// 400 +// ); +// }, [dispatch, shouldPinGallery]); - const handleClickLoadMore = () => { - dispatch(requestImages(currentCategory)); - }; +// const handleClickLoadMore = () => { +// dispatch(requestImages(currentCategory)); +// }; - const handleChangeGalleryImageMinimumWidth = (v: number) => { - dispatch(setGalleryImageMinimumWidth(v)); - }; +// const handleChangeGalleryImageMinimumWidth = (v: number) => { +// dispatch(setGalleryImageMinimumWidth(v)); +// }; - const setCloseGalleryTimer = () => { - if (shouldHoldGalleryOpen) return; - timeoutIdRef.current = window.setTimeout(() => handleCloseGallery(), 500); - }; +// const setCloseGalleryTimer = () => { +// if (shouldHoldGalleryOpen) return; +// timeoutIdRef.current = window.setTimeout(() => handleCloseGallery(), 500); +// }; - const cancelCloseGalleryTimer = () => { - timeoutIdRef.current && window.clearTimeout(timeoutIdRef.current); - }; +// const cancelCloseGalleryTimer = () => { +// timeoutIdRef.current && window.clearTimeout(timeoutIdRef.current); +// }; - useHotkeys( - 'g', - () => { - handleToggleGallery(); - }, - [shouldShowGallery, shouldPinGallery] - ); +// useHotkeys( +// 'g', +// () => { +// handleToggleGallery(); +// }, +// [shouldShowGallery, shouldPinGallery] +// ); - useHotkeys( - 'left', - () => { - dispatch(selectPrevImage()); - }, - { - enabled: !isStaging || activeTabName !== 'unifiedCanvas', - }, - [isStaging] - ); +// useHotkeys( +// 'left', +// () => { +// dispatch(selectPrevImage()); +// }, +// { +// enabled: !isStaging || activeTabName !== 'unifiedCanvas', +// }, +// [isStaging] +// ); - useHotkeys( - 'right', - () => { - dispatch(selectNextImage()); - }, - { - enabled: !isStaging || activeTabName !== 'unifiedCanvas', - }, - [isStaging] - ); +// useHotkeys( +// 'right', +// () => { +// dispatch(selectNextImage()); +// }, +// { +// enabled: !isStaging || activeTabName !== 'unifiedCanvas', +// }, +// [isStaging] +// ); - useHotkeys( - 'shift+g', - () => { - handleSetShouldPinGallery(); - }, - [shouldPinGallery] - ); +// useHotkeys( +// 'shift+g', +// () => { +// handleSetShouldPinGallery(); +// }, +// [shouldPinGallery] +// ); - useHotkeys( - 'esc', - () => { - dispatch(setShouldShowGallery(false)); - }, - { - enabled: () => !shouldPinGallery, - preventDefault: true, - }, - [shouldPinGallery] - ); +// useHotkeys( +// 'esc', +// () => { +// dispatch(setShouldShowGallery(false)); +// }, +// { +// enabled: () => !shouldPinGallery, +// preventDefault: true, +// }, +// [shouldPinGallery] +// ); - const IMAGE_SIZE_STEP = 32; +// const IMAGE_SIZE_STEP = 32; - useHotkeys( - 'shift+up', - () => { - if (galleryImageMinimumWidth < 256) { - const newMinWidth = clamp( - galleryImageMinimumWidth + IMAGE_SIZE_STEP, - 32, - 256 - ); - dispatch(setGalleryImageMinimumWidth(newMinWidth)); - } - }, - [galleryImageMinimumWidth] - ); +// useHotkeys( +// 'shift+up', +// () => { +// if (galleryImageMinimumWidth < 256) { +// const newMinWidth = clamp( +// galleryImageMinimumWidth + IMAGE_SIZE_STEP, +// 32, +// 256 +// ); +// dispatch(setGalleryImageMinimumWidth(newMinWidth)); +// } +// }, +// [galleryImageMinimumWidth] +// ); - useHotkeys( - 'shift+down', - () => { - if (galleryImageMinimumWidth > 32) { - const newMinWidth = clamp( - galleryImageMinimumWidth - IMAGE_SIZE_STEP, - 32, - 256 - ); - dispatch(setGalleryImageMinimumWidth(newMinWidth)); - } - }, - [galleryImageMinimumWidth] - ); +// useHotkeys( +// 'shift+down', +// () => { +// if (galleryImageMinimumWidth > 32) { +// const newMinWidth = clamp( +// galleryImageMinimumWidth - IMAGE_SIZE_STEP, +// 32, +// 256 +// ); +// dispatch(setGalleryImageMinimumWidth(newMinWidth)); +// } +// }, +// [galleryImageMinimumWidth] +// ); - useEffect(() => { - function handleClickOutside(e: MouseEvent) { - if ( - !shouldPinGallery && - galleryRef.current && - !galleryRef.current.contains(e.target as Node) - ) { - handleCloseGallery(); - } - } - document.addEventListener('mousedown', handleClickOutside); - return () => { - document.removeEventListener('mousedown', handleClickOutside); - }; - }, [handleCloseGallery, shouldPinGallery]); +// useEffect(() => { +// function handleClickOutside(e: MouseEvent) { +// if ( +// !shouldPinGallery && +// galleryRef.current && +// !galleryRef.current.contains(e.target as Node) +// ) { +// handleCloseGallery(); +// } +// } +// document.addEventListener('mousedown', handleClickOutside); +// return () => { +// document.removeEventListener('mousedown', handleClickOutside); +// }; +// }, [handleCloseGallery, shouldPinGallery]); - return ( - - - - | React.TouchEvent, - _direction: Direction, - elementRef: HTMLElement - ) => { - setGalleryResizeHeight(elementRef.clientHeight); - elementRef.style.height = `${elementRef.clientHeight}px`; - if (shouldPinGallery) { - elementRef.style.position = 'fixed'; - elementRef.style.insetInlineEnd = '1rem'; - setIsResizing(true); - } - }} - onResizeStop={( - _event: MouseEvent | TouchEvent, - _direction: Direction, - elementRef: HTMLElement, - delta: NumberSize - ) => { - const newWidth = shouldPinGallery - ? clamp( - Number(galleryWidth) + delta.width, - galleryMinWidth, - Number(galleryMaxWidth) - ) - : Number(galleryWidth) + delta.width; - dispatch(setGalleryWidth(newWidth)); +// return ( +// +// +// +// | React.TouchEvent, +// _direction: Direction, +// elementRef: HTMLElement +// ) => { +// setGalleryResizeHeight(elementRef.clientHeight); +// elementRef.style.height = `${elementRef.clientHeight}px`; +// if (shouldPinGallery) { +// elementRef.style.position = 'fixed'; +// elementRef.style.insetInlineEnd = '1rem'; +// setIsResizing(true); +// } +// }} +// onResizeStop={( +// _event: MouseEvent | TouchEvent, +// _direction: Direction, +// elementRef: HTMLElement, +// delta: NumberSize +// ) => { +// const newWidth = shouldPinGallery +// ? clamp( +// Number(galleryWidth) + delta.width, +// galleryMinWidth, +// Number(galleryMaxWidth) +// ) +// : Number(galleryWidth) + delta.width; +// dispatch(setGalleryWidth(newWidth)); - elementRef.removeAttribute('data-resize-alert'); +// elementRef.removeAttribute('data-resize-alert'); - if (shouldPinGallery) { - console.log('unpin'); - elementRef.style.position = 'relative'; - elementRef.style.removeProperty('inset-inline-end'); - elementRef.style.setProperty( - 'height', - shouldPinGallery ? '100%' : '100vh' - ); - setIsResizing(false); - dispatch(setDoesCanvasNeedScaling(true)); - } - }} - onResize={( - _event: MouseEvent | TouchEvent, - _direction: Direction, - elementRef: HTMLElement, - delta: NumberSize - ) => { - const newWidth = clamp( - Number(galleryWidth) + delta.width, - galleryMinWidth, - Number( - shouldPinGallery ? galleryMaxWidth : 0.95 * window.innerWidth - ) - ); +// if (shouldPinGallery) { +// console.log('unpin'); +// elementRef.style.position = 'relative'; +// elementRef.style.removeProperty('inset-inline-end'); +// elementRef.style.setProperty( +// 'height', +// shouldPinGallery ? '100%' : '100vh' +// ); +// setIsResizing(false); +// dispatch(setDoesCanvasNeedScaling(true)); +// } +// }} +// onResize={( +// _event: MouseEvent | TouchEvent, +// _direction: Direction, +// elementRef: HTMLElement, +// delta: NumberSize +// ) => { +// const newWidth = clamp( +// Number(galleryWidth) + delta.width, +// galleryMinWidth, +// Number( +// shouldPinGallery ? galleryMaxWidth : 0.95 * window.innerWidth +// ) +// ); - if ( - newWidth >= GALLERY_SHOW_BUTTONS_MIN_WIDTH && - !shouldShowButtons - ) { - setShouldShowButtons(true); - } else if ( - newWidth < GALLERY_SHOW_BUTTONS_MIN_WIDTH && - shouldShowButtons - ) { - setShouldShowButtons(false); - } +// if ( +// newWidth >= GALLERY_SHOW_BUTTONS_MIN_WIDTH && +// !shouldShowButtons +// ) { +// setShouldShowButtons(true); +// } else if ( +// newWidth < GALLERY_SHOW_BUTTONS_MIN_WIDTH && +// shouldShowButtons +// ) { +// setShouldShowButtons(false); +// } - if ( - galleryImageMinimumWidth > - newWidth - GALLERY_IMAGE_WIDTH_OFFSET - ) { - dispatch( - setGalleryImageMinimumWidth( - newWidth - GALLERY_IMAGE_WIDTH_OFFSET - ) - ); - } +// if ( +// galleryImageMinimumWidth > +// newWidth - GALLERY_IMAGE_WIDTH_OFFSET +// ) { +// dispatch( +// setGalleryImageMinimumWidth( +// newWidth - GALLERY_IMAGE_WIDTH_OFFSET +// ) +// ); +// } - if (shouldPinGallery) { - if (newWidth >= galleryMaxWidth) { - elementRef.setAttribute('data-resize-alert', 'true'); - } else { - elementRef.removeAttribute('data-resize-alert'); - } - } +// if (shouldPinGallery) { +// if (newWidth >= galleryMaxWidth) { +// elementRef.setAttribute('data-resize-alert', 'true'); +// } else { +// elementRef.removeAttribute('data-resize-alert'); +// } +// } - elementRef.style.height = `${galleryResizeHeight}px`; - }} - > - - - {shouldShowButtons ? ( - <> - dispatch(setCurrentCategory('result'))} - flexGrow={1} - > - {t('gallery.generations')} - - dispatch(setCurrentCategory('user'))} - flexGrow={1} - > - {t('gallery.uploads')} - - - ) : ( - <> - } - onClick={() => dispatch(setCurrentCategory('result'))} - /> - } - onClick={() => dispatch(setCurrentCategory('user'))} - /> - - )} - +// elementRef.style.height = `${galleryResizeHeight}px`; +// }} +// > +// +// +// {isResizing && ( +// +// )} +// +// +// ); +// } - - } - /> - } - > - - - dispatch(setGalleryImageMinimumWidth(64)) - } - /> - - dispatch( - setGalleryImageObjectFit( - galleryImageObjectFit === 'contain' - ? 'cover' - : 'contain' - ) - ) - } - /> - ) => - dispatch(setShouldAutoSwitchToNewImages(e.target.checked)) - } - /> - ) => - dispatch( - setShouldUseSingleGalleryColumn(e.target.checked) - ) - } - /> - - - - : } - /> - - - - {images.length || areMoreImagesAvailable ? ( - <> - - {images.map((image) => { - const { uuid } = image; - const isSelected = currentImageUuid === uuid; - return ( - - ); - })} - - - {areMoreImagesAvailable - ? t('gallery.loadMore') - : t('gallery.allImagesLoaded')} - - - ) : ( - - -

{t('gallery.noImagesInGallery')}

-
- )} -
-
- {isResizing && ( - - )} - -
- ); -} +export default {}; diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageGalleryContent.tsx b/invokeai/frontend/web/src/features/gallery/components/ImageGalleryContent.tsx new file mode 100644 index 0000000000..8ddf862c47 --- /dev/null +++ b/invokeai/frontend/web/src/features/gallery/components/ImageGalleryContent.tsx @@ -0,0 +1,257 @@ +import { ButtonGroup, Flex, Grid, Icon, Text } from '@chakra-ui/react'; +import { requestImages } from 'app/socketio/actions'; +import { useAppDispatch, useAppSelector } from 'app/storeHooks'; +import IAIButton from 'common/components/IAIButton'; +import IAICheckbox from 'common/components/IAICheckbox'; +import IAIIconButton from 'common/components/IAIIconButton'; +import IAIPopover from 'common/components/IAIPopover'; +import IAISlider from 'common/components/IAISlider'; +import { imageGallerySelector } from 'features/gallery/store/gallerySelectors'; +import { + setCurrentCategory, + setGalleryImageMinimumWidth, + setGalleryImageObjectFit, + setShouldAutoSwitchToNewImages, + setShouldUseSingleGalleryColumn, +} from 'features/gallery/store/gallerySlice'; +import { togglePinGalleryPanel } from 'features/ui/store/uiSlice'; + +import { ChangeEvent, useEffect, useRef, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { BsPinAngle, BsPinAngleFill } from 'react-icons/bs'; +import { FaImage, FaUser, FaWrench } from 'react-icons/fa'; +import { MdPhotoLibrary } from 'react-icons/md'; +import HoverableImage from './HoverableImage'; + +import Scrollable from 'features/ui/components/common/Scrollable'; +import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale'; + +const GALLERY_SHOW_BUTTONS_MIN_WIDTH = 290; + +const ImageGalleryContent = () => { + const dispatch = useAppDispatch(); + const { t } = useTranslation(); + const resizeObserverRef = useRef(null); + const [shouldShouldIconButtons, setShouldShouldIconButtons] = useState(true); + + const { + images, + currentCategory, + currentImageUuid, + shouldPinGallery, + galleryImageMinimumWidth, + galleryGridTemplateColumns, + galleryImageObjectFit, + shouldAutoSwitchToNewImages, + areMoreImagesAvailable, + shouldUseSingleGalleryColumn, + } = useAppSelector(imageGallerySelector); + + const handleClickLoadMore = () => { + dispatch(requestImages(currentCategory)); + }; + + const handleChangeGalleryImageMinimumWidth = (v: number) => { + dispatch(setGalleryImageMinimumWidth(v)); + }; + + const handleSetShouldPinGallery = () => { + dispatch(togglePinGalleryPanel()); + dispatch(requestCanvasRescale()); + }; + + useEffect(() => { + if (!resizeObserverRef.current) { + return; + } + const resizeObserver = new ResizeObserver(() => { + if (!resizeObserverRef.current) { + return; + } + + if ( + resizeObserverRef.current.clientWidth < GALLERY_SHOW_BUTTONS_MIN_WIDTH + ) { + setShouldShouldIconButtons(true); + return; + } + + setShouldShouldIconButtons(false); + }); + resizeObserver.observe(resizeObserverRef.current); + return () => resizeObserver.disconnect(); // clean up + }, []); + + return ( + + + + {shouldShouldIconButtons ? ( + <> + } + onClick={() => dispatch(setCurrentCategory('result'))} + /> + } + onClick={() => dispatch(setCurrentCategory('user'))} + /> + + ) : ( + <> + dispatch(setCurrentCategory('result'))} + flexGrow={1} + > + {t('gallery.generations')} + + dispatch(setCurrentCategory('user'))} + flexGrow={1} + > + {t('gallery.uploads')} + + + )} + + + + } + /> + } + > + + dispatch(setGalleryImageMinimumWidth(64))} + /> + + dispatch( + setGalleryImageObjectFit( + galleryImageObjectFit === 'contain' ? 'cover' : 'contain' + ) + ) + } + /> + ) => + dispatch(setShouldAutoSwitchToNewImages(e.target.checked)) + } + /> + ) => + dispatch(setShouldUseSingleGalleryColumn(e.target.checked)) + } + /> + + + + : } + /> + + + + + {images.length || areMoreImagesAvailable ? ( + <> + + {images.map((image) => { + const { uuid } = image; + const isSelected = currentImageUuid === uuid; + return ( + + ); + })} + + + {areMoreImagesAvailable + ? t('gallery.loadMore') + : t('gallery.allImagesLoaded')} + + + ) : ( + + + {t('gallery.noImagesInGallery')} + + )} + + + + ); +}; + +ImageGalleryContent.displayName = 'ImageGalleryContent'; +export default ImageGalleryContent; diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageGalleryPanel.tsx b/invokeai/frontend/web/src/features/gallery/components/ImageGalleryPanel.tsx new file mode 100644 index 0000000000..da97dea9bf --- /dev/null +++ b/invokeai/frontend/web/src/features/gallery/components/ImageGalleryPanel.tsx @@ -0,0 +1,202 @@ +import { useAppDispatch, useAppSelector } from 'app/storeHooks'; +import { gallerySelector } from 'features/gallery/store/gallerySelectors'; +import { + selectNextImage, + selectPrevImage, + setGalleryImageMinimumWidth, +} from 'features/gallery/store/gallerySlice'; +import { InvokeTabName } from 'features/ui/store/tabMap'; + +import { clamp, isEqual } from 'lodash'; +import { useHotkeys } from 'react-hotkeys-hook'; + +import './ImageGallery.css'; +import ImageGalleryContent from './ImageGalleryContent'; +import ResizableDrawer from 'features/ui/components/common/ResizableDrawer/ResizableDrawer'; +import { + setShouldShowGallery, + toggleGalleryPanel, + togglePinGalleryPanel, +} from 'features/ui/store/uiSlice'; +import { createSelector } from '@reduxjs/toolkit'; +import { + activeTabNameSelector, + uiSelector, +} from 'features/ui/store/uiSelectors'; +import { isStagingSelector } from 'features/canvas/store/canvasSelectors'; +import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale'; +import { lightboxSelector } from 'features/lightbox/store/lightboxSelectors'; + +const GALLERY_TAB_WIDTHS: Record< + InvokeTabName, + { galleryMinWidth: number; galleryMaxWidth: number } +> = { + txt2img: { galleryMinWidth: 200, galleryMaxWidth: 500 }, + img2img: { galleryMinWidth: 200, galleryMaxWidth: 500 }, + unifiedCanvas: { galleryMinWidth: 200, galleryMaxWidth: 200 }, + nodes: { galleryMinWidth: 200, galleryMaxWidth: 500 }, + postprocessing: { galleryMinWidth: 200, galleryMaxWidth: 500 }, + training: { galleryMinWidth: 200, galleryMaxWidth: 500 }, +}; + +const galleryPanelSelector = createSelector( + [ + activeTabNameSelector, + uiSelector, + gallerySelector, + isStagingSelector, + lightboxSelector, + ], + (activeTabName, ui, gallery, isStaging, lightbox) => { + const { shouldPinGallery, shouldShowGallery } = ui; + const { galleryImageMinimumWidth } = gallery; + const { isLightboxOpen } = lightbox; + + return { + activeTabName, + isStaging, + shouldPinGallery, + shouldShowGallery, + galleryImageMinimumWidth, + isResizable: activeTabName !== 'unifiedCanvas', + isLightboxOpen, + }; + }, + { + memoizeOptions: { + resultEqualityCheck: isEqual, + }, + } +); + +export default function ImageGalleryPanel() { + const dispatch = useAppDispatch(); + const { + shouldPinGallery, + shouldShowGallery, + galleryImageMinimumWidth, + activeTabName, + isStaging, + isResizable, + isLightboxOpen, + } = useAppSelector(galleryPanelSelector); + + const handleSetShouldPinGallery = () => { + dispatch(togglePinGalleryPanel()); + dispatch(requestCanvasRescale()); + }; + + const handleToggleGallery = () => { + dispatch(toggleGalleryPanel()); + shouldPinGallery && dispatch(requestCanvasRescale()); + }; + + const handleCloseGallery = () => { + dispatch(setShouldShowGallery(false)); + shouldPinGallery && dispatch(requestCanvasRescale()); + }; + + useHotkeys( + 'g', + () => { + handleToggleGallery(); + }, + [shouldPinGallery] + ); + + useHotkeys( + 'left', + () => { + dispatch(selectPrevImage()); + }, + { + enabled: !isStaging || activeTabName !== 'unifiedCanvas', + }, + [isStaging, activeTabName] + ); + + useHotkeys( + 'right', + () => { + dispatch(selectNextImage()); + }, + { + enabled: !isStaging || activeTabName !== 'unifiedCanvas', + }, + [isStaging, activeTabName] + ); + + useHotkeys( + 'shift+g', + () => { + handleSetShouldPinGallery(); + }, + [shouldPinGallery] + ); + + useHotkeys( + 'esc', + () => { + dispatch(setShouldShowGallery(false)); + }, + { + enabled: () => !shouldPinGallery, + preventDefault: true, + }, + [shouldPinGallery] + ); + + const IMAGE_SIZE_STEP = 32; + + useHotkeys( + 'shift+up', + () => { + if (galleryImageMinimumWidth < 256) { + const newMinWidth = clamp( + galleryImageMinimumWidth + IMAGE_SIZE_STEP, + 32, + 256 + ); + dispatch(setGalleryImageMinimumWidth(newMinWidth)); + } + }, + [galleryImageMinimumWidth] + ); + + useHotkeys( + 'shift+down', + () => { + if (galleryImageMinimumWidth > 32) { + const newMinWidth = clamp( + galleryImageMinimumWidth - IMAGE_SIZE_STEP, + 32, + 256 + ); + dispatch(setGalleryImageMinimumWidth(newMinWidth)); + } + }, + [galleryImageMinimumWidth] + ); + + return ( + + + + ); +} diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageMetaDataViewer/ImageMetadataViewer.tsx b/invokeai/frontend/web/src/features/gallery/components/ImageMetaDataViewer/ImageMetadataViewer.tsx index 192b832454..130c716f6b 100644 --- a/invokeai/frontend/web/src/features/gallery/components/ImageMetaDataViewer/ImageMetadataViewer.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/ImageMetaDataViewer/ImageMetadataViewer.tsx @@ -42,9 +42,9 @@ import { import { setShouldShowImageDetails } from 'features/ui/store/uiSlice'; import { memo } from 'react'; import { useHotkeys } from 'react-hotkeys-hook'; +import { useTranslation } from 'react-i18next'; import { FaCopy } from 'react-icons/fa'; import { IoArrowUndoCircleOutline } from 'react-icons/io5'; -import { APP_METADATA_HEIGHT } from 'theme/util/constants'; type MetadataItemProps = { isLink?: boolean; @@ -66,12 +66,14 @@ const MetadataItem = ({ labelPosition, withCopy = false, }: MetadataItemProps) => { + const { t } = useTranslation(); + return ( {onClick && ( } size="xs" variant="ghost" @@ -112,7 +114,6 @@ const MetadataItem = ({ type ImageMetadataViewerProps = { image: InvokeAI.Image; - styleClass?: string; }; // TODO: I don't know if this is needed. @@ -127,343 +128,328 @@ const memoEqualityCheck = ( * Image metadata viewer overlays currently selected image and provides * access to any of its metadata for use in processing. */ -const ImageMetadataViewer = memo( - ({ image, styleClass }: ImageMetadataViewerProps) => { - const dispatch = useAppDispatch(); +const ImageMetadataViewer = memo(({ image }: ImageMetadataViewerProps) => { + const dispatch = useAppDispatch(); - const setBothPrompts = useSetBothPrompts(); + const setBothPrompts = useSetBothPrompts(); - useHotkeys('esc', () => { - dispatch(setShouldShowImageDetails(false)); - }); + useHotkeys('esc', () => { + dispatch(setShouldShowImageDetails(false)); + }); - const metadata = image?.metadata?.image || {}; - const dreamPrompt = image?.dreamPrompt; + const metadata = image?.metadata?.image || {}; + const dreamPrompt = image?.dreamPrompt; - const { - cfg_scale, - fit, - height, - hires_fix, - init_image_path, - mask_image_path, - orig_path, - perlin, - postprocessing, - prompt, - sampler, - seamless, - seed, - steps, - strength, - threshold, - type, - variations, - width, - } = metadata; + const { + cfg_scale, + fit, + height, + hires_fix, + init_image_path, + mask_image_path, + orig_path, + perlin, + postprocessing, + prompt, + sampler, + seamless, + seed, + steps, + strength, + threshold, + type, + variations, + width, + } = metadata; - const metadataJSON = JSON.stringify(image.metadata, null, 2); + const { t } = useTranslation(); - return ( - - - - File: - - {image.url.length > 64 - ? image.url.substring(0, 64).concat('...') - : image.url} - - - - {Object.keys(metadata).length > 0 ? ( - <> - {type && } - {image.metadata?.model_weights && ( - - )} - {['esrgan', 'gfpgan'].includes(type) && ( - - )} - {prompt && ( - setBothPrompts(prompt)} - /> - )} - {seed !== undefined && ( - dispatch(setSeed(seed))} - /> - )} - {threshold !== undefined && ( - dispatch(setThreshold(threshold))} - /> - )} - {perlin !== undefined && ( - dispatch(setPerlin(perlin))} - /> - )} - {sampler && ( - dispatch(setSampler(sampler))} - /> - )} - {steps && ( - dispatch(setSteps(steps))} - /> - )} - {cfg_scale !== undefined && ( - dispatch(setCfgScale(cfg_scale))} - /> - )} - {variations && variations.length > 0 && ( - - dispatch(setSeedWeights(seedWeightsToString(variations))) - } - /> - )} - {seamless && ( - dispatch(setSeamless(seamless))} - /> - )} - {hires_fix && ( - dispatch(setHiresFix(hires_fix))} - /> - )} - {width && ( - dispatch(setWidth(width))} - /> - )} - {height && ( - dispatch(setHeight(height))} - /> - )} - {init_image_path && ( - dispatch(setInitialImage(init_image_path))} - /> - )} - {mask_image_path && ( - dispatch(setMaskPath(mask_image_path))} - /> - )} - {type === 'img2img' && strength && ( - dispatch(setImg2imgStrength(strength))} - /> - )} - {fit && ( - dispatch(setShouldFitToWidthHeight(fit))} - /> - )} - {postprocessing && postprocessing.length > 0 && ( - <> - Postprocessing - {postprocessing.map( - ( - postprocess: InvokeAI.PostProcessedImageMetadata, - i: number - ) => { - if (postprocess.type === 'esrgan') { - const { scale, strength, denoise_str } = postprocess; - return ( - - {`${ - i + 1 - }: Upscale (ESRGAN)`} - dispatch(setUpscalingLevel(scale))} - /> - - dispatch(setUpscalingStrength(strength)) - } - /> - {denoise_str !== undefined && ( - - dispatch(setUpscalingDenoising(denoise_str)) - } - /> - )} - - ); - } else if (postprocess.type === 'gfpgan') { - const { strength } = postprocess; - return ( - - {`${ - i + 1 - }: Face restoration (GFPGAN)`} - - { - dispatch(setFacetoolStrength(strength)); - dispatch(setFacetoolType('gfpgan')); - }} - /> - - ); - } else if (postprocess.type === 'codeformer') { - const { strength, fidelity } = postprocess; - return ( - - {`${ - i + 1 - }: Face restoration (Codeformer)`} - - { - dispatch(setFacetoolStrength(strength)); - dispatch(setFacetoolType('codeformer')); - }} - /> - {fidelity && ( - { - dispatch(setCodeformerFidelity(fidelity)); - dispatch(setFacetoolType('codeformer')); - }} - /> - )} - - ); - } - } - )} - - )} - {dreamPrompt && ( - - )} - - - - } - size="xs" - variant="ghost" - fontSize={14} - onClick={() => - navigator.clipboard.writeText(metadataJSON) - } - /> - - Metadata JSON: - - -
{metadataJSON}
-
-
- - ) : ( -
- - No metadata available - -
+ }, + }} + > + + File: + + {image.url.length > 64 + ? image.url.substring(0, 64).concat('...') + : image.url} + + + + {Object.keys(metadata).length > 0 ? ( + <> + {type && } + {image.metadata?.model_weights && ( + )} -
-
- ); - }, - memoEqualityCheck -); + {['esrgan', 'gfpgan'].includes(type) && ( + + )} + {prompt && ( + setBothPrompts(prompt)} + /> + )} + {seed !== undefined && ( + dispatch(setSeed(seed))} + /> + )} + {threshold !== undefined && ( + dispatch(setThreshold(threshold))} + /> + )} + {perlin !== undefined && ( + dispatch(setPerlin(perlin))} + /> + )} + {sampler && ( + dispatch(setSampler(sampler))} + /> + )} + {steps && ( + dispatch(setSteps(steps))} + /> + )} + {cfg_scale !== undefined && ( + dispatch(setCfgScale(cfg_scale))} + /> + )} + {variations && variations.length > 0 && ( + + dispatch(setSeedWeights(seedWeightsToString(variations))) + } + /> + )} + {seamless && ( + dispatch(setSeamless(seamless))} + /> + )} + {hires_fix && ( + dispatch(setHiresFix(hires_fix))} + /> + )} + {width && ( + dispatch(setWidth(width))} + /> + )} + {height && ( + dispatch(setHeight(height))} + /> + )} + {init_image_path && ( + dispatch(setInitialImage(init_image_path))} + /> + )} + {mask_image_path && ( + dispatch(setMaskPath(mask_image_path))} + /> + )} + {type === 'img2img' && strength && ( + dispatch(setImg2imgStrength(strength))} + /> + )} + {fit && ( + dispatch(setShouldFitToWidthHeight(fit))} + /> + )} + {postprocessing && postprocessing.length > 0 && ( + <> + Postprocessing + {postprocessing.map( + ( + postprocess: InvokeAI.PostProcessedImageMetadata, + i: number + ) => { + if (postprocess.type === 'esrgan') { + const { scale, strength, denoise_str } = postprocess; + return ( + + {`${i + 1}: Upscale (ESRGAN)`} + dispatch(setUpscalingLevel(scale))} + /> + + dispatch(setUpscalingStrength(strength)) + } + /> + {denoise_str !== undefined && ( + + dispatch(setUpscalingDenoising(denoise_str)) + } + /> + )} + + ); + } else if (postprocess.type === 'gfpgan') { + const { strength } = postprocess; + return ( + + {`${ + i + 1 + }: Face restoration (GFPGAN)`} + + { + dispatch(setFacetoolStrength(strength)); + dispatch(setFacetoolType('gfpgan')); + }} + /> + + ); + } else if (postprocess.type === 'codeformer') { + const { strength, fidelity } = postprocess; + return ( + + {`${ + i + 1 + }: Face restoration (Codeformer)`} + + { + dispatch(setFacetoolStrength(strength)); + dispatch(setFacetoolType('codeformer')); + }} + /> + {fidelity && ( + { + dispatch(setCodeformerFidelity(fidelity)); + dispatch(setFacetoolType('codeformer')); + }} + /> + )} + + ); + } + } + )} + + )} + {dreamPrompt && ( + + )} + + + + } + size="xs" + variant="ghost" + fontSize={14} + onClick={() => navigator.clipboard.writeText(metadataJSON)} + /> + + Metadata JSON: + + +
{metadataJSON}
+
+
+ + ) : ( +
+ + No metadata available + +
+ )} +
+ ); +}, memoEqualityCheck); ImageMetadataViewer.displayName = 'ImageMetadataViewer'; diff --git a/invokeai/frontend/web/src/features/gallery/components/NextPrevImageButtons.tsx b/invokeai/frontend/web/src/features/gallery/components/NextPrevImageButtons.tsx index 0cf41cb057..2da7579fd9 100644 --- a/invokeai/frontend/web/src/features/gallery/components/NextPrevImageButtons.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/NextPrevImageButtons.tsx @@ -3,6 +3,7 @@ import { createSelector } from '@reduxjs/toolkit'; import { useAppDispatch, useAppSelector } from 'app/storeHooks'; import { isEqual } from 'lodash'; import { useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { FaAngleLeft, FaAngleRight } from 'react-icons/fa'; import { gallerySelector } from '../store/gallerySelectors'; import { @@ -51,6 +52,7 @@ export const nextPrevImageButtonsSelector = createSelector( const NextPrevImageButtons = () => { const dispatch = useAppDispatch(); + const { t } = useTranslation(); const { isOnFirstImage, isOnLastImage } = useAppSelector( nextPrevImageButtonsSelector @@ -95,7 +97,7 @@ const NextPrevImageButtons = () => { > {shouldShowNextPrevButtons && !isOnFirstImage && ( } variant="unstyled" onClick={handleClickPrevButton} @@ -114,7 +116,7 @@ const NextPrevImageButtons = () => { > {shouldShowNextPrevButtons && !isOnLastImage && ( } variant="unstyled" onClick={handleClickNextButton} diff --git a/invokeai/frontend/web/src/features/gallery/store/gallerySelectors.ts b/invokeai/frontend/web/src/features/gallery/store/gallerySelectors.ts index 751eee14d7..61223692fa 100644 --- a/invokeai/frontend/web/src/features/gallery/store/gallerySelectors.ts +++ b/invokeai/frontend/web/src/features/gallery/store/gallerySelectors.ts @@ -1,53 +1,47 @@ import { createSelector } from '@reduxjs/toolkit'; import { RootState } from 'app/store'; -import { isStagingSelector } from 'features/canvas/store/canvasSelectors'; import { lightboxSelector } from 'features/lightbox/store/lightboxSelectors'; import { systemSelector } from 'features/system/store/systemSelectors'; -import { activeTabNameSelector } from 'features/ui/store/uiSelectors'; +import { + activeTabNameSelector, + uiSelector, +} from 'features/ui/store/uiSelectors'; import { isEqual } from 'lodash'; -import { GalleryState } from './gallerySlice'; - export const gallerySelector = (state: RootState) => state.gallery; export const imageGallerySelector = createSelector( - [gallerySelector, lightboxSelector, isStagingSelector, activeTabNameSelector], - (gallery: GalleryState, lightbox, isStaging, activeTabName) => { + [gallerySelector, uiSelector, lightboxSelector, activeTabNameSelector], + (gallery, ui, lightbox, activeTabName) => { const { categories, currentCategory, currentImageUuid, - shouldPinGallery, - shouldShowGallery, galleryImageMinimumWidth, galleryImageObjectFit, - shouldHoldGalleryOpen, shouldAutoSwitchToNewImages, galleryWidth, shouldUseSingleGalleryColumn, } = gallery; + const { shouldPinGallery } = ui; + const { isLightboxOpen } = lightbox; return { currentImageUuid, shouldPinGallery, - shouldShowGallery, galleryImageMinimumWidth, galleryImageObjectFit, galleryGridTemplateColumns: shouldUseSingleGalleryColumn ? 'auto' : `repeat(auto-fill, minmax(${galleryImageMinimumWidth}px, auto))`, - activeTabName, - shouldHoldGalleryOpen, shouldAutoSwitchToNewImages, + currentCategory, images: categories[currentCategory].images, areMoreImagesAvailable: categories[currentCategory].areMoreImagesAvailable, - currentCategory, galleryWidth, - isLightboxOpen, - isStaging, shouldEnableResize: isLightboxOpen || (activeTabName === 'unifiedCanvas' && shouldPinGallery) @@ -65,7 +59,7 @@ export const imageGallerySelector = createSelector( export const hoverableImageSelector = createSelector( [gallerySelector, systemSelector, lightboxSelector, activeTabNameSelector], - (gallery: GalleryState, system, lightbox, activeTabName) => { + (gallery, system, lightbox, activeTabName) => { return { mayDeleteImage: system.isConnected && !system.isProcessing, galleryImageObjectFit: gallery.galleryImageObjectFit, diff --git a/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts b/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts index c96a3c9aac..dbb173c74a 100644 --- a/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts +++ b/invokeai/frontend/web/src/features/gallery/store/gallerySlice.ts @@ -29,11 +29,8 @@ export interface GalleryState { boundingBox?: IRect; generationMode?: InvokeTabName; }; - shouldPinGallery: boolean; - shouldShowGallery: boolean; galleryImageMinimumWidth: number; galleryImageObjectFit: GalleryImageObjectFitType; - shouldHoldGalleryOpen: boolean; shouldAutoSwitchToNewImages: boolean; categories: { user: Gallery; @@ -46,11 +43,8 @@ export interface GalleryState { const initialState: GalleryState = { currentImageUuid: '', - shouldPinGallery: true, - shouldShowGallery: true, galleryImageMinimumWidth: 64, galleryImageObjectFit: 'cover', - shouldHoldGalleryOpen: false, shouldAutoSwitchToNewImages: true, currentCategory: 'result', categories: { @@ -233,13 +227,6 @@ export const gallerySlice = createSlice({ areMoreImagesAvailable; } }, - setShouldPinGallery: (state, action: PayloadAction) => { - state.shouldPinGallery = action.payload; - }, - setShouldShowGallery: (state, action: PayloadAction) => { - state.shouldShowGallery = action.payload; - }, - setGalleryImageMinimumWidth: (state, action: PayloadAction) => { state.galleryImageMinimumWidth = action.payload; }, @@ -249,9 +236,6 @@ export const gallerySlice = createSlice({ ) => { state.galleryImageObjectFit = action.payload; }, - setShouldHoldGalleryOpen: (state, action: PayloadAction) => { - state.shouldHoldGalleryOpen = action.payload; - }, setShouldAutoSwitchToNewImages: (state, action: PayloadAction) => { state.shouldAutoSwitchToNewImages = action.payload; }, @@ -279,11 +263,8 @@ export const { setIntermediateImage, selectNextImage, selectPrevImage, - setShouldPinGallery, - setShouldShowGallery, setGalleryImageMinimumWidth, setGalleryImageObjectFit, - setShouldHoldGalleryOpen, setShouldAutoSwitchToNewImages, setCurrentCategory, setGalleryWidth, diff --git a/invokeai/frontend/web/src/features/lightbox/components/Lightbox.tsx b/invokeai/frontend/web/src/features/lightbox/components/Lightbox.tsx index 79b2655583..9ca4196fa3 100644 --- a/invokeai/frontend/web/src/features/lightbox/components/Lightbox.tsx +++ b/invokeai/frontend/web/src/features/lightbox/components/Lightbox.tsx @@ -1,19 +1,20 @@ -import { Box, Flex, Grid } from '@chakra-ui/react'; +import { Box, Flex } from '@chakra-ui/react'; import { createSelector } from '@reduxjs/toolkit'; import { RootState } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks'; import IAIIconButton from 'common/components/IAIIconButton'; import CurrentImageButtons from 'features/gallery/components/CurrentImageButtons'; -import ImageGallery from 'features/gallery/components/ImageGallery'; import ImageMetadataViewer from 'features/gallery/components/ImageMetaDataViewer/ImageMetadataViewer'; import NextPrevImageButtons from 'features/gallery/components/NextPrevImageButtons'; import { gallerySelector } from 'features/gallery/store/gallerySelectors'; import { setIsLightboxOpen } from 'features/lightbox/store/lightboxSlice'; import { uiSelector } from 'features/ui/store/uiSelectors'; +import { AnimatePresence, motion } from 'framer-motion'; import { isEqual } from 'lodash'; import { useHotkeys } from 'react-hotkeys-hook'; import { BiExit } from 'react-icons/bi'; import { TransformWrapper } from 'react-zoom-pan-pinch'; +import { PROGRESS_BAR_THICKNESS } from 'theme/util/constants'; import useImageTransform from '../hooks/useImageTransform'; import ReactPanZoomButtons from './ReactPanZoomButtons'; import ReactPanZoomImage from './ReactPanZoomImage'; @@ -65,106 +66,102 @@ export default function Lightbox() { ); return ( - - - + {isLightBoxOpen && ( + - } - aria-label="Exit Viewer" - onClick={() => { - dispatch(setIsLightboxOpen(false)); - }} - fontSize={20} - /> - - - - - + + } + aria-label="Exit Viewer" + className="lightbox-close-btn" + onClick={() => { + dispatch(setIsLightboxOpen(false)); + }} + fontSize={20} + /> + + + + + + {viewerImageToDisplay && ( <> {shouldShowImageDetails && ( )} + + {!shouldShowImageDetails && ( + + + + )} )} - - {!shouldShowImageDetails && ( - - - - )} - - - - - - - - - + + + )} + ); } diff --git a/invokeai/frontend/web/src/features/lightbox/components/ReactPanZoomButtons.tsx b/invokeai/frontend/web/src/features/lightbox/components/ReactPanZoomButtons.tsx index fffe609ab7..ee9be65cc1 100644 --- a/invokeai/frontend/web/src/features/lightbox/components/ReactPanZoomButtons.tsx +++ b/invokeai/frontend/web/src/features/lightbox/components/ReactPanZoomButtons.tsx @@ -1,5 +1,6 @@ import { ButtonGroup } from '@chakra-ui/react'; import IAIIconButton from 'common/components/IAIIconButton'; +import { useTranslation } from 'react-i18next'; import { BiReset, BiRotateLeft, @@ -26,12 +27,13 @@ const ReactPanZoomButtons = ({ reset, }: ReactPanZoomButtonsProps) => { const { zoomIn, zoomOut, resetTransform } = useTransformContext(); + const { t } = useTranslation(); return ( } - aria-label="Zoom In" + aria-label={t('accessibility.zoomIn')} tooltip="Zoom In" onClick={() => zoomIn()} fontSize={20} @@ -39,7 +41,7 @@ const ReactPanZoomButtons = ({ } - aria-label="Zoom Out" + aria-label={t('accessibility.zoomOut')} tooltip="Zoom Out" onClick={() => zoomOut()} fontSize={20} @@ -47,7 +49,7 @@ const ReactPanZoomButtons = ({ } - aria-label="Rotate Counter-Clockwise" + aria-label={t('accessibility.rotateCounterClockwise')} tooltip="Rotate Counter-Clockwise" onClick={rotateCounterClockwise} fontSize={20} @@ -55,7 +57,7 @@ const ReactPanZoomButtons = ({ } - aria-label="Rotate Clockwise" + aria-label={t('accessibility.rotateClockwise')} tooltip="Rotate Clockwise" onClick={rotateClockwise} fontSize={20} @@ -63,7 +65,7 @@ const ReactPanZoomButtons = ({ } - aria-label="Flip Horizontally" + aria-label={t('accessibility.flipHorizontally')} tooltip="Flip Horizontally" onClick={flipHorizontally} fontSize={20} @@ -71,7 +73,7 @@ const ReactPanZoomButtons = ({ } - aria-label="Flip Vertically" + aria-label={t('accessibility.flipVertically')} tooltip="Flip Vertically" onClick={flipVertically} fontSize={20} @@ -79,7 +81,7 @@ const ReactPanZoomButtons = ({ } - aria-label="Reset" + aria-label={t('accessibility.reset')} tooltip="Reset" onClick={() => { resetTransform(); diff --git a/invokeai/frontend/web/src/features/lightbox/components/ReactPanZoomImage.tsx b/invokeai/frontend/web/src/features/lightbox/components/ReactPanZoomImage.tsx index db6a02ae71..0658fd1756 100644 --- a/invokeai/frontend/web/src/features/lightbox/components/ReactPanZoomImage.tsx +++ b/invokeai/frontend/web/src/features/lightbox/components/ReactPanZoomImage.tsx @@ -1,8 +1,9 @@ import * as React from 'react'; import { TransformComponent, useTransformContext } from 'react-zoom-pan-pinch'; +import * as InvokeAI from 'app/invokeai'; type ReactPanZoomProps = { - image: string; + image: InvokeAI.Image; styleClass?: string; alt?: string; ref?: React.Ref; @@ -34,7 +35,7 @@ export default function ReactPanZoomImage({ transform: `rotate(${rotation}deg) scaleX(${scaleX}) scaleY(${scaleY})`, width: '100%', }} - src={image} + src={image.url} alt={alt} ref={ref} className={styleClass ? styleClass : ''} diff --git a/invokeai/frontend/web/src/features/ui/components/ImageToImage/ImageToImageSettings.tsx b/invokeai/frontend/web/src/features/parameters/components/AdvancedParameters/ImageToImage/ImageToImageSettings.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/ImageToImage/ImageToImageSettings.tsx rename to invokeai/frontend/web/src/features/parameters/components/AdvancedParameters/ImageToImage/ImageToImageSettings.tsx diff --git a/invokeai/frontend/web/src/features/parameters/components/ParametersAccordion.tsx b/invokeai/frontend/web/src/features/parameters/components/ParametersAccordion.tsx index 019fb02f90..76277867de 100644 --- a/invokeai/frontend/web/src/features/parameters/components/ParametersAccordion.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/ParametersAccordion.tsx @@ -59,6 +59,11 @@ const ParametersAccordion = (props: ParametersAccordionsType) => { allowMultiple reduceMotion onChange={handleChangeAccordionState} + sx={{ + display: 'flex', + flexDirection: 'column', + gap: 2, + }} > {renderAccordions()} diff --git a/invokeai/frontend/web/src/features/parameters/components/ProcessButtons/CancelButton.tsx b/invokeai/frontend/web/src/features/parameters/components/ProcessButtons/CancelButton.tsx index 9363bcdfd3..0992e63ee3 100644 --- a/invokeai/frontend/web/src/features/parameters/components/ProcessButtons/CancelButton.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/ProcessButtons/CancelButton.tsx @@ -11,7 +11,7 @@ import { setCancelType, } from 'features/system/store/systemSlice'; import { isEqual } from 'lodash'; -import { useEffect, useCallback } from 'react'; +import { useEffect, useCallback, memo } from 'react'; import { ButtonSpinner, ButtonGroup } from '@chakra-ui/react'; import { useHotkeys } from 'react-hotkeys-hook'; @@ -44,9 +44,9 @@ interface CancelButtonProps { btnGroupWidth?: string | number; } -export default function CancelButton( +const CancelButton = ( props: CancelButtonProps & Omit -) { +) => { const dispatch = useAppDispatch(); const { btnGroupWidth = 'auto', ...rest } = props; const { @@ -146,4 +146,6 @@ export default function CancelButton( /> ); -} +}; + +export default memo(CancelButton); diff --git a/invokeai/frontend/web/src/features/system/components/Console.tsx b/invokeai/frontend/web/src/features/system/components/Console.tsx index 562b339c59..226c96ea13 100644 --- a/invokeai/frontend/web/src/features/system/components/Console.tsx +++ b/invokeai/frontend/web/src/features/system/components/Console.tsx @@ -11,6 +11,7 @@ import { isEqual } from 'lodash'; import { Resizable } from 're-resizable'; import { useLayoutEffect, useRef, useState } from 'react'; import { useHotkeys } from 'react-hotkeys-hook'; +import { useTranslation } from 'react-i18next'; import { FaAngleDoubleDown, FaCode, FaMinus } from 'react-icons/fa'; import { systemSelector } from '../store/systemSelectors'; @@ -46,6 +47,7 @@ const consoleSelector = createSelector( */ const Console = () => { const dispatch = useAppDispatch(); + const { t } = useTranslation(); const log = useAppSelector(logSelector); const { shouldShowLogViewer, hasError, wasErrorSeen } = useAppSelector(consoleSelector); @@ -156,7 +158,7 @@ const Console = () => { > } onClick={() => setShouldAutoscroll(!shouldAutoscroll)} isChecked={shouldAutoscroll} @@ -175,7 +177,7 @@ const Console = () => { > : } onClick={handleClickLogViewerToggle} sx={{ diff --git a/invokeai/frontend/web/src/features/system/components/HotkeysModal/HotkeysModal.tsx b/invokeai/frontend/web/src/features/system/components/HotkeysModal/HotkeysModal.tsx index 62b7985a6c..4a7f4292eb 100644 --- a/invokeai/frontend/web/src/features/system/components/HotkeysModal/HotkeysModal.tsx +++ b/invokeai/frontend/web/src/features/system/components/HotkeysModal/HotkeysModal.tsx @@ -329,69 +329,71 @@ export default function HotkeysModal({ children }: HotkeysModalProps) { - - - -

{t('hotkeys.appHotkeys')}

- -
-
- - {renderHotkeyModalItems(appHotkeys)} - -
+ + + + +

{t('hotkeys.appHotkeys')}

+ +
+
+ + {renderHotkeyModalItems(appHotkeys)} + +
- - - -

{t('hotkeys.generalHotkeys')}

- -
-
- - {renderHotkeyModalItems(generalHotkeys)} - -
+ + + +

{t('hotkeys.generalHotkeys')}

+ +
+
+ + {renderHotkeyModalItems(generalHotkeys)} + +
- - - -

{t('hotkeys.galleryHotkeys')}

- -
-
- - {renderHotkeyModalItems(galleryHotkeys)} - -
+ + + +

{t('hotkeys.galleryHotkeys')}

+ +
+
+ + {renderHotkeyModalItems(galleryHotkeys)} + +
- - - -

{t('hotkeys.unifiedCanvasHotkeys')}

- -
-
- - {renderHotkeyModalItems(unifiedCanvasHotkeys)} - -
+ + + +

{t('hotkeys.unifiedCanvasHotkeys')}

+ +
+
+ + {renderHotkeyModalItems(unifiedCanvasHotkeys)} + +
+
diff --git a/invokeai/frontend/web/src/features/system/components/ModelManager/CheckpointModelEdit.tsx b/invokeai/frontend/web/src/features/system/components/ModelManager/CheckpointModelEdit.tsx index b7573f7b56..ac49be30fc 100644 --- a/invokeai/frontend/web/src/features/system/components/ModelManager/CheckpointModelEdit.tsx +++ b/invokeai/frontend/web/src/features/system/components/ModelManager/CheckpointModelEdit.tsx @@ -11,8 +11,6 @@ import { systemSelector } from 'features/system/store/systemSelectors'; import { Flex, FormControl, - FormErrorMessage, - FormHelperText, FormLabel, HStack, Text, @@ -28,6 +26,8 @@ import type { RootState } from 'app/store'; import type { FieldInputProps, FormikProps } from 'formik'; import { isEqual, pickBy } from 'lodash'; import ModelConvert from './ModelConvert'; +import IAIFormHelperText from 'common/components/IAIForms/IAIFormHelperText'; +import IAIFormErrorMessage from 'common/components/IAIForms/IAIFormErrorMessage'; const selector = createSelector( [systemSelector], @@ -139,11 +139,13 @@ export default function CheckpointModelEdit() { width="full" /> {!!errors.description && touched.description ? ( - {errors.description} + + {errors.description} + ) : ( - + {t('modelManager.descriptionValidationMsg')} - + )} @@ -165,11 +167,11 @@ export default function CheckpointModelEdit() { width="full" /> {!!errors.config && touched.config ? ( - {errors.config} + {errors.config} ) : ( - + {t('modelManager.configValidationMsg')} - + )} @@ -191,11 +193,13 @@ export default function CheckpointModelEdit() { width="full" /> {!!errors.weights && touched.weights ? ( - {errors.weights} + + {errors.weights} + ) : ( - + {t('modelManager.modelLocationValidationMsg')} - + )} @@ -214,11 +218,11 @@ export default function CheckpointModelEdit() { width="full" /> {!!errors.vae && touched.vae ? ( - {errors.vae} + {errors.vae} ) : ( - + {t('modelManager.vaeLocationValidationMsg')} - + )} @@ -253,11 +257,13 @@ export default function CheckpointModelEdit() { {!!errors.width && touched.width ? ( - {errors.width} + + {errors.width} + ) : ( - + {t('modelManager.widthValidationMsg')} - + )} @@ -291,11 +297,13 @@ export default function CheckpointModelEdit() { {!!errors.height && touched.height ? ( - {errors.height} + + {errors.height} + ) : ( - + {t('modelManager.heightValidationMsg')} - + )} diff --git a/invokeai/frontend/web/src/features/system/components/ModelManager/DiffusersModelEdit.tsx b/invokeai/frontend/web/src/features/system/components/ModelManager/DiffusersModelEdit.tsx index a21aee672c..4e5fe9a8cf 100644 --- a/invokeai/frontend/web/src/features/system/components/ModelManager/DiffusersModelEdit.tsx +++ b/invokeai/frontend/web/src/features/system/components/ModelManager/DiffusersModelEdit.tsx @@ -7,15 +7,7 @@ import { useEffect, useState } from 'react'; import { useAppDispatch, useAppSelector } from 'app/storeHooks'; import { systemSelector } from 'features/system/store/systemSelectors'; -import { - Flex, - FormControl, - FormErrorMessage, - FormHelperText, - FormLabel, - Text, - VStack, -} from '@chakra-ui/react'; +import { Flex, FormControl, FormLabel, Text, VStack } from '@chakra-ui/react'; import { addNewModel } from 'app/socketio/actions'; import { Field, Formik } from 'formik'; @@ -24,6 +16,8 @@ import { useTranslation } from 'react-i18next'; import type { InvokeDiffusersModelConfigProps } from 'app/invokeai'; import type { RootState } from 'app/store'; import { isEqual, pickBy } from 'lodash'; +import IAIFormHelperText from 'common/components/IAIForms/IAIFormHelperText'; +import IAIFormErrorMessage from 'common/components/IAIForms/IAIFormErrorMessage'; const selector = createSelector( [systemSelector], @@ -141,11 +135,13 @@ export default function DiffusersModelEdit() { width="full" /> {!!errors.description && touched.description ? ( - {errors.description} + + {errors.description} + ) : ( - + {t('modelManager.descriptionValidationMsg')} - + )} @@ -167,11 +163,11 @@ export default function DiffusersModelEdit() { width="full" /> {!!errors.path && touched.path ? ( - {errors.path} + {errors.path} ) : ( - + {t('modelManager.modelLocationValidationMsg')} - + )} @@ -190,11 +186,13 @@ export default function DiffusersModelEdit() { width="full" /> {!!errors.repo_id && touched.repo_id ? ( - {errors.repo_id} + + {errors.repo_id} + ) : ( - + {t('modelManager.repoIDValidationMsg')} - + )} @@ -215,11 +213,13 @@ export default function DiffusersModelEdit() { width="full" /> {!!errors.vae?.path && touched.vae?.path ? ( - {errors.vae?.path} + + {errors.vae?.path} + ) : ( - + {t('modelManager.vaeLocationValidationMsg')} - + )} @@ -240,11 +240,13 @@ export default function DiffusersModelEdit() { width="full" /> {!!errors.vae?.repo_id && touched.vae?.repo_id ? ( - {errors.vae?.repo_id} + + {errors.vae?.repo_id} + ) : ( - + {t('modelManager.vaeRepoIDValidationMsg')} - + )} diff --git a/invokeai/frontend/web/src/features/system/components/ModelManager/ModelListItem.tsx b/invokeai/frontend/web/src/features/system/components/ModelManager/ModelListItem.tsx index 9b2b6d29f4..6b9e4d1cfd 100644 --- a/invokeai/frontend/web/src/features/system/components/ModelManager/ModelListItem.tsx +++ b/invokeai/frontend/web/src/features/system/components/ModelManager/ModelListItem.tsx @@ -94,7 +94,7 @@ export default function ModelListItem(props: ModelListItemProps) { icon={} size="sm" onClick={openModelHandler} - aria-label="Modify Config" + aria-label={t('accessibility.modifyConfig')} isDisabled={status === 'active' || isProcessing || !isConnected} /> { - - - - } - /> + + } + /> + - - - - } - /> + + } + /> + - - - - } - /> + + } + /> + { ); }; +SiteHeader.displayName = 'SiteHeader'; export default SiteHeader; diff --git a/invokeai/frontend/web/src/features/system/components/ThemeChanger.tsx b/invokeai/frontend/web/src/features/system/components/ThemeChanger.tsx index 9114a9d9e1..a8f125784c 100644 --- a/invokeai/frontend/web/src/features/system/components/ThemeChanger.tsx +++ b/invokeai/frontend/web/src/features/system/components/ThemeChanger.tsx @@ -34,9 +34,6 @@ export default function ThemeChanger() { Object.keys(THEMES).forEach((theme) => { themesToRender.push( : undefined} size="sm" diff --git a/invokeai/frontend/web/src/features/ui/components/FloatingGalleryButton.tsx b/invokeai/frontend/web/src/features/ui/components/FloatingGalleryButton.tsx index 71b18a60a4..6076b0944f 100644 --- a/invokeai/frontend/web/src/features/ui/components/FloatingGalleryButton.tsx +++ b/invokeai/frontend/web/src/features/ui/components/FloatingGalleryButton.tsx @@ -1,27 +1,45 @@ +import { createSelector } from '@reduxjs/toolkit'; import { useAppDispatch, useAppSelector } from 'app/storeHooks'; import IAIIconButton from 'common/components/IAIIconButton'; -import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice'; -import { setShouldShowGallery } from 'features/gallery/store/gallerySlice'; +import { useTranslation } from 'react-i18next'; +import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale'; +import { setShouldShowGallery } from 'features/ui/store/uiSlice'; +import { isEqual } from 'lodash'; import { MdPhotoLibrary } from 'react-icons/md'; -import { floatingSelector } from './FloatingParametersPanelButtons'; +import { activeTabNameSelector, uiSelector } from '../store/uiSelectors'; + +const floatingGalleryButtonSelector = createSelector( + [activeTabNameSelector, uiSelector], + (activeTabName, ui) => { + const { shouldPinGallery, shouldShowGallery } = ui; + + return { + shouldPinGallery, + shouldShowGalleryButton: + (!shouldPinGallery || !shouldShowGallery) && + ['txt2img', 'img2img', 'unifiedCanvas'].includes(activeTabName), + }; + }, + { memoizeOptions: { resultEqualityCheck: isEqual } } +); const FloatingGalleryButton = () => { + const { t } = useTranslation(); + const { shouldPinGallery, shouldShowGalleryButton } = useAppSelector( + floatingGalleryButtonSelector + ); const dispatch = useAppDispatch(); - const { shouldShowGalleryButton, shouldPinGallery } = - useAppSelector(floatingSelector); const handleShowGallery = () => { dispatch(setShouldShowGallery(true)); - if (shouldPinGallery) { - dispatch(setDoesCanvasNeedScaling(true)); - } + shouldPinGallery && dispatch(requestCanvasRescale()); }; return shouldShowGalleryButton ? ( { +export const floatingParametersPanelButtonSelector = createSelector( + [uiSelector, activeTabNameSelector], + (ui, activeTabName) => { const { shouldPinParametersPanel, - shouldShowParametersPanel, - shouldHoldParametersPanelOpen, shouldUseCanvasBetaLayout, + shouldShowParametersPanel, } = ui; - const { shouldShowGallery, shouldPinGallery, shouldHoldGalleryOpen } = - gallery; - const canvasBetaLayoutCheck = shouldUseCanvasBetaLayout && activeTabName === 'unifiedCanvas'; - const shouldShowParametersPanelButton = - !canvasBetaLayoutCheck && - !( - shouldShowParametersPanel || - (shouldHoldParametersPanelOpen && !shouldPinParametersPanel) - ) && - ['txt2img', 'img2img', 'unifiedCanvas'].includes(activeTabName); - - const shouldShowGalleryButton = - !(shouldShowGallery || (shouldHoldGalleryOpen && !shouldPinGallery)) && - ['txt2img', 'img2img', 'unifiedCanvas'].includes(activeTabName); - const shouldShowProcessButtons = !canvasBetaLayoutCheck && (!shouldPinParametersPanel || !shouldShowParametersPanel); + const shouldShowParametersPanelButton = + !canvasBetaLayoutCheck && + (!shouldPinParametersPanel || !shouldShowParametersPanel) && + ['txt2img', 'img2img', 'unifiedCanvas'].includes(activeTabName); + return { shouldPinParametersPanel, - shouldShowProcessButtons, shouldShowParametersPanelButton, - shouldShowParametersPanel, - shouldShowGallery, - shouldPinGallery, - shouldShowGalleryButton, + shouldShowProcessButtons, }; }, { memoizeOptions: { resultEqualityCheck: isEqual } } @@ -68,17 +52,16 @@ export const floatingSelector = createSelector( const FloatingParametersPanelButtons = () => { const dispatch = useAppDispatch(); + const { t } = useTranslation(); const { - shouldShowParametersPanelButton, shouldShowProcessButtons, + shouldShowParametersPanelButton, shouldPinParametersPanel, - } = useAppSelector(floatingSelector); + } = useAppSelector(floatingParametersPanelButtonSelector); const handleShowOptionsPanel = () => { dispatch(setShouldShowParametersPanel(true)); - if (shouldPinParametersPanel) { - setTimeout(() => dispatch(setDoesCanvasNeedScaling(true)), 400); - } + shouldPinParametersPanel && dispatch(requestCanvasRescale()); }; return shouldShowParametersPanelButton ? ( @@ -95,7 +78,7 @@ const FloatingParametersPanelButtons = () => { diff --git a/invokeai/frontend/web/src/features/ui/components/ImageToImage/InitialImageOverlay.tsx b/invokeai/frontend/web/src/features/ui/components/ImageToImage/InitialImageOverlay.tsx deleted file mode 100644 index 99b3ba4c32..0000000000 --- a/invokeai/frontend/web/src/features/ui/components/ImageToImage/InitialImageOverlay.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Image } from '@chakra-ui/react'; -import { RootState } from 'app/store'; -import { useAppSelector } from 'app/storeHooks'; - -export default function InitialImageOverlay() { - const initialImage = useAppSelector( - (state: RootState) => state.generation.initialImage - ); - - return initialImage ? ( - - ) : null; -} diff --git a/invokeai/frontend/web/src/features/ui/components/ImageToImage/index.tsx b/invokeai/frontend/web/src/features/ui/components/ImageToImage/index.tsx deleted file mode 100644 index e1c38ad75f..0000000000 --- a/invokeai/frontend/web/src/features/ui/components/ImageToImage/index.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import InvokeWorkarea from 'features/ui/components/InvokeWorkarea'; -import ImageToImageDisplay from './ImageToImageDisplay'; -import ImageToImagePanel from './ImageToImagePanel'; - -export default function ImageToImageWorkarea() { - return ( - }> - - - ); -} diff --git a/invokeai/frontend/web/src/features/ui/components/InvokeParametersPanel.css b/invokeai/frontend/web/src/features/ui/components/InvokeParametersPanel.css deleted file mode 100644 index f43861edba..0000000000 --- a/invokeai/frontend/web/src/features/ui/components/InvokeParametersPanel.css +++ /dev/null @@ -1,35 +0,0 @@ -.ltr-parameters-panel-transition-enter { - transform: translateX(-150%); -} - -.ltr-parameters-panel-transition-enter-active { - transform: translateX(0); - transition: all 120ms ease-out; -} - -.ltr-parameters-panel-transition-exit { - transform: translateX(0); -} - -.ltr-parameters-panel-transition-exit-active { - transform: translateX(-150%); - transition: all 120ms ease-out; -} - -.rtl-parameters-panel-transition-enter { - transform: translateX(150%); -} - -.rtl-parameters-panel-transition-enter-active { - transform: translateX(0); - transition: all 120ms ease-out; -} - -.rtl-parameters-panel-transition-exit { - transform: translateX(0); -} - -.rtl-parameters-panel-transition-exit-active { - transform: translateX(150%); - transition: all 120ms ease-out; -} diff --git a/invokeai/frontend/web/src/features/ui/components/InvokeParametersPanel.tsx b/invokeai/frontend/web/src/features/ui/components/InvokeParametersPanel.tsx deleted file mode 100644 index e7e610df6c..0000000000 --- a/invokeai/frontend/web/src/features/ui/components/InvokeParametersPanel.tsx +++ /dev/null @@ -1,249 +0,0 @@ -import { Box, Flex, Tooltip, Icon, useTheme } from '@chakra-ui/react'; -import { createSelector } from '@reduxjs/toolkit'; -import { useAppDispatch, useAppSelector } from 'app/storeHooks'; -import { - setShouldHoldParametersPanelOpen, - setShouldPinParametersPanel, - setShouldShowParametersPanel, -} from 'features/ui/store/uiSlice'; - -import React, { ReactNode, useCallback, useEffect, useRef } from 'react'; -import { useHotkeys } from 'react-hotkeys-hook'; -import { BsPinAngle, BsPinAngleFill } from 'react-icons/bs'; -import { CSSTransition } from 'react-transition-group'; - -import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice'; -import { setParametersPanelScrollPosition } from 'features/ui/store/uiSlice'; - -import { isEqual } from 'lodash'; -import { uiSelector } from '../store/uiSelectors'; -import { useTranslation } from 'react-i18next'; -import { - APP_CONTENT_HEIGHT, - OPTIONS_BAR_MAX_WIDTH, - PROGRESS_BAR_THICKNESS, -} from 'theme/util/constants'; -import InvokeAILogoComponent from 'features/system/components/InvokeAILogoComponent'; - -import './InvokeParametersPanel.css'; -import { no_scrollbar } from 'theme/components/scrollbar'; - -type Props = { children: ReactNode }; - -const optionsPanelSelector = createSelector( - uiSelector, - (ui) => { - const { - shouldShowParametersPanel, - shouldHoldParametersPanelOpen, - shouldPinParametersPanel, - parametersPanelScrollPosition, - } = ui; - - return { - shouldShowParametersPanel, - shouldHoldParametersPanelOpen, - shouldPinParametersPanel, - parametersPanelScrollPosition, - }; - }, - { - memoizeOptions: { - resultEqualityCheck: isEqual, - }, - } -); - -const InvokeOptionsPanel = (props: Props) => { - const dispatch = useAppDispatch(); - const { direction } = useTheme(); - - const { - shouldShowParametersPanel, - shouldHoldParametersPanelOpen, - shouldPinParametersPanel, - } = useAppSelector(optionsPanelSelector); - - const optionsPanelRef = useRef(null); - const optionsPanelContainerRef = useRef(null); - - const timeoutIdRef = useRef(null); - - const { children } = props; - - const { t } = useTranslation(); - - // Hotkeys - useHotkeys( - 'o', - () => { - dispatch(setShouldShowParametersPanel(!shouldShowParametersPanel)); - shouldPinParametersPanel && - setTimeout(() => dispatch(setDoesCanvasNeedScaling(true)), 400); - }, - [shouldShowParametersPanel, shouldPinParametersPanel] - ); - - useHotkeys( - 'esc', - () => { - dispatch(setShouldShowParametersPanel(false)); - }, - { - enabled: () => !shouldPinParametersPanel, - preventDefault: true, - }, - [shouldPinParametersPanel] - ); - - useHotkeys( - 'shift+o', - () => { - handleClickPinOptionsPanel(); - dispatch(setDoesCanvasNeedScaling(true)); - }, - [shouldPinParametersPanel] - ); - - const handleCloseOptionsPanel = useCallback(() => { - if (shouldPinParametersPanel) return; - dispatch( - setParametersPanelScrollPosition( - optionsPanelContainerRef.current - ? optionsPanelContainerRef.current.scrollTop - : 0 - ) - ); - dispatch(setShouldShowParametersPanel(false)); - dispatch(setShouldHoldParametersPanelOpen(false)); - }, [dispatch, shouldPinParametersPanel]); - - const setCloseOptionsPanelTimer = () => { - timeoutIdRef.current = window.setTimeout( - () => handleCloseOptionsPanel(), - 500 - ); - }; - - const cancelCloseOptionsPanelTimer = () => { - timeoutIdRef.current && window.clearTimeout(timeoutIdRef.current); - }; - - const handleClickPinOptionsPanel = () => { - dispatch(setShouldPinParametersPanel(!shouldPinParametersPanel)); - dispatch(setDoesCanvasNeedScaling(true)); - }; - - useEffect(() => { - function handleClickOutside(e: MouseEvent) { - if ( - optionsPanelRef.current && - !optionsPanelRef.current.contains(e.target as Node) - ) { - handleCloseOptionsPanel(); - } - } - document.addEventListener('mousedown', handleClickOutside); - return () => { - document.removeEventListener('mousedown', handleClickOutside); - }; - }, [handleCloseOptionsPanel]); - - return ( - - - - ) => { - if (e.target !== optionsPanelContainerRef.current) { - cancelCloseOptionsPanelTimer(); - } else { - !shouldPinParametersPanel && setCloseOptionsPanelTimer(); - } - }} - sx={{ - display: 'flex', - flexDirection: 'column', - rowGap: 2, - height: '100%', - }} - > - - - - - - {!shouldPinParametersPanel && ( - - - - )} - {children} - - - - - ); -}; - -export default InvokeOptionsPanel; diff --git a/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx b/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx index 740c71edfd..13eea186cf 100644 --- a/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx +++ b/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx @@ -1,4 +1,5 @@ import { + ChakraProps, Icon, Tab, TabList, @@ -13,18 +14,10 @@ import { useAppDispatch, useAppSelector } from 'app/storeHooks'; import NodesWIP from 'common/components/WorkInProgress/NodesWIP'; import { PostProcessingWIP } from 'common/components/WorkInProgress/PostProcessingWIP'; import TrainingWIP from 'common/components/WorkInProgress/Training'; -import useUpdateTranslations from 'common/hooks/useUpdateTranslations'; -import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice'; -import { setShouldShowGallery } from 'features/gallery/store/gallerySlice'; -import Lightbox from 'features/lightbox/components/Lightbox'; import { setIsLightboxOpen } from 'features/lightbox/store/lightboxSlice'; import { InvokeTabName } from 'features/ui/store/tabMap'; -import { - setActiveTab, - setShouldShowParametersPanel, -} from 'features/ui/store/uiSlice'; -import i18n from 'i18n'; -import { ReactElement } from 'react'; +import { setActiveTab, togglePanels } from 'features/ui/store/uiSlice'; +import { ReactNode, useMemo } from 'react'; import { useHotkeys } from 'react-hotkeys-hook'; import { MdDeviceHub, @@ -35,58 +28,55 @@ import { MdTextFields, } from 'react-icons/md'; import { activeTabIndexSelector } from '../store/uiSelectors'; -import { floatingSelector } from './FloatingParametersPanelButtons'; -import ImageToImageWorkarea from './ImageToImage'; -import TextToImageWorkarea from './TextToImage'; -import UnifiedCanvasWorkarea from './UnifiedCanvas/UnifiedCanvasWorkarea'; +import ImageToImageWorkarea from 'features/ui/components/tabs/ImageToImage/ImageToImageWorkarea'; +import TextToImageWorkarea from 'features/ui/components/tabs/TextToImage/TextToImageWorkarea'; +import UnifiedCanvasWorkarea from 'features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasWorkarea'; +import { useTranslation } from 'react-i18next'; +import { ResourceKey } from 'i18next'; +import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale'; export interface InvokeTabInfo { - title: ReactElement; - workarea: ReactElement; - tooltip: string; + id: InvokeTabName; + icon: ReactNode; + workarea: ReactNode; } -export const tabDict: Record = { - txt2img: { - title: , - workarea: , - tooltip: 'Text To Image', - }, - img2img: { - title: , - workarea: , - tooltip: 'Image To Image', - }, - unifiedCanvas: { - title: , - workarea: , - tooltip: 'Unified Canvas', - }, - nodes: { - title: , - workarea: , - tooltip: 'Nodes', - }, - postprocess: { - title: , - workarea: , - tooltip: 'Post Processing', - }, - training: { - title: , - workarea: , - tooltip: 'Training', - }, +const tabIconStyles: ChakraProps['sx'] = { + boxSize: 6, }; -function updateTabTranslations() { - tabDict.txt2img.tooltip = i18n.t('common.text2img'); - tabDict.img2img.tooltip = i18n.t('common.img2img'); - tabDict.unifiedCanvas.tooltip = i18n.t('common.unifiedCanvas'); - tabDict.nodes.tooltip = i18n.t('common.nodes'); - tabDict.postprocess.tooltip = i18n.t('common.postProcessing'); - tabDict.training.tooltip = i18n.t('common.training'); -} +const tabInfo: InvokeTabInfo[] = [ + { + id: 'txt2img', + icon: , + workarea: , + }, + { + id: 'img2img', + icon: , + workarea: , + }, + { + id: 'unifiedCanvas', + icon: , + workarea: , + }, + { + id: 'nodes', + icon: , + workarea: , + }, + { + id: 'postprocessing', + icon: , + workarea: , + }, + { + id: 'training', + icon: , + workarea: , + }, +]; export default function InvokeTabs() { const activeTab = useAppSelector(activeTabIndexSelector); @@ -95,14 +85,15 @@ export default function InvokeTabs() { (state: RootState) => state.lightbox.isLightboxOpen ); - const { - shouldShowGallery, - shouldShowParametersPanel, - shouldPinGallery, - shouldPinParametersPanel, - } = useAppSelector(floatingSelector); + const shouldPinGallery = useAppSelector( + (state: RootState) => state.ui.shouldPinGallery + ); - useUpdateTranslations(updateTabTranslations); + const shouldPinParametersPanel = useAppSelector( + (state: RootState) => state.ui.shouldPinParametersPanel + ); + + const { t } = useTranslation(); const dispatch = useAppDispatch(); @@ -142,53 +133,50 @@ export default function InvokeTabs() { useHotkeys( 'f', () => { - if (shouldShowGallery || shouldShowParametersPanel) { - dispatch(setShouldShowParametersPanel(false)); - dispatch(setShouldShowGallery(false)); - } else { - dispatch(setShouldShowParametersPanel(true)); - dispatch(setShouldShowGallery(true)); - } - if (shouldPinGallery || shouldPinParametersPanel) - setTimeout(() => dispatch(setDoesCanvasNeedScaling(true)), 400); + dispatch(togglePanels()); + (shouldPinGallery || shouldPinParametersPanel) && + dispatch(requestCanvasRescale()); }, - [shouldShowGallery, shouldShowParametersPanel] + [shouldPinGallery, shouldPinParametersPanel] ); - const renderTabs = () => { - const tabsToRender: ReactElement[] = []; - Object.keys(tabDict).forEach((key) => { - tabsToRender.push( + const tabs = useMemo( + () => + tabInfo.map((tab) => ( - {tabDict[key as keyof typeof tabDict].tooltip} + {String(t(`common.${tab.id}` as ResourceKey))} - {tabDict[key as keyof typeof tabDict].title} + {tab.icon} - ); - }); - return tabsToRender; - }; + )), + [t] + ); - const renderTabPanels = () => { - const tabPanelsToRender: ReactElement[] = []; - Object.keys(tabDict).forEach((key) => { - tabPanelsToRender.push( - - {tabDict[key as keyof typeof tabDict].workarea} - - ); - }); - return tabPanelsToRender; - }; + const tabPanels = useMemo( + () => + tabInfo.map((tab) => {tab.workarea}), + [] + ); + /** + * isLazy means the tabs are mounted and unmounted when changing them. There is a tradeoff here, + * as mounting is expensive, but so is retaining all tabs in the DOM at all times. + * + * Removing isLazy messes with the outside click watcher, which is used by ResizableDrawer. + * Because you have multiple handlers listening for an outside click, any click anywhere triggers + * the watcher for the hidden drawers, closing the open drawer. + * + * TODO: Add logic to the `useOutsideClick` in ResizableDrawer to enable it only for the active + * tab's drawer. + */ return ( { dispatch(setActiveTab(index)); }} + flexGrow={1} > - {renderTabs()} - {isLightBoxOpen ? : renderTabPanels()} + {tabs} + {tabPanels} ); } diff --git a/invokeai/frontend/web/src/features/ui/components/InvokeWorkarea.tsx b/invokeai/frontend/web/src/features/ui/components/InvokeWorkarea.tsx index 0210d249cf..ea4cd5ba1a 100644 --- a/invokeai/frontend/web/src/features/ui/components/InvokeWorkarea.tsx +++ b/invokeai/frontend/web/src/features/ui/components/InvokeWorkarea.tsx @@ -1,7 +1,6 @@ import { Box, BoxProps, Flex } from '@chakra-ui/react'; import { createSelector } from '@reduxjs/toolkit'; import { useAppDispatch, useAppSelector } from 'app/storeHooks'; -import ImageGallery from 'features/gallery/components/ImageGallery'; import { setInitialImage } from 'features/parameters/store/generationSlice'; import { activeTabNameSelector, @@ -11,17 +10,16 @@ import { DragEvent, ReactNode } from 'react'; import { setInitialCanvasImage } from 'features/canvas/store/canvasSlice'; import useGetImageByUuid from 'features/gallery/hooks/useGetImageByUuid'; -import { lightboxSelector } from 'features/lightbox/store/lightboxSelectors'; import { isEqual } from 'lodash'; +import { APP_CONTENT_HEIGHT } from 'theme/util/constants'; +import ParametersPanel from './ParametersPanel'; const workareaSelector = createSelector( - [uiSelector, lightboxSelector, activeTabNameSelector], - (ui, lightbox, activeTabName) => { + [uiSelector, activeTabNameSelector], + (ui, activeTabName) => { const { shouldPinParametersPanel } = ui; - const { isLightboxOpen } = lightbox; return { shouldPinParametersPanel, - isLightboxOpen, activeTabName, }; }, @@ -33,14 +31,14 @@ const workareaSelector = createSelector( ); type InvokeWorkareaProps = BoxProps & { - optionsPanel: ReactNode; + parametersPanelContent: ReactNode; children: ReactNode; }; const InvokeWorkarea = (props: InvokeWorkareaProps) => { + const { parametersPanelContent, children, ...rest } = props; const dispatch = useAppDispatch(); - const { optionsPanel, children, ...rest } = props; - const { activeTabName, isLightboxOpen } = useAppSelector(workareaSelector); + const { activeTabName } = useAppSelector(workareaSelector); const getImageByUuid = useGetImageByUuid(); @@ -56,15 +54,12 @@ const InvokeWorkarea = (props: InvokeWorkareaProps) => { }; return ( - - - {optionsPanel} - - {children} - - {!isLightboxOpen && } - - + + {parametersPanelContent} + + {children} + + ); }; diff --git a/invokeai/frontend/web/src/features/ui/components/ParametersPanel.tsx b/invokeai/frontend/web/src/features/ui/components/ParametersPanel.tsx new file mode 100644 index 0000000000..1f0bcaead3 --- /dev/null +++ b/invokeai/frontend/web/src/features/ui/components/ParametersPanel.tsx @@ -0,0 +1,129 @@ +import { Flex } from '@chakra-ui/react'; +import { useAppDispatch, useAppSelector } from 'app/storeHooks'; + +import { memo, ReactNode } from 'react'; + +import { PARAMETERS_PANEL_WIDTH } from 'theme/util/constants'; +import ResizableDrawer from 'features/ui/components/common/ResizableDrawer/ResizableDrawer'; +import { + setShouldShowParametersPanel, + toggleParametersPanel, + togglePinParametersPanel, +} from 'features/ui/store/uiSlice'; +import { useHotkeys } from 'react-hotkeys-hook'; +import InvokeAILogoComponent from 'features/system/components/InvokeAILogoComponent'; +import Scrollable from './common/Scrollable'; +import PinParametersPanelButton from './PinParametersPanelButton'; +import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale'; +import { createSelector } from '@reduxjs/toolkit'; +import { activeTabNameSelector, uiSelector } from '../store/uiSelectors'; +import { isEqual } from 'lodash'; +import { lightboxSelector } from 'features/lightbox/store/lightboxSelectors'; + +const parametersPanelSelector = createSelector( + [uiSelector, activeTabNameSelector, lightboxSelector], + (ui, activeTabName, lightbox) => { + const { shouldPinParametersPanel, shouldShowParametersPanel } = ui; + const { isLightboxOpen } = lightbox; + + return { + shouldPinParametersPanel, + shouldShowParametersPanel, + isResizable: activeTabName !== 'unifiedCanvas', + isLightboxOpen, + }; + }, + { + memoizeOptions: { + resultEqualityCheck: isEqual, + }, + } +); + +type ParametersPanelProps = { + children: ReactNode; +}; + +const ParametersPanel = ({ children }: ParametersPanelProps) => { + const dispatch = useAppDispatch(); + + const { + shouldPinParametersPanel, + shouldShowParametersPanel, + isResizable, + isLightboxOpen, + } = useAppSelector(parametersPanelSelector); + + const closeParametersPanel = () => { + dispatch(setShouldShowParametersPanel(false)); + }; + + useHotkeys( + 'o', + () => { + dispatch(toggleParametersPanel()); + shouldPinParametersPanel && dispatch(requestCanvasRescale()); + }, + { enabled: () => !isLightboxOpen }, + [shouldPinParametersPanel, isLightboxOpen] + ); + + useHotkeys( + 'esc', + () => { + dispatch(setShouldShowParametersPanel(false)); + }, + { + enabled: () => !shouldPinParametersPanel, + preventDefault: true, + }, + [shouldPinParametersPanel] + ); + + useHotkeys( + 'shift+o', + () => { + dispatch(togglePinParametersPanel()); + dispatch(requestCanvasRescale()); + }, + [] + ); + return ( + + + {!shouldPinParametersPanel && ( + + + + + )} + {children} + {shouldPinParametersPanel && ( + + )} + + + ); +}; + +export default memo(ParametersPanel); diff --git a/invokeai/frontend/web/src/features/ui/components/PinParametersPanelButton.tsx b/invokeai/frontend/web/src/features/ui/components/PinParametersPanelButton.tsx new file mode 100644 index 0000000000..66d71aabe3 --- /dev/null +++ b/invokeai/frontend/web/src/features/ui/components/PinParametersPanelButton.tsx @@ -0,0 +1,51 @@ +import { Tooltip } from '@chakra-ui/react'; +import { useAppDispatch, useAppSelector } from 'app/storeHooks'; +import IAIIconButton, { + IAIIconButtonProps, +} from 'common/components/IAIIconButton'; +import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale'; +import { useTranslation } from 'react-i18next'; +import { BsPinAngle, BsPinAngleFill } from 'react-icons/bs'; +import { setShouldPinParametersPanel } from '../store/uiSlice'; + +type PinParametersPanelButtonProps = Omit; + +const PinParametersPanelButton = (props: PinParametersPanelButtonProps) => { + const { sx } = props; + const dispatch = useAppDispatch(); + const shouldPinParametersPanel = useAppSelector( + (state) => state.ui.shouldPinParametersPanel + ); + + const { t } = useTranslation(); + + const handleClickPinOptionsPanel = () => { + dispatch(setShouldPinParametersPanel(!shouldPinParametersPanel)); + dispatch(requestCanvasRescale()); + }; + + return ( + + : } + variant="ghost" + size="sm" + sx={{ + color: 'base.700', + _hover: { + color: 'base.550', + }, + _active: { + color: 'base.500', + }, + ...sx, + }} + /> + + ); +}; + +export default PinParametersPanelButton; diff --git a/invokeai/frontend/web/src/features/ui/components/TextToImage/index.tsx b/invokeai/frontend/web/src/features/ui/components/TextToImage/index.tsx deleted file mode 100644 index fccd862160..0000000000 --- a/invokeai/frontend/web/src/features/ui/components/TextToImage/index.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import InvokeWorkarea from 'features/ui/components/InvokeWorkarea'; -import TextToImageDisplay from './TextToImageDisplay'; -import TextToImagePanel from './TextToImagePanel'; - -export default function TextToImageWorkarea() { - return ( - }> - - - ); -} diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasWorkarea.tsx b/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasWorkarea.tsx deleted file mode 100644 index b35504a2ac..0000000000 --- a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasWorkarea.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { RootState } from 'app/store'; -import { useAppSelector } from 'app/storeHooks'; -import InvokeWorkarea from 'features/ui/components/InvokeWorkarea'; -import UnifiedCanvasDisplayBeta from './UnifiedCanvasBeta/UnifiedCanvasDisplayBeta'; -import UnifiedCanvasDisplay from './UnifiedCanvasDisplay'; -import UnifiedCanvasPanel from './UnifiedCanvasPanel'; - -export default function UnifiedCanvasWorkarea() { - const shouldUseCanvasBetaLayout = useAppSelector( - (state: RootState) => state.ui.shouldUseCanvasBetaLayout - ); - return ( - }> - {shouldUseCanvasBetaLayout ? ( - - ) : ( - - )} - - ); -} diff --git a/invokeai/frontend/web/src/features/ui/components/common/ResizableDrawer/ResizableDrawer.tsx b/invokeai/frontend/web/src/features/ui/components/common/ResizableDrawer/ResizableDrawer.tsx new file mode 100644 index 0000000000..8b920da868 --- /dev/null +++ b/invokeai/frontend/web/src/features/ui/components/common/ResizableDrawer/ResizableDrawer.tsx @@ -0,0 +1,222 @@ +import { + Box, + chakra, + ChakraProps, + Slide, + useOutsideClick, + useTheme, + SlideDirection, +} from '@chakra-ui/react'; +import { + Resizable, + ResizableProps, + ResizeCallback, + ResizeStartCallback, +} from 're-resizable'; +import { ReactNode, useEffect, useMemo, useRef, useState } from 'react'; +import { LangDirection } from './types'; +import { + getHandleEnables, + getMinMaxDimensions, + getSlideDirection, + getStyles, + parseAndPadSize, +} from './util'; + +type ResizableDrawerProps = ResizableProps & { + children: ReactNode; + isResizable: boolean; + isPinned: boolean; + isOpen: boolean; + onClose: () => void; + direction?: SlideDirection; + initialWidth?: number; + minWidth?: number; + maxWidth?: number; + initialHeight?: number; + minHeight?: number; + maxHeight?: number; + onResizeStart?: ResizeStartCallback; + onResizeStop?: ResizeCallback; + onResize?: ResizeCallback; + handleWidth?: string | number; + handleInteractWidth?: string | number; + sx?: ChakraProps['sx']; +}; + +const ChakraResizeable = chakra(Resizable, { + shouldForwardProp: (prop) => !['sx'].includes(prop), +}); + +const ResizableDrawer = ({ + direction = 'left', + isResizable, + isPinned, + isOpen, + onClose, + children, + initialWidth, + minWidth, + maxWidth, + initialHeight, + minHeight, + maxHeight, + onResizeStart, + onResizeStop, + onResize, + sx = {}, +}: ResizableDrawerProps) => { + const langDirection = useTheme().direction as LangDirection; + + const outsideClickRef = useRef(null); + + const defaultWidth = useMemo( + () => + initialWidth ?? + minWidth ?? + (['left', 'right'].includes(direction) ? 500 : '100%'), + [initialWidth, minWidth, direction] + ); + + const defaultHeight = useMemo( + () => + initialHeight ?? + minHeight ?? + (['top', 'bottom'].includes(direction) ? 500 : '100%'), + [initialHeight, minHeight, direction] + ); + + const [width, setWidth] = useState(defaultWidth); + + const [height, setHeight] = useState(defaultHeight); + + useOutsideClick({ + ref: outsideClickRef, + handler: () => { + if (isPinned) { + return; + } + + onClose(); + }, + }); + + const handleEnables = useMemo( + () => (isResizable ? getHandleEnables({ direction, langDirection }) : {}), + [isResizable, langDirection, direction] + ); + + const minMaxDimensions = useMemo( + () => + getMinMaxDimensions({ + direction, + minWidth: isResizable + ? parseAndPadSize(minWidth, 18) + : parseAndPadSize(minWidth), + maxWidth: isResizable + ? parseAndPadSize(maxWidth, 18) + : parseAndPadSize(maxWidth), + minHeight: isResizable + ? parseAndPadSize(minHeight, 18) + : parseAndPadSize(minHeight), + maxHeight: isResizable + ? parseAndPadSize(maxHeight, 18) + : parseAndPadSize(maxHeight), + }), + [minWidth, maxWidth, minHeight, maxHeight, direction, isResizable] + ); + + const { containerStyles, handleStyles } = useMemo( + () => + getStyles({ + isPinned, + isResizable, + direction, + }), + [isPinned, isResizable, direction] + ); + + const slideDirection = useMemo( + () => getSlideDirection(direction, langDirection), + [direction, langDirection] + ); + + useEffect(() => { + if (['left', 'right'].includes(direction)) { + setHeight(isPinned ? '100%' : '100vh'); + } + if (['top', 'bottom'].includes(direction)) { + setWidth(isPinned ? '100%' : '100vw'); + } + }, [isPinned, direction]); + + return ( + + + { + onResizeStart && onResizeStart(event, direction, elementRef); + }} + onResize={(event, direction, elementRef, delta) => { + onResize && onResize(event, direction, elementRef, delta); + }} + onResizeStop={(event, direction, elementRef, delta) => { + if (['left', 'right'].includes(direction)) { + setWidth(Number(width) + delta.width); + } + if (['top', 'bottom'].includes(direction)) { + setHeight(Number(height) + delta.height); + } + onResizeStop && onResizeStop(event, direction, elementRef, delta); + }} + > + {children} + + + + ); +}; + +export default ResizableDrawer; diff --git a/invokeai/frontend/web/src/features/ui/components/common/ResizableDrawer/types.ts b/invokeai/frontend/web/src/features/ui/components/common/ResizableDrawer/types.ts new file mode 100644 index 0000000000..5aa42ab7e5 --- /dev/null +++ b/invokeai/frontend/web/src/features/ui/components/common/ResizableDrawer/types.ts @@ -0,0 +1,2 @@ +export type Placement = 'top' | 'right' | 'bottom' | 'left'; +export type LangDirection = 'ltr' | 'rtl' | undefined; diff --git a/invokeai/frontend/web/src/features/ui/components/common/ResizableDrawer/util.ts b/invokeai/frontend/web/src/features/ui/components/common/ResizableDrawer/util.ts new file mode 100644 index 0000000000..b69da8cf1c --- /dev/null +++ b/invokeai/frontend/web/src/features/ui/components/common/ResizableDrawer/util.ts @@ -0,0 +1,294 @@ +import { SlideDirection } from '@chakra-ui/react'; +import { AnimationProps } from 'framer-motion'; +import { HandleStyles } from 're-resizable'; +import { CSSProperties } from 'react'; +import { LangDirection } from './types'; + +export type GetHandleEnablesOptions = { + direction: SlideDirection; + langDirection: LangDirection; +}; + +/** + * Determine handles to enable. `re-resizable` doesn't handle RTL, so we have to do that here. + */ +export const getHandleEnables = ({ + direction, + langDirection, +}: GetHandleEnablesOptions) => { + const top = direction === 'bottom'; + + const right = + (langDirection !== 'rtl' && direction === 'left') || + (langDirection === 'rtl' && direction === 'right'); + + const bottom = direction === 'top'; + + const left = + (langDirection !== 'rtl' && direction === 'right') || + (langDirection === 'rtl' && direction === 'left'); + + return { + top, + right, + bottom, + left, + }; +}; + +export type GetDefaultSizeOptions = { + initialWidth?: string | number; + initialHeight?: string | number; + direction: SlideDirection; +}; + +// Get default sizes based on direction and initial values +export const getDefaultSize = ({ + initialWidth, + initialHeight, + direction, +}: GetDefaultSizeOptions) => { + const width = + initialWidth ?? (['left', 'right'].includes(direction) ? 500 : '100vw'); + + const height = + initialHeight ?? (['top', 'bottom'].includes(direction) ? 500 : '100vh'); + + return { width, height }; +}; + +export type GetMinMaxDimensionsOptions = { + direction: SlideDirection; + minWidth?: number; + maxWidth?: number; + minHeight?: number; + maxHeight?: number; +}; + +// Get the min/max width/height based on direction and provided values +export const getMinMaxDimensions = ({ + direction, + minWidth, + maxWidth, + minHeight, + maxHeight, +}: GetMinMaxDimensionsOptions) => { + const minW = + minWidth ?? (['left', 'right'].includes(direction) ? 10 : undefined); + + const maxW = + maxWidth ?? (['left', 'right'].includes(direction) ? '95vw' : undefined); + + const minH = + minHeight ?? (['top', 'bottom'].includes(direction) ? 10 : undefined); + + const maxH = + maxHeight ?? (['top', 'bottom'].includes(direction) ? '95vh' : undefined); + + return { + ...(minW ? { minWidth: minW } : {}), + ...(maxW ? { maxWidth: maxW } : {}), + ...(minH ? { minHeight: minH } : {}), + ...(maxH ? { maxHeight: maxH } : {}), + }; +}; + +export type GetAnimationsOptions = { + direction: SlideDirection; + langDirection: LangDirection; +}; + +// Get the framer-motion animation props, taking into account language direction +export const getAnimations = ({ + direction, + langDirection, +}: GetAnimationsOptions): AnimationProps => { + const baseAnimation = { + initial: { opacity: 0 }, + animate: { opacity: 1 }, + exit: { opacity: 0 }, + // chakra consumes the transition prop, which, for it, is a string. + // however we know the transition prop will make it to framer motion, + // which wants it as an object. cast as string to satisfy TS. + transition: { duration: 0.2, ease: 'easeInOut' }, + }; + + const langDirectionFactor = langDirection === 'rtl' ? -1 : 1; + + if (direction === 'top') { + return { + ...baseAnimation, + initial: { y: -999 }, + animate: { y: 0 }, + exit: { y: -999 }, + }; + } + + if (direction === 'right') { + return { + ...baseAnimation, + initial: { x: 999 * langDirectionFactor }, + animate: { x: 0 }, + exit: { x: 999 * langDirectionFactor }, + }; + } + + if (direction === 'bottom') { + return { + ...baseAnimation, + initial: { y: 999 }, + animate: { y: 0 }, + exit: { y: 999 }, + }; + } + + if (direction === 'left') { + return { + ...baseAnimation, + initial: { x: -999 * langDirectionFactor }, + animate: { x: 0 }, + exit: { x: -999 * langDirectionFactor }, + }; + } + + return {}; +}; + +export type GetResizableStylesProps = { + isPinned: boolean; + isResizable: boolean; + direction: SlideDirection; +}; + +// Expand the handle hitbox +const HANDLE_INTERACT_PADDING = '0.75rem'; + +// Visible padding around handle +const HANDLE_PADDING = '1rem'; + +const HANDLE_WIDTH_PINNED = '2px'; +const HANDLE_WIDTH_UNPINNED = '5px'; + +// Get the styles for the container and handle. Do not need to handle langDirection here bc we use direction-agnostic CSS +export const getStyles = ({ + isPinned, + isResizable, + direction, +}: GetResizableStylesProps): { + containerStyles: CSSProperties; // technically this could be ChakraProps['sx'], but we cannot use this for HandleStyles so leave it as CSSProperties to be consistent + handleStyles: HandleStyles; +} => { + if (!isResizable) { + return { containerStyles: {}, handleStyles: {} }; + } + + const handleWidth = isPinned ? HANDLE_WIDTH_PINNED : HANDLE_WIDTH_UNPINNED; + + // Calculate the positioning offset of the handle hitbox so it is centered over the handle + const handleOffset = `calc((2 * ${HANDLE_INTERACT_PADDING} + ${handleWidth}) / -2)`; + + if (direction === 'top') { + return { + containerStyles: { + borderBottomWidth: handleWidth, + paddingBottom: HANDLE_PADDING, + }, + handleStyles: { + top: { + paddingTop: HANDLE_INTERACT_PADDING, + paddingBottom: HANDLE_INTERACT_PADDING, + bottom: handleOffset, + }, + }, + }; + } + + if (direction === 'left') { + return { + containerStyles: { + borderInlineEndWidth: handleWidth, + paddingInlineEnd: HANDLE_PADDING, + }, + handleStyles: { + right: { + paddingInlineStart: HANDLE_INTERACT_PADDING, + paddingInlineEnd: HANDLE_INTERACT_PADDING, + insetInlineEnd: handleOffset, + }, + }, + }; + } + + if (direction === 'bottom') { + return { + containerStyles: { + borderTopWidth: handleWidth, + paddingTop: HANDLE_PADDING, + }, + handleStyles: { + bottom: { + paddingTop: HANDLE_INTERACT_PADDING, + paddingBottom: HANDLE_INTERACT_PADDING, + top: handleOffset, + }, + }, + }; + } + + if (direction === 'right') { + return { + containerStyles: { + borderInlineStartWidth: handleWidth, + paddingInlineStart: HANDLE_PADDING, + }, + handleStyles: { + left: { + paddingInlineStart: HANDLE_INTERACT_PADDING, + paddingInlineEnd: HANDLE_INTERACT_PADDING, + insetInlineStart: handleOffset, + }, + }, + }; + } + + return { containerStyles: {}, handleStyles: {} }; +}; + +// Chakra's Slide does not handle langDirection, so we need to do it here +export const getSlideDirection = ( + direction: SlideDirection, + langDirection: LangDirection +) => { + if (['top', 'bottom'].includes(direction)) { + return direction; + } + + if (direction === 'left') { + if (langDirection === 'rtl') { + return 'right'; + } + return 'left'; + } + + if (direction === 'right') { + if (langDirection === 'rtl') { + return 'left'; + } + return 'right'; + } + + return 'left'; +}; + +// Hack to correct the width of panels while pinned and unpinned, due to different padding in pinned vs unpinned +export const parseAndPadSize = (size?: number, padding?: number) => { + if (!size) { + return undefined; + } + + if (!padding) { + return size; + } + + return size + padding; +}; diff --git a/invokeai/frontend/web/src/features/ui/components/common/Scrollable.tsx b/invokeai/frontend/web/src/features/ui/components/common/Scrollable.tsx new file mode 100644 index 0000000000..0fdcff742f --- /dev/null +++ b/invokeai/frontend/web/src/features/ui/components/common/Scrollable.tsx @@ -0,0 +1,88 @@ +import { Box, ChakraProps } from '@chakra-ui/react'; +import { throttle } from 'lodash'; +import { ReactNode, useEffect, useRef } from 'react'; + +const scrollShadowBaseStyles: ChakraProps['sx'] = { + position: 'absolute', + width: 'full', + height: 24, + left: 0, + pointerEvents: 'none', + transition: 'opacity 0.2s ease-in-out', +}; + +type ScrollableProps = { + children: ReactNode; +}; + +const Scrollable = ({ children }: ScrollableProps) => { + const scrollableRef = useRef(null); + const topShadowRef = useRef(null); + const bottomShadowRef = useRef(null); + + const updateScrollShadowOpacity = throttle( + () => { + if ( + !scrollableRef.current || + !topShadowRef.current || + !bottomShadowRef.current + ) { + return; + } + const { scrollTop, scrollHeight, offsetHeight } = scrollableRef.current; + + if (scrollTop > 0) { + topShadowRef.current.style.opacity = '1'; + } else { + topShadowRef.current.style.opacity = '0'; + } + + if (scrollTop >= scrollHeight - offsetHeight) { + bottomShadowRef.current.style.opacity = '0'; + } else { + bottomShadowRef.current.style.opacity = '1'; + } + }, + 33, + { leading: true } + ); + + useEffect(() => { + updateScrollShadowOpacity(); + }, [updateScrollShadowOpacity]); + + return ( + + + {children} + + + + + ); +}; + +export default Scrollable; diff --git a/invokeai/frontend/web/src/features/ui/components/ImageToImage/ImageToImageDisplay.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/ImageToImage/ImageToImageContent.tsx similarity index 94% rename from invokeai/frontend/web/src/features/ui/components/ImageToImage/ImageToImageDisplay.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/ImageToImage/ImageToImageContent.tsx index 173985697f..db62d2ed80 100644 --- a/invokeai/frontend/web/src/features/ui/components/ImageToImage/ImageToImageDisplay.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/ImageToImage/ImageToImageContent.tsx @@ -14,7 +14,7 @@ const workareaSplitViewStyle: ChakraProps['sx'] = { padding: 4, }; -const ImageToImageDisplay = () => { +const ImageToImageContent = () => { const initialImage = useAppSelector( (state: RootState) => state.generation.initialImage ); @@ -47,4 +47,4 @@ const ImageToImageDisplay = () => { ); }; -export default ImageToImageDisplay; +export default ImageToImageContent; diff --git a/invokeai/frontend/web/src/features/ui/components/ImageToImage/ImageToImagePanel.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/ImageToImage/ImageToImageParameters.tsx similarity index 89% rename from invokeai/frontend/web/src/features/ui/components/ImageToImage/ImageToImagePanel.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/ImageToImage/ImageToImageParameters.tsx index d5f2268cb8..4989ef034b 100644 --- a/invokeai/frontend/web/src/features/ui/components/ImageToImage/ImageToImagePanel.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/ImageToImage/ImageToImageParameters.tsx @@ -15,11 +15,11 @@ import ParametersAccordion from 'features/parameters/components/ParametersAccord import ProcessButtons from 'features/parameters/components/ProcessButtons/ProcessButtons'; import NegativePromptInput from 'features/parameters/components/PromptInput/NegativePromptInput'; import PromptInput from 'features/parameters/components/PromptInput/PromptInput'; -import InvokeOptionsPanel from 'features/ui/components/InvokeParametersPanel'; import { useTranslation } from 'react-i18next'; -import ImageToImageSettings from './ImageToImageSettings'; +import ImageToImageSettings from 'features/parameters/components/AdvancedParameters/ImageToImage/ImageToImageSettings'; +import { memo } from 'react'; -export default function ImageToImagePanel() { +const ImageToImageParameters = () => { const { t } = useTranslation(); const imageToImageAccordions = { @@ -69,13 +69,13 @@ export default function ImageToImagePanel() { }; return ( - - - - - + + + - + ); -} +}; + +export default memo(ImageToImageParameters); diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/ImageToImage/ImageToImageWorkarea.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/ImageToImage/ImageToImageWorkarea.tsx new file mode 100644 index 0000000000..ebc6f50ff2 --- /dev/null +++ b/invokeai/frontend/web/src/features/ui/components/tabs/ImageToImage/ImageToImageWorkarea.tsx @@ -0,0 +1,11 @@ +import InvokeWorkarea from 'features/ui/components/InvokeWorkarea'; +import ImageToImageContent from './ImageToImageContent'; +import ImageToImageParameters from './ImageToImageParameters'; + +export default function ImageToImageWorkarea() { + return ( + }> + + + ); +} diff --git a/invokeai/frontend/web/src/features/ui/components/ImageToImage/InitImagePreview.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/ImageToImage/InitImagePreview.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/ImageToImage/InitImagePreview.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/ImageToImage/InitImagePreview.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/TextToImage/TextToImageDisplay.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/TextToImage/TextToImageContent.tsx similarity index 85% rename from invokeai/frontend/web/src/features/ui/components/TextToImage/TextToImageDisplay.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/TextToImage/TextToImageContent.tsx index 219b70bc2d..886e3a5331 100644 --- a/invokeai/frontend/web/src/features/ui/components/TextToImage/TextToImageDisplay.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/TextToImage/TextToImageContent.tsx @@ -1,7 +1,7 @@ import { Box, Flex } from '@chakra-ui/react'; import CurrentImageDisplay from 'features/gallery/components/CurrentImageDisplay'; -const TextToImageDisplay = () => { +const TextToImageContent = () => { return ( { ); }; -export default TextToImageDisplay; +export default TextToImageContent; diff --git a/invokeai/frontend/web/src/features/ui/components/TextToImage/TextToImagePanel.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/TextToImage/TextToImageParameters.tsx similarity index 91% rename from invokeai/frontend/web/src/features/ui/components/TextToImage/TextToImagePanel.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/TextToImage/TextToImageParameters.tsx index 09b96be20c..126dd10228 100644 --- a/invokeai/frontend/web/src/features/ui/components/TextToImage/TextToImagePanel.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/TextToImage/TextToImageParameters.tsx @@ -15,10 +15,10 @@ import ParametersAccordion from 'features/parameters/components/ParametersAccord import ProcessButtons from 'features/parameters/components/ProcessButtons/ProcessButtons'; import NegativePromptInput from 'features/parameters/components/PromptInput/NegativePromptInput'; import PromptInput from 'features/parameters/components/PromptInput/PromptInput'; -import InvokeOptionsPanel from 'features/ui/components/InvokeParametersPanel'; +import { memo } from 'react'; import { useTranslation } from 'react-i18next'; -export default function TextToImagePanel() { +const TextToImageParameters = () => { const { t } = useTranslation(); const textToImageAccordions = { @@ -63,13 +63,13 @@ export default function TextToImagePanel() { }; return ( - - - - - + + + - + ); -} +}; + +export default memo(TextToImageParameters); diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/TextToImage/TextToImageWorkarea.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/TextToImage/TextToImageWorkarea.tsx new file mode 100644 index 0000000000..eb95c96be5 --- /dev/null +++ b/invokeai/frontend/web/src/features/ui/components/tabs/TextToImage/TextToImageWorkarea.tsx @@ -0,0 +1,11 @@ +import InvokeWorkarea from 'features/ui/components/InvokeWorkarea'; +import TextToImageContent from './TextToImageContent'; +import TextToImageParameters from './TextToImageParameters'; + +export default function TextToImageWorkarea() { + return ( + }> + + + ); +} diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasDisplayBeta.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasContentBeta.tsx similarity index 82% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasDisplayBeta.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasContentBeta.tsx index 2ca4139ed0..b489acf916 100644 --- a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasDisplayBeta.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasContentBeta.tsx @@ -5,12 +5,12 @@ import { useAppDispatch, useAppSelector } from 'app/storeHooks'; import IAICanvas from 'features/canvas/components/IAICanvas'; import IAICanvasResizer from 'features/canvas/components/IAICanvasResizer'; import { canvasSelector } from 'features/canvas/store/canvasSelectors'; -import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice'; -import { debounce, isEqual } from 'lodash'; +import { isEqual } from 'lodash'; import { useLayoutEffect } from 'react'; import UnifiedCanvasToolbarBeta from './UnifiedCanvasToolbarBeta'; import UnifiedCanvasToolSettingsBeta from './UnifiedCanvasToolSettingsBeta'; +import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale'; const selector = createSelector( [canvasSelector], @@ -27,17 +27,16 @@ const selector = createSelector( } ); -const UnifiedCanvasDisplayBeta = () => { +const UnifiedCanvasContentBeta = () => { const dispatch = useAppDispatch(); const { doesCanvasNeedScaling } = useAppSelector(selector); useLayoutEffect(() => { - dispatch(setDoesCanvasNeedScaling(true)); - - const resizeCallback = debounce(() => { - dispatch(setDoesCanvasNeedScaling(true)); - }, 250); + dispatch(requestCanvasRescale()); + const resizeCallback = () => { + dispatch(requestCanvasRescale()); + }; window.addEventListener('resize', resizeCallback); @@ -70,4 +69,4 @@ const UnifiedCanvasDisplayBeta = () => { ); }; -export default UnifiedCanvasDisplayBeta; +export default UnifiedCanvasContentBeta; diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasBaseBrushSettings.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasBaseBrushSettings.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasBaseBrushSettings.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasBaseBrushSettings.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasBrushSettings.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasBrushSettings.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasBrushSettings.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasBrushSettings.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasBrushSize.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasBrushSize.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasBrushSize.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasBrushSize.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasClearMask.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasClearMask.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasClearMask.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasClearMask.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasColorPicker.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasColorPicker.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasColorPicker.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasColorPicker.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasDarkenOutsideSelection.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasDarkenOutsideSelection.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasDarkenOutsideSelection.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasDarkenOutsideSelection.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasEnableMask.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasEnableMask.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasEnableMask.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasEnableMask.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasLimitStrokesToBox.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasLimitStrokesToBox.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasLimitStrokesToBox.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasLimitStrokesToBox.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasMaskBrushSettings.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasMaskBrushSettings.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasMaskBrushSettings.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasMaskBrushSettings.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasMoveSettings.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasMoveSettings.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasMoveSettings.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasMoveSettings.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasPreserveMask.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasPreserveMask.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasPreserveMask.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasPreserveMask.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasSettings.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasSettings.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasSettings.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasSettings.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasShowGrid.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasShowGrid.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasShowGrid.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasShowGrid.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasSnapToGrid.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasSnapToGrid.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasSnapToGrid.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettings/UnifiedCanvasSnapToGrid.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettingsBeta.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettingsBeta.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettingsBeta.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolSettingsBeta.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasCopyToClipboard.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasCopyToClipboard.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasCopyToClipboard.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasCopyToClipboard.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasDownloadImage.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasDownloadImage.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasDownloadImage.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasDownloadImage.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasFileUploader.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasFileUploader.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasFileUploader.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasFileUploader.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasLayerSelect.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasLayerSelect.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasLayerSelect.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasLayerSelect.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasMergeVisible.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasMergeVisible.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasMergeVisible.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasMergeVisible.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasMoveTool.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasMoveTool.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasMoveTool.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasMoveTool.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasProcessingButtons.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasProcessingButtons.tsx similarity index 77% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasProcessingButtons.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasProcessingButtons.tsx index 5880aa037b..11436f7abe 100644 --- a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasProcessingButtons.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasProcessingButtons.tsx @@ -1,8 +1,7 @@ import { Flex } from '@chakra-ui/layout'; -import { RootState } from 'app/store'; import { useAppDispatch, useAppSelector } from 'app/storeHooks'; import IAIIconButton from 'common/components/IAIIconButton'; -import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice'; +import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale'; import CancelButton from 'features/parameters/components/ProcessButtons/CancelButton'; import InvokeButton from 'features/parameters/components/ProcessButtons/InvokeButton'; import { setShouldShowParametersPanel } from 'features/ui/store/uiSlice'; @@ -11,7 +10,10 @@ import { FaSlidersH } from 'react-icons/fa'; export default function UnifiedCanvasProcessingButtons() { const shouldPinParametersPanel = useAppSelector( - (state: RootState) => state.ui.shouldPinParametersPanel + (state) => state.ui.shouldPinParametersPanel + ); + const shouldShowParametersPanel = useAppSelector( + (state) => state.ui.shouldShowParametersPanel ); const dispatch = useAppDispatch(); @@ -19,12 +21,10 @@ export default function UnifiedCanvasProcessingButtons() { const handleShowOptionsPanel = () => { dispatch(setShouldShowParametersPanel(true)); - if (shouldPinParametersPanel) { - setTimeout(() => dispatch(setDoesCanvasNeedScaling(true)), 400); - } + shouldPinParametersPanel && dispatch(requestCanvasRescale()); }; - return ( + return !shouldPinParametersPanel || !shouldShowParametersPanel ? ( - ); + ) : null; } diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasResetCanvas.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasResetCanvas.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasResetCanvas.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasResetCanvas.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasResetView.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasResetView.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasResetView.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasResetView.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasSaveToGallery.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasSaveToGallery.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasSaveToGallery.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasSaveToGallery.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasToolSelect.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasToolSelect.tsx similarity index 100% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasToolSelect.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbar/UnifiedCanvasToolSelect.tsx diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbarBeta.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbarBeta.tsx similarity index 88% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbarBeta.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbarBeta.tsx index cf41020cbb..ece4386d45 100644 --- a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbarBeta.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasBeta/UnifiedCanvasToolbarBeta.tsx @@ -1,7 +1,5 @@ import { Flex } from '@chakra-ui/react'; -import { RootState } from 'app/store'; -import { useAppSelector } from 'app/storeHooks'; import IAICanvasRedoButton from 'features/canvas/components/IAICanvasToolbar/IAICanvasRedoButton'; import IAICanvasUndoButton from 'features/canvas/components/IAICanvasToolbar/IAICanvasUndoButton'; import UnifiedCanvasCopyToClipboard from './UnifiedCanvasToolbar/UnifiedCanvasCopyToClipboard'; @@ -18,10 +16,6 @@ import UnifiedCanvasToolSelect from './UnifiedCanvasToolbar/UnifiedCanvasToolSel import UnifiedCanvasSettings from './UnifiedCanvasToolSettings/UnifiedCanvasSettings'; const UnifiedCanvasToolbarBeta = () => { - const shouldShowParametersPanel = useAppSelector( - (state: RootState) => state.ui.shouldShowParametersPanel - ); - return ( @@ -52,7 +46,7 @@ const UnifiedCanvasToolbarBeta = () => { - {!shouldShowParametersPanel && } + ); }; diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasDisplay.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasContent.tsx similarity index 84% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasDisplay.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasContent.tsx index ac7f086bea..1ae4a6500f 100644 --- a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasDisplay.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasContent.tsx @@ -6,8 +6,8 @@ import IAICanvas from 'features/canvas/components/IAICanvas'; import IAICanvasResizer from 'features/canvas/components/IAICanvasResizer'; import IAICanvasToolbar from 'features/canvas/components/IAICanvasToolbar/IAICanvasToolbar'; import { canvasSelector } from 'features/canvas/store/canvasSelectors'; -import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice'; -import { debounce, isEqual } from 'lodash'; +import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale'; +import { isEqual } from 'lodash'; import { useLayoutEffect } from 'react'; @@ -26,17 +26,17 @@ const selector = createSelector( } ); -const UnifiedCanvasDisplay = () => { +const UnifiedCanvasContent = () => { const dispatch = useAppDispatch(); const { doesCanvasNeedScaling } = useAppSelector(selector); useLayoutEffect(() => { - dispatch(setDoesCanvasNeedScaling(true)); + dispatch(requestCanvasRescale()); - const resizeCallback = debounce(() => { - dispatch(setDoesCanvasNeedScaling(true)); - }, 250); + const resizeCallback = () => { + dispatch(requestCanvasRescale()); + }; window.addEventListener('resize', resizeCallback); @@ -80,4 +80,4 @@ const UnifiedCanvasDisplay = () => { ); }; -export default UnifiedCanvasDisplay; +export default UnifiedCanvasContent; diff --git a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasPanel.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasParameters.tsx similarity index 88% rename from invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasPanel.tsx rename to invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasParameters.tsx index 97ba3f23ec..0d49eafebd 100644 --- a/invokeai/frontend/web/src/features/ui/components/UnifiedCanvas/UnifiedCanvasPanel.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasParameters.tsx @@ -1,4 +1,3 @@ -// import { Feature } from 'app/features'; import { Flex } from '@chakra-ui/react'; import { Feature } from 'app/features'; import BoundingBoxSettings from 'features/parameters/components/AdvancedParameters/Canvas/BoundingBox/BoundingBoxSettings'; @@ -15,10 +14,9 @@ import ParametersAccordion from 'features/parameters/components/ParametersAccord import ProcessButtons from 'features/parameters/components/ProcessButtons/ProcessButtons'; import NegativePromptInput from 'features/parameters/components/PromptInput/NegativePromptInput'; import PromptInput from 'features/parameters/components/PromptInput/PromptInput'; -import InvokeOptionsPanel from 'features/ui/components/InvokeParametersPanel'; import { useTranslation } from 'react-i18next'; -export default function UnifiedCanvasPanel() { +export default function UnifiedCanvasParameters() { const { t } = useTranslation(); const unifiedCanvasAccordions = { @@ -66,14 +64,11 @@ export default function UnifiedCanvasPanel() { }; return ( - - - - - + + + - {/* */} - + ); } diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasWorkarea.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasWorkarea.tsx new file mode 100644 index 0000000000..f7991f6eaa --- /dev/null +++ b/invokeai/frontend/web/src/features/ui/components/tabs/UnifiedCanvas/UnifiedCanvasWorkarea.tsx @@ -0,0 +1,26 @@ +import { RootState } from 'app/store'; +import { useAppSelector } from 'app/storeHooks'; +import InvokeWorkarea from 'features/ui/components/InvokeWorkarea'; +import { activeTabNameSelector } from 'features/ui/store/uiSelectors'; +import UnifiedCanvasContentBeta from './UnifiedCanvasBeta/UnifiedCanvasContentBeta'; +import UnifiedCanvasContent from './UnifiedCanvasContent'; +import UnifiedCanvasParameters from './UnifiedCanvasParameters'; + +export default function UnifiedCanvasWorkarea() { + const shouldUseCanvasBetaLayout = useAppSelector( + (state: RootState) => state.ui.shouldUseCanvasBetaLayout + ); + + const activeTabName = useAppSelector(activeTabNameSelector); + + return ( + }> + {activeTabName === 'unifiedCanvas' && + (shouldUseCanvasBetaLayout ? ( + + ) : ( + + ))} + + ); +} diff --git a/invokeai/frontend/web/src/features/ui/store/tabMap.ts b/invokeai/frontend/web/src/features/ui/store/tabMap.ts index 13a93f7f70..d30799a80f 100644 --- a/invokeai/frontend/web/src/features/ui/store/tabMap.ts +++ b/invokeai/frontend/web/src/features/ui/store/tabMap.ts @@ -3,7 +3,7 @@ export const tabMap = [ 'img2img', 'unifiedCanvas', 'nodes', - 'postprocess', + 'postprocessing', 'training', ] as const; diff --git a/invokeai/frontend/web/src/features/ui/store/uiSlice.ts b/invokeai/frontend/web/src/features/ui/store/uiSlice.ts index d9abae23d8..a0eaf46096 100644 --- a/invokeai/frontend/web/src/features/ui/store/uiSlice.ts +++ b/invokeai/frontend/web/src/features/ui/store/uiSlice.ts @@ -7,7 +7,6 @@ const initialtabsState: UIState = { activeTab: 0, currentTheme: 'dark', parametersPanelScrollPosition: 0, - shouldHoldParametersPanelOpen: false, shouldPinParametersPanel: true, shouldShowParametersPanel: true, shouldShowImageDetails: false, @@ -15,6 +14,8 @@ const initialtabsState: UIState = { shouldShowExistingModelsInSearch: false, shouldUseSliders: false, addNewModelUIOption: null, + shouldPinGallery: true, + shouldShowGallery: true, }; const initialState: UIState = initialtabsState; @@ -41,16 +42,11 @@ export const uiSlice = createSlice({ }, setShouldPinParametersPanel: (state, action: PayloadAction) => { state.shouldPinParametersPanel = action.payload; + state.shouldShowParametersPanel = true; }, setShouldShowParametersPanel: (state, action: PayloadAction) => { state.shouldShowParametersPanel = action.payload; }, - setShouldHoldParametersPanelOpen: ( - state, - action: PayloadAction - ) => { - state.shouldHoldParametersPanelOpen = action.payload; - }, setShouldShowImageDetails: (state, action: PayloadAction) => { state.shouldShowImageDetails = action.payload; }, @@ -69,6 +65,33 @@ export const uiSlice = createSlice({ setAddNewModelUIOption: (state, action: PayloadAction) => { state.addNewModelUIOption = action.payload; }, + setShouldPinGallery: (state, action: PayloadAction) => { + state.shouldPinGallery = action.payload; + }, + setShouldShowGallery: (state, action: PayloadAction) => { + state.shouldShowGallery = action.payload; + }, + togglePinGalleryPanel: (state) => { + state.shouldPinGallery = !state.shouldPinGallery; + }, + togglePinParametersPanel: (state) => { + state.shouldPinParametersPanel = !state.shouldPinParametersPanel; + }, + toggleParametersPanel: (state) => { + state.shouldShowParametersPanel = !state.shouldShowParametersPanel; + }, + toggleGalleryPanel: (state) => { + state.shouldShowGallery = !state.shouldShowGallery; + }, + togglePanels: (state) => { + if (state.shouldShowGallery || state.shouldShowParametersPanel) { + state.shouldShowGallery = false; + state.shouldShowParametersPanel = false; + } else { + state.shouldShowGallery = true; + state.shouldShowParametersPanel = true; + } + }, }, }); @@ -76,7 +99,6 @@ export const { setActiveTab, setCurrentTheme, setParametersPanelScrollPosition, - setShouldHoldParametersPanelOpen, setShouldPinParametersPanel, setShouldShowParametersPanel, setShouldShowImageDetails, @@ -84,6 +106,13 @@ export const { setShouldShowExistingModelsInSearch, setShouldUseSliders, setAddNewModelUIOption, + setShouldPinGallery, + setShouldShowGallery, + togglePanels, + togglePinGalleryPanel, + togglePinParametersPanel, + toggleParametersPanel, + toggleGalleryPanel, } = uiSlice.actions; export default uiSlice.reducer; diff --git a/invokeai/frontend/web/src/features/ui/store/uiTypes.ts b/invokeai/frontend/web/src/features/ui/store/uiTypes.ts index 5885bc3ed7..900ea703b4 100644 --- a/invokeai/frontend/web/src/features/ui/store/uiTypes.ts +++ b/invokeai/frontend/web/src/features/ui/store/uiTypes.ts @@ -4,7 +4,6 @@ export interface UIState { activeTab: number; currentTheme: string; parametersPanelScrollPosition: number; - shouldHoldParametersPanelOpen: boolean; shouldPinParametersPanel: boolean; shouldShowParametersPanel: boolean; shouldShowImageDetails: boolean; @@ -12,4 +11,6 @@ export interface UIState { shouldShowExistingModelsInSearch: boolean; shouldUseSliders: boolean; addNewModelUIOption: AddNewModelType; + shouldPinGallery: boolean; + shouldShowGallery: boolean; } diff --git a/invokeai/frontend/web/src/theme/colors/greenTea.ts b/invokeai/frontend/web/src/theme/colors/greenTea.ts index 6da7fa3b82..06476c0513 100644 --- a/invokeai/frontend/web/src/theme/colors/greenTea.ts +++ b/invokeai/frontend/web/src/theme/colors/greenTea.ts @@ -1,10 +1,12 @@ +import { InvokeAIThemeColors } from 'theme/themeTypes'; import { generateColorPalette } from '../util/generateColorPalette'; -export const greenTeaThemeColors = { +export const greenTeaThemeColors: InvokeAIThemeColors = { base: generateColorPalette(223, 10), accent: generateColorPalette(155, 80), working: generateColorPalette(47, 68), warning: generateColorPalette(28, 75), ok: generateColorPalette(122, 49), error: generateColorPalette(0, 50), + gridLineColor: 'rgba(255, 255, 255, 0.2)', }; diff --git a/invokeai/frontend/web/src/theme/colors/invokeAI.ts b/invokeai/frontend/web/src/theme/colors/invokeAI.ts index cf5b4221b7..a523ae38c8 100644 --- a/invokeai/frontend/web/src/theme/colors/invokeAI.ts +++ b/invokeai/frontend/web/src/theme/colors/invokeAI.ts @@ -1,10 +1,12 @@ +import { InvokeAIThemeColors } from 'theme/themeTypes'; import { generateColorPalette } from 'theme/util/generateColorPalette'; -export const invokeAIThemeColors = { +export const invokeAIThemeColors: InvokeAIThemeColors = { base: generateColorPalette(225, 15), accent: generateColorPalette(250, 50), working: generateColorPalette(47, 67), warning: generateColorPalette(28, 75), ok: generateColorPalette(113, 70), error: generateColorPalette(0, 76), + gridLineColor: 'rgba(255, 255, 255, 0.2)', }; diff --git a/invokeai/frontend/web/src/theme/colors/lightTheme.ts b/invokeai/frontend/web/src/theme/colors/lightTheme.ts index 3a4d3b8747..8fdf199bb8 100644 --- a/invokeai/frontend/web/src/theme/colors/lightTheme.ts +++ b/invokeai/frontend/web/src/theme/colors/lightTheme.ts @@ -1,10 +1,12 @@ +import { InvokeAIThemeColors } from 'theme/themeTypes'; import { generateColorPalette } from '../util/generateColorPalette'; -export const lightThemeColors = { +export const lightThemeColors: InvokeAIThemeColors = { base: generateColorPalette(223, 10, true), accent: generateColorPalette(40, 80, true), working: generateColorPalette(47, 68, true), warning: generateColorPalette(28, 75, true), ok: generateColorPalette(122, 49, true), error: generateColorPalette(0, 50, true), + gridLineColor: 'rgba(0, 0, 0, 0.2)', }; diff --git a/invokeai/frontend/web/src/theme/colors/oceanBlue.ts b/invokeai/frontend/web/src/theme/colors/oceanBlue.ts index 1f29def485..3462459c1c 100644 --- a/invokeai/frontend/web/src/theme/colors/oceanBlue.ts +++ b/invokeai/frontend/web/src/theme/colors/oceanBlue.ts @@ -1,10 +1,12 @@ +import { InvokeAIThemeColors } from 'theme/themeTypes'; import { generateColorPalette } from '../util/generateColorPalette'; -export const oceanBlueColors = { +export const oceanBlueColors: InvokeAIThemeColors = { base: generateColorPalette(220, 30), accent: generateColorPalette(210, 80), working: generateColorPalette(47, 68), warning: generateColorPalette(28, 75), ok: generateColorPalette(122, 49), error: generateColorPalette(0, 100), + gridLineColor: 'rgba(136, 148, 184, 0.2)', }; diff --git a/invokeai/frontend/web/src/theme/components/accordion.ts b/invokeai/frontend/web/src/theme/components/accordion.ts index 46a0c69fd7..3477548c70 100644 --- a/invokeai/frontend/web/src/theme/components/accordion.ts +++ b/invokeai/frontend/web/src/theme/components/accordion.ts @@ -9,7 +9,6 @@ const { definePartsStyle, defineMultiStyleConfig } = const invokeAIContainer = defineStyle({ border: 'none', - pt: 2, }); const invokeAIButton = defineStyle((props) => { @@ -40,7 +39,6 @@ const invokeAIPanel = defineStyle((props) => { bg: `${c}.800`, borderRadius: 'base', borderTopRadius: 'none', - p: 4, }; }); diff --git a/invokeai/frontend/web/src/theme/theme.ts b/invokeai/frontend/web/src/theme/theme.ts index 6cb658564c..1753bae77b 100644 --- a/invokeai/frontend/web/src/theme/theme.ts +++ b/invokeai/frontend/web/src/theme/theme.ts @@ -12,7 +12,7 @@ import { modalTheme } from './components/modal'; import { numberInputTheme } from './components/numberInput'; import { popoverTheme } from './components/popover'; import { progressTheme } from './components/progress'; -import { scrollbar } from './components/scrollbar'; +import { no_scrollbar, scrollbar as _scrollbar } from './components/scrollbar'; import { selectTheme } from './components/select'; import { sliderTheme } from './components/slider'; import { switchTheme } from './components/switch'; @@ -31,7 +31,7 @@ export const theme: ThemeOverride = { color: 'base.50', overflow: 'hidden', }, - ...scrollbar, + '*': { ...no_scrollbar }, }), }, direction: 'ltr', diff --git a/invokeai/frontend/web/src/theme/themeTypes.d.ts b/invokeai/frontend/web/src/theme/themeTypes.d.ts new file mode 100644 index 0000000000..aeb7ae0411 --- /dev/null +++ b/invokeai/frontend/web/src/theme/themeTypes.d.ts @@ -0,0 +1,33 @@ +export declare type InvokeAIThemeColors = { + base: Partial; + accent: Partial; + working: Partial; + warning: Partial; + ok: Partial; + error: Partial; + gridLineColor: string; +}; + +export declare type InvokeAIPaletteSteps = { + 0: string; + 50: string; + 100: string; + 150: string; + 200: string; + 250: string; + 300: string; + 350: string; + 400: string; + 450: string; + 500: string; + 550: string; + 600: string; + 650: string; + 700: string; + 750: string; + 800: string; + 850: string; + 900: string; + 950: string; + 1000: string; +}; diff --git a/invokeai/frontend/web/src/theme/util/constants.ts b/invokeai/frontend/web/src/theme/util/constants.ts index 85d9185f31..38b859913c 100644 --- a/invokeai/frontend/web/src/theme/util/constants.ts +++ b/invokeai/frontend/web/src/theme/util/constants.ts @@ -1,7 +1,6 @@ // Calc Values export const APP_CUTOFF = '0px'; export const APP_CONTENT_HEIGHT_CUTOFF = 'calc(70px + 1rem)'; // default: 7rem -export const APP_PADDING = 4; export const PROGRESS_BAR_THICKNESS = 1.5; export const APP_WIDTH = `calc(100vw - ${APP_CUTOFF})`; export const APP_HEIGHT = `calc(100vh - ${PROGRESS_BAR_THICKNESS * 4}px)`; @@ -11,6 +10,9 @@ export const APP_GALLERY_HEIGHT = 'calc(100vw - 0.3rem + 5rem)'; export const APP_GALLERY_POPOVER_HEIGHT = `calc(100vh - (${APP_CONTENT_HEIGHT_CUTOFF} + 6rem))`; export const APP_METADATA_HEIGHT = `calc(100vh - (${APP_CONTENT_HEIGHT_CUTOFF} + 4.4rem))`; +// this is in pixels +export const PARAMETERS_PANEL_WIDTH = 384; + // do not touch ffs export const APP_TEXT_TO_IMAGE_HEIGHT = 'calc(100vh - 9.4375rem - 1.925rem - 1.15rem)'; diff --git a/invokeai/frontend/web/src/theme/util/generateColorPalette.ts b/invokeai/frontend/web/src/theme/util/generateColorPalette.ts index abd7939fa1..ed346c684a 100644 --- a/invokeai/frontend/web/src/theme/util/generateColorPalette.ts +++ b/invokeai/frontend/web/src/theme/util/generateColorPalette.ts @@ -1,26 +1,4 @@ -type paletteSteps = { - 0: string; - 50: string; - 100: string; - 150: string; - 200: string; - 250: string; - 300: string; - 350: string; - 400: string; - 450: string; - 500: string; - 550: string; - 600: string; - 650: string; - 700: string; - 750: string; - 800: string; - 850: string; - 900: string; - 950: string; - 1000: string; -}; +import { InvokeAIPaletteSteps } from 'theme/themeTypes'; /** * Add two numbers together @@ -61,8 +39,8 @@ export function generateColorPalette( '100', ]; - const darkPalette: Partial = {}; - const lightPalette: Partial = {}; + const darkPalette: Partial = {}; + const lightPalette: Partial = {}; colorSteps.forEach((colorStep, index) => { darkPalette[ diff --git a/invokeai/frontend/web/stats.html b/invokeai/frontend/web/stats.html index 8cb440de4b..0e83f2bee4 100644 --- a/invokeai/frontend/web/stats.html +++ b/invokeai/frontend/web/stats.html @@ -6157,7 +6157,7 @@ var drawChart = (function (exports) { + + + +
+

Stable Diffusion Dream Server

+
+ For news and support for this web service, visit our GitHub site +
+
+ +
+
+
+ +
+
+
Basic options
+ + + + + + + + + + +
+ + + + + + + + + +
+ + + + + +
+ + + + + + +
+
+
Image-to-image options
+ + + +
+ + + + +
+
+
Post-processing options
+ + + + + + +
+
+
+
+
+ + +
+ +
+ Postprocessing...1/3 +
+ +
+ +
+
+

No results...

+
+
+
+ + diff --git a/static/legacy_web/index.js b/static/legacy_web/index.js new file mode 100644 index 0000000000..57ad076062 --- /dev/null +++ b/static/legacy_web/index.js @@ -0,0 +1,213 @@ +function toBase64(file) { + return new Promise((resolve, reject) => { + const r = new FileReader(); + r.readAsDataURL(file); + r.onload = () => resolve(r.result); + r.onerror = (error) => reject(error); + }); +} + +function appendOutput(src, seed, config) { + let outputNode = document.createElement("figure"); + + let variations = config.with_variations; + if (config.variation_amount > 0) { + variations = (variations ? variations + ',' : '') + seed + ':' + config.variation_amount; + } + let baseseed = (config.with_variations || config.variation_amount > 0) ? config.seed : seed; + let altText = baseseed + ' | ' + (variations ? variations + ' | ' : '') + config.prompt; + + // img needs width and height for lazy loading to work + const figureContents = ` + + ${altText} + +
${seed}
+ `; + + outputNode.innerHTML = figureContents; + let figcaption = outputNode.querySelector('figcaption'); + + // Reload image config + figcaption.addEventListener('click', () => { + let form = document.querySelector("#generate-form"); + for (const [k, v] of new FormData(form)) { + if (k == 'initimg') { continue; } + form.querySelector(`*[name=${k}]`).value = config[k]; + } + + document.querySelector("#seed").value = baseseed; + document.querySelector("#with_variations").value = variations || ''; + if (document.querySelector("#variation_amount").value <= 0) { + document.querySelector("#variation_amount").value = 0.2; + } + + saveFields(document.querySelector("#generate-form")); + }); + + document.querySelector("#results").prepend(outputNode); +} + +function saveFields(form) { + for (const [k, v] of new FormData(form)) { + if (typeof v !== 'object') { // Don't save 'file' type + localStorage.setItem(k, v); + } + } +} + +function loadFields(form) { + for (const [k, v] of new FormData(form)) { + const item = localStorage.getItem(k); + if (item != null) { + form.querySelector(`*[name=${k}]`).value = item; + } + } +} + +function clearFields(form) { + localStorage.clear(); + let prompt = form.prompt.value; + form.reset(); + form.prompt.value = prompt; +} + +const BLANK_IMAGE_URL = 'data:image/svg+xml,'; +async function generateSubmit(form) { + const prompt = document.querySelector("#prompt").value; + + // Convert file data to base64 + let formData = Object.fromEntries(new FormData(form)); + formData.initimg_name = formData.initimg.name + formData.initimg = formData.initimg.name !== '' ? await toBase64(formData.initimg) : null; + + let strength = formData.strength; + let totalSteps = formData.initimg ? Math.floor(strength * formData.steps) : formData.steps; + + let progressSectionEle = document.querySelector('#progress-section'); + progressSectionEle.style.display = 'initial'; + let progressEle = document.querySelector('#progress-bar'); + progressEle.setAttribute('max', totalSteps); + let progressImageEle = document.querySelector('#progress-image'); + progressImageEle.src = BLANK_IMAGE_URL; + + progressImageEle.style.display = {}.hasOwnProperty.call(formData, 'progress_images') ? 'initial': 'none'; + + // Post as JSON, using Fetch streaming to get results + fetch(form.action, { + method: form.method, + body: JSON.stringify(formData), + }).then(async (response) => { + const reader = response.body.getReader(); + + let noOutputs = true; + while (true) { + let {value, done} = await reader.read(); + value = new TextDecoder().decode(value); + if (done) { + progressSectionEle.style.display = 'none'; + break; + } + + for (let event of value.split('\n').filter(e => e !== '')) { + const data = JSON.parse(event); + + if (data.event === 'result') { + noOutputs = false; + appendOutput(data.url, data.seed, data.config); + progressEle.setAttribute('value', 0); + progressEle.setAttribute('max', totalSteps); + } else if (data.event === 'upscaling-started') { + document.getElementById("processing_cnt").textContent=data.processed_file_cnt; + document.getElementById("scaling-inprocess-message").style.display = "block"; + } else if (data.event === 'upscaling-done') { + document.getElementById("scaling-inprocess-message").style.display = "none"; + } else if (data.event === 'step') { + progressEle.setAttribute('value', data.step); + if (data.url) { + progressImageEle.src = data.url; + } + } else if (data.event === 'canceled') { + // avoid alerting as if this were an error case + noOutputs = false; + } + } + } + + // Re-enable form, remove no-results-message + form.querySelector('fieldset').removeAttribute('disabled'); + document.querySelector("#prompt").value = prompt; + document.querySelector('progress').setAttribute('value', '0'); + + if (noOutputs) { + alert("Error occurred while generating."); + } + }); + + // Disable form while generating + form.querySelector('fieldset').setAttribute('disabled',''); + document.querySelector("#prompt").value = `Generating: "${prompt}"`; +} + +async function fetchRunLog() { + try { + let response = await fetch('/run_log.json') + const data = await response.json(); + for(let item of data.run_log) { + appendOutput(item.url, item.seed, item); + } + } catch (e) { + console.error(e); + } +} + +window.onload = async () => { + document.querySelector("#prompt").addEventListener("keydown", (e) => { + if (e.key === "Enter" && !e.shiftKey) { + const form = e.target.form; + generateSubmit(form); + } + }); + document.querySelector("#generate-form").addEventListener('submit', (e) => { + e.preventDefault(); + const form = e.target; + + generateSubmit(form); + }); + document.querySelector("#generate-form").addEventListener('change', (e) => { + saveFields(e.target.form); + }); + document.querySelector("#reset-seed").addEventListener('click', (e) => { + document.querySelector("#seed").value = -1; + saveFields(e.target.form); + }); + document.querySelector("#reset-all").addEventListener('click', (e) => { + clearFields(e.target.form); + }); + document.querySelector("#remove-image").addEventListener('click', (e) => { + initimg.value=null; + }); + loadFields(document.querySelector("#generate-form")); + + document.querySelector('#cancel-button').addEventListener('click', () => { + fetch('/cancel').catch(e => { + console.error(e); + }); + }); + document.documentElement.addEventListener('keydown', (e) => { + if (e.key === "Escape") + fetch('/cancel').catch(err => { + console.error(err); + }); + }); + + if (!config.gfpgan_model_exists) { + document.querySelector("#gfpgan").style.display = 'none'; + } + await fetchRunLog() +}; diff --git a/tests/nodes/test_graph_execution_state.py b/tests/nodes/test_graph_execution_state.py index 4c22507098..b722539935 100644 --- a/tests/nodes/test_graph_execution_state.py +++ b/tests/nodes/test_graph_execution_state.py @@ -21,12 +21,13 @@ def simple_graph(): def mock_services(): # NOTE: none of these are actually called by the test invocations return InvocationServices( - generate = None, + model_manager = None, events = None, images = None, queue = MemoryInvocationQueue(), graph_execution_manager = SqliteItemStorage[GraphExecutionState](filename = sqlite_memory, table_name = 'graph_executions'), - processor = DefaultInvocationProcessor() + processor = DefaultInvocationProcessor(), + restoration = None, ) def invoke_next(g: GraphExecutionState, services: InvocationServices) -> tuple[BaseInvocation, BaseInvocationOutput]: diff --git a/tests/nodes/test_invoker.py b/tests/nodes/test_invoker.py index 6a7867bffe..718baa7a1f 100644 --- a/tests/nodes/test_invoker.py +++ b/tests/nodes/test_invoker.py @@ -21,12 +21,13 @@ def simple_graph(): def mock_services() -> InvocationServices: # NOTE: none of these are actually called by the test invocations return InvocationServices( - generate = None, # type: ignore + model_manager = None, # type: ignore events = TestEventService(), images = None, # type: ignore queue = MemoryInvocationQueue(), graph_execution_manager = SqliteItemStorage[GraphExecutionState](filename = sqlite_memory, table_name = 'graph_executions'), - processor = DefaultInvocationProcessor() + processor = DefaultInvocationProcessor(), + restoration = None, ) @pytest.fixture()