diff --git a/.github/workflows/windows_release_nightly_pytorch.yml b/.github/workflows/windows_release_nightly_pytorch.yml index 07f52e0b..f9048870 100644 --- a/.github/workflows/windows_release_nightly_pytorch.yml +++ b/.github/workflows/windows_release_nightly_pytorch.yml @@ -7,19 +7,19 @@ on: description: 'cuda version' required: true type: string - default: "124" + default: "126" python_minor: description: 'python minor version' required: true type: string - default: "12" + default: "13" python_patch: description: 'python patch version' required: true type: string - default: "4" + default: "1" # push: # branches: # - master diff --git a/api_server/services/terminal_service.py b/api_server/services/terminal_service.py index 6293075d..ab4371f4 100644 --- a/api_server/services/terminal_service.py +++ b/api_server/services/terminal_service.py @@ -28,7 +28,7 @@ class TerminalService: if columns != self.cols: self.cols = columns - changed = True + changed = True if lines != self.rows: self.rows = lines diff --git a/app/custom_node_manager.py b/app/custom_node_manager.py index 277f8954..7f9f645c 100644 --- a/app/custom_node_manager.py +++ b/app/custom_node_manager.py @@ -10,7 +10,7 @@ class CustomNodeManager: Placeholder to refactor the custom node management features from ComfyUI-Manager. Currently it only contains the custom workflow templates feature. """ - def add_routes(self, routes, webapp, loadedModules): + def add_routes(self, routes, webapp, loadedModules): @routes.get("/workflow_templates") async def get_workflow_templates(request): diff --git a/comfy/comfy_types/README.md b/comfy/comfy_types/README.md index 869851e7..20a786a5 100644 --- a/comfy/comfy_types/README.md +++ b/comfy/comfy_types/README.md @@ -5,7 +5,7 @@ This module provides type hinting and concrete convenience types for node develo If cloned to the custom_nodes directory of ComfyUI, types can be imported using: ```python -from comfy_types import IO, ComfyNodeABC, CheckLazyMixin +from comfy.comfy_types import IO, ComfyNodeABC, CheckLazyMixin class ExampleNode(ComfyNodeABC): @classmethod diff --git a/comfy/comfy_types/examples/example_nodes.py b/comfy/comfy_types/examples/example_nodes.py index b6465f39..6e19c545 100644 --- a/comfy/comfy_types/examples/example_nodes.py +++ b/comfy/comfy_types/examples/example_nodes.py @@ -1,12 +1,12 @@ -from comfy_types import IO, ComfyNodeABC, InputTypeDict +from comfy.comfy_types import IO, ComfyNodeABC, InputTypeDict from inspect import cleandoc class ExampleNode(ComfyNodeABC): """An example node that just adds 1 to an input integer. - * Requires an IDE configured with analysis paths etc to be worth looking at. - * Not intended for use in ComfyUI. + * Requires a modern IDE to provide any benefit (detail: an IDE configured with analysis paths etc). + * This node is intended as an example for developers only. """ DESCRIPTION = cleandoc(__doc__) diff --git a/comfy/extra_samplers/uni_pc.py b/comfy/extra_samplers/uni_pc.py index 77d20bbf..5b80a8af 100644 --- a/comfy/extra_samplers/uni_pc.py +++ b/comfy/extra_samplers/uni_pc.py @@ -226,7 +226,7 @@ def model_wrapper( The input `model` has the following format: `` model(x, t_input, **model_kwargs) -> noise | x_start | v | score - `` + `` The input `classifier_fn` has the following format: `` @@ -240,7 +240,7 @@ def model_wrapper( The input `model` has the following format: `` model(x, t_input, cond, **model_kwargs) -> noise | x_start | v | score - `` + `` And if cond == `unconditional_condition`, the model output is the unconditional DPM output. [4] Ho, Jonathan, and Tim Salimans. "Classifier-free diffusion guidance." @@ -254,7 +254,7 @@ def model_wrapper( `` def model_fn(x, t_continuous) -> noise: t_input = get_model_input_time(t_continuous) - return noise_pred(model, x, t_input, **model_kwargs) + return noise_pred(model, x, t_input, **model_kwargs) `` where `t_continuous` is the continuous time labels (i.e. epsilon to T). And we use `model_fn` for DPM-Solver. @@ -359,7 +359,7 @@ class UniPC: max_val=1., variant='bh1', ): - """Construct a UniPC. + """Construct a UniPC. We support both data_prediction and noise_prediction. """ @@ -372,7 +372,7 @@ class UniPC: def dynamic_thresholding_fn(self, x0, t=None): """ - The dynamic thresholding method. + The dynamic thresholding method. """ dims = x0.dim() p = self.dynamic_thresholding_ratio @@ -404,7 +404,7 @@ class UniPC: def model_fn(self, x, t): """ - Convert the model to the noise prediction model or the data prediction model. + Convert the model to the noise prediction model or the data prediction model. """ if self.predict_x0: return self.data_prediction_fn(x, t) @@ -461,7 +461,7 @@ class UniPC: def denoise_to_zero_fn(self, x, s): """ - Denoise at the final step, which is equivalent to solve the ODE from lambda_s to infty by first-order discretization. + Denoise at the final step, which is equivalent to solve the ODE from lambda_s to infty by first-order discretization. """ return self.data_prediction_fn(x, s) @@ -510,7 +510,7 @@ class UniPC: col = torch.ones_like(rks) for k in range(1, K + 1): C.append(col) - col = col * rks / (k + 1) + col = col * rks / (k + 1) C = torch.stack(C, dim=1) if len(D1s) > 0: @@ -626,7 +626,7 @@ class UniPC: R.append(torch.pow(rks, i - 1)) b.append(h_phi_k * factorial_i / B_h) factorial_i *= (i + 1) - h_phi_k = h_phi_k / hh - 1 / factorial_i + h_phi_k = h_phi_k / hh - 1 / factorial_i R = torch.stack(R) b = torch.tensor(b, device=x.device) diff --git a/comfy/ldm/cascade/stage_b.py b/comfy/ldm/cascade/stage_b.py index 7c3d8fea..77383095 100644 --- a/comfy/ldm/cascade/stage_b.py +++ b/comfy/ldm/cascade/stage_b.py @@ -138,7 +138,7 @@ class StageB(nn.Module): # nn.init.normal_(self.pixels_mapper[2].weight, std=0.02) # conditionings # torch.nn.init.xavier_uniform_(self.embedding[1].weight, 0.02) # inputs # nn.init.constant_(self.clf[1].weight, 0) # outputs - # + # # # blocks # for level_block in self.down_blocks + self.up_blocks: # for block in level_block: @@ -148,7 +148,7 @@ class StageB(nn.Module): # for layer in block.modules(): # if isinstance(layer, nn.Linear): # nn.init.constant_(layer.weight, 0) - # + # # def _init_weights(self, m): # if isinstance(m, (nn.Conv2d, nn.Linear)): # torch.nn.init.xavier_uniform_(m.weight) diff --git a/comfy/ldm/cascade/stage_c.py b/comfy/ldm/cascade/stage_c.py index c85da1f0..b952d034 100644 --- a/comfy/ldm/cascade/stage_c.py +++ b/comfy/ldm/cascade/stage_c.py @@ -142,7 +142,7 @@ class StageC(nn.Module): # nn.init.normal_(self.clip_img_mapper.weight, std=0.02) # conditionings # torch.nn.init.xavier_uniform_(self.embedding[1].weight, 0.02) # inputs # nn.init.constant_(self.clf[1].weight, 0) # outputs - # + # # # blocks # for level_block in self.down_blocks + self.up_blocks: # for block in level_block: @@ -152,7 +152,7 @@ class StageC(nn.Module): # for layer in block.modules(): # if isinstance(layer, nn.Linear): # nn.init.constant_(layer.weight, 0) - # + # # def _init_weights(self, m): # if isinstance(m, (nn.Conv2d, nn.Linear)): # torch.nn.init.xavier_uniform_(m.weight) diff --git a/comfy/ldm/flux/model.py b/comfy/ldm/flux/model.py index 02be0684..dead87de 100644 --- a/comfy/ldm/flux/model.py +++ b/comfy/ldm/flux/model.py @@ -168,7 +168,7 @@ class Flux(nn.Module): out = blocks_replace[("single_block", i)]({"img": img, "vec": vec, "pe": pe, - "attn_mask": attn_mask}, + "attn_mask": attn_mask}, {"original_block": block_wrap}) img = out["img"] else: diff --git a/comfy/ldm/hydit/attn_layers.py b/comfy/ldm/hydit/attn_layers.py index e2801f71..3ca25a5d 100644 --- a/comfy/ldm/hydit/attn_layers.py +++ b/comfy/ldm/hydit/attn_layers.py @@ -159,7 +159,7 @@ class CrossAttention(nn.Module): q = q.transpose(-2, -3).contiguous() # q -> B, L1, H, C - B, H, L1, C k = k.transpose(-2, -3).contiguous() # k -> B, L2, H, C - B, H, C, L2 - v = v.transpose(-2, -3).contiguous() + v = v.transpose(-2, -3).contiguous() context = optimized_attention(q, k, v, self.num_heads, skip_reshape=True, attn_precision=self.attn_precision) diff --git a/comfy/ldm/modules/sub_quadratic_attention.py b/comfy/ldm/modules/sub_quadratic_attention.py index fca8d117..21c72373 100644 --- a/comfy/ldm/modules/sub_quadratic_attention.py +++ b/comfy/ldm/modules/sub_quadratic_attention.py @@ -17,10 +17,10 @@ import math import logging try: - from typing import Optional, NamedTuple, List, Protocol + from typing import Optional, NamedTuple, List, Protocol except ImportError: - from typing import Optional, NamedTuple, List - from typing_extensions import Protocol + from typing import Optional, NamedTuple, List + from typing_extensions import Protocol from typing import List diff --git a/comfy/model_base.py b/comfy/model_base.py index 76b2289b..141f3f40 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -787,7 +787,7 @@ class Flux(BaseModel): cross_attn = kwargs.get("cross_attn", None) if cross_attn is not None: out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) - # upscale the attention mask, since now we + # upscale the attention mask, since now we attention_mask = kwargs.get("attention_mask", None) if attention_mask is not None: shape = kwargs["noise"].shape diff --git a/comfy/model_detection.py b/comfy/model_detection.py index de00f773..f5a33cd9 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -576,7 +576,7 @@ def unet_config_from_diffusers_unet(state_dict, dtype=None): 'dtype': dtype, 'in_channels': 9, 'model_channels': 320, 'num_res_blocks': [2, 2, 2, 2], 'transformer_depth': [1, 1, 1, 1, 1, 1, 0, 0], 'channel_mult': [1, 2, 4, 4], 'transformer_depth_middle': 1, 'use_linear_in_transformer': False, 'context_dim': 768, 'num_heads': 8, 'transformer_depth_output': [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], - 'use_temporal_attention': False, 'use_temporal_resblock': False} + 'use_temporal_attention': False, 'use_temporal_resblock': False} supported_models = [SDXL, SDXL_refiner, SD21, SD15, SD21_uncliph, SD21_unclipl, SDXL_mid_cnet, SDXL_small_cnet, SDXL_diffusers_inpaint, SSD_1B, Segmind_Vega, KOALA_700M, KOALA_1B, SD09_XS, SD_XS, SDXL_diffusers_ip2p, SD15_diffusers_inpaint] diff --git a/comfy/model_management.py b/comfy/model_management.py index 731fb584..15800a8e 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -1121,9 +1121,8 @@ def soft_empty_cache(force=False): elif is_ascend_npu(): torch.npu.empty_cache() elif torch.cuda.is_available(): - if force or is_nvidia(): #This seems to make things worse on ROCm so I only do it for cuda - torch.cuda.empty_cache() - torch.cuda.ipc_collect() + torch.cuda.empty_cache() + torch.cuda.ipc_collect() def unload_all_models(): free_memory(1e30, get_torch_device()) diff --git a/comfy/samplers.py b/comfy/samplers.py index cd25bc35..89464a42 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -1,12 +1,13 @@ from __future__ import annotations from .k_diffusion import sampling as k_diffusion_sampling from .extra_samplers import uni_pc -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Callable, NamedTuple if TYPE_CHECKING: from comfy.model_patcher import ModelPatcher from comfy.model_base import BaseModel from comfy.controlnet import ControlBase import torch +from functools import partial import collections from comfy import model_management import math @@ -224,7 +225,7 @@ def _calc_cond_batch(model: 'BaseModel', conds: list[list[dict]], x_in: torch.Te default_conds.append(default_c) if has_default_conds: - finalize_default_conds(model, hooked_to_run, default_conds, x_in, timestep) + finalize_default_conds(model, hooked_to_run, default_conds, x_in, timestep, model_options) model.current_patcher.prepare_state(timestep) @@ -920,31 +921,37 @@ def sample(model, noise, positive, negative, cfg, device, sampler, sigmas, model return cfg_guider.sample(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed) -SCHEDULER_NAMES = ["normal", "karras", "exponential", "sgm_uniform", "simple", "ddim_uniform", "beta", "linear_quadratic", "kl_optimal"] SAMPLER_NAMES = KSAMPLER_NAMES + ["ddim", "uni_pc", "uni_pc_bh2"] -def calculate_sigmas(model_sampling, scheduler_name, steps): - if scheduler_name == "karras": - sigmas = k_diffusion_sampling.get_sigmas_karras(n=steps, sigma_min=float(model_sampling.sigma_min), sigma_max=float(model_sampling.sigma_max)) - elif scheduler_name == "exponential": - sigmas = k_diffusion_sampling.get_sigmas_exponential(n=steps, sigma_min=float(model_sampling.sigma_min), sigma_max=float(model_sampling.sigma_max)) - elif scheduler_name == "normal": - sigmas = normal_scheduler(model_sampling, steps) - elif scheduler_name == "simple": - sigmas = simple_scheduler(model_sampling, steps) - elif scheduler_name == "ddim_uniform": - sigmas = ddim_scheduler(model_sampling, steps) - elif scheduler_name == "sgm_uniform": - sigmas = normal_scheduler(model_sampling, steps, sgm=True) - elif scheduler_name == "beta": - sigmas = beta_scheduler(model_sampling, steps) - elif scheduler_name == "linear_quadratic": - sigmas = linear_quadratic_schedule(model_sampling, steps) - elif scheduler_name == "kl_optimal": - sigmas = kl_optimal_scheduler(n=steps, sigma_min=float(model_sampling.sigma_min), sigma_max=float(model_sampling.sigma_max)) - else: - logging.error("error invalid scheduler {}".format(scheduler_name)) - return sigmas +class SchedulerHandler(NamedTuple): + handler: Callable[..., torch.Tensor] + # Boolean indicates whether to call the handler like: + # scheduler_function(model_sampling, steps) or + # scheduler_function(n, sigma_min: float, sigma_max: float) + use_ms: bool = True + +SCHEDULER_HANDLERS = { + "normal": SchedulerHandler(normal_scheduler), + "karras": SchedulerHandler(k_diffusion_sampling.get_sigmas_karras, use_ms=False), + "exponential": SchedulerHandler(k_diffusion_sampling.get_sigmas_exponential, use_ms=False), + "sgm_uniform": SchedulerHandler(partial(normal_scheduler, sgm=True)), + "simple": SchedulerHandler(simple_scheduler), + "ddim_uniform": SchedulerHandler(ddim_scheduler), + "beta": SchedulerHandler(beta_scheduler), + "linear_quadratic": SchedulerHandler(linear_quadratic_schedule), + "kl_optimal": SchedulerHandler(kl_optimal_scheduler, use_ms=False), +} +SCHEDULER_NAMES = list(SCHEDULER_HANDLERS) + +def calculate_sigmas(model_sampling: object, scheduler_name: str, steps: int) -> torch.Tensor: + handler = SCHEDULER_HANDLERS.get(scheduler_name) + if handler is None: + err = f"error invalid scheduler {scheduler_name}" + logging.error(err) + raise ValueError(err) + if handler.use_ms: + return handler.handler(model_sampling, steps) + return handler.handler(n=steps, sigma_min=float(model_sampling.sigma_min), sigma_max=float(model_sampling.sigma_max)) def sampler_object(name): if name == "uni_pc": diff --git a/comfy/utils.py b/comfy/utils.py index de64b91d..ea666ae5 100644 --- a/comfy/utils.py +++ b/comfy/utils.py @@ -727,7 +727,7 @@ def bislerp(samples, width, height): res *= (b1_norms * (1.0-r) + b2_norms * r).expand(-1,c) #edge cases for same or polar opposites - res[dot > 1 - 1e-5] = b1[dot > 1 - 1e-5] + res[dot > 1 - 1e-5] = b1[dot > 1 - 1e-5] res[dot < 1e-5 - 1] = (b1 * (1.0-r) + b2 * r)[dot < 1e-5 - 1] return res @@ -893,7 +893,7 @@ def tiled_scale_multidim(samples, function, tile=(64, 64), overlap=8, upscale_am out = torch.zeros([s.shape[0], out_channels] + mult_list_upscale(s.shape[2:]), device=output_device) out_div = torch.zeros([s.shape[0], out_channels] + mult_list_upscale(s.shape[2:]), device=output_device) - positions = [range(0, s.shape[d+2], tile[d] - overlap[d]) if s.shape[d+2] > tile[d] else [0] for d in range(dims)] + positions = [range(0, s.shape[d+2] - overlap[d], tile[d] - overlap[d]) if s.shape[d+2] > tile[d] else [0] for d in range(dims)] for it in itertools.product(*positions): s_in = s diff --git a/comfy_extras/nodes_gits.py b/comfy_extras/nodes_gits.py index 7bfae4ce..47b1dd04 100644 --- a/comfy_extras/nodes_gits.py +++ b/comfy_extras/nodes_gits.py @@ -162,7 +162,7 @@ NOISE_LEVELS = { [14.61464119, 7.49001646, 5.85520077, 4.45427561, 3.46139455, 2.84484982, 2.19988537, 1.72759056, 1.36964464, 1.08895338, 0.86115354, 0.69515091, 0.54755926, 0.43325692, 0.34370604, 0.25053367, 0.17026083, 0.09824532, 0.02916753], [14.61464119, 11.54541874, 7.49001646, 5.85520077, 4.45427561, 3.46139455, 2.84484982, 2.19988537, 1.72759056, 1.36964464, 1.08895338, 0.86115354, 0.69515091, 0.54755926, 0.43325692, 0.34370604, 0.25053367, 0.17026083, 0.09824532, 0.02916753], [14.61464119, 11.54541874, 7.49001646, 5.85520077, 4.45427561, 3.46139455, 2.84484982, 2.19988537, 1.72759056, 1.36964464, 1.08895338, 0.89115214, 0.72133851, 0.59516323, 0.4783645, 0.38853383, 0.29807833, 0.22545385, 0.17026083, 0.09824532, 0.02916753], - ], + ], 1.15: [ [14.61464119, 0.83188516, 0.02916753], [14.61464119, 1.84880662, 0.59516323, 0.02916753], @@ -246,7 +246,7 @@ NOISE_LEVELS = { [14.61464119, 5.85520077, 2.84484982, 1.72759056, 1.162866, 0.83188516, 0.64427125, 0.52423614, 0.43325692, 0.36617002, 0.32104823, 0.27464288, 0.25053367, 0.22545385, 0.19894916, 0.17026083, 0.13792117, 0.09824532, 0.02916753], [14.61464119, 5.85520077, 2.84484982, 1.78698075, 1.24153244, 0.92192322, 0.72133851, 0.57119018, 0.45573691, 0.38853383, 0.34370604, 0.29807833, 0.27464288, 0.25053367, 0.22545385, 0.19894916, 0.17026083, 0.13792117, 0.09824532, 0.02916753], [14.61464119, 5.85520077, 2.84484982, 1.78698075, 1.24153244, 0.92192322, 0.72133851, 0.57119018, 0.4783645, 0.41087446, 0.36617002, 0.32104823, 0.29807833, 0.27464288, 0.25053367, 0.22545385, 0.19894916, 0.17026083, 0.13792117, 0.09824532, 0.02916753], - ], + ], 1.35: [ [14.61464119, 0.69515091, 0.02916753], [14.61464119, 0.95350921, 0.34370604, 0.02916753], diff --git a/comfy_extras/nodes_load_3d.py b/comfy_extras/nodes_load_3d.py index d10c4e12..3560ab78 100644 --- a/comfy_extras/nodes_load_3d.py +++ b/comfy_extras/nodes_load_3d.py @@ -26,6 +26,7 @@ class Load3D(): "bg_color": ("STRING", {"default": "#000000", "multiline": False}), "light_intensity": ("INT", {"default": 10, "min": 1, "max": 20, "step": 1}), "up_direction": (["original", "-x", "+x", "-y", "+y", "-z", "+z"],), + "fov": ("INT", {"default": 75, "min": 10, "max": 150, "step": 1}), }} RETURN_TYPES = ("IMAGE", "MASK", "STRING") @@ -37,13 +38,22 @@ class Load3D(): CATEGORY = "3d" def process(self, model_file, image, **kwargs): - imagepath = folder_paths.get_annotated_filepath(image) + if isinstance(image, dict): + image_path = folder_paths.get_annotated_filepath(image['image']) + mask_path = folder_paths.get_annotated_filepath(image['mask']) - load_image_node = nodes.LoadImage() + load_image_node = nodes.LoadImage() + output_image, ignore_mask = load_image_node.load_image(image=image_path) + ignore_image, output_mask = load_image_node.load_image(image=mask_path) - output_image, output_mask = load_image_node.load_image(image=imagepath) - - return output_image, output_mask, model_file, + return output_image, output_mask, model_file, + else: + # to avoid the format is not dict which will happen the FE code is not compatibility to core, + # we need to this to double-check, it can be removed after merged FE into the core + image_path = folder_paths.get_annotated_filepath(image) + load_image_node = nodes.LoadImage() + output_image, output_mask = load_image_node.load_image(image=image_path) + return output_image, output_mask, model_file, class Load3DAnimation(): @classmethod @@ -67,6 +77,7 @@ class Load3DAnimation(): "light_intensity": ("INT", {"default": 10, "min": 1, "max": 20, "step": 1}), "up_direction": (["original", "-x", "+x", "-y", "+y", "-z", "+z"],), "animation_speed": (["0.1", "0.5", "1", "1.5", "2"], {"default": "1"}), + "fov": ("INT", {"default": 75, "min": 10, "max": 150, "step": 1}), }} RETURN_TYPES = ("IMAGE", "MASK", "STRING") @@ -78,13 +89,20 @@ class Load3DAnimation(): CATEGORY = "3d" def process(self, model_file, image, **kwargs): - imagepath = folder_paths.get_annotated_filepath(image) + if isinstance(image, dict): + image_path = folder_paths.get_annotated_filepath(image['image']) + mask_path = folder_paths.get_annotated_filepath(image['mask']) - load_image_node = nodes.LoadImage() + load_image_node = nodes.LoadImage() + output_image, ignore_mask = load_image_node.load_image(image=image_path) + ignore_image, output_mask = load_image_node.load_image(image=mask_path) - output_image, output_mask = load_image_node.load_image(image=imagepath) - - return output_image, output_mask, model_file, + return output_image, output_mask, model_file, + else: + image_path = folder_paths.get_annotated_filepath(image) + load_image_node = nodes.LoadImage() + output_image, output_mask = load_image_node.load_image(image=image_path) + return output_image, output_mask, model_file, class Preview3D(): @classmethod @@ -98,6 +116,7 @@ class Preview3D(): "bg_color": ("STRING", {"default": "#000000", "multiline": False}), "light_intensity": ("INT", {"default": 10, "min": 1, "max": 20, "step": 1}), "up_direction": (["original", "-x", "+x", "-y", "+y", "-z", "+z"],), + "fov": ("INT", {"default": 75, "min": 10, "max": 150, "step": 1}), }} OUTPUT_NODE = True diff --git a/comfy_extras/nodes_perpneg.py b/comfy_extras/nodes_perpneg.py index 290bc4a5..6c6f7176 100644 --- a/comfy_extras/nodes_perpneg.py +++ b/comfy_extras/nodes_perpneg.py @@ -73,7 +73,7 @@ class Guider_PerpNeg(comfy.samplers.CFGGuider): comfy.samplers.calc_cond_batch(self.inner_model, [positive_cond, negative_cond, empty_cond], x, timestep, model_options) cfg_result = perp_neg(x, noise_pred_pos, noise_pred_neg, noise_pred_empty, self.neg_scale, self.cfg) - # normally this would be done in cfg_function, but we skipped + # normally this would be done in cfg_function, but we skipped # that for efficiency: we can compute the noise predictions in # a single call to calc_cond_batch() (rather than two) # so we replicate the hook here diff --git a/execution.py b/execution.py index b18dc4b8..2c979205 100644 --- a/execution.py +++ b/execution.py @@ -62,7 +62,7 @@ class IsChangedCache: class CacheSet: def __init__(self, lru_size=None): if lru_size is None or lru_size == 0: - self.init_classic_cache() + self.init_classic_cache() else: self.init_lru_cache(lru_size) self.all = [self.outputs, self.ui, self.objects] @@ -168,7 +168,7 @@ def _map_node_over_list(obj, input_data_all, func, allow_interrupt=False, execut process_inputs(input_data_all, 0, input_is_list=input_is_list) elif max_len_input == 0: process_inputs({}) - else: + else: for i in range(max_len_input): input_dict = slice_dict(input_data_all, i) process_inputs(input_dict, i) @@ -232,7 +232,7 @@ def get_output_data(obj, input_data_all, execution_block_cb=None, pre_execute_cb output = merge_result_data(results, obj) else: output = [] - ui = dict() + ui = dict() if len(uis) > 0: ui = {k: [y for x in uis for y in x[k]] for k in uis[0].keys()} return output, ui, has_subgraph diff --git a/main.py b/main.py index 95972f73..c5c9f4e0 100644 --- a/main.py +++ b/main.py @@ -211,7 +211,9 @@ async def run(server_instance, address='', port=8188, verbose=True, call_on_star addresses = [] for addr in address.split(","): addresses.append((addr, port)) - await asyncio.gather(server_instance.start_multi_address(addresses, call_on_start), server_instance.publish_loop()) + await asyncio.gather( + server_instance.start_multi_address(addresses, call_on_start, verbose), server_instance.publish_loop() + ) def hijack_progress(server_instance): diff --git a/nodes.py b/nodes.py index 513d8a25..7f9f5aa5 100644 --- a/nodes.py +++ b/nodes.py @@ -51,7 +51,7 @@ class CLIPTextEncode(ComfyNodeABC): def INPUT_TYPES(s) -> InputTypeDict: return { "required": { - "text": (IO.STRING, {"multiline": True, "dynamicPrompts": True, "tooltip": "The text to be encoded."}), + "text": (IO.STRING, {"multiline": True, "dynamicPrompts": True, "tooltip": "The text to be encoded."}), "clip": (IO.CLIP, {"tooltip": "The CLIP model used for encoding the text."}) } } @@ -269,8 +269,8 @@ class VAEDecode: @classmethod def INPUT_TYPES(s): return { - "required": { - "samples": ("LATENT", {"tooltip": "The latent to be decoded."}), + "required": { + "samples": ("LATENT", {"tooltip": "The latent to be decoded."}), "vae": ("VAE", {"tooltip": "The VAE model used for decoding the latent."}) } } @@ -309,7 +309,7 @@ class VAEDecodeTiled: temporal_compression = vae.temporal_compression_decode() if temporal_compression is not None: temporal_size = max(2, temporal_size // temporal_compression) - temporal_overlap = min(1, temporal_size // 2, temporal_overlap // temporal_compression) + temporal_overlap = max(1, min(temporal_size // 2, temporal_overlap // temporal_compression)) else: temporal_size = None temporal_overlap = None @@ -550,13 +550,13 @@ class CheckpointLoaderSimple: @classmethod def INPUT_TYPES(s): return { - "required": { + "required": { "ckpt_name": (folder_paths.get_filename_list("checkpoints"), {"tooltip": "The name of the checkpoint (model) to load."}), } } RETURN_TYPES = ("MODEL", "CLIP", "VAE") - OUTPUT_TOOLTIPS = ("The model used for denoising latents.", - "The CLIP model used for encoding text prompts.", + OUTPUT_TOOLTIPS = ("The model used for denoising latents.", + "The CLIP model used for encoding text prompts.", "The VAE model used for encoding and decoding images to and from latent space.") FUNCTION = "load_checkpoint" @@ -633,7 +633,7 @@ class LoraLoader: @classmethod def INPUT_TYPES(s): return { - "required": { + "required": { "model": ("MODEL", {"tooltip": "The diffusion model the LoRA will be applied to."}), "clip": ("CLIP", {"tooltip": "The CLIP model the LoRA will be applied to."}), "lora_name": (folder_paths.get_filename_list("loras"), {"tooltip": "The name of the LoRA."}), @@ -1162,7 +1162,7 @@ class EmptyLatentImage: @classmethod def INPUT_TYPES(s): return { - "required": { + "required": { "width": ("INT", {"default": 512, "min": 16, "max": MAX_RESOLUTION, "step": 8, "tooltip": "The width of the latent images in pixels."}), "height": ("INT", {"default": 512, "min": 16, "max": MAX_RESOLUTION, "step": 8, "tooltip": "The height of the latent images in pixels."}), "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096, "tooltip": "The number of latent images in the batch."}) diff --git a/ruff.toml b/ruff.toml index 6f9ac932..660831f2 100644 --- a/ruff.toml +++ b/ruff.toml @@ -5,8 +5,7 @@ lint.ignore = ["ALL"] lint.select = [ "S307", # suspicious-eval-usage "T201", # print-usage - "W292", - "W293", + "W", # The "F" series in Ruff stands for "Pyflakes" rules, which catch various Python syntax errors and undefined names. # See all rules here: https://docs.astral.sh/ruff/rules/#pyflakes-f "F", diff --git a/server.py b/server.py index 2dc53b9d..ceb5e83b 100644 --- a/server.py +++ b/server.py @@ -807,7 +807,7 @@ class PromptServer(): async def start(self, address, port, verbose=True, call_on_start=None): await self.start_multi_address([(address, port)], call_on_start=call_on_start) - async def start_multi_address(self, addresses, call_on_start=None): + async def start_multi_address(self, addresses, call_on_start=None, verbose=True): runner = web.AppRunner(self.app, access_log=None) await runner.setup() ssl_ctx = None @@ -818,7 +818,8 @@ class PromptServer(): keyfile=args.tls_keyfile) scheme = "https" - logging.info("Starting server\n") + if verbose: + logging.info("Starting server\n") for addr in addresses: address = addr[0] port = addr[1] @@ -834,7 +835,8 @@ class PromptServer(): else: address_print = address - logging.info("To see the GUI go to: {}://{}:{}".format(scheme, address_print, port)) + if verbose: + logging.info("To see the GUI go to: {}://{}:{}".format(scheme, address_print, port)) if call_on_start is not None: call_on_start(scheme, self.address, self.port) diff --git a/tests-unit/folder_paths_test/filter_by_content_types_test.py b/tests-unit/folder_paths_test/filter_by_content_types_test.py index 6b334313..423677a6 100644 --- a/tests-unit/folder_paths_test/filter_by_content_types_test.py +++ b/tests-unit/folder_paths_test/filter_by_content_types_test.py @@ -6,8 +6,8 @@ from folder_paths import filter_files_content_types @pytest.fixture(scope="module") def file_extensions(): return { - 'image': ['gif', 'heif', 'ico', 'jpeg', 'jpg', 'png', 'pnm', 'ppm', 'svg', 'tiff', 'webp', 'xbm', 'xpm'], - 'audio': ['aif', 'aifc', 'aiff', 'au', 'flac', 'm4a', 'mp2', 'mp3', 'ogg', 'snd', 'wav'], + 'image': ['gif', 'heif', 'ico', 'jpeg', 'jpg', 'png', 'pnm', 'ppm', 'svg', 'tiff', 'webp', 'xbm', 'xpm'], + 'audio': ['aif', 'aifc', 'aiff', 'au', 'flac', 'm4a', 'mp2', 'mp3', 'ogg', 'snd', 'wav'], 'video': ['avi', 'm2v', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'ogv', 'qt', 'webm', 'wmv'] } diff --git a/tests-unit/utils/extra_config_test.py b/tests-unit/utils/extra_config_test.py index 9f69e907..143e1f2e 100644 --- a/tests-unit/utils/extra_config_test.py +++ b/tests-unit/utils/extra_config_test.py @@ -57,8 +57,8 @@ def mock_yaml_safe_load(mock_yaml_content): def test_load_extra_model_paths_expands_userpath( mock_file, monkeypatch, - mock_add_model_folder_path, - mock_expanduser, + mock_add_model_folder_path, + mock_expanduser, mock_yaml_safe_load, mock_expanded_home ): @@ -78,7 +78,7 @@ def test_load_extra_model_paths_expands_userpath( # Check if add_model_folder_path was called with the correct arguments for actual_call, expected_call in zip(mock_add_model_folder_path.call_args_list, expected_calls): - assert actual_call.args[0] == expected_call[0] + assert actual_call.args[0] == expected_call[0] assert os.path.normpath(actual_call.args[1]) == os.path.normpath(expected_call[1]) # Normalize and check the path to check on multiple OS. assert actual_call.args[2] == expected_call[2] @@ -97,7 +97,7 @@ def test_load_extra_model_paths_expands_appdata( yaml_config_with_appdata, mock_yaml_content_appdata ): - # Set the mock_file to return yaml with appdata as a variable + # Set the mock_file to return yaml with appdata as a variable mock_file.return_value.read.return_value = yaml_config_with_appdata # Attach mocks diff --git a/tests/compare/test_quality.py b/tests/compare/test_quality.py index 6c347f8d..01c19054 100644 --- a/tests/compare/test_quality.py +++ b/tests/compare/test_quality.py @@ -32,7 +32,7 @@ class TestCompareImageMetrics: @fixture(scope="class") def test_file_names(self, args_pytest): test_dir = args_pytest['test_dir'] - fnames = self.gather_file_basenames(test_dir) + fnames = self.gather_file_basenames(test_dir) yield fnames del fnames @@ -84,7 +84,7 @@ class TestCompareImageMetrics: file_match = self.find_file_match(baseline_file_path, file_paths) assert file_match is not None, f"Could not find a file in {args_pytest['test_dir']} with matching metadata to {baseline_file_path}" - # For a baseline image file, finds the corresponding file name in test_dir and + # For a baseline image file, finds the corresponding file name in test_dir and # compares the images using the metrics in METRICS @pytest.mark.parametrize("metric", METRICS.keys()) def test_pipeline_compare( @@ -181,7 +181,7 @@ class TestCompareImageMetrics: # Find file match # Reorder test_file_names so that the file with matching name is first - # This is an optimization because matching file names are more likely + # This is an optimization because matching file names are more likely # to have matching metadata if they were generated with the same script basename = os.path.basename(baseline_file) file_path_basenames = [os.path.basename(f) for f in file_paths] diff --git a/tests/inference/test_execution.py b/tests/inference/test_execution.py index 44e1da2f..5cda5c1a 100644 --- a/tests/inference/test_execution.py +++ b/tests/inference/test_execution.py @@ -40,8 +40,8 @@ class ComfyClient: def __init__(self): self.test_name = "" - def connect(self, - listen:str = '127.0.0.1', + def connect(self, + listen:str = '127.0.0.1', port:Union[str,int] = 8188, client_id: str = str(uuid.uuid4()) ): @@ -125,7 +125,7 @@ class TestExecution: def _server(self, args_pytest, request): # Start server pargs = [ - 'python','main.py', + 'python','main.py', '--output-directory', args_pytest["output_dir"], '--listen', args_pytest["listen"], '--port', str(args_pytest["port"]), diff --git a/tests/inference/test_inference.py b/tests/inference/test_inference.py index a4b6ef0d..7e4a206c 100644 --- a/tests/inference/test_inference.py +++ b/tests/inference/test_inference.py @@ -23,7 +23,7 @@ These tests generate and save images through a range of parameters """ class ComfyGraph: - def __init__(self, + def __init__(self, graph: dict, sampler_nodes: list[str], ): @@ -59,8 +59,8 @@ class ComfyGraph: class ComfyClient: # From examples/websockets_api_example.py - def connect(self, - listen:str = '127.0.0.1', + def connect(self, + listen:str = '127.0.0.1', port:Union[str,int] = 8188, client_id: str = str(uuid.uuid4()) ): @@ -152,7 +152,7 @@ class TestInference: def _server(self, args_pytest): # Start server p = subprocess.Popen([ - 'python','main.py', + 'python','main.py', '--output-directory', args_pytest["output_dir"], '--listen', args_pytest["listen"], '--port', str(args_pytest["port"]), diff --git a/web/assets/BaseViewTemplate-CsEJhGbv.js b/web/assets/BaseViewTemplate-CsEJhGbv.js new file mode 100644 index 00000000..d254b402 --- /dev/null +++ b/web/assets/BaseViewTemplate-CsEJhGbv.js @@ -0,0 +1,23 @@ +import { d as defineComponent, o as openBlock, f as createElementBlock, J as renderSlot, T as normalizeClass } from "./index-C4Fk50Nx.js"; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "BaseViewTemplate", + props: { + dark: { type: Boolean, default: false } + }, + setup(__props) { + const props = __props; + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", { + class: normalizeClass(["font-sans w-screen h-screen flex items-center justify-center pointer-events-auto overflow-auto", [ + props.dark ? "text-neutral-300 bg-neutral-900 dark-theme" : "text-neutral-900 bg-neutral-300" + ]]) + }, [ + renderSlot(_ctx.$slots, "default") + ], 2); + }; + } +}); +export { + _sfc_main as _ +}; +//# sourceMappingURL=BaseViewTemplate-CsEJhGbv.js.map diff --git a/web/assets/DownloadGitView-B3f7KHY3.js.map b/web/assets/DownloadGitView-B3f7KHY3.js.map deleted file mode 100644 index 3e120e82..00000000 --- a/web/assets/DownloadGitView-B3f7KHY3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DownloadGitView-B3f7KHY3.js","sources":["../../src/views/DownloadGitView.vue"],"sourcesContent":["\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAqDA,UAAM,mBAAmB,6BAAM;AACtB,aAAA,KAAK,kCAAkC,QAAQ;AAAA,IAAA,GAD/B;AAIzB,UAAM,UAAU,6BAAM;AACpB,cAAQ,KAAK,SAAS;AACtB,YAAM,SAAS;AACf,aAAO,KAAK,SAAS;AAAA,IAAA,GAHP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/web/assets/DownloadGitView-B3f7KHY3.js b/web/assets/DownloadGitView-DP1MIWYX.js similarity index 53% rename from web/assets/DownloadGitView-B3f7KHY3.js rename to web/assets/DownloadGitView-DP1MIWYX.js index 7937398c..fff3e743 100644 --- a/web/assets/DownloadGitView-B3f7KHY3.js +++ b/web/assets/DownloadGitView-DP1MIWYX.js @@ -1,15 +1,14 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { a as defineComponent, f as openBlock, g as createElementBlock, A as createBaseVNode, a8 as toDisplayString, h as createVNode, z as unref, D as script, bU as useRouter } from "./index-DIU5yZe9.js"; -const _hoisted_1 = { class: "font-sans w-screen h-screen mx-0 grid place-items-center justify-center items-center text-neutral-900 bg-neutral-300 pointer-events-auto" }; -const _hoisted_2 = { class: "col-start-1 h-screen row-start-1 place-content-center mx-auto overflow-y-auto" }; -const _hoisted_3 = { class: "max-w-screen-sm flex flex-col gap-8 p-8 bg-[url('/assets/images/Git-Logo-White.svg')] bg-no-repeat bg-right-top bg-origin-padding" }; -const _hoisted_4 = { class: "mt-24 text-4xl font-bold text-red-500" }; -const _hoisted_5 = { class: "space-y-4" }; -const _hoisted_6 = { class: "text-xl" }; -const _hoisted_7 = { class: "text-xl" }; -const _hoisted_8 = { class: "text-m" }; -const _hoisted_9 = { class: "flex gap-4 flex-row-reverse" }; +import { d as defineComponent, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, l as script, bW as useRouter } from "./index-C4Fk50Nx.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-CsEJhGbv.js"; +const _hoisted_1 = { class: "max-w-screen-sm flex flex-col gap-8 p-8 bg-[url('/assets/images/Git-Logo-White.svg')] bg-no-repeat bg-right-top bg-origin-padding" }; +const _hoisted_2 = { class: "mt-24 text-4xl font-bold text-red-500" }; +const _hoisted_3 = { class: "space-y-4" }; +const _hoisted_4 = { class: "text-xl" }; +const _hoisted_5 = { class: "text-xl" }; +const _hoisted_6 = { class: "text-m" }; +const _hoisted_7 = { class: "flex gap-4 flex-row-reverse" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "DownloadGitView", setup(__props) { @@ -22,16 +21,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ router.push("install"); }, "skipGit"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1, [ - createBaseVNode("div", _hoisted_2, [ - createBaseVNode("div", _hoisted_3, [ - createBaseVNode("h1", _hoisted_4, toDisplayString(_ctx.$t("downloadGit.title")), 1), - createBaseVNode("div", _hoisted_5, [ - createBaseVNode("p", _hoisted_6, toDisplayString(_ctx.$t("downloadGit.message")), 1), - createBaseVNode("p", _hoisted_7, toDisplayString(_ctx.$t("downloadGit.instructions")), 1), - createBaseVNode("p", _hoisted_8, toDisplayString(_ctx.$t("downloadGit.warning")), 1) + return openBlock(), createBlock(_sfc_main$1, null, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_1, [ + createBaseVNode("h1", _hoisted_2, toDisplayString(_ctx.$t("downloadGit.title")), 1), + createBaseVNode("div", _hoisted_3, [ + createBaseVNode("p", _hoisted_4, toDisplayString(_ctx.$t("downloadGit.message")), 1), + createBaseVNode("p", _hoisted_5, toDisplayString(_ctx.$t("downloadGit.instructions")), 1), + createBaseVNode("p", _hoisted_6, toDisplayString(_ctx.$t("downloadGit.warning")), 1) ]), - createBaseVNode("div", _hoisted_9, [ + createBaseVNode("div", _hoisted_7, [ createVNode(unref(script), { label: _ctx.$t("downloadGit.gitWebsite"), icon: "pi pi-external-link", @@ -47,12 +46,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }, null, 8, ["label"]) ]) ]) - ]) - ]); + ]), + _: 1 + }); }; } }); export { _sfc_main as default }; -//# sourceMappingURL=DownloadGitView-B3f7KHY3.js.map +//# sourceMappingURL=DownloadGitView-DP1MIWYX.js.map diff --git a/web/assets/ExtensionPanel-ByeZ01RF.js.map b/web/assets/ExtensionPanel-ByeZ01RF.js.map deleted file mode 100644 index 02f2515f..00000000 --- a/web/assets/ExtensionPanel-ByeZ01RF.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ExtensionPanel-ByeZ01RF.js","sources":["../../src/components/dialog/content/setting/ExtensionPanel.vue"],"sourcesContent":["\n\n\n"],"names":[],"mappings":";;;;;;;;;AA8DA,UAAM,UAAU,IAAI;AAAA,MAClB,QAAQ,EAAE,OAAO,IAAI,WAAW,gBAAgB,SAAS;AAAA,IAAA,CAC1D;AAED,UAAM,iBAAiB;AACvB,UAAM,eAAe;AAEf,UAAA,2BAA2B,IAA6B,CAAA,CAAE;AAEhE,cAAU,MAAM;AACC,qBAAA,WAAW,QAAQ,CAAC,QAAQ;AACzC,iCAAyB,MAAM,IAAI,IAAI,IACrC,eAAe,mBAAmB,IAAI,IAAI;AAAA,MAAA,CAC7C;AAAA,IAAA,CACF;AAEK,UAAA,oBAAoB,SAAS,MAAM;AACvC,aAAO,eAAe,WAAW;AAAA,QAC/B,CAAC,QACC,yBAAyB,MAAM,IAAI,IAAI,MACvC,eAAe,mBAAmB,IAAI,IAAI;AAAA,MAAA;AAAA,IAC9C,CACD;AAEK,UAAA,aAAa,SAAS,MAAM;AACzB,aAAA,kBAAkB,MAAM,SAAS;AAAA,IAAA,CACzC;AAED,UAAM,wBAAwB,6BAAM;AAClC,YAAM,gCAAgC,OAAO;AAAA,QAC3C,yBAAyB;AAAA,MAExB,EAAA,OAAO,CAAC,CAAC,GAAG,OAAO,MAAM,CAAC,OAAO,EACjC,IAAI,CAAC,CAAC,IAAI,MAAM,IAAI;AAEvB,mBAAa,IAAI,4BAA4B;AAAA,QAC3C,GAAG,eAAe;AAAA,QAClB,GAAG;AAAA,MAAA,CACJ;AAAA,IAAA,GAV2B;AAa9B,UAAM,eAAe,6BAAM;AAEzB,aAAO,SAAS;IAAO,GAFJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/web/assets/ExtensionPanel-ByeZ01RF.js b/web/assets/ExtensionPanel-CxijYN47.js similarity index 54% rename from web/assets/ExtensionPanel-ByeZ01RF.js rename to web/assets/ExtensionPanel-CxijYN47.js index 59f2a113..6cf7706c 100644 --- a/web/assets/ExtensionPanel-ByeZ01RF.js +++ b/web/assets/ExtensionPanel-CxijYN47.js @@ -1,8 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { a as defineComponent, r as ref, ck as FilterMatchMode, co as useExtensionStore, u as useSettingStore, o as onMounted, q as computed, f as openBlock, x as createBlock, y as withCtx, h as createVNode, cl as SearchBox, z as unref, bW as script, A as createBaseVNode, g as createElementBlock, Q as renderList, a8 as toDisplayString, ay as createTextVNode, P as Fragment, D as script$1, i as createCommentVNode, c5 as script$3, cm as _sfc_main$1 } from "./index-DIU5yZe9.js"; -import { s as script$2, a as script$4 } from "./index-D3u7l7ha.js"; -import "./index-d698Brhb.js"; +import { d as defineComponent, ab as ref, cn as FilterMatchMode, cs as useExtensionStore, a as useSettingStore, m as onMounted, c as computed, o as openBlock, k as createBlock, M as withCtx, N as createVNode, co as SearchBox, j as unref, bZ as script, H as createBaseVNode, f as createElementBlock, E as renderList, X as toDisplayString, aE as createTextVNode, F as Fragment, l as script$1, I as createCommentVNode, aI as script$3, bO as script$4, c4 as script$5, cp as _sfc_main$1 } from "./index-C4Fk50Nx.js"; +import { s as script$2, a as script$6 } from "./index-CK0rrCYF.js"; +import "./index-lMQBwSDj.js"; +import "./index-B7ycxfFq.js"; const _hoisted_1 = { class: "flex justify-end" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "ExtensionPanel", @@ -35,9 +36,49 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ ...editingDisabledExtensionNames ]); }, "updateExtensionStatus"); + const enableAllExtensions = /* @__PURE__ */ __name(() => { + extensionStore.extensions.forEach((ext) => { + if (extensionStore.isExtensionReadOnly(ext.name)) return; + editingEnabledExtensions.value[ext.name] = true; + }); + updateExtensionStatus(); + }, "enableAllExtensions"); + const disableAllExtensions = /* @__PURE__ */ __name(() => { + extensionStore.extensions.forEach((ext) => { + if (extensionStore.isExtensionReadOnly(ext.name)) return; + editingEnabledExtensions.value[ext.name] = false; + }); + updateExtensionStatus(); + }, "disableAllExtensions"); + const disableThirdPartyExtensions = /* @__PURE__ */ __name(() => { + extensionStore.extensions.forEach((ext) => { + if (extensionStore.isCoreExtension(ext.name)) return; + editingEnabledExtensions.value[ext.name] = false; + }); + updateExtensionStatus(); + }, "disableThirdPartyExtensions"); const applyChanges = /* @__PURE__ */ __name(() => { window.location.reload(); }, "applyChanges"); + const menu = ref(); + const contextMenuItems = [ + { + label: "Enable All", + icon: "pi pi-check", + command: enableAllExtensions + }, + { + label: "Disable All", + icon: "pi pi-times", + command: disableAllExtensions + }, + { + label: "Disable 3rd Party", + icon: "pi pi-times", + command: disableThirdPartyExtensions, + disabled: !extensionStore.hasThirdPartyExtensions + } + ]; return (_ctx, _cache) => { return openBlock(), createBlock(_sfc_main$1, { value: "Extension", @@ -52,7 +93,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ hasChanges.value ? (openBlock(), createBlock(unref(script), { key: 0, severity: "info", - "pt:text": "w-full" + "pt:text": "w-full", + class: "max-h-96 overflow-y-auto" }, { default: withCtx(() => [ createBaseVNode("ul", null, [ @@ -78,7 +120,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ })) : createCommentVNode("", true) ]), default: withCtx(() => [ - createVNode(unref(script$4), { + createVNode(unref(script$6), { value: unref(extensionStore).extensions, stripedRows: "", size: "small", @@ -86,19 +128,43 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }, { default: withCtx(() => [ createVNode(unref(script$2), { - field: "name", header: _ctx.$t("g.extensionName"), - sortable: "" - }, null, 8, ["header"]), + sortable: "", + field: "name" + }, { + body: withCtx((slotProps) => [ + createTextVNode(toDisplayString(slotProps.data.name) + " ", 1), + unref(extensionStore).isCoreExtension(slotProps.data.name) ? (openBlock(), createBlock(unref(script$3), { + key: 0, + value: "Core" + })) : createCommentVNode("", true) + ]), + _: 1 + }, 8, ["header"]), createVNode(unref(script$2), { pt: { + headerCell: "flex items-center justify-end", bodyCell: "flex items-center justify-end" } }, { + header: withCtx(() => [ + createVNode(unref(script$1), { + icon: "pi pi-ellipsis-h", + text: "", + severity: "secondary", + onClick: _cache[1] || (_cache[1] = ($event) => menu.value.show($event)) + }), + createVNode(unref(script$4), { + ref_key: "menu", + ref: menu, + model: contextMenuItems + }, null, 512) + ]), body: withCtx((slotProps) => [ - createVNode(unref(script$3), { + createVNode(unref(script$5), { + disabled: unref(extensionStore).isExtensionReadOnly(slotProps.data.name), modelValue: editingEnabledExtensions.value[slotProps.data.name], "onUpdate:modelValue": /* @__PURE__ */ __name(($event) => editingEnabledExtensions.value[slotProps.data.name] = $event, "onUpdate:modelValue"), onChange: updateExtensionStatus - }, null, 8, ["modelValue", "onUpdate:modelValue"]) + }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue"]) ]), _: 1 }) @@ -114,4 +180,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ExtensionPanel-ByeZ01RF.js.map +//# sourceMappingURL=ExtensionPanel-CxijYN47.js.map diff --git a/web/assets/GraphView-BWxgNrh6.js.map b/web/assets/GraphView-BWxgNrh6.js.map deleted file mode 100644 index 276ddaec..00000000 --- a/web/assets/GraphView-BWxgNrh6.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"GraphView-BWxgNrh6.js","sources":["../../src/stores/graphStore.ts","../../src/components/graph/TitleEditor.vue","../../node_modules/primevue/overlaybadge/style/index.mjs","../../node_modules/primevue/overlaybadge/index.mjs","../../src/components/sidebar/SidebarIcon.vue","../../src/components/sidebar/SidebarThemeToggleIcon.vue","../../src/components/sidebar/SidebarSettingsToggleIcon.vue","../../src/components/sidebar/SidebarLogoutIcon.vue","../../src/components/common/ExtensionSlot.vue","../../src/components/sidebar/SideToolbar.vue","../../node_modules/primevue/tablist/style/index.mjs","../../node_modules/primevue/tablist/index.mjs","../../node_modules/primevue/tab/style/index.mjs","../../node_modules/primevue/tab/index.mjs","../../src/components/bottomPanel/BottomPanel.vue","../../node_modules/primevue/splitter/style/index.mjs","../../node_modules/primevue/splitter/index.mjs","../../node_modules/primevue/splitterpanel/style/index.mjs","../../node_modules/primevue/splitterpanel/index.mjs","../../src/components/LiteGraphCanvasSplitterOverlay.vue","../../node_modules/primevue/autocomplete/style/index.mjs","../../node_modules/primevue/autocomplete/index.mjs","../../src/components/primevueOverride/AutoCompletePlus.vue","../../src/components/searchbox/NodeSearchItem.vue","../../src/components/searchbox/NodeSearchBox.vue","../../src/types/litegraphTypes.ts","../../src/stores/workspace/searchBoxStore.ts","../../src/components/searchbox/NodeSearchBoxPopover.vue","../../src/components/graph/NodeTooltip.vue","../../src/components/graph/NodeBadge.vue","../../node_modules/primevue/buttongroup/style/index.mjs","../../node_modules/primevue/buttongroup/index.mjs","../../src/components/graph/GraphCanvasMenu.vue","../../src/components/graph/GraphCanvas.vue","../../src/components/MenuHamburger.vue","../../node_modules/primevue/toast/style/index.mjs","../../node_modules/primevue/toast/index.mjs","../../src/components/toast/GlobalToast.vue","../../src/components/dialog/UnloadWindowConfirmDialog.vue","../../src/components/BrowserTabTitle.vue","../../src/components/topbar/WorkflowTabs.vue","../../node_modules/primevue/menubar/style/index.mjs","../../node_modules/primevue/menubar/index.mjs","../../src/components/topbar/CommandMenubar.vue","../../node_modules/primevue/panel/style/index.mjs","../../node_modules/primevue/panel/index.mjs","../../node_modules/primevue/tieredmenu/style/index.mjs","../../node_modules/primevue/tieredmenu/index.mjs","../../node_modules/primevue/splitbutton/style/index.mjs","../../node_modules/primevue/splitbutton/index.mjs","../../src/components/actionbar/BatchCountEdit.vue","../../src/components/actionbar/ComfyQueueButton.vue","../../src/components/actionbar/ComfyActionbar.vue","../../src/components/topbar/BottomPanelToggleButton.vue","../../src/components/topbar/TopMenubar.vue","../../src/services/autoQueueService.ts","../../src/types/serverArgs.ts","../../src/constants/serverConfig.ts","../../src/hooks/coreCommandHooks.ts","../../src/views/GraphView.vue"],"sourcesContent":["import { LGraphNode, LGraphGroup, LGraphCanvas } from '@comfyorg/litegraph'\nimport { defineStore } from 'pinia'\nimport { shallowRef } from 'vue'\n\nexport const useTitleEditorStore = defineStore('titleEditor', () => {\n const titleEditorTarget = shallowRef(null)\n\n return {\n titleEditorTarget\n }\n})\n\nexport const useCanvasStore = defineStore('canvas', () => {\n /**\n * The LGraphCanvas instance.\n *\n * The root LGraphCanvas object is shallow reactive.\n */\n const canvas = shallowRef(null)\n\n return {\n canvas\n }\n})\n","\n\n\n\n\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-overlaybadge {\\n position: relative;\\n}\\n\\n.p-overlaybadge .p-badge {\\n position: absolute;\\n top: 0;\\n right: 0;\\n transform: translate(50%, -50%);\\n transform-origin: 100% 0;\\n margin: 0;\\n outline-width: \".concat(dt('overlaybadge.outline.width'), \";\\n outline-style: solid;\\n outline-color: \").concat(dt('overlaybadge.outline.color'), \";\\n}\\n\");\n};\nvar classes = {\n root: 'p-overlaybadge'\n};\nvar OverlayBadgeStyle = BaseStyle.extend({\n name: 'overlaybadge',\n theme: theme,\n classes: classes\n});\n\nexport { OverlayBadgeStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import Badge from 'primevue/badge';\nimport OverlayBadgeStyle from 'primevue/overlaybadge/style';\nimport { resolveComponent, openBlock, createElementBlock, mergeProps, renderSlot, createVNode } from 'vue';\n\nvar script$1 = {\n name: 'OverlayBadge',\n \"extends\": Badge,\n style: OverlayBadgeStyle,\n provide: function provide() {\n return {\n $pcOverlayBadge: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'OverlayBadge',\n \"extends\": script$1,\n inheritAttrs: false,\n components: {\n Badge: Badge\n }\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_Badge = resolveComponent(\"Badge\");\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root')), [renderSlot(_ctx.$slots, \"default\"), createVNode(_component_Badge, mergeProps(_ctx.$props, {\n pt: _ctx.ptm('pcBadge')\n }), null, 16, [\"pt\"])], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n\n\n\n\n","\n\n\n","\n\n\n","\n\n\n","\n\n\n","\n\n\n\n\n\n\n","import BaseStyle from '@primevue/core/base/style';\n\nvar classes = {\n root: 'p-tablist',\n content: function content(_ref) {\n var instance = _ref.instance;\n return ['p-tablist-content', {\n 'p-tablist-viewport': instance.$pcTabs.scrollable\n }];\n },\n tabList: 'p-tablist-tab-list',\n activeBar: 'p-tablist-active-bar',\n prevButton: 'p-tablist-prev-button p-tablist-nav-button',\n nextButton: 'p-tablist-next-button p-tablist-nav-button'\n};\nvar TabListStyle = BaseStyle.extend({\n name: 'tablist',\n classes: classes\n});\n\nexport { TabListStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { getWidth, findSingle, getOuterHeight, getOffset, getOuterWidth, getHeight } from '@primeuix/utils/dom';\nimport ChevronLeftIcon from '@primevue/icons/chevronleft';\nimport ChevronRightIcon from '@primevue/icons/chevronright';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport TabListStyle from 'primevue/tablist/style';\nimport Ripple from 'primevue/ripple';\nimport { resolveDirective, openBlock, createElementBlock, mergeProps, withDirectives, createBlock, resolveDynamicComponent, createCommentVNode, createElementVNode, renderSlot } from 'vue';\n\nvar script$1 = {\n name: 'BaseTabList',\n \"extends\": BaseComponent,\n props: {},\n style: TabListStyle,\n provide: function provide() {\n return {\n $pcTabList: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'TabList',\n \"extends\": script$1,\n inheritAttrs: false,\n inject: ['$pcTabs'],\n data: function data() {\n return {\n isPrevButtonEnabled: false,\n isNextButtonEnabled: true\n };\n },\n resizeObserver: undefined,\n watch: {\n showNavigators: function showNavigators(newValue) {\n newValue ? this.bindResizeObserver() : this.unbindResizeObserver();\n },\n activeValue: {\n flush: 'post',\n handler: function handler() {\n this.updateInkBar();\n }\n }\n },\n mounted: function mounted() {\n var _this = this;\n this.$nextTick(function () {\n _this.updateInkBar();\n });\n if (this.showNavigators) {\n this.updateButtonState();\n this.bindResizeObserver();\n }\n },\n updated: function updated() {\n this.showNavigators && this.updateButtonState();\n },\n beforeUnmount: function beforeUnmount() {\n this.unbindResizeObserver();\n },\n methods: {\n onScroll: function onScroll(event) {\n this.showNavigators && this.updateButtonState();\n event.preventDefault();\n },\n onPrevButtonClick: function onPrevButtonClick() {\n var content = this.$refs.content;\n var width = getWidth(content);\n var pos = content.scrollLeft - width;\n content.scrollLeft = pos <= 0 ? 0 : pos;\n },\n onNextButtonClick: function onNextButtonClick() {\n var content = this.$refs.content;\n var width = getWidth(content) - this.getVisibleButtonWidths();\n var pos = content.scrollLeft + width;\n var lastPos = content.scrollWidth - width;\n content.scrollLeft = pos >= lastPos ? lastPos : pos;\n },\n bindResizeObserver: function bindResizeObserver() {\n var _this2 = this;\n this.resizeObserver = new ResizeObserver(function () {\n return _this2.updateButtonState();\n });\n this.resizeObserver.observe(this.$refs.list);\n },\n unbindResizeObserver: function unbindResizeObserver() {\n var _this$resizeObserver;\n (_this$resizeObserver = this.resizeObserver) === null || _this$resizeObserver === void 0 || _this$resizeObserver.unobserve(this.$refs.list);\n this.resizeObserver = undefined;\n },\n updateInkBar: function updateInkBar() {\n var _this$$refs = this.$refs,\n content = _this$$refs.content,\n inkbar = _this$$refs.inkbar,\n tabs = _this$$refs.tabs;\n var activeTab = findSingle(content, '[data-pc-name=\"tab\"][data-p-active=\"true\"]');\n if (this.$pcTabs.isVertical()) {\n inkbar.style.height = getOuterHeight(activeTab) + 'px';\n inkbar.style.top = getOffset(activeTab).top - getOffset(tabs).top + 'px';\n } else {\n inkbar.style.width = getOuterWidth(activeTab) + 'px';\n inkbar.style.left = getOffset(activeTab).left - getOffset(tabs).left + 'px';\n }\n },\n updateButtonState: function updateButtonState() {\n var _this$$refs2 = this.$refs,\n list = _this$$refs2.list,\n content = _this$$refs2.content;\n var scrollLeft = content.scrollLeft,\n scrollTop = content.scrollTop,\n scrollWidth = content.scrollWidth,\n scrollHeight = content.scrollHeight,\n offsetWidth = content.offsetWidth,\n offsetHeight = content.offsetHeight;\n var _ref = [getWidth(content), getHeight(content)],\n width = _ref[0],\n height = _ref[1];\n if (this.$pcTabs.isVertical()) {\n this.isPrevButtonEnabled = scrollTop !== 0;\n this.isNextButtonEnabled = list.offsetHeight >= offsetHeight && parseInt(scrollTop) !== scrollHeight - height;\n } else {\n this.isPrevButtonEnabled = scrollLeft !== 0;\n this.isNextButtonEnabled = list.offsetWidth >= offsetWidth && parseInt(scrollLeft) !== scrollWidth - width;\n }\n },\n getVisibleButtonWidths: function getVisibleButtonWidths() {\n var _this$$refs3 = this.$refs,\n prevBtn = _this$$refs3.prevBtn,\n nextBtn = _this$$refs3.nextBtn;\n return [prevBtn, nextBtn].reduce(function (acc, el) {\n return el ? acc + getWidth(el) : acc;\n }, 0);\n }\n },\n computed: {\n templates: function templates() {\n return this.$pcTabs.$slots;\n },\n activeValue: function activeValue() {\n return this.$pcTabs.d_value;\n },\n showNavigators: function showNavigators() {\n return this.$pcTabs.scrollable && this.$pcTabs.showNavigators;\n },\n prevButtonAriaLabel: function prevButtonAriaLabel() {\n return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.previous : undefined;\n },\n nextButtonAriaLabel: function nextButtonAriaLabel() {\n return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.next : undefined;\n }\n },\n components: {\n ChevronLeftIcon: ChevronLeftIcon,\n ChevronRightIcon: ChevronRightIcon\n },\n directives: {\n ripple: Ripple\n }\n};\n\nvar _hoisted_1 = [\"aria-label\", \"tabindex\"];\nvar _hoisted_2 = [\"aria-orientation\"];\nvar _hoisted_3 = [\"aria-label\", \"tabindex\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _directive_ripple = resolveDirective(\"ripple\");\n return openBlock(), createElementBlock(\"div\", mergeProps({\n ref: \"list\",\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root')), [$options.showNavigators && $data.isPrevButtonEnabled ? withDirectives((openBlock(), createElementBlock(\"button\", mergeProps({\n key: 0,\n ref: \"prevButton\",\n \"class\": _ctx.cx('prevButton'),\n \"aria-label\": $options.prevButtonAriaLabel,\n tabindex: $options.$pcTabs.tabindex,\n onClick: _cache[0] || (_cache[0] = function () {\n return $options.onPrevButtonClick && $options.onPrevButtonClick.apply($options, arguments);\n })\n }, _ctx.ptm('prevButton'), {\n \"data-pc-group-section\": \"navigator\"\n }), [(openBlock(), createBlock(resolveDynamicComponent($options.templates.previcon || 'ChevronLeftIcon'), mergeProps({\n \"aria-hidden\": \"true\"\n }, _ctx.ptm('prevIcon')), null, 16))], 16, _hoisted_1)), [[_directive_ripple]]) : createCommentVNode(\"\", true), createElementVNode(\"div\", mergeProps({\n ref: \"content\",\n \"class\": _ctx.cx('content'),\n onScroll: _cache[1] || (_cache[1] = function () {\n return $options.onScroll && $options.onScroll.apply($options, arguments);\n })\n }, _ctx.ptm('content')), [createElementVNode(\"div\", mergeProps({\n ref: \"tabs\",\n \"class\": _ctx.cx('tabList'),\n role: \"tablist\",\n \"aria-orientation\": $options.$pcTabs.orientation || 'horizontal'\n }, _ctx.ptm('tabList')), [renderSlot(_ctx.$slots, \"default\"), createElementVNode(\"span\", mergeProps({\n ref: \"inkbar\",\n \"class\": _ctx.cx('activeBar'),\n role: \"presentation\",\n \"aria-hidden\": \"true\"\n }, _ctx.ptm('activeBar')), null, 16)], 16, _hoisted_2)], 16), $options.showNavigators && $data.isNextButtonEnabled ? withDirectives((openBlock(), createElementBlock(\"button\", mergeProps({\n key: 1,\n ref: \"nextButton\",\n \"class\": _ctx.cx('nextButton'),\n \"aria-label\": $options.nextButtonAriaLabel,\n tabindex: $options.$pcTabs.tabindex,\n onClick: _cache[2] || (_cache[2] = function () {\n return $options.onNextButtonClick && $options.onNextButtonClick.apply($options, arguments);\n })\n }, _ctx.ptm('nextButton'), {\n \"data-pc-group-section\": \"navigator\"\n }), [(openBlock(), createBlock(resolveDynamicComponent($options.templates.nexticon || 'ChevronRightIcon'), mergeProps({\n \"aria-hidden\": \"true\"\n }, _ctx.ptm('nextIcon')), null, 16))], 16, _hoisted_3)), [[_directive_ripple]]) : createCommentVNode(\"\", true)], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar classes = {\n root: function root(_ref) {\n var instance = _ref.instance,\n props = _ref.props;\n return ['p-tab', {\n 'p-tab-active': instance.active,\n 'p-disabled': props.disabled\n }];\n }\n};\nvar TabStyle = BaseStyle.extend({\n name: 'tab',\n classes: classes\n});\n\nexport { TabStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { getAttribute, findSingle, focus } from '@primeuix/utils/dom';\nimport { equals } from '@primeuix/utils/object';\nimport Ripple from 'primevue/ripple';\nimport { mergeProps, resolveDirective, withDirectives, openBlock, createBlock, resolveDynamicComponent, withCtx, renderSlot, normalizeClass } from 'vue';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport TabStyle from 'primevue/tab/style';\n\nvar script$1 = {\n name: 'BaseTab',\n \"extends\": BaseComponent,\n props: {\n value: {\n type: [String, Number],\n \"default\": undefined\n },\n disabled: {\n type: Boolean,\n \"default\": false\n },\n as: {\n type: [String, Object],\n \"default\": 'BUTTON'\n },\n asChild: {\n type: Boolean,\n \"default\": false\n }\n },\n style: TabStyle,\n provide: function provide() {\n return {\n $pcTab: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'Tab',\n \"extends\": script$1,\n inheritAttrs: false,\n inject: ['$pcTabs', '$pcTabList'],\n methods: {\n onFocus: function onFocus() {\n this.$pcTabs.selectOnFocus && this.changeActiveValue();\n },\n onClick: function onClick() {\n this.changeActiveValue();\n },\n onKeydown: function onKeydown(event) {\n switch (event.code) {\n case 'ArrowRight':\n this.onArrowRightKey(event);\n break;\n case 'ArrowLeft':\n this.onArrowLeftKey(event);\n break;\n case 'Home':\n this.onHomeKey(event);\n break;\n case 'End':\n this.onEndKey(event);\n break;\n case 'PageDown':\n this.onPageDownKey(event);\n break;\n case 'PageUp':\n this.onPageUpKey(event);\n break;\n case 'Enter':\n case 'NumpadEnter':\n case 'Space':\n this.onEnterKey(event);\n break;\n }\n },\n onArrowRightKey: function onArrowRightKey(event) {\n var nextTab = this.findNextTab(event.currentTarget);\n nextTab ? this.changeFocusedTab(event, nextTab) : this.onHomeKey(event);\n event.preventDefault();\n },\n onArrowLeftKey: function onArrowLeftKey(event) {\n var prevTab = this.findPrevTab(event.currentTarget);\n prevTab ? this.changeFocusedTab(event, prevTab) : this.onEndKey(event);\n event.preventDefault();\n },\n onHomeKey: function onHomeKey(event) {\n var firstTab = this.findFirstTab();\n this.changeFocusedTab(event, firstTab);\n event.preventDefault();\n },\n onEndKey: function onEndKey(event) {\n var lastTab = this.findLastTab();\n this.changeFocusedTab(event, lastTab);\n event.preventDefault();\n },\n onPageDownKey: function onPageDownKey(event) {\n this.scrollInView(this.findLastTab());\n event.preventDefault();\n },\n onPageUpKey: function onPageUpKey(event) {\n this.scrollInView(this.findFirstTab());\n event.preventDefault();\n },\n onEnterKey: function onEnterKey(event) {\n this.changeActiveValue();\n event.preventDefault();\n },\n findNextTab: function findNextTab(tabElement) {\n var selfCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var element = selfCheck ? tabElement : tabElement.nextElementSibling;\n return element ? getAttribute(element, 'data-p-disabled') || getAttribute(element, 'data-pc-section') === 'inkbar' ? this.findNextTab(element) : findSingle(element, '[data-pc-name=\"tab\"]') : null;\n },\n findPrevTab: function findPrevTab(tabElement) {\n var selfCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var element = selfCheck ? tabElement : tabElement.previousElementSibling;\n return element ? getAttribute(element, 'data-p-disabled') || getAttribute(element, 'data-pc-section') === 'inkbar' ? this.findPrevTab(element) : findSingle(element, '[data-pc-name=\"tab\"]') : null;\n },\n findFirstTab: function findFirstTab() {\n return this.findNextTab(this.$pcTabList.$refs.content.firstElementChild, true);\n },\n findLastTab: function findLastTab() {\n return this.findPrevTab(this.$pcTabList.$refs.content.lastElementChild, true);\n },\n changeActiveValue: function changeActiveValue() {\n this.$pcTabs.updateValue(this.value);\n },\n changeFocusedTab: function changeFocusedTab(event, element) {\n focus(element);\n this.scrollInView(element);\n },\n scrollInView: function scrollInView(element) {\n var _element$scrollIntoVi;\n element === null || element === void 0 || (_element$scrollIntoVi = element.scrollIntoView) === null || _element$scrollIntoVi === void 0 || _element$scrollIntoVi.call(element, {\n block: 'nearest'\n });\n }\n },\n computed: {\n active: function active() {\n var _this$$pcTabs;\n return equals((_this$$pcTabs = this.$pcTabs) === null || _this$$pcTabs === void 0 ? void 0 : _this$$pcTabs.d_value, this.value);\n },\n id: function id() {\n var _this$$pcTabs2;\n return \"\".concat((_this$$pcTabs2 = this.$pcTabs) === null || _this$$pcTabs2 === void 0 ? void 0 : _this$$pcTabs2.id, \"_tab_\").concat(this.value);\n },\n ariaControls: function ariaControls() {\n var _this$$pcTabs3;\n return \"\".concat((_this$$pcTabs3 = this.$pcTabs) === null || _this$$pcTabs3 === void 0 ? void 0 : _this$$pcTabs3.id, \"_tabpanel_\").concat(this.value);\n },\n attrs: function attrs() {\n return mergeProps(this.asAttrs, this.a11yAttrs, this.ptmi('root', this.ptParams));\n },\n asAttrs: function asAttrs() {\n return this.as === 'BUTTON' ? {\n type: 'button',\n disabled: this.disabled\n } : undefined;\n },\n a11yAttrs: function a11yAttrs() {\n return {\n id: this.id,\n tabindex: this.active ? this.$pcTabs.tabindex : -1,\n role: 'tab',\n 'aria-selected': this.active,\n 'aria-controls': this.ariaControls,\n 'data-pc-name': 'tab',\n 'data-p-disabled': this.disabled,\n 'data-p-active': this.active,\n onFocus: this.onFocus,\n onKeydown: this.onKeydown\n };\n },\n ptParams: function ptParams() {\n return {\n context: {\n active: this.active\n }\n };\n }\n },\n directives: {\n ripple: Ripple\n }\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _directive_ripple = resolveDirective(\"ripple\");\n return !_ctx.asChild ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({\n key: 0,\n \"class\": _ctx.cx('root'),\n onClick: $options.onClick\n }, $options.attrs), {\n \"default\": withCtx(function () {\n return [renderSlot(_ctx.$slots, \"default\")];\n }),\n _: 3\n }, 16, [\"class\", \"onClick\"])), [[_directive_ripple]]) : renderSlot(_ctx.$slots, \"default\", {\n key: 1,\n \"class\": normalizeClass(_ctx.cx('root')),\n active: $options.active,\n a11yAttrs: $options.a11yAttrs,\n onClick: $options.onClick\n });\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-splitter {\\n display: flex;\\n flex-wrap: nowrap;\\n border: 1px solid \".concat(dt('splitter.border.color'), \";\\n background: \").concat(dt('splitter.background'), \";\\n border-radius: \").concat(dt('border.radius.md'), \";\\n color: \").concat(dt('splitter.color'), \";\\n}\\n\\n.p-splitter-vertical {\\n flex-direction: column;\\n}\\n\\n.p-splitter-gutter {\\n flex-grow: 0;\\n flex-shrink: 0;\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n z-index: 1;\\n background: \").concat(dt('splitter.gutter.background'), \";\\n}\\n\\n.p-splitter-gutter-handle {\\n border-radius: \").concat(dt('splitter.handle.border.radius'), \";\\n background: \").concat(dt('splitter.handle.background'), \";\\n transition: outline-color \").concat(dt('splitter.transition.duration'), \", box-shadow \").concat(dt('splitter.transition.duration'), \";\\n outline-color: transparent;\\n}\\n\\n.p-splitter-gutter-handle:focus-visible {\\n box-shadow: \").concat(dt('splitter.handle.focus.ring.shadow'), \";\\n outline: \").concat(dt('splitter.handle.focus.ring.width'), \" \").concat(dt('splitter.handle.focus.ring.style'), \" \").concat(dt('splitter.handle.focus.ring.color'), \";\\n outline-offset: \").concat(dt('splitter.handle.focus.ring.offset'), \";\\n}\\n\\n.p-splitter-horizontal.p-splitter-resizing {\\n cursor: col-resize;\\n user-select: none;\\n}\\n\\n.p-splitter-vertical.p-splitter-resizing {\\n cursor: row-resize;\\n user-select: none;\\n}\\n\\n.p-splitter-horizontal > .p-splitter-gutter > .p-splitter-gutter-handle {\\n height: \").concat(dt('splitter.handle.size'), \";\\n width: 100%;\\n}\\n\\n.p-splitter-vertical > .p-splitter-gutter > .p-splitter-gutter-handle {\\n width: \").concat(dt('splitter.handle.size'), \";\\n height: 100%;\\n}\\n\\n.p-splitter-horizontal > .p-splitter-gutter {\\n cursor: col-resize;\\n}\\n\\n.p-splitter-vertical > .p-splitter-gutter {\\n cursor: row-resize;\\n}\\n\\n.p-splitterpanel {\\n flex-grow: 1;\\n overflow: hidden;\\n}\\n\\n.p-splitterpanel-nested {\\n display: flex;\\n}\\n\\n.p-splitterpanel .p-splitter {\\n flex-grow: 1;\\n border: 0 none;\\n}\\n\");\n};\nvar classes = {\n root: function root(_ref2) {\n var props = _ref2.props;\n return ['p-splitter p-component', 'p-splitter-' + props.layout];\n },\n gutter: 'p-splitter-gutter',\n gutterHandle: 'p-splitter-gutter-handle'\n};\nvar inlineStyles = {\n root: function root(_ref3) {\n var props = _ref3.props;\n return [{\n display: 'flex',\n 'flex-wrap': 'nowrap'\n }, props.layout === 'vertical' ? {\n 'flex-direction': 'column'\n } : ''];\n }\n};\nvar SplitterStyle = BaseStyle.extend({\n name: 'splitter',\n theme: theme,\n classes: classes,\n inlineStyles: inlineStyles\n});\n\nexport { SplitterStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { getVNodeProp } from '@primevue/core/utils';\nimport { getWidth, getHeight, getOuterWidth, getOuterHeight } from '@primeuix/utils/dom';\nimport { isArray } from '@primeuix/utils/object';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport SplitterStyle from 'primevue/splitter/style';\nimport { openBlock, createElementBlock, mergeProps, Fragment, renderList, createBlock, resolveDynamicComponent, createElementVNode, createCommentVNode } from 'vue';\n\nvar script$1 = {\n name: 'BaseSplitter',\n \"extends\": BaseComponent,\n props: {\n layout: {\n type: String,\n \"default\": 'horizontal'\n },\n gutterSize: {\n type: Number,\n \"default\": 4\n },\n stateKey: {\n type: String,\n \"default\": null\n },\n stateStorage: {\n type: String,\n \"default\": 'session'\n },\n step: {\n type: Number,\n \"default\": 5\n }\n },\n style: SplitterStyle,\n provide: function provide() {\n return {\n $pcSplitter: this,\n $parentInstance: this\n };\n }\n};\n\nfunction _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _iterableToArray(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nvar script = {\n name: 'Splitter',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['resizestart', 'resizeend', 'resize'],\n dragging: false,\n mouseMoveListener: null,\n mouseUpListener: null,\n touchMoveListener: null,\n touchEndListener: null,\n size: null,\n gutterElement: null,\n startPos: null,\n prevPanelElement: null,\n nextPanelElement: null,\n nextPanelSize: null,\n prevPanelSize: null,\n panelSizes: null,\n prevPanelIndex: null,\n timer: null,\n data: function data() {\n return {\n prevSize: null\n };\n },\n mounted: function mounted() {\n var _this = this;\n if (this.panels && this.panels.length) {\n var initialized = false;\n if (this.isStateful()) {\n initialized = this.restoreState();\n }\n if (!initialized) {\n var children = _toConsumableArray(this.$el.children).filter(function (child) {\n return child.getAttribute('data-pc-name') === 'splitterpanel';\n });\n var _panelSizes = [];\n this.panels.map(function (panel, i) {\n var panelInitialSize = panel.props && panel.props.size ? panel.props.size : null;\n var panelSize = panelInitialSize || 100 / _this.panels.length;\n _panelSizes[i] = panelSize;\n children[i].style.flexBasis = 'calc(' + panelSize + '% - ' + (_this.panels.length - 1) * _this.gutterSize + 'px)';\n });\n this.panelSizes = _panelSizes;\n this.prevSize = parseFloat(_panelSizes[0]).toFixed(4);\n }\n }\n },\n beforeUnmount: function beforeUnmount() {\n this.clear();\n this.unbindMouseListeners();\n },\n methods: {\n isSplitterPanel: function isSplitterPanel(child) {\n return child.type.name === 'SplitterPanel';\n },\n onResizeStart: function onResizeStart(event, index, isKeyDown) {\n this.gutterElement = event.currentTarget || event.target.parentElement;\n this.size = this.horizontal ? getWidth(this.$el) : getHeight(this.$el);\n if (!isKeyDown) {\n this.dragging = true;\n this.startPos = this.layout === 'horizontal' ? event.pageX || event.changedTouches[0].pageX : event.pageY || event.changedTouches[0].pageY;\n }\n this.prevPanelElement = this.gutterElement.previousElementSibling;\n this.nextPanelElement = this.gutterElement.nextElementSibling;\n if (isKeyDown) {\n this.prevPanelSize = this.horizontal ? getOuterWidth(this.prevPanelElement, true) : getOuterHeight(this.prevPanelElement, true);\n this.nextPanelSize = this.horizontal ? getOuterWidth(this.nextPanelElement, true) : getOuterHeight(this.nextPanelElement, true);\n } else {\n this.prevPanelSize = 100 * (this.horizontal ? getOuterWidth(this.prevPanelElement, true) : getOuterHeight(this.prevPanelElement, true)) / this.size;\n this.nextPanelSize = 100 * (this.horizontal ? getOuterWidth(this.nextPanelElement, true) : getOuterHeight(this.nextPanelElement, true)) / this.size;\n }\n this.prevPanelIndex = index;\n this.$emit('resizestart', {\n originalEvent: event,\n sizes: this.panelSizes\n });\n this.$refs.gutter[index].setAttribute('data-p-gutter-resizing', true);\n this.$el.setAttribute('data-p-resizing', true);\n },\n onResize: function onResize(event, step, isKeyDown) {\n var newPos, newPrevPanelSize, newNextPanelSize;\n if (isKeyDown) {\n if (this.horizontal) {\n newPrevPanelSize = 100 * (this.prevPanelSize + step) / this.size;\n newNextPanelSize = 100 * (this.nextPanelSize - step) / this.size;\n } else {\n newPrevPanelSize = 100 * (this.prevPanelSize - step) / this.size;\n newNextPanelSize = 100 * (this.nextPanelSize + step) / this.size;\n }\n } else {\n if (this.horizontal) newPos = event.pageX * 100 / this.size - this.startPos * 100 / this.size;else newPos = event.pageY * 100 / this.size - this.startPos * 100 / this.size;\n newPrevPanelSize = this.prevPanelSize + newPos;\n newNextPanelSize = this.nextPanelSize - newPos;\n }\n if (this.validateResize(newPrevPanelSize, newNextPanelSize)) {\n this.prevPanelElement.style.flexBasis = 'calc(' + newPrevPanelSize + '% - ' + (this.panels.length - 1) * this.gutterSize + 'px)';\n this.nextPanelElement.style.flexBasis = 'calc(' + newNextPanelSize + '% - ' + (this.panels.length - 1) * this.gutterSize + 'px)';\n this.panelSizes[this.prevPanelIndex] = newPrevPanelSize;\n this.panelSizes[this.prevPanelIndex + 1] = newNextPanelSize;\n this.prevSize = parseFloat(newPrevPanelSize).toFixed(4);\n }\n this.$emit('resize', {\n originalEvent: event,\n sizes: this.panelSizes\n });\n },\n onResizeEnd: function onResizeEnd(event) {\n if (this.isStateful()) {\n this.saveState();\n }\n this.$emit('resizeend', {\n originalEvent: event,\n sizes: this.panelSizes\n });\n this.$refs.gutter.forEach(function (gutter) {\n return gutter.setAttribute('data-p-gutter-resizing', false);\n });\n this.$el.setAttribute('data-p-resizing', false);\n this.clear();\n },\n repeat: function repeat(event, index, step) {\n this.onResizeStart(event, index, true);\n this.onResize(event, step, true);\n },\n setTimer: function setTimer(event, index, step) {\n var _this2 = this;\n if (!this.timer) {\n this.timer = setInterval(function () {\n _this2.repeat(event, index, step);\n }, 40);\n }\n },\n clearTimer: function clearTimer() {\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = null;\n }\n },\n onGutterKeyUp: function onGutterKeyUp() {\n this.clearTimer();\n this.onResizeEnd();\n },\n onGutterKeyDown: function onGutterKeyDown(event, index) {\n switch (event.code) {\n case 'ArrowLeft':\n {\n if (this.layout === 'horizontal') {\n this.setTimer(event, index, this.step * -1);\n }\n event.preventDefault();\n break;\n }\n case 'ArrowRight':\n {\n if (this.layout === 'horizontal') {\n this.setTimer(event, index, this.step);\n }\n event.preventDefault();\n break;\n }\n case 'ArrowDown':\n {\n if (this.layout === 'vertical') {\n this.setTimer(event, index, this.step * -1);\n }\n event.preventDefault();\n break;\n }\n case 'ArrowUp':\n {\n if (this.layout === 'vertical') {\n this.setTimer(event, index, this.step);\n }\n event.preventDefault();\n break;\n }\n }\n },\n onGutterMouseDown: function onGutterMouseDown(event, index) {\n this.onResizeStart(event, index);\n this.bindMouseListeners();\n },\n onGutterTouchStart: function onGutterTouchStart(event, index) {\n this.onResizeStart(event, index);\n this.bindTouchListeners();\n event.preventDefault();\n },\n onGutterTouchMove: function onGutterTouchMove(event) {\n this.onResize(event);\n event.preventDefault();\n },\n onGutterTouchEnd: function onGutterTouchEnd(event) {\n this.onResizeEnd(event);\n this.unbindTouchListeners();\n event.preventDefault();\n },\n bindMouseListeners: function bindMouseListeners() {\n var _this3 = this;\n if (!this.mouseMoveListener) {\n this.mouseMoveListener = function (event) {\n return _this3.onResize(event);\n };\n document.addEventListener('mousemove', this.mouseMoveListener);\n }\n if (!this.mouseUpListener) {\n this.mouseUpListener = function (event) {\n _this3.onResizeEnd(event);\n _this3.unbindMouseListeners();\n };\n document.addEventListener('mouseup', this.mouseUpListener);\n }\n },\n bindTouchListeners: function bindTouchListeners() {\n var _this4 = this;\n if (!this.touchMoveListener) {\n this.touchMoveListener = function (event) {\n return _this4.onResize(event.changedTouches[0]);\n };\n document.addEventListener('touchmove', this.touchMoveListener);\n }\n if (!this.touchEndListener) {\n this.touchEndListener = function (event) {\n _this4.resizeEnd(event);\n _this4.unbindTouchListeners();\n };\n document.addEventListener('touchend', this.touchEndListener);\n }\n },\n validateResize: function validateResize(newPrevPanelSize, newNextPanelSize) {\n if (newPrevPanelSize > 100 || newPrevPanelSize < 0) return false;\n if (newNextPanelSize > 100 || newNextPanelSize < 0) return false;\n var prevPanelMinSize = getVNodeProp(this.panels[this.prevPanelIndex], 'minSize');\n if (this.panels[this.prevPanelIndex].props && prevPanelMinSize && prevPanelMinSize > newPrevPanelSize) {\n return false;\n }\n var newPanelMinSize = getVNodeProp(this.panels[this.prevPanelIndex + 1], 'minSize');\n if (this.panels[this.prevPanelIndex + 1].props && newPanelMinSize && newPanelMinSize > newNextPanelSize) {\n return false;\n }\n return true;\n },\n unbindMouseListeners: function unbindMouseListeners() {\n if (this.mouseMoveListener) {\n document.removeEventListener('mousemove', this.mouseMoveListener);\n this.mouseMoveListener = null;\n }\n if (this.mouseUpListener) {\n document.removeEventListener('mouseup', this.mouseUpListener);\n this.mouseUpListener = null;\n }\n },\n unbindTouchListeners: function unbindTouchListeners() {\n if (this.touchMoveListener) {\n document.removeEventListener('touchmove', this.touchMoveListener);\n this.touchMoveListener = null;\n }\n if (this.touchEndListener) {\n document.removeEventListener('touchend', this.touchEndListener);\n this.touchEndListener = null;\n }\n },\n clear: function clear() {\n this.dragging = false;\n this.size = null;\n this.startPos = null;\n this.prevPanelElement = null;\n this.nextPanelElement = null;\n this.prevPanelSize = null;\n this.nextPanelSize = null;\n this.gutterElement = null;\n this.prevPanelIndex = null;\n },\n isStateful: function isStateful() {\n return this.stateKey != null;\n },\n getStorage: function getStorage() {\n switch (this.stateStorage) {\n case 'local':\n return window.localStorage;\n case 'session':\n return window.sessionStorage;\n default:\n throw new Error(this.stateStorage + ' is not a valid value for the state storage, supported values are \"local\" and \"session\".');\n }\n },\n saveState: function saveState() {\n if (isArray(this.panelSizes)) {\n this.getStorage().setItem(this.stateKey, JSON.stringify(this.panelSizes));\n }\n },\n restoreState: function restoreState() {\n var _this5 = this;\n var storage = this.getStorage();\n var stateString = storage.getItem(this.stateKey);\n if (stateString) {\n this.panelSizes = JSON.parse(stateString);\n var children = _toConsumableArray(this.$el.children).filter(function (child) {\n return child.getAttribute('data-pc-name') === 'splitterpanel';\n });\n children.forEach(function (child, i) {\n child.style.flexBasis = 'calc(' + _this5.panelSizes[i] + '% - ' + (_this5.panels.length - 1) * _this5.gutterSize + 'px)';\n });\n return true;\n }\n return false;\n }\n },\n computed: {\n panels: function panels() {\n var _this6 = this;\n var panels = [];\n this.$slots[\"default\"]().forEach(function (child) {\n if (_this6.isSplitterPanel(child)) {\n panels.push(child);\n } else if (child.children instanceof Array) {\n child.children.forEach(function (nestedChild) {\n if (_this6.isSplitterPanel(nestedChild)) {\n panels.push(nestedChild);\n }\n });\n }\n });\n return panels;\n },\n gutterStyle: function gutterStyle() {\n if (this.horizontal) return {\n width: this.gutterSize + 'px'\n };else return {\n height: this.gutterSize + 'px'\n };\n },\n horizontal: function horizontal() {\n return this.layout === 'horizontal';\n },\n getPTOptions: function getPTOptions() {\n var _this$$parentInstance;\n return {\n context: {\n nested: (_this$$parentInstance = this.$parentInstance) === null || _this$$parentInstance === void 0 ? void 0 : _this$$parentInstance.nestedState\n }\n };\n }\n }\n};\n\nvar _hoisted_1 = [\"onMousedown\", \"onTouchstart\", \"onTouchmove\", \"onTouchend\"];\nvar _hoisted_2 = [\"aria-orientation\", \"aria-valuenow\", \"onKeydown\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root'),\n style: _ctx.sx('root'),\n \"data-p-resizing\": false\n }, _ctx.ptmi('root', $options.getPTOptions)), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.panels, function (panel, i) {\n return openBlock(), createElementBlock(Fragment, {\n key: i\n }, [(openBlock(), createBlock(resolveDynamicComponent(panel), {\n tabindex: \"-1\"\n })), i !== $options.panels.length - 1 ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n ref_for: true,\n ref: \"gutter\",\n \"class\": _ctx.cx('gutter'),\n role: \"separator\",\n tabindex: \"-1\",\n onMousedown: function onMousedown($event) {\n return $options.onGutterMouseDown($event, i);\n },\n onTouchstart: function onTouchstart($event) {\n return $options.onGutterTouchStart($event, i);\n },\n onTouchmove: function onTouchmove($event) {\n return $options.onGutterTouchMove($event, i);\n },\n onTouchend: function onTouchend($event) {\n return $options.onGutterTouchEnd($event, i);\n },\n \"data-p-gutter-resizing\": false\n }, _ctx.ptm('gutter')), [createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('gutterHandle'),\n tabindex: \"0\",\n style: [$options.gutterStyle],\n \"aria-orientation\": _ctx.layout,\n \"aria-valuenow\": $data.prevSize,\n onKeyup: _cache[0] || (_cache[0] = function () {\n return $options.onGutterKeyUp && $options.onGutterKeyUp.apply($options, arguments);\n }),\n onKeydown: function onKeydown($event) {\n return $options.onGutterKeyDown($event, i);\n },\n ref_for: true\n }, _ctx.ptm('gutterHandle')), null, 16, _hoisted_2)], 16, _hoisted_1)) : createCommentVNode(\"\", true)], 64);\n }), 128))], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar classes = {\n root: function root(_ref) {\n var instance = _ref.instance;\n return ['p-splitterpanel', {\n 'p-splitterpanel-nested': instance.isNested\n }];\n }\n};\nvar SplitterPanelStyle = BaseStyle.extend({\n name: 'splitterpanel',\n classes: classes\n});\n\nexport { SplitterPanelStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseComponent from '@primevue/core/basecomponent';\nimport SplitterPanelStyle from 'primevue/splitterpanel/style';\nimport { openBlock, createElementBlock, mergeProps, renderSlot } from 'vue';\n\nvar script$1 = {\n name: 'BaseSplitterPanel',\n \"extends\": BaseComponent,\n props: {\n size: {\n type: Number,\n \"default\": null\n },\n minSize: {\n type: Number,\n \"default\": null\n }\n },\n style: SplitterPanelStyle,\n provide: function provide() {\n return {\n $pcSplitterPanel: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'SplitterPanel',\n \"extends\": script$1,\n inheritAttrs: false,\n data: function data() {\n return {\n nestedState: null\n };\n },\n computed: {\n isNested: function isNested() {\n var _this = this;\n return this.$slots[\"default\"]().some(function (child) {\n _this.nestedState = child.type.name === 'Splitter' ? true : null;\n return _this.nestedState;\n });\n },\n getPTOptions: function getPTOptions() {\n return {\n context: {\n nested: this.isNested\n }\n };\n }\n }\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", mergeProps({\n ref: \"container\",\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root', $options.getPTOptions)), [renderSlot(_ctx.$slots, \"default\")], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n\n\n","import { isNotEmpty } from '@primeuix/utils/object';\nimport BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-autocomplete {\\n display: inline-flex;\\n}\\n\\n.p-autocomplete-loader {\\n position: absolute;\\n top: 50%;\\n margin-top: -0.5rem;\\n right: \".concat(dt('autocomplete.padding.x'), \";\\n}\\n\\n.p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-loader {\\n right: calc(\").concat(dt('autocomplete.dropdown.width'), \" + \").concat(dt('autocomplete.padding.x'), \");\\n}\\n\\n.p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-input {\\n flex: 1 1 auto;\\n width: 1%;\\n}\\n\\n.p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-input,\\n.p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-input-multiple {\\n border-top-right-radius: 0;\\n border-bottom-right-radius: 0;\\n}\\n\\n.p-autocomplete-dropdown {\\n cursor: pointer;\\n display: inline-flex;\\n cursor: pointer;\\n user-select: none;\\n align-items: center;\\n justify-content: center;\\n overflow: hidden;\\n position: relative;\\n width: \").concat(dt('autocomplete.dropdown.width'), \";\\n border-top-right-radius: \").concat(dt('autocomplete.dropdown.border.radius'), \";\\n border-bottom-right-radius: \").concat(dt('autocomplete.dropdown.border.radius'), \";\\n background: \").concat(dt('autocomplete.dropdown.background'), \";\\n border: 1px solid \").concat(dt('autocomplete.dropdown.border.color'), \";\\n border-left: 0 none;\\n color: \").concat(dt('autocomplete.dropdown.color'), \";\\n transition: background \").concat(dt('autocomplete.transition.duration'), \", color \").concat(dt('autocomplete.transition.duration'), \", border-color \").concat(dt('autocomplete.transition.duration'), \", outline-color \").concat(dt('autocomplete.transition.duration'), \", box-shadow \").concat(dt('autocomplete.transition.duration'), \";\\n outline-color: transparent;\\n}\\n\\n.p-autocomplete-dropdown:not(:disabled):hover {\\n background: \").concat(dt('autocomplete.dropdown.hover.background'), \";\\n border-color: \").concat(dt('autocomplete.dropdown.hover.border.color'), \";\\n color: \").concat(dt('autocomplete.dropdown.hover.color'), \";\\n}\\n\\n.p-autocomplete-dropdown:not(:disabled):active {\\n background: \").concat(dt('autocomplete.dropdown.active.background'), \";\\n border-color: \").concat(dt('autocomplete.dropdown.active.border.color'), \";\\n color: \").concat(dt('autocomplete.dropdown.active.color'), \";\\n}\\n\\n.p-autocomplete-dropdown:focus-visible {\\n box-shadow: \").concat(dt('autocomplete.dropdown.focus.ring.shadow'), \";\\n outline: \").concat(dt('autocomplete.dropdown.focus.ring.width'), \" \").concat(dt('autocomplete.dropdown.focus.ring.style'), \" \").concat(dt('autocomplete.dropdown.focus.ring.color'), \";\\n outline-offset: \").concat(dt('autocomplete.dropdown.focus.ring.offset'), \";\\n}\\n\\n.p-autocomplete .p-autocomplete-overlay {\\n min-width: 100%;\\n}\\n\\n.p-autocomplete-overlay {\\n position: absolute;\\n overflow: auto;\\n top: 0;\\n left: 0;\\n background: \").concat(dt('autocomplete.overlay.background'), \";\\n color: \").concat(dt('autocomplete.overlay.color'), \";\\n border: 1px solid \").concat(dt('autocomplete.overlay.border.color'), \";\\n border-radius: \").concat(dt('autocomplete.overlay.border.radius'), \";\\n box-shadow: \").concat(dt('autocomplete.overlay.shadow'), \";\\n}\\n\\n.p-autocomplete-list {\\n margin: 0;\\n padding: 0;\\n list-style-type: none;\\n display: flex;\\n flex-direction: column;\\n gap: \").concat(dt('autocomplete.list.gap'), \";\\n padding: \").concat(dt('autocomplete.list.padding'), \";\\n}\\n\\n.p-autocomplete-option {\\n cursor: pointer;\\n white-space: nowrap;\\n position: relative;\\n overflow: hidden;\\n display: flex;\\n align-items: center;\\n padding: \").concat(dt('autocomplete.option.padding'), \";\\n border: 0 none;\\n color: \").concat(dt('autocomplete.option.color'), \";\\n background: transparent;\\n transition: background \").concat(dt('autocomplete.transition.duration'), \", color \").concat(dt('autocomplete.transition.duration'), \", border-color \").concat(dt('autocomplete.transition.duration'), \";\\n border-radius: \").concat(dt('autocomplete.option.border.radius'), \";\\n}\\n\\n.p-autocomplete-option:not(.p-autocomplete-option-selected):not(.p-disabled).p-focus {\\n background: \").concat(dt('autocomplete.option.focus.background'), \";\\n color: \").concat(dt('autocomplete.option.focus.color'), \";\\n}\\n\\n.p-autocomplete-option-selected {\\n background: \").concat(dt('autocomplete.option.selected.background'), \";\\n color: \").concat(dt('autocomplete.option.selected.color'), \";\\n}\\n\\n.p-autocomplete-option-selected.p-focus {\\n background: \").concat(dt('autocomplete.option.selected.focus.background'), \";\\n color: \").concat(dt('autocomplete.option.selected.focus.color'), \";\\n}\\n\\n.p-autocomplete-option-group {\\n margin: 0;\\n padding: \").concat(dt('autocomplete.option.group.padding'), \";\\n color: \").concat(dt('autocomplete.option.group.color'), \";\\n background: \").concat(dt('autocomplete.option.group.background'), \";\\n font-weight: \").concat(dt('autocomplete.option.group.font.weight'), \";\\n}\\n\\n.p-autocomplete-input-multiple {\\n margin: 0;\\n list-style-type: none;\\n cursor: text;\\n overflow: hidden;\\n display: flex;\\n align-items: center;\\n flex-wrap: wrap;\\n padding: calc(\").concat(dt('autocomplete.padding.y'), \" / 2) \").concat(dt('autocomplete.padding.x'), \";\\n gap: calc(\").concat(dt('autocomplete.padding.y'), \" / 2);\\n color: \").concat(dt('autocomplete.color'), \";\\n background: \").concat(dt('autocomplete.background'), \";\\n border: 1px solid \").concat(dt('autocomplete.border.color'), \";\\n border-radius: \").concat(dt('autocomplete.border.radius'), \";\\n width: 100%;\\n transition: background \").concat(dt('autocomplete.transition.duration'), \", color \").concat(dt('autocomplete.transition.duration'), \", border-color \").concat(dt('autocomplete.transition.duration'), \", outline-color \").concat(dt('autocomplete.transition.duration'), \", box-shadow \").concat(dt('autocomplete.transition.duration'), \";\\n outline-color: transparent;\\n box-shadow: \").concat(dt('autocomplete.shadow'), \";\\n}\\n\\n.p-autocomplete:not(.p-disabled):hover .p-autocomplete-input-multiple {\\n border-color: \").concat(dt('autocomplete.hover.border.color'), \";\\n}\\n\\n.p-autocomplete:not(.p-disabled).p-focus .p-autocomplete-input-multiple {\\n border-color: \").concat(dt('autocomplete.focus.border.color'), \";\\n box-shadow: \").concat(dt('autocomplete.focus.ring.shadow'), \";\\n outline: \").concat(dt('autocomplete.focus.ring.width'), \" \").concat(dt('autocomplete.focus.ring.style'), \" \").concat(dt('autocomplete.focus.ring.color'), \";\\n outline-offset: \").concat(dt('autocomplete.focus.ring.offset'), \";\\n}\\n\\n.p-autocomplete.p-invalid .p-autocomplete-input-multiple {\\n border-color: \").concat(dt('autocomplete.invalid.border.color'), \";\\n}\\n\\n.p-variant-filled.p-autocomplete-input-multiple {\\n background: \").concat(dt('autocomplete.filled.background'), \";\\n}\\n\\n.p-autocomplete:not(.p-disabled).p-focus .p-variant-filled.p-autocomplete-input-multiple {\\n background: \").concat(dt('autocomplete.filled.focus.background'), \";\\n}\\n\\n.p-autocomplete.p-disabled .p-autocomplete-input-multiple {\\n opacity: 1;\\n background: \").concat(dt('autocomplete.disabled.background'), \";\\n color: \").concat(dt('autocomplete.disabled.color'), \";\\n}\\n\\n.p-autocomplete-chip.p-chip {\\n padding-top: calc(\").concat(dt('autocomplete.padding.y'), \" / 2);\\n padding-bottom: calc(\").concat(dt('autocomplete.padding.y'), \" / 2);\\n border-radius: \").concat(dt('autocomplete.chip.border.radius'), \";\\n}\\n\\n.p-autocomplete-input-multiple:has(.p-autocomplete-chip) {\\n padding-left: calc(\").concat(dt('autocomplete.padding.y'), \" / 2);\\n padding-right: calc(\").concat(dt('autocomplete.padding.y'), \" / 2);\\n}\\n\\n.p-autocomplete-chip-item.p-focus .p-autocomplete-chip {\\n background: \").concat(dt('inputchips.chip.focus.background'), \";\\n color: \").concat(dt('inputchips.chip.focus.color'), \";\\n}\\n\\n.p-autocomplete-input-chip {\\n flex: 1 1 auto;\\n display: inline-flex;\\n padding-top: calc(\").concat(dt('autocomplete.padding.y'), \" / 2);\\n padding-bottom: calc(\").concat(dt('autocomplete.padding.y'), \" / 2);\\n}\\n\\n.p-autocomplete-input-chip input {\\n border: 0 none;\\n outline: 0 none;\\n background: transparent;\\n margin: 0;\\n padding: 0;\\n box-shadow: none;\\n border-radius: 0;\\n width: 100%;\\n font-family: inherit;\\n font-feature-settings: inherit;\\n font-size: 1rem;\\n color: inherit;\\n}\\n\\n.p-autocomplete-input-chip input::placeholder {\\n color: \").concat(dt('autocomplete.placeholder.color'), \";\\n}\\n\\n.p-autocomplete-empty-message {\\n padding: \").concat(dt('autocomplete.empty.message.padding'), \";\\n}\\n\\n.p-autocomplete-fluid {\\n display: flex;\\n}\\n\\n.p-autocomplete-fluid:has(.p-autocomplete-dropdown) .p-autocomplete-input {\\n width: 1%;\\n}\\n\");\n};\nvar inlineStyles = {\n root: {\n position: 'relative'\n }\n};\nvar classes = {\n root: function root(_ref2) {\n var instance = _ref2.instance,\n props = _ref2.props;\n return ['p-autocomplete p-component p-inputwrapper', {\n 'p-disabled': props.disabled,\n 'p-invalid': props.invalid,\n 'p-focus': instance.focused,\n 'p-inputwrapper-filled': props.modelValue || isNotEmpty(instance.inputValue),\n 'p-inputwrapper-focus': instance.focused,\n 'p-autocomplete-open': instance.overlayVisible,\n 'p-autocomplete-fluid': instance.hasFluid\n }];\n },\n pcInput: 'p-autocomplete-input',\n inputMultiple: function inputMultiple(_ref3) {\n var props = _ref3.props,\n instance = _ref3.instance;\n return ['p-autocomplete-input-multiple', {\n 'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled' || instance.$primevue.config.inputVariant === 'filled'\n }];\n },\n chipItem: function chipItem(_ref4) {\n var instance = _ref4.instance,\n i = _ref4.i;\n return ['p-autocomplete-chip-item', {\n 'p-focus': instance.focusedMultipleOptionIndex === i\n }];\n },\n pcChip: 'p-autocomplete-chip',\n chipIcon: 'p-autocomplete-chip-icon',\n inputChip: 'p-autocomplete-input-chip',\n loader: 'p-autocomplete-loader',\n dropdown: 'p-autocomplete-dropdown',\n overlay: 'p-autocomplete-overlay p-component',\n list: 'p-autocomplete-list',\n optionGroup: 'p-autocomplete-option-group',\n option: function option(_ref5) {\n var instance = _ref5.instance,\n _option = _ref5.option,\n i = _ref5.i,\n getItemOptions = _ref5.getItemOptions;\n return ['p-autocomplete-option', {\n 'p-autocomplete-option-selected': instance.isSelected(_option),\n 'p-focus': instance.focusedOptionIndex === instance.getOptionIndex(i, getItemOptions),\n 'p-disabled': instance.isOptionDisabled(_option)\n }];\n },\n emptyMessage: 'p-autocomplete-empty-message'\n};\nvar AutoCompleteStyle = BaseStyle.extend({\n name: 'autocomplete',\n theme: theme,\n classes: classes,\n inlineStyles: inlineStyles\n});\n\nexport { AutoCompleteStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { focus, addStyle, relativePosition, getOuterWidth, absolutePosition, isTouchDevice, findSingle } from '@primeuix/utils/dom';\nimport { resolveFieldData, isEmpty, isNotEmpty, equals, findLastIndex } from '@primeuix/utils/object';\nimport { ZIndex } from '@primeuix/utils/zindex';\nimport { UniqueComponentId, ConnectedOverlayScrollHandler } from '@primevue/core/utils';\nimport ChevronDownIcon from '@primevue/icons/chevrondown';\nimport SpinnerIcon from '@primevue/icons/spinner';\nimport Chip from 'primevue/chip';\nimport InputText from 'primevue/inputtext';\nimport OverlayEventBus from 'primevue/overlayeventbus';\nimport Portal from 'primevue/portal';\nimport Ripple from 'primevue/ripple';\nimport VirtualScroller from 'primevue/virtualscroller';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport AutoCompleteStyle from 'primevue/autocomplete/style';\nimport { resolveComponent, resolveDirective, openBlock, createElementBlock, mergeProps, createBlock, normalizeClass, normalizeStyle, createCommentVNode, Fragment, renderList, renderSlot, createVNode, withCtx, createElementVNode, resolveDynamicComponent, toDisplayString, Transition, createSlots, createTextVNode, withDirectives } from 'vue';\n\nvar script$1 = {\n name: 'BaseAutoComplete',\n \"extends\": BaseComponent,\n props: {\n modelValue: null,\n suggestions: {\n type: Array,\n \"default\": null\n },\n optionLabel: null,\n optionDisabled: null,\n optionGroupLabel: null,\n optionGroupChildren: null,\n scrollHeight: {\n type: String,\n \"default\": '14rem'\n },\n dropdown: {\n type: Boolean,\n \"default\": false\n },\n dropdownMode: {\n type: String,\n \"default\": 'blank'\n },\n multiple: {\n type: Boolean,\n \"default\": false\n },\n loading: {\n type: Boolean,\n \"default\": false\n },\n variant: {\n type: String,\n \"default\": null\n },\n invalid: {\n type: Boolean,\n \"default\": false\n },\n disabled: {\n type: Boolean,\n \"default\": false\n },\n placeholder: {\n type: String,\n \"default\": null\n },\n dataKey: {\n type: String,\n \"default\": null\n },\n minLength: {\n type: Number,\n \"default\": 1\n },\n delay: {\n type: Number,\n \"default\": 300\n },\n appendTo: {\n type: [String, Object],\n \"default\": 'body'\n },\n forceSelection: {\n type: Boolean,\n \"default\": false\n },\n completeOnFocus: {\n type: Boolean,\n \"default\": false\n },\n inputId: {\n type: String,\n \"default\": null\n },\n inputStyle: {\n type: Object,\n \"default\": null\n },\n inputClass: {\n type: [String, Object],\n \"default\": null\n },\n panelStyle: {\n type: Object,\n \"default\": null\n },\n panelClass: {\n type: [String, Object],\n \"default\": null\n },\n overlayStyle: {\n type: Object,\n \"default\": null\n },\n overlayClass: {\n type: [String, Object],\n \"default\": null\n },\n dropdownIcon: {\n type: String,\n \"default\": null\n },\n dropdownClass: {\n type: [String, Object],\n \"default\": null\n },\n loader: {\n type: String,\n \"default\": null\n },\n loadingIcon: {\n type: String,\n \"default\": null\n },\n removeTokenIcon: {\n type: String,\n \"default\": null\n },\n chipIcon: {\n type: String,\n \"default\": null\n },\n virtualScrollerOptions: {\n type: Object,\n \"default\": null\n },\n autoOptionFocus: {\n type: Boolean,\n \"default\": false\n },\n selectOnFocus: {\n type: Boolean,\n \"default\": false\n },\n focusOnHover: {\n type: Boolean,\n \"default\": true\n },\n searchLocale: {\n type: String,\n \"default\": undefined\n },\n searchMessage: {\n type: String,\n \"default\": null\n },\n selectionMessage: {\n type: String,\n \"default\": null\n },\n emptySelectionMessage: {\n type: String,\n \"default\": null\n },\n emptySearchMessage: {\n type: String,\n \"default\": null\n },\n tabindex: {\n type: Number,\n \"default\": 0\n },\n typeahead: {\n type: Boolean,\n \"default\": true\n },\n ariaLabel: {\n type: String,\n \"default\": null\n },\n ariaLabelledby: {\n type: String,\n \"default\": null\n },\n fluid: {\n type: Boolean,\n \"default\": null\n }\n },\n style: AutoCompleteStyle,\n provide: function provide() {\n return {\n $pcAutoComplete: this,\n $parentInstance: this\n };\n }\n};\n\nfunction _typeof$1(o) { \"@babel/helpers - typeof\"; return _typeof$1 = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof$1(o); }\nfunction _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _iterableToArray(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nvar script = {\n name: 'AutoComplete',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['update:modelValue', 'change', 'focus', 'blur', 'item-select', 'item-unselect', 'option-select', 'option-unselect', 'dropdown-click', 'clear', 'complete', 'before-show', 'before-hide', 'show', 'hide'],\n inject: {\n $pcFluid: {\n \"default\": null\n }\n },\n outsideClickListener: null,\n resizeListener: null,\n scrollHandler: null,\n overlay: null,\n virtualScroller: null,\n searchTimeout: null,\n dirty: false,\n data: function data() {\n return {\n id: this.$attrs.id,\n clicked: false,\n focused: false,\n focusedOptionIndex: -1,\n focusedMultipleOptionIndex: -1,\n overlayVisible: false,\n searching: false\n };\n },\n watch: {\n '$attrs.id': function $attrsId(newValue) {\n this.id = newValue || UniqueComponentId();\n },\n suggestions: function suggestions() {\n if (this.searching) {\n this.show();\n this.focusedOptionIndex = this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;\n this.searching = false;\n }\n this.autoUpdateModel();\n }\n },\n mounted: function mounted() {\n this.id = this.id || UniqueComponentId();\n this.autoUpdateModel();\n },\n updated: function updated() {\n if (this.overlayVisible) {\n this.alignOverlay();\n }\n },\n beforeUnmount: function beforeUnmount() {\n this.unbindOutsideClickListener();\n this.unbindResizeListener();\n if (this.scrollHandler) {\n this.scrollHandler.destroy();\n this.scrollHandler = null;\n }\n if (this.overlay) {\n ZIndex.clear(this.overlay);\n this.overlay = null;\n }\n },\n methods: {\n getOptionIndex: function getOptionIndex(index, fn) {\n return this.virtualScrollerDisabled ? index : fn && fn(index)['index'];\n },\n getOptionLabel: function getOptionLabel(option) {\n return this.optionLabel ? resolveFieldData(option, this.optionLabel) : option;\n },\n getOptionValue: function getOptionValue(option) {\n return option; // TODO: The 'optionValue' properties can be added.\n },\n getOptionRenderKey: function getOptionRenderKey(option, index) {\n return (this.dataKey ? resolveFieldData(option, this.dataKey) : this.getOptionLabel(option)) + '_' + index;\n },\n getPTOptions: function getPTOptions(option, itemOptions, index, key) {\n return this.ptm(key, {\n context: {\n selected: this.isSelected(option),\n focused: this.focusedOptionIndex === this.getOptionIndex(index, itemOptions),\n disabled: this.isOptionDisabled(option)\n }\n });\n },\n isOptionDisabled: function isOptionDisabled(option) {\n return this.optionDisabled ? resolveFieldData(option, this.optionDisabled) : false;\n },\n isOptionGroup: function isOptionGroup(option) {\n return this.optionGroupLabel && option.optionGroup && option.group;\n },\n getOptionGroupLabel: function getOptionGroupLabel(optionGroup) {\n return resolveFieldData(optionGroup, this.optionGroupLabel);\n },\n getOptionGroupChildren: function getOptionGroupChildren(optionGroup) {\n return resolveFieldData(optionGroup, this.optionGroupChildren);\n },\n getAriaPosInset: function getAriaPosInset(index) {\n var _this = this;\n return (this.optionGroupLabel ? index - this.visibleOptions.slice(0, index).filter(function (option) {\n return _this.isOptionGroup(option);\n }).length : index) + 1;\n },\n show: function show(isFocus) {\n this.$emit('before-show');\n this.dirty = true;\n this.overlayVisible = true;\n this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;\n isFocus && focus(this.multiple ? this.$refs.focusInput : this.$refs.focusInput.$el);\n },\n hide: function hide(isFocus) {\n var _this2 = this;\n var _hide = function _hide() {\n _this2.$emit('before-hide');\n _this2.dirty = isFocus;\n _this2.overlayVisible = false;\n _this2.clicked = false;\n _this2.focusedOptionIndex = -1;\n isFocus && focus(_this2.multiple ? _this2.$refs.focusInput : _this2.$refs.focusInput.$el);\n };\n setTimeout(function () {\n _hide();\n }, 0); // For ScreenReaders\n },\n onFocus: function onFocus(event) {\n if (this.disabled) {\n // For ScreenReaders\n return;\n }\n if (!this.dirty && this.completeOnFocus) {\n this.search(event, event.target.value, 'focus');\n }\n this.dirty = true;\n this.focused = true;\n if (this.overlayVisible) {\n this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;\n this.scrollInView(this.focusedOptionIndex);\n }\n this.$emit('focus', event);\n },\n onBlur: function onBlur(event) {\n this.dirty = false;\n this.focused = false;\n this.focusedOptionIndex = -1;\n this.$emit('blur', event);\n },\n onKeyDown: function onKeyDown(event) {\n if (this.disabled) {\n event.preventDefault();\n return;\n }\n switch (event.code) {\n case 'ArrowDown':\n this.onArrowDownKey(event);\n break;\n case 'ArrowUp':\n this.onArrowUpKey(event);\n break;\n case 'ArrowLeft':\n this.onArrowLeftKey(event);\n break;\n case 'ArrowRight':\n this.onArrowRightKey(event);\n break;\n case 'Home':\n this.onHomeKey(event);\n break;\n case 'End':\n this.onEndKey(event);\n break;\n case 'PageDown':\n this.onPageDownKey(event);\n break;\n case 'PageUp':\n this.onPageUpKey(event);\n break;\n case 'Enter':\n case 'NumpadEnter':\n this.onEnterKey(event);\n break;\n case 'Escape':\n this.onEscapeKey(event);\n break;\n case 'Tab':\n this.onTabKey(event);\n break;\n case 'Backspace':\n this.onBackspaceKey(event);\n break;\n }\n this.clicked = false;\n },\n onInput: function onInput(event) {\n var _this3 = this;\n if (this.typeahead) {\n if (this.searchTimeout) {\n clearTimeout(this.searchTimeout);\n }\n var query = event.target.value;\n if (!this.multiple) {\n this.updateModel(event, query);\n }\n if (query.length === 0) {\n this.hide();\n this.$emit('clear');\n } else {\n if (query.length >= this.minLength) {\n this.focusedOptionIndex = -1;\n this.searchTimeout = setTimeout(function () {\n _this3.search(event, query, 'input');\n }, this.delay);\n } else {\n this.hide();\n }\n }\n }\n },\n onChange: function onChange(event) {\n var _this4 = this;\n if (this.forceSelection) {\n var valid = false;\n\n // when forceSelection is on, prevent called twice onOptionSelect()\n if (this.visibleOptions && !this.multiple) {\n var value = this.multiple ? this.$refs.focusInput.value : this.$refs.focusInput.$el.value;\n var matchedValue = this.visibleOptions.find(function (option) {\n return _this4.isOptionMatched(option, value || '');\n });\n if (matchedValue !== undefined) {\n valid = true;\n !this.isSelected(matchedValue) && this.onOptionSelect(event, matchedValue);\n }\n }\n if (!valid) {\n if (this.multiple) this.$refs.focusInput.value = '';else this.$refs.focusInput.$el.value = '';\n this.$emit('clear');\n !this.multiple && this.updateModel(event, null);\n }\n }\n },\n onMultipleContainerFocus: function onMultipleContainerFocus() {\n if (this.disabled) {\n // For ScreenReaders\n return;\n }\n this.focused = true;\n },\n onMultipleContainerBlur: function onMultipleContainerBlur() {\n this.focusedMultipleOptionIndex = -1;\n this.focused = false;\n },\n onMultipleContainerKeyDown: function onMultipleContainerKeyDown(event) {\n if (this.disabled) {\n event.preventDefault();\n return;\n }\n switch (event.code) {\n case 'ArrowLeft':\n this.onArrowLeftKeyOnMultiple(event);\n break;\n case 'ArrowRight':\n this.onArrowRightKeyOnMultiple(event);\n break;\n case 'Backspace':\n this.onBackspaceKeyOnMultiple(event);\n break;\n }\n },\n onContainerClick: function onContainerClick(event) {\n this.clicked = true;\n if (this.disabled || this.searching || this.loading || this.isInputClicked(event) || this.isDropdownClicked(event)) {\n return;\n }\n if (!this.overlay || !this.overlay.contains(event.target)) {\n focus(this.multiple ? this.$refs.focusInput : this.$refs.focusInput.$el);\n }\n },\n onDropdownClick: function onDropdownClick(event) {\n var query = undefined;\n if (this.overlayVisible) {\n this.hide(true);\n } else {\n var target = this.multiple ? this.$refs.focusInput : this.$refs.focusInput.$el;\n focus(target);\n query = target.value;\n if (this.dropdownMode === 'blank') this.search(event, '', 'dropdown');else if (this.dropdownMode === 'current') this.search(event, query, 'dropdown');\n }\n this.$emit('dropdown-click', {\n originalEvent: event,\n query: query\n });\n },\n onOptionSelect: function onOptionSelect(event, option) {\n var isHide = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n var value = this.getOptionValue(option);\n if (this.multiple) {\n this.$refs.focusInput.value = '';\n if (!this.isSelected(option)) {\n this.updateModel(event, [].concat(_toConsumableArray(this.modelValue || []), [value]));\n }\n } else {\n this.updateModel(event, value);\n }\n this.$emit('item-select', {\n originalEvent: event,\n value: option\n });\n this.$emit('option-select', {\n originalEvent: event,\n value: option\n });\n isHide && this.hide(true);\n },\n onOptionMouseMove: function onOptionMouseMove(event, index) {\n if (this.focusOnHover) {\n this.changeFocusedOptionIndex(event, index);\n }\n },\n onOverlayClick: function onOverlayClick(event) {\n OverlayEventBus.emit('overlay-click', {\n originalEvent: event,\n target: this.$el\n });\n },\n onOverlayKeyDown: function onOverlayKeyDown(event) {\n switch (event.code) {\n case 'Escape':\n this.onEscapeKey(event);\n break;\n }\n },\n onArrowDownKey: function onArrowDownKey(event) {\n if (!this.overlayVisible) {\n return;\n }\n var optionIndex = this.focusedOptionIndex !== -1 ? this.findNextOptionIndex(this.focusedOptionIndex) : this.clicked ? this.findFirstOptionIndex() : this.findFirstFocusedOptionIndex();\n this.changeFocusedOptionIndex(event, optionIndex);\n event.preventDefault();\n },\n onArrowUpKey: function onArrowUpKey(event) {\n if (!this.overlayVisible) {\n return;\n }\n if (event.altKey) {\n if (this.focusedOptionIndex !== -1) {\n this.onOptionSelect(event, this.visibleOptions[this.focusedOptionIndex]);\n }\n this.overlayVisible && this.hide();\n event.preventDefault();\n } else {\n var optionIndex = this.focusedOptionIndex !== -1 ? this.findPrevOptionIndex(this.focusedOptionIndex) : this.clicked ? this.findLastOptionIndex() : this.findLastFocusedOptionIndex();\n this.changeFocusedOptionIndex(event, optionIndex);\n event.preventDefault();\n }\n },\n onArrowLeftKey: function onArrowLeftKey(event) {\n var target = event.currentTarget;\n this.focusedOptionIndex = -1;\n if (this.multiple) {\n if (isEmpty(target.value) && this.hasSelectedOption) {\n focus(this.$refs.multiContainer);\n this.focusedMultipleOptionIndex = this.modelValue.length;\n } else {\n event.stopPropagation(); // To prevent onArrowLeftKeyOnMultiple method\n }\n }\n },\n onArrowRightKey: function onArrowRightKey(event) {\n this.focusedOptionIndex = -1;\n this.multiple && event.stopPropagation(); // To prevent onArrowRightKeyOnMultiple method\n },\n onHomeKey: function onHomeKey(event) {\n var currentTarget = event.currentTarget;\n var len = currentTarget.value.length;\n currentTarget.setSelectionRange(0, event.shiftKey ? len : 0);\n this.focusedOptionIndex = -1;\n event.preventDefault();\n },\n onEndKey: function onEndKey(event) {\n var currentTarget = event.currentTarget;\n var len = currentTarget.value.length;\n currentTarget.setSelectionRange(event.shiftKey ? 0 : len, len);\n this.focusedOptionIndex = -1;\n event.preventDefault();\n },\n onPageUpKey: function onPageUpKey(event) {\n this.scrollInView(0);\n event.preventDefault();\n },\n onPageDownKey: function onPageDownKey(event) {\n this.scrollInView(this.visibleOptions.length - 1);\n event.preventDefault();\n },\n onEnterKey: function onEnterKey(event) {\n if (!this.typeahead) {\n if (this.multiple) {\n this.updateModel(event, [].concat(_toConsumableArray(this.modelValue || []), [event.target.value]));\n this.$refs.focusInput.value = '';\n }\n } else {\n if (!this.overlayVisible) {\n this.focusedOptionIndex = -1; // reset\n this.onArrowDownKey(event);\n } else {\n if (this.focusedOptionIndex !== -1) {\n this.onOptionSelect(event, this.visibleOptions[this.focusedOptionIndex]);\n }\n this.hide();\n }\n }\n },\n onEscapeKey: function onEscapeKey(event) {\n this.overlayVisible && this.hide(true);\n event.preventDefault();\n },\n onTabKey: function onTabKey(event) {\n if (this.focusedOptionIndex !== -1) {\n this.onOptionSelect(event, this.visibleOptions[this.focusedOptionIndex]);\n }\n this.overlayVisible && this.hide();\n },\n onBackspaceKey: function onBackspaceKey(event) {\n if (this.multiple) {\n if (isNotEmpty(this.modelValue) && !this.$refs.focusInput.value) {\n var removedValue = this.modelValue[this.modelValue.length - 1];\n var newValue = this.modelValue.slice(0, -1);\n this.$emit('update:modelValue', newValue);\n this.$emit('item-unselect', {\n originalEvent: event,\n value: removedValue\n });\n this.$emit('option-unselect', {\n originalEvent: event,\n value: removedValue\n });\n }\n event.stopPropagation(); // To prevent onBackspaceKeyOnMultiple method\n }\n },\n onArrowLeftKeyOnMultiple: function onArrowLeftKeyOnMultiple() {\n this.focusedMultipleOptionIndex = this.focusedMultipleOptionIndex < 1 ? 0 : this.focusedMultipleOptionIndex - 1;\n },\n onArrowRightKeyOnMultiple: function onArrowRightKeyOnMultiple() {\n this.focusedMultipleOptionIndex++;\n if (this.focusedMultipleOptionIndex > this.modelValue.length - 1) {\n this.focusedMultipleOptionIndex = -1;\n focus(this.$refs.focusInput);\n }\n },\n onBackspaceKeyOnMultiple: function onBackspaceKeyOnMultiple(event) {\n if (this.focusedMultipleOptionIndex !== -1) {\n this.removeOption(event, this.focusedMultipleOptionIndex);\n }\n },\n onOverlayEnter: function onOverlayEnter(el) {\n ZIndex.set('overlay', el, this.$primevue.config.zIndex.overlay);\n addStyle(el, {\n position: 'absolute',\n top: '0',\n left: '0'\n });\n this.alignOverlay();\n },\n onOverlayAfterEnter: function onOverlayAfterEnter() {\n this.bindOutsideClickListener();\n this.bindScrollListener();\n this.bindResizeListener();\n this.$emit('show');\n },\n onOverlayLeave: function onOverlayLeave() {\n this.unbindOutsideClickListener();\n this.unbindScrollListener();\n this.unbindResizeListener();\n this.$emit('hide');\n this.overlay = null;\n },\n onOverlayAfterLeave: function onOverlayAfterLeave(el) {\n ZIndex.clear(el);\n },\n alignOverlay: function alignOverlay() {\n var target = this.multiple ? this.$refs.multiContainer : this.$refs.focusInput.$el;\n if (this.appendTo === 'self') {\n relativePosition(this.overlay, target);\n } else {\n this.overlay.style.minWidth = getOuterWidth(target) + 'px';\n absolutePosition(this.overlay, target);\n }\n },\n bindOutsideClickListener: function bindOutsideClickListener() {\n var _this5 = this;\n if (!this.outsideClickListener) {\n this.outsideClickListener = function (event) {\n if (_this5.overlayVisible && _this5.overlay && _this5.isOutsideClicked(event)) {\n _this5.hide();\n }\n };\n document.addEventListener('click', this.outsideClickListener);\n }\n },\n unbindOutsideClickListener: function unbindOutsideClickListener() {\n if (this.outsideClickListener) {\n document.removeEventListener('click', this.outsideClickListener);\n this.outsideClickListener = null;\n }\n },\n bindScrollListener: function bindScrollListener() {\n var _this6 = this;\n if (!this.scrollHandler) {\n this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, function () {\n if (_this6.overlayVisible) {\n _this6.hide();\n }\n });\n }\n this.scrollHandler.bindScrollListener();\n },\n unbindScrollListener: function unbindScrollListener() {\n if (this.scrollHandler) {\n this.scrollHandler.unbindScrollListener();\n }\n },\n bindResizeListener: function bindResizeListener() {\n var _this7 = this;\n if (!this.resizeListener) {\n this.resizeListener = function () {\n if (_this7.overlayVisible && !isTouchDevice()) {\n _this7.hide();\n }\n };\n window.addEventListener('resize', this.resizeListener);\n }\n },\n unbindResizeListener: function unbindResizeListener() {\n if (this.resizeListener) {\n window.removeEventListener('resize', this.resizeListener);\n this.resizeListener = null;\n }\n },\n isOutsideClicked: function isOutsideClicked(event) {\n return !this.overlay.contains(event.target) && !this.isInputClicked(event) && !this.isDropdownClicked(event);\n },\n isInputClicked: function isInputClicked(event) {\n if (this.multiple) return event.target === this.$refs.multiContainer || this.$refs.multiContainer.contains(event.target);else return event.target === this.$refs.focusInput.$el;\n },\n isDropdownClicked: function isDropdownClicked(event) {\n return this.$refs.dropdownButton ? event.target === this.$refs.dropdownButton || this.$refs.dropdownButton.contains(event.target) : false;\n },\n isOptionMatched: function isOptionMatched(option, value) {\n var _this$getOptionLabel;\n return this.isValidOption(option) && ((_this$getOptionLabel = this.getOptionLabel(option)) === null || _this$getOptionLabel === void 0 ? void 0 : _this$getOptionLabel.toLocaleLowerCase(this.searchLocale)) === value.toLocaleLowerCase(this.searchLocale);\n },\n isValidOption: function isValidOption(option) {\n return isNotEmpty(option) && !(this.isOptionDisabled(option) || this.isOptionGroup(option));\n },\n isValidSelectedOption: function isValidSelectedOption(option) {\n return this.isValidOption(option) && this.isSelected(option);\n },\n isEquals: function isEquals(value1, value2) {\n return equals(value1, value2, this.equalityKey);\n },\n isSelected: function isSelected(option) {\n var _this8 = this;\n var optionValue = this.getOptionValue(option);\n return this.multiple ? (this.modelValue || []).some(function (value) {\n return _this8.isEquals(value, optionValue);\n }) : this.isEquals(this.modelValue, this.getOptionValue(option));\n },\n findFirstOptionIndex: function findFirstOptionIndex() {\n var _this9 = this;\n return this.visibleOptions.findIndex(function (option) {\n return _this9.isValidOption(option);\n });\n },\n findLastOptionIndex: function findLastOptionIndex() {\n var _this10 = this;\n return findLastIndex(this.visibleOptions, function (option) {\n return _this10.isValidOption(option);\n });\n },\n findNextOptionIndex: function findNextOptionIndex(index) {\n var _this11 = this;\n var matchedOptionIndex = index < this.visibleOptions.length - 1 ? this.visibleOptions.slice(index + 1).findIndex(function (option) {\n return _this11.isValidOption(option);\n }) : -1;\n return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index;\n },\n findPrevOptionIndex: function findPrevOptionIndex(index) {\n var _this12 = this;\n var matchedOptionIndex = index > 0 ? findLastIndex(this.visibleOptions.slice(0, index), function (option) {\n return _this12.isValidOption(option);\n }) : -1;\n return matchedOptionIndex > -1 ? matchedOptionIndex : index;\n },\n findSelectedOptionIndex: function findSelectedOptionIndex() {\n var _this13 = this;\n return this.hasSelectedOption ? this.visibleOptions.findIndex(function (option) {\n return _this13.isValidSelectedOption(option);\n }) : -1;\n },\n findFirstFocusedOptionIndex: function findFirstFocusedOptionIndex() {\n var selectedIndex = this.findSelectedOptionIndex();\n return selectedIndex < 0 ? this.findFirstOptionIndex() : selectedIndex;\n },\n findLastFocusedOptionIndex: function findLastFocusedOptionIndex() {\n var selectedIndex = this.findSelectedOptionIndex();\n return selectedIndex < 0 ? this.findLastOptionIndex() : selectedIndex;\n },\n search: function search(event, query, source) {\n //allow empty string but not undefined or null\n if (query === undefined || query === null) {\n return;\n }\n\n //do not search blank values on input change\n if (source === 'input' && query.trim().length === 0) {\n return;\n }\n this.searching = true;\n this.$emit('complete', {\n originalEvent: event,\n query: query\n });\n },\n removeOption: function removeOption(event, index) {\n var _this14 = this;\n var removedOption = this.modelValue[index];\n var value = this.modelValue.filter(function (_, i) {\n return i !== index;\n }).map(function (option) {\n return _this14.getOptionValue(option);\n });\n this.updateModel(event, value);\n this.$emit('item-unselect', {\n originalEvent: event,\n value: removedOption\n });\n this.$emit('option-unselect', {\n originalEvent: event,\n value: removedOption\n });\n this.dirty = true;\n focus(this.multiple ? this.$refs.focusInput : this.$refs.focusInput.$el);\n },\n changeFocusedOptionIndex: function changeFocusedOptionIndex(event, index) {\n if (this.focusedOptionIndex !== index) {\n this.focusedOptionIndex = index;\n this.scrollInView();\n if (this.selectOnFocus) {\n this.onOptionSelect(event, this.visibleOptions[index], false);\n }\n }\n },\n scrollInView: function scrollInView() {\n var _this15 = this;\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;\n this.$nextTick(function () {\n var id = index !== -1 ? \"\".concat(_this15.id, \"_\").concat(index) : _this15.focusedOptionId;\n var element = findSingle(_this15.list, \"li[id=\\\"\".concat(id, \"\\\"]\"));\n if (element) {\n element.scrollIntoView && element.scrollIntoView({\n block: 'nearest',\n inline: 'start'\n });\n } else if (!_this15.virtualScrollerDisabled) {\n _this15.virtualScroller && _this15.virtualScroller.scrollToIndex(index !== -1 ? index : _this15.focusedOptionIndex);\n }\n });\n },\n autoUpdateModel: function autoUpdateModel() {\n if (this.selectOnFocus && this.autoOptionFocus && !this.hasSelectedOption) {\n this.focusedOptionIndex = this.findFirstFocusedOptionIndex();\n this.onOptionSelect(null, this.visibleOptions[this.focusedOptionIndex], false);\n }\n },\n updateModel: function updateModel(event, value) {\n this.$emit('update:modelValue', value);\n this.$emit('change', {\n originalEvent: event,\n value: value\n });\n },\n flatOptions: function flatOptions(options) {\n var _this16 = this;\n return (options || []).reduce(function (result, option, index) {\n result.push({\n optionGroup: option,\n group: true,\n index: index\n });\n var optionGroupChildren = _this16.getOptionGroupChildren(option);\n optionGroupChildren && optionGroupChildren.forEach(function (o) {\n return result.push(o);\n });\n return result;\n }, []);\n },\n overlayRef: function overlayRef(el) {\n this.overlay = el;\n },\n listRef: function listRef(el, contentRef) {\n this.list = el;\n contentRef && contentRef(el); // For VirtualScroller\n },\n virtualScrollerRef: function virtualScrollerRef(el) {\n this.virtualScroller = el;\n }\n },\n computed: {\n visibleOptions: function visibleOptions() {\n return this.optionGroupLabel ? this.flatOptions(this.suggestions) : this.suggestions || [];\n },\n inputValue: function inputValue() {\n if (isNotEmpty(this.modelValue)) {\n if (_typeof$1(this.modelValue) === 'object') {\n var label = this.getOptionLabel(this.modelValue);\n return label != null ? label : this.modelValue;\n } else {\n return this.modelValue;\n }\n } else {\n return '';\n }\n },\n hasSelectedOption: function hasSelectedOption() {\n return isNotEmpty(this.modelValue);\n },\n equalityKey: function equalityKey() {\n return this.dataKey; // TODO: The 'optionValue' properties can be added.\n },\n searchResultMessageText: function searchResultMessageText() {\n return isNotEmpty(this.visibleOptions) && this.overlayVisible ? this.searchMessageText.replaceAll('{0}', this.visibleOptions.length) : this.emptySearchMessageText;\n },\n searchMessageText: function searchMessageText() {\n return this.searchMessage || this.$primevue.config.locale.searchMessage || '';\n },\n emptySearchMessageText: function emptySearchMessageText() {\n return this.emptySearchMessage || this.$primevue.config.locale.emptySearchMessage || '';\n },\n selectionMessageText: function selectionMessageText() {\n return this.selectionMessage || this.$primevue.config.locale.selectionMessage || '';\n },\n emptySelectionMessageText: function emptySelectionMessageText() {\n return this.emptySelectionMessage || this.$primevue.config.locale.emptySelectionMessage || '';\n },\n selectedMessageText: function selectedMessageText() {\n return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', this.multiple ? this.modelValue.length : '1') : this.emptySelectionMessageText;\n },\n listAriaLabel: function listAriaLabel() {\n return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.listLabel : undefined;\n },\n focusedOptionId: function focusedOptionId() {\n return this.focusedOptionIndex !== -1 ? \"\".concat(this.id, \"_\").concat(this.focusedOptionIndex) : null;\n },\n focusedMultipleOptionId: function focusedMultipleOptionId() {\n return this.focusedMultipleOptionIndex !== -1 ? \"\".concat(this.id, \"_multiple_option_\").concat(this.focusedMultipleOptionIndex) : null;\n },\n ariaSetSize: function ariaSetSize() {\n var _this17 = this;\n return this.visibleOptions.filter(function (option) {\n return !_this17.isOptionGroup(option);\n }).length;\n },\n virtualScrollerDisabled: function virtualScrollerDisabled() {\n return !this.virtualScrollerOptions;\n },\n panelId: function panelId() {\n return this.id + '_panel';\n },\n hasFluid: function hasFluid() {\n return isEmpty(this.fluid) ? !!this.$pcFluid : this.fluid;\n }\n },\n components: {\n InputText: InputText,\n VirtualScroller: VirtualScroller,\n Portal: Portal,\n ChevronDownIcon: ChevronDownIcon,\n SpinnerIcon: SpinnerIcon,\n Chip: Chip\n },\n directives: {\n ripple: Ripple\n }\n};\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar _hoisted_1 = [\"aria-activedescendant\"];\nvar _hoisted_2 = [\"id\", \"aria-label\", \"aria-setsize\", \"aria-posinset\"];\nvar _hoisted_3 = [\"id\", \"placeholder\", \"tabindex\", \"disabled\", \"aria-label\", \"aria-labelledby\", \"aria-expanded\", \"aria-controls\", \"aria-activedescendant\", \"aria-invalid\"];\nvar _hoisted_4 = [\"disabled\", \"aria-expanded\", \"aria-controls\"];\nvar _hoisted_5 = [\"id\"];\nvar _hoisted_6 = [\"id\", \"aria-label\"];\nvar _hoisted_7 = [\"id\"];\nvar _hoisted_8 = [\"id\", \"aria-label\", \"aria-selected\", \"aria-disabled\", \"aria-setsize\", \"aria-posinset\", \"onClick\", \"onMousemove\", \"data-p-selected\", \"data-p-focus\", \"data-p-disabled\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_InputText = resolveComponent(\"InputText\");\n var _component_Chip = resolveComponent(\"Chip\");\n var _component_SpinnerIcon = resolveComponent(\"SpinnerIcon\");\n var _component_VirtualScroller = resolveComponent(\"VirtualScroller\");\n var _component_Portal = resolveComponent(\"Portal\");\n var _directive_ripple = resolveDirective(\"ripple\");\n return openBlock(), createElementBlock(\"div\", mergeProps({\n ref: \"container\",\n \"class\": _ctx.cx('root'),\n style: _ctx.sx('root'),\n onClick: _cache[11] || (_cache[11] = function () {\n return $options.onContainerClick && $options.onContainerClick.apply($options, arguments);\n })\n }, _ctx.ptmi('root')), [!_ctx.multiple ? (openBlock(), createBlock(_component_InputText, {\n key: 0,\n ref: \"focusInput\",\n id: _ctx.inputId,\n type: \"text\",\n \"class\": normalizeClass([_ctx.cx('pcInput'), _ctx.inputClass]),\n style: normalizeStyle(_ctx.inputStyle),\n value: $options.inputValue,\n placeholder: _ctx.placeholder,\n tabindex: !_ctx.disabled ? _ctx.tabindex : -1,\n fluid: $options.hasFluid,\n disabled: _ctx.disabled,\n invalid: _ctx.invalid,\n variant: _ctx.variant,\n autocomplete: \"off\",\n role: \"combobox\",\n \"aria-label\": _ctx.ariaLabel,\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-haspopup\": \"listbox\",\n \"aria-autocomplete\": \"list\",\n \"aria-expanded\": $data.overlayVisible,\n \"aria-controls\": $options.panelId,\n \"aria-activedescendant\": $data.focused ? $options.focusedOptionId : undefined,\n onFocus: $options.onFocus,\n onBlur: $options.onBlur,\n onKeydown: $options.onKeyDown,\n onInput: $options.onInput,\n onChange: $options.onChange,\n unstyled: _ctx.unstyled,\n pt: _ctx.ptm('pcInput')\n }, null, 8, [\"id\", \"class\", \"style\", \"value\", \"placeholder\", \"tabindex\", \"fluid\", \"disabled\", \"invalid\", \"variant\", \"aria-label\", \"aria-labelledby\", \"aria-expanded\", \"aria-controls\", \"aria-activedescendant\", \"onFocus\", \"onBlur\", \"onKeydown\", \"onInput\", \"onChange\", \"unstyled\", \"pt\"])) : createCommentVNode(\"\", true), _ctx.multiple ? (openBlock(), createElementBlock(\"ul\", mergeProps({\n key: 1,\n ref: \"multiContainer\",\n \"class\": _ctx.cx('inputMultiple'),\n tabindex: \"-1\",\n role: \"listbox\",\n \"aria-orientation\": \"horizontal\",\n \"aria-activedescendant\": $data.focused ? $options.focusedMultipleOptionId : undefined,\n onFocus: _cache[5] || (_cache[5] = function () {\n return $options.onMultipleContainerFocus && $options.onMultipleContainerFocus.apply($options, arguments);\n }),\n onBlur: _cache[6] || (_cache[6] = function () {\n return $options.onMultipleContainerBlur && $options.onMultipleContainerBlur.apply($options, arguments);\n }),\n onKeydown: _cache[7] || (_cache[7] = function () {\n return $options.onMultipleContainerKeyDown && $options.onMultipleContainerKeyDown.apply($options, arguments);\n })\n }, _ctx.ptm('inputMultiple')), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.modelValue, function (option, i) {\n return openBlock(), createElementBlock(\"li\", mergeProps({\n key: \"\".concat(i, \"_\").concat($options.getOptionLabel(option)),\n id: $data.id + '_multiple_option_' + i,\n \"class\": _ctx.cx('chipItem', {\n i: i\n }),\n role: \"option\",\n \"aria-label\": $options.getOptionLabel(option),\n \"aria-selected\": true,\n \"aria-setsize\": _ctx.modelValue.length,\n \"aria-posinset\": i + 1,\n ref_for: true\n }, _ctx.ptm('chipItem')), [renderSlot(_ctx.$slots, \"chip\", mergeProps({\n \"class\": _ctx.cx('pcChip'),\n value: option,\n index: i,\n removeCallback: function removeCallback(event) {\n return $options.removeOption(event, i);\n },\n ref_for: true\n }, _ctx.ptm('pcChip')), function () {\n return [createVNode(_component_Chip, {\n \"class\": normalizeClass(_ctx.cx('pcChip')),\n label: $options.getOptionLabel(option),\n removeIcon: _ctx.chipIcon || _ctx.removeTokenIcon,\n removable: \"\",\n unstyled: _ctx.unstyled,\n onRemove: function onRemove($event) {\n return $options.removeOption($event, i);\n },\n pt: _ctx.ptm('pcChip')\n }, {\n removeicon: withCtx(function () {\n return [renderSlot(_ctx.$slots, _ctx.$slots.chipicon ? 'chipicon' : 'removetokenicon', {\n \"class\": normalizeClass(_ctx.cx('chipIcon')),\n index: i,\n removeCallback: function removeCallback(event) {\n return $options.removeOption(event, i);\n }\n })];\n }),\n _: 2\n }, 1032, [\"class\", \"label\", \"removeIcon\", \"unstyled\", \"onRemove\", \"pt\"])];\n })], 16, _hoisted_2);\n }), 128)), createElementVNode(\"li\", mergeProps({\n \"class\": _ctx.cx('inputChip'),\n role: \"option\"\n }, _ctx.ptm('inputChip')), [createElementVNode(\"input\", mergeProps({\n ref: \"focusInput\",\n id: _ctx.inputId,\n type: \"text\",\n style: _ctx.inputStyle,\n \"class\": _ctx.inputClass,\n placeholder: _ctx.placeholder,\n tabindex: !_ctx.disabled ? _ctx.tabindex : -1,\n disabled: _ctx.disabled,\n autocomplete: \"off\",\n role: \"combobox\",\n \"aria-label\": _ctx.ariaLabel,\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-haspopup\": \"listbox\",\n \"aria-autocomplete\": \"list\",\n \"aria-expanded\": $data.overlayVisible,\n \"aria-controls\": $data.id + '_list',\n \"aria-activedescendant\": $data.focused ? $options.focusedOptionId : undefined,\n \"aria-invalid\": _ctx.invalid || undefined,\n onFocus: _cache[0] || (_cache[0] = function () {\n return $options.onFocus && $options.onFocus.apply($options, arguments);\n }),\n onBlur: _cache[1] || (_cache[1] = function () {\n return $options.onBlur && $options.onBlur.apply($options, arguments);\n }),\n onKeydown: _cache[2] || (_cache[2] = function () {\n return $options.onKeyDown && $options.onKeyDown.apply($options, arguments);\n }),\n onInput: _cache[3] || (_cache[3] = function () {\n return $options.onInput && $options.onInput.apply($options, arguments);\n }),\n onChange: _cache[4] || (_cache[4] = function () {\n return $options.onChange && $options.onChange.apply($options, arguments);\n })\n }, _ctx.ptm('input')), null, 16, _hoisted_3)], 16)], 16, _hoisted_1)) : createCommentVNode(\"\", true), $data.searching || _ctx.loading ? renderSlot(_ctx.$slots, _ctx.$slots.loader ? 'loader' : 'loadingicon', {\n key: 2,\n \"class\": normalizeClass(_ctx.cx('loader'))\n }, function () {\n return [_ctx.loader || _ctx.loadingIcon ? (openBlock(), createElementBlock(\"i\", mergeProps({\n key: 0,\n \"class\": ['pi-spin', _ctx.cx('loader'), _ctx.loader, _ctx.loadingIcon],\n \"aria-hidden\": \"true\"\n }, _ctx.ptm('loader')), null, 16)) : (openBlock(), createBlock(_component_SpinnerIcon, mergeProps({\n key: 1,\n \"class\": _ctx.cx('loader'),\n spin: \"\",\n \"aria-hidden\": \"true\"\n }, _ctx.ptm('loader')), null, 16, [\"class\"]))];\n }) : createCommentVNode(\"\", true), renderSlot(_ctx.$slots, _ctx.$slots.dropdown ? 'dropdown' : 'dropdownbutton', {\n toggleCallback: function toggleCallback(event) {\n return $options.onDropdownClick(event);\n }\n }, function () {\n return [_ctx.dropdown ? (openBlock(), createElementBlock(\"button\", mergeProps({\n key: 0,\n ref: \"dropdownButton\",\n type: \"button\",\n \"class\": [_ctx.cx('dropdown'), _ctx.dropdownClass],\n disabled: _ctx.disabled,\n \"aria-haspopup\": \"listbox\",\n \"aria-expanded\": $data.overlayVisible,\n \"aria-controls\": $options.panelId,\n onClick: _cache[8] || (_cache[8] = function () {\n return $options.onDropdownClick && $options.onDropdownClick.apply($options, arguments);\n })\n }, _ctx.ptm('dropdown')), [renderSlot(_ctx.$slots, \"dropdownicon\", {\n \"class\": normalizeClass(_ctx.dropdownIcon)\n }, function () {\n return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.dropdownIcon ? 'span' : 'ChevronDownIcon'), mergeProps({\n \"class\": _ctx.dropdownIcon\n }, _ctx.ptm('dropdownIcon')), null, 16, [\"class\"]))];\n })], 16, _hoisted_4)) : createCommentVNode(\"\", true)];\n }), createElementVNode(\"span\", mergeProps({\n role: \"status\",\n \"aria-live\": \"polite\",\n \"class\": \"p-hidden-accessible\"\n }, _ctx.ptm('hiddenSearchResult'), {\n \"data-p-hidden-accessible\": true\n }), toDisplayString($options.searchResultMessageText), 17), createVNode(_component_Portal, {\n appendTo: _ctx.appendTo\n }, {\n \"default\": withCtx(function () {\n return [createVNode(Transition, mergeProps({\n name: \"p-connected-overlay\",\n onEnter: $options.onOverlayEnter,\n onAfterEnter: $options.onOverlayAfterEnter,\n onLeave: $options.onOverlayLeave,\n onAfterLeave: $options.onOverlayAfterLeave\n }, _ctx.ptm('transition')), {\n \"default\": withCtx(function () {\n return [$data.overlayVisible ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n ref: $options.overlayRef,\n id: $options.panelId,\n \"class\": [_ctx.cx('overlay'), _ctx.panelClass, _ctx.overlayClass],\n style: _objectSpread(_objectSpread(_objectSpread({}, _ctx.panelStyle), _ctx.overlayStyle), {}, {\n 'max-height': $options.virtualScrollerDisabled ? _ctx.scrollHeight : ''\n }),\n onClick: _cache[9] || (_cache[9] = function () {\n return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments);\n }),\n onKeydown: _cache[10] || (_cache[10] = function () {\n return $options.onOverlayKeyDown && $options.onOverlayKeyDown.apply($options, arguments);\n })\n }, _ctx.ptm('overlay')), [renderSlot(_ctx.$slots, \"header\", {\n value: _ctx.modelValue,\n suggestions: $options.visibleOptions\n }), createVNode(_component_VirtualScroller, mergeProps({\n ref: $options.virtualScrollerRef\n }, _ctx.virtualScrollerOptions, {\n style: {\n height: _ctx.scrollHeight\n },\n items: $options.visibleOptions,\n tabindex: -1,\n disabled: $options.virtualScrollerDisabled,\n pt: _ctx.ptm('virtualScroller')\n }), createSlots({\n content: withCtx(function (_ref) {\n var styleClass = _ref.styleClass,\n contentRef = _ref.contentRef,\n items = _ref.items,\n getItemOptions = _ref.getItemOptions,\n contentStyle = _ref.contentStyle,\n itemSize = _ref.itemSize;\n return [createElementVNode(\"ul\", mergeProps({\n ref: function ref(el) {\n return $options.listRef(el, contentRef);\n },\n id: $data.id + '_list',\n \"class\": [_ctx.cx('list'), styleClass],\n style: contentStyle,\n role: \"listbox\",\n \"aria-label\": $options.listAriaLabel\n }, _ctx.ptm('list')), [(openBlock(true), createElementBlock(Fragment, null, renderList(items, function (option, i) {\n return openBlock(), createElementBlock(Fragment, {\n key: $options.getOptionRenderKey(option, $options.getOptionIndex(i, getItemOptions))\n }, [$options.isOptionGroup(option) ? (openBlock(), createElementBlock(\"li\", mergeProps({\n key: 0,\n id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),\n style: {\n height: itemSize ? itemSize + 'px' : undefined\n },\n \"class\": _ctx.cx('optionGroup'),\n role: \"option\",\n ref_for: true\n }, _ctx.ptm('optionGroup')), [renderSlot(_ctx.$slots, \"optiongroup\", {\n option: option.optionGroup,\n index: $options.getOptionIndex(i, getItemOptions)\n }, function () {\n return [createTextVNode(toDisplayString($options.getOptionGroupLabel(option.optionGroup)), 1)];\n })], 16, _hoisted_7)) : withDirectives((openBlock(), createElementBlock(\"li\", mergeProps({\n key: 1,\n id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),\n style: {\n height: itemSize ? itemSize + 'px' : undefined\n },\n \"class\": _ctx.cx('option', {\n option: option,\n i: i,\n getItemOptions: getItemOptions\n }),\n role: \"option\",\n \"aria-label\": $options.getOptionLabel(option),\n \"aria-selected\": $options.isSelected(option),\n \"aria-disabled\": $options.isOptionDisabled(option),\n \"aria-setsize\": $options.ariaSetSize,\n \"aria-posinset\": $options.getAriaPosInset($options.getOptionIndex(i, getItemOptions)),\n onClick: function onClick($event) {\n return $options.onOptionSelect($event, option);\n },\n onMousemove: function onMousemove($event) {\n return $options.onOptionMouseMove($event, $options.getOptionIndex(i, getItemOptions));\n },\n \"data-p-selected\": $options.isSelected(option),\n \"data-p-focus\": $data.focusedOptionIndex === $options.getOptionIndex(i, getItemOptions),\n \"data-p-disabled\": $options.isOptionDisabled(option),\n ref_for: true\n }, $options.getPTOptions(option, getItemOptions, i, 'option')), [renderSlot(_ctx.$slots, \"option\", {\n option: option,\n index: $options.getOptionIndex(i, getItemOptions)\n }, function () {\n return [createTextVNode(toDisplayString($options.getOptionLabel(option)), 1)];\n })], 16, _hoisted_8)), [[_directive_ripple]])], 64);\n }), 128)), !items || items && items.length === 0 ? (openBlock(), createElementBlock(\"li\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('emptyMessage'),\n role: \"option\"\n }, _ctx.ptm('emptyMessage')), [renderSlot(_ctx.$slots, \"empty\", {}, function () {\n return [createTextVNode(toDisplayString($options.searchResultMessageText), 1)];\n })], 16)) : createCommentVNode(\"\", true)], 16, _hoisted_6)];\n }),\n _: 2\n }, [_ctx.$slots.loader ? {\n name: \"loader\",\n fn: withCtx(function (_ref2) {\n var options = _ref2.options;\n return [renderSlot(_ctx.$slots, \"loader\", {\n options: options\n })];\n }),\n key: \"0\"\n } : undefined]), 1040, [\"style\", \"items\", \"disabled\", \"pt\"]), renderSlot(_ctx.$slots, \"footer\", {\n value: _ctx.modelValue,\n suggestions: $options.visibleOptions\n }), createElementVNode(\"span\", mergeProps({\n role: \"status\",\n \"aria-live\": \"polite\",\n \"class\": \"p-hidden-accessible\"\n }, _ctx.ptm('hiddenSelectedMessage'), {\n \"data-p-hidden-accessible\": true\n }), toDisplayString($options.selectedMessageText), 17)], 16, _hoisted_5)) : createCommentVNode(\"\", true)];\n }),\n _: 3\n }, 16, [\"onEnter\", \"onAfterEnter\", \"onLeave\", \"onAfterLeave\"])];\n }),\n _: 3\n }, 8, [\"appendTo\"])], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n","\n\n\n\n\n","\n\n\n","import type {\n ConnectingLink,\n LGraphNode,\n Vector2,\n INodeInputSlot,\n INodeOutputSlot,\n INodeSlot,\n ISlotType\n} from '@comfyorg/litegraph'\nimport { LiteGraph } from '@comfyorg/litegraph'\nimport { RerouteId } from '@comfyorg/litegraph/dist/Reroute'\n\nexport class ConnectingLinkImpl implements ConnectingLink {\n constructor(\n public node: LGraphNode,\n public slot: number,\n public input: INodeInputSlot | undefined,\n public output: INodeOutputSlot | undefined,\n public pos: Vector2,\n public afterRerouteId?: RerouteId\n ) {}\n\n static createFromPlainObject(obj: ConnectingLink) {\n return new ConnectingLinkImpl(\n obj.node,\n obj.slot,\n obj.input,\n obj.output,\n obj.pos,\n obj.afterRerouteId\n )\n }\n\n get type(): ISlotType | null {\n const result = this.input ? this.input.type : this.output?.type ?? null\n return result === -1 ? null : result\n }\n\n /**\n * Which slot type is release and need to be reconnected.\n * - 'output' means we need a new node's outputs slot to connect with this link\n */\n get releaseSlotType(): 'input' | 'output' {\n return this.output ? 'input' : 'output'\n }\n\n connectTo(newNode: LGraphNode) {\n const newNodeSlots =\n this.releaseSlotType === 'output' ? newNode.outputs : newNode.inputs\n if (!newNodeSlots) return\n\n const newNodeSlot = newNodeSlots.findIndex((slot: INodeSlot) =>\n LiteGraph.isValidConnection(slot.type, this.type)\n )\n\n if (newNodeSlot === -1) {\n console.warn(\n `Could not find slot with type ${this.type} on node ${newNode.title}. This should never happen`\n )\n return\n }\n\n if (this.releaseSlotType === 'input') {\n this.node.connect(this.slot, newNode, newNodeSlot, this.afterRerouteId)\n } else {\n newNode.connect(newNodeSlot, this.node, this.slot, this.afterRerouteId)\n }\n }\n}\n\nexport type CanvasDragAndDropData = {\n type: 'add-node'\n data: T\n}\n","import { defineStore } from 'pinia'\nimport { ref } from 'vue'\n\nexport const useSearchBoxStore = defineStore('searchBox', () => {\n const visible = ref(false)\n function toggleVisible() {\n visible.value = !visible.value\n }\n\n return {\n visible,\n toggleVisible\n }\n})\n","\n\n\n\n\n","\n\n\n\n\n","\n\n\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n _ref.dt;\n return \"\\n.p-buttongroup .p-button {\\n margin: 0;\\n}\\n\\n.p-buttongroup .p-button:not(:last-child),\\n.p-buttongroup .p-button:not(:last-child):hover {\\n border-right: 0 none;\\n}\\n\\n.p-buttongroup .p-button:not(:first-of-type):not(:last-of-type) {\\n border-radius: 0;\\n}\\n\\n.p-buttongroup .p-button:first-of-type:not(:only-of-type) {\\n border-top-right-radius: 0;\\n border-bottom-right-radius: 0;\\n}\\n\\n.p-buttongroup .p-button:last-of-type:not(:only-of-type) {\\n border-top-left-radius: 0;\\n border-bottom-left-radius: 0;\\n}\\n\\n.p-buttongroup .p-button:focus {\\n position: relative;\\n z-index: 1;\\n}\\n\";\n};\nvar classes = {\n root: 'p-buttongroup p-component'\n};\nvar ButtonGroupStyle = BaseStyle.extend({\n name: 'buttongroup',\n theme: theme,\n classes: classes\n});\n\nexport { ButtonGroupStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseComponent from '@primevue/core/basecomponent';\nimport ButtonGroupStyle from 'primevue/buttongroup/style';\nimport { openBlock, createElementBlock, mergeProps, renderSlot } from 'vue';\n\nvar script$1 = {\n name: 'BaseButtonGroup',\n \"extends\": BaseComponent,\n style: ButtonGroupStyle,\n provide: function provide() {\n return {\n $pcButtonGroup: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'ButtonGroup',\n \"extends\": script$1,\n inheritAttrs: false\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps({\n \"class\": _ctx.cx('root'),\n role: \"group\"\n }, _ctx.ptmi('root')), [renderSlot(_ctx.$slots, \"default\")], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n\n\n","\n\n\n","\n\n\n\n\n","import BaseStyle from '@primevue/core/base/style';\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-toast {\\n width: \".concat(dt('toast.width'), \";\\n white-space: pre-line;\\n word-break: break-word;\\n}\\n\\n.p-toast-message {\\n margin: 0 0 1rem 0;\\n}\\n\\n.p-toast-message-icon {\\n flex-shrink: 0;\\n font-size: \").concat(dt('toast.icon.size'), \";\\n width: \").concat(dt('toast.icon.size'), \";\\n height: \").concat(dt('toast.icon.size'), \";\\n}\\n\\n.p-toast-message-content {\\n display: flex;\\n align-items: flex-start;\\n padding: \").concat(dt('toast.content.padding'), \";\\n gap: \").concat(dt('toast.content.gap'), \";\\n}\\n\\n.p-toast-message-text {\\n flex: 1 1 auto;\\n display: flex;\\n flex-direction: column;\\n gap: \").concat(dt('toast.text.gap'), \";\\n}\\n\\n.p-toast-summary {\\n font-weight: \").concat(dt('toast.summary.font.weight'), \";\\n font-size: \").concat(dt('toast.summary.font.size'), \";\\n}\\n\\n.p-toast-detail {\\n font-weight: \").concat(dt('toast.detail.font.weight'), \";\\n font-size: \").concat(dt('toast.detail.font.size'), \";\\n}\\n\\n.p-toast-close-button {\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n overflow: hidden;\\n position: relative;\\n cursor: pointer;\\n background: transparent;\\n transition: background \").concat(dt('toast.transition.duration'), \", color \").concat(dt('toast.transition.duration'), \", outline-color \").concat(dt('toast.transition.duration'), \", box-shadow \").concat(dt('toast.transition.duration'), \";\\n outline-color: transparent;\\n color: inherit;\\n width: \").concat(dt('toast.close.button.width'), \";\\n height: \").concat(dt('toast.close.button.height'), \";\\n border-radius: \").concat(dt('toast.close.button.border.radius'), \";\\n margin: -25% 0 0 0;\\n right: -25%;\\n padding: 0;\\n border: none;\\n user-select: none;\\n}\\n\\n.p-toast-message-info,\\n.p-toast-message-success,\\n.p-toast-message-warn,\\n.p-toast-message-error,\\n.p-toast-message-secondary,\\n.p-toast-message-contrast {\\n border-width: \").concat(dt('toast.border.width'), \";\\n border-style: solid;\\n backdrop-filter: blur(\").concat(dt('toast.blur'), \");\\n border-radius: \").concat(dt('toast.border.radius'), \";\\n}\\n\\n.p-toast-close-icon {\\n font-size: \").concat(dt('toast.close.icon.size'), \";\\n width: \").concat(dt('toast.close.icon.size'), \";\\n height: \").concat(dt('toast.close.icon.size'), \";\\n}\\n\\n.p-toast-close-button:focus-visible {\\n outline-width: \").concat(dt('focus.ring.width'), \";\\n outline-style: \").concat(dt('focus.ring.style'), \";\\n outline-offset: \").concat(dt('focus.ring.offset'), \";\\n}\\n\\n.p-toast-message-info {\\n background: \").concat(dt('toast.info.background'), \";\\n border-color: \").concat(dt('toast.info.border.color'), \";\\n color: \").concat(dt('toast.info.color'), \";\\n box-shadow: \").concat(dt('toast.info.shadow'), \";\\n}\\n\\n.p-toast-message-info .p-toast-detail {\\n color: \").concat(dt('toast.info.detail.color'), \";\\n}\\n\\n.p-toast-message-info .p-toast-close-button:focus-visible {\\n outline-color: \").concat(dt('toast.info.close.button.focus.ring.color'), \";\\n box-shadow: \").concat(dt('toast.info.close.button.focus.ring.shadow'), \";\\n}\\n\\n.p-toast-message-info .p-toast-close-button:hover {\\n background: \").concat(dt('toast.info.close.button.hover.background'), \";\\n}\\n\\n.p-toast-message-success {\\n background: \").concat(dt('toast.success.background'), \";\\n border-color: \").concat(dt('toast.success.border.color'), \";\\n color: \").concat(dt('toast.success.color'), \";\\n box-shadow: \").concat(dt('toast.success.shadow'), \";\\n}\\n\\n.p-toast-message-success .p-toast-detail {\\n color: \").concat(dt('toast.success.detail.color'), \";\\n}\\n\\n.p-toast-message-success .p-toast-close-button:focus-visible {\\n outline-color: \").concat(dt('toast.success.close.button.focus.ring.color'), \";\\n box-shadow: \").concat(dt('toast.success.close.button.focus.ring.shadow'), \";\\n}\\n\\n.p-toast-message-success .p-toast-close-button:hover {\\n background: \").concat(dt('toast.success.close.button.hover.background'), \";\\n}\\n\\n.p-toast-message-warn {\\n background: \").concat(dt('toast.warn.background'), \";\\n border-color: \").concat(dt('toast.warn.border.color'), \";\\n color: \").concat(dt('toast.warn.color'), \";\\n box-shadow: \").concat(dt('toast.warn.shadow'), \";\\n}\\n\\n.p-toast-message-warn .p-toast-detail {\\n color: \").concat(dt('toast.warn.detail.color'), \";\\n}\\n\\n.p-toast-message-warn .p-toast-close-button:focus-visible {\\n outline-color: \").concat(dt('toast.warn.close.button.focus.ring.color'), \";\\n box-shadow: \").concat(dt('toast.warn.close.button.focus.ring.shadow'), \";\\n}\\n\\n.p-toast-message-warn .p-toast-close-button:hover {\\n background: \").concat(dt('toast.warn.close.button.hover.background'), \";\\n}\\n\\n.p-toast-message-error {\\n background: \").concat(dt('toast.error.background'), \";\\n border-color: \").concat(dt('toast.error.border.color'), \";\\n color: \").concat(dt('toast.error.color'), \";\\n box-shadow: \").concat(dt('toast.error.shadow'), \";\\n}\\n\\n.p-toast-message-error .p-toast-detail {\\n color: \").concat(dt('toast.error.detail.color'), \";\\n}\\n\\n.p-toast-message-error .p-toast-close-button:focus-visible {\\n outline-color: \").concat(dt('toast.error.close.button.focus.ring.color'), \";\\n box-shadow: \").concat(dt('toast.error.close.button.focus.ring.shadow'), \";\\n}\\n\\n.p-toast-message-error .p-toast-close-button:hover {\\n background: \").concat(dt('toast.error.close.button.hover.background'), \";\\n}\\n\\n.p-toast-message-secondary {\\n background: \").concat(dt('toast.secondary.background'), \";\\n border-color: \").concat(dt('toast.secondary.border.color'), \";\\n color: \").concat(dt('toast.secondary.color'), \";\\n box-shadow: \").concat(dt('toast.secondary.shadow'), \";\\n}\\n\\n.p-toast-message-secondary .p-toast-detail {\\n color: \").concat(dt('toast.secondary.detail.color'), \";\\n}\\n\\n.p-toast-message-secondary .p-toast-close-button:focus-visible {\\n outline-color: \").concat(dt('toast.secondary.close.button.focus.ring.color'), \";\\n box-shadow: \").concat(dt('toast.secondary.close.button.focus.ring.shadow'), \";\\n}\\n\\n.p-toast-message-secondary .p-toast-close-button:hover {\\n background: \").concat(dt('toast.secondary.close.button.hover.background'), \";\\n}\\n\\n.p-toast-message-contrast {\\n background: \").concat(dt('toast.contrast.background'), \";\\n border-color: \").concat(dt('toast.contrast.border.color'), \";\\n color: \").concat(dt('toast.contrast.color'), \";\\n box-shadow: \").concat(dt('toast.contrast.shadow'), \";\\n}\\n\\n.p-toast-message-contrast .p-toast-detail {\\n color: \").concat(dt('toast.contrast.detail.color'), \";\\n}\\n\\n.p-toast-message-contrast .p-toast-close-button:focus-visible {\\n outline-color: \").concat(dt('toast.contrast.close.button.focus.ring.color'), \";\\n box-shadow: \").concat(dt('toast.contrast.close.button.focus.ring.shadow'), \";\\n}\\n\\n.p-toast-message-contrast .p-toast-close-button:hover {\\n background: \").concat(dt('toast.contrast.close.button.hover.background'), \";\\n}\\n\\n.p-toast-top-center {\\n transform: translateX(-50%);\\n}\\n\\n.p-toast-bottom-center {\\n transform: translateX(-50%);\\n}\\n\\n.p-toast-center {\\n min-width: 20vw;\\n transform: translate(-50%, -50%);\\n}\\n\\n.p-toast-message-enter-from {\\n opacity: 0;\\n transform: translateY(50%);\\n}\\n\\n.p-toast-message-leave-from {\\n max-height: 1000px;\\n}\\n\\n.p-toast .p-toast-message.p-toast-message-leave-to {\\n max-height: 0;\\n opacity: 0;\\n margin-bottom: 0;\\n overflow: hidden;\\n}\\n\\n.p-toast-message-enter-active {\\n transition: transform 0.3s, opacity 0.3s;\\n}\\n\\n.p-toast-message-leave-active {\\n transition: max-height 0.45s cubic-bezier(0, 1, 0, 1), opacity 0.3s, margin-bottom 0.3s;\\n}\\n\");\n};\n\n// Position\nvar inlineStyles = {\n root: function root(_ref2) {\n var position = _ref2.position;\n return {\n position: 'fixed',\n top: position === 'top-right' || position === 'top-left' || position === 'top-center' ? '20px' : position === 'center' ? '50%' : null,\n right: (position === 'top-right' || position === 'bottom-right') && '20px',\n bottom: (position === 'bottom-left' || position === 'bottom-right' || position === 'bottom-center') && '20px',\n left: position === 'top-left' || position === 'bottom-left' ? '20px' : position === 'center' || position === 'top-center' || position === 'bottom-center' ? '50%' : null\n };\n }\n};\nvar classes = {\n root: function root(_ref3) {\n var props = _ref3.props;\n return ['p-toast p-component p-toast-' + props.position];\n },\n message: function message(_ref4) {\n var props = _ref4.props;\n return ['p-toast-message', {\n 'p-toast-message-info': props.message.severity === 'info' || props.message.severity === undefined,\n 'p-toast-message-warn': props.message.severity === 'warn',\n 'p-toast-message-error': props.message.severity === 'error',\n 'p-toast-message-success': props.message.severity === 'success',\n 'p-toast-message-secondary': props.message.severity === 'secondary',\n 'p-toast-message-contrast': props.message.severity === 'contrast'\n }];\n },\n messageContent: 'p-toast-message-content',\n messageIcon: function messageIcon(_ref5) {\n var props = _ref5.props;\n return ['p-toast-message-icon', _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, props.infoIcon, props.message.severity === 'info'), props.warnIcon, props.message.severity === 'warn'), props.errorIcon, props.message.severity === 'error'), props.successIcon, props.message.severity === 'success')];\n },\n messageText: 'p-toast-message-text',\n summary: 'p-toast-summary',\n detail: 'p-toast-detail',\n closeButton: 'p-toast-close-button',\n closeIcon: 'p-toast-close-icon'\n};\nvar ToastStyle = BaseStyle.extend({\n name: 'toast',\n theme: theme,\n classes: classes,\n inlineStyles: inlineStyles\n});\n\nexport { ToastStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { setAttribute } from '@primeuix/utils/dom';\nimport { isEmpty } from '@primeuix/utils/object';\nimport { ZIndex } from '@primeuix/utils/zindex';\nimport { UniqueComponentId } from '@primevue/core/utils';\nimport Portal from 'primevue/portal';\nimport ToastEventBus from 'primevue/toasteventbus';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport ToastStyle from 'primevue/toast/style';\nimport CheckIcon from '@primevue/icons/check';\nimport ExclamationTriangleIcon from '@primevue/icons/exclamationtriangle';\nimport InfoCircleIcon from '@primevue/icons/infocircle';\nimport TimesIcon from '@primevue/icons/times';\nimport TimesCircleIcon from '@primevue/icons/timescircle';\nimport Ripple from 'primevue/ripple';\nimport { resolveDirective, openBlock, createElementBlock, mergeProps, createBlock, resolveDynamicComponent, Fragment, createElementVNode, toDisplayString, normalizeProps, withDirectives, createCommentVNode, resolveComponent, withCtx, createVNode, TransitionGroup, renderList } from 'vue';\n\nvar script$2 = {\n name: 'BaseToast',\n \"extends\": BaseComponent,\n props: {\n group: {\n type: String,\n \"default\": null\n },\n position: {\n type: String,\n \"default\": 'top-right'\n },\n autoZIndex: {\n type: Boolean,\n \"default\": true\n },\n baseZIndex: {\n type: Number,\n \"default\": 0\n },\n breakpoints: {\n type: Object,\n \"default\": null\n },\n closeIcon: {\n type: String,\n \"default\": undefined\n },\n infoIcon: {\n type: String,\n \"default\": undefined\n },\n warnIcon: {\n type: String,\n \"default\": undefined\n },\n errorIcon: {\n type: String,\n \"default\": undefined\n },\n successIcon: {\n type: String,\n \"default\": undefined\n },\n closeButtonProps: {\n type: null,\n \"default\": null\n }\n },\n style: ToastStyle,\n provide: function provide() {\n return {\n $pcToast: this,\n $parentInstance: this\n };\n }\n};\n\nvar script$1 = {\n name: 'ToastMessage',\n hostName: 'Toast',\n \"extends\": BaseComponent,\n emits: ['close'],\n closeTimeout: null,\n props: {\n message: {\n type: null,\n \"default\": null\n },\n templates: {\n type: Object,\n \"default\": null\n },\n closeIcon: {\n type: String,\n \"default\": null\n },\n infoIcon: {\n type: String,\n \"default\": null\n },\n warnIcon: {\n type: String,\n \"default\": null\n },\n errorIcon: {\n type: String,\n \"default\": null\n },\n successIcon: {\n type: String,\n \"default\": null\n },\n closeButtonProps: {\n type: null,\n \"default\": null\n }\n },\n mounted: function mounted() {\n var _this = this;\n if (this.message.life) {\n this.closeTimeout = setTimeout(function () {\n _this.close({\n message: _this.message,\n type: 'life-end'\n });\n }, this.message.life);\n }\n },\n beforeUnmount: function beforeUnmount() {\n this.clearCloseTimeout();\n },\n methods: {\n close: function close(params) {\n this.$emit('close', params);\n },\n onCloseClick: function onCloseClick() {\n this.clearCloseTimeout();\n this.close({\n message: this.message,\n type: 'close'\n });\n },\n clearCloseTimeout: function clearCloseTimeout() {\n if (this.closeTimeout) {\n clearTimeout(this.closeTimeout);\n this.closeTimeout = null;\n }\n }\n },\n computed: {\n iconComponent: function iconComponent() {\n return {\n info: !this.infoIcon && InfoCircleIcon,\n success: !this.successIcon && CheckIcon,\n warn: !this.warnIcon && ExclamationTriangleIcon,\n error: !this.errorIcon && TimesCircleIcon\n }[this.message.severity];\n },\n closeAriaLabel: function closeAriaLabel() {\n return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : undefined;\n }\n },\n components: {\n TimesIcon: TimesIcon,\n InfoCircleIcon: InfoCircleIcon,\n CheckIcon: CheckIcon,\n ExclamationTriangleIcon: ExclamationTriangleIcon,\n TimesCircleIcon: TimesCircleIcon\n },\n directives: {\n ripple: Ripple\n }\n};\n\nfunction _typeof$1(o) { \"@babel/helpers - typeof\"; return _typeof$1 = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof$1(o); }\nfunction ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty$1(e, r, t) { return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey$1(t) { var i = _toPrimitive$1(t, \"string\"); return \"symbol\" == _typeof$1(i) ? i : i + \"\"; }\nfunction _toPrimitive$1(t, r) { if (\"object\" != _typeof$1(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof$1(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar _hoisted_1 = [\"aria-label\"];\nfunction render$1(_ctx, _cache, $props, $setup, $data, $options) {\n var _directive_ripple = resolveDirective(\"ripple\");\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": [_ctx.cx('message'), $props.message.styleClass],\n role: \"alert\",\n \"aria-live\": \"assertive\",\n \"aria-atomic\": \"true\"\n }, _ctx.ptm('message')), [$props.templates.container ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.container), {\n key: 0,\n message: $props.message,\n closeCallback: $options.onCloseClick\n }, null, 8, [\"message\", \"closeCallback\"])) : (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 1,\n \"class\": [_ctx.cx('messageContent'), $props.message.contentStyleClass]\n }, _ctx.ptm('messageContent')), [!$props.templates.message ? (openBlock(), createElementBlock(Fragment, {\n key: 0\n }, [(openBlock(), createBlock(resolveDynamicComponent($props.templates.messageicon ? $props.templates.messageicon : $props.templates.icon ? $props.templates.icon : $options.iconComponent && $options.iconComponent.name ? $options.iconComponent : 'span'), mergeProps({\n \"class\": _ctx.cx('messageIcon')\n }, _ctx.ptm('messageIcon')), null, 16, [\"class\"])), createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('messageText')\n }, _ctx.ptm('messageText')), [createElementVNode(\"span\", mergeProps({\n \"class\": _ctx.cx('summary')\n }, _ctx.ptm('summary')), toDisplayString($props.message.summary), 17), createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('detail')\n }, _ctx.ptm('detail')), toDisplayString($props.message.detail), 17)], 16)], 64)) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.message), {\n key: 1,\n message: $props.message\n }, null, 8, [\"message\"])), $props.message.closable !== false ? (openBlock(), createElementBlock(\"div\", normalizeProps(mergeProps({\n key: 2\n }, _ctx.ptm('buttonContainer'))), [withDirectives((openBlock(), createElementBlock(\"button\", mergeProps({\n \"class\": _ctx.cx('closeButton'),\n type: \"button\",\n \"aria-label\": $options.closeAriaLabel,\n onClick: _cache[0] || (_cache[0] = function () {\n return $options.onCloseClick && $options.onCloseClick.apply($options, arguments);\n }),\n autofocus: \"\"\n }, _objectSpread$1(_objectSpread$1({}, $props.closeButtonProps), _ctx.ptm('closeButton'))), [(openBlock(), createBlock(resolveDynamicComponent($props.templates.closeicon || 'TimesIcon'), mergeProps({\n \"class\": [_ctx.cx('closeIcon'), $props.closeIcon]\n }, _ctx.ptm('closeIcon')), null, 16, [\"class\"]))], 16, _hoisted_1)), [[_directive_ripple]])], 16)) : createCommentVNode(\"\", true)], 16))], 16);\n}\n\nscript$1.render = render$1;\n\nfunction _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _iterableToArray(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nvar messageIdx = 0;\nvar script = {\n name: 'Toast',\n \"extends\": script$2,\n inheritAttrs: false,\n emits: ['close', 'life-end'],\n data: function data() {\n return {\n messages: []\n };\n },\n styleElement: null,\n mounted: function mounted() {\n ToastEventBus.on('add', this.onAdd);\n ToastEventBus.on('remove', this.onRemove);\n ToastEventBus.on('remove-group', this.onRemoveGroup);\n ToastEventBus.on('remove-all-groups', this.onRemoveAllGroups);\n if (this.breakpoints) {\n this.createStyle();\n }\n },\n beforeUnmount: function beforeUnmount() {\n this.destroyStyle();\n if (this.$refs.container && this.autoZIndex) {\n ZIndex.clear(this.$refs.container);\n }\n ToastEventBus.off('add', this.onAdd);\n ToastEventBus.off('remove', this.onRemove);\n ToastEventBus.off('remove-group', this.onRemoveGroup);\n ToastEventBus.off('remove-all-groups', this.onRemoveAllGroups);\n },\n methods: {\n add: function add(message) {\n if (message.id == null) {\n message.id = messageIdx++;\n }\n this.messages = [].concat(_toConsumableArray(this.messages), [message]);\n },\n remove: function remove(params) {\n var index = this.messages.findIndex(function (m) {\n return m.id === params.message.id;\n });\n if (index !== -1) {\n this.messages.splice(index, 1);\n this.$emit(params.type, {\n message: params.message\n });\n }\n },\n onAdd: function onAdd(message) {\n if (this.group == message.group) {\n this.add(message);\n }\n },\n onRemove: function onRemove(message) {\n this.remove({\n message: message,\n type: 'close'\n });\n },\n onRemoveGroup: function onRemoveGroup(group) {\n if (this.group === group) {\n this.messages = [];\n }\n },\n onRemoveAllGroups: function onRemoveAllGroups() {\n this.messages = [];\n },\n onEnter: function onEnter() {\n this.$refs.container.setAttribute(this.attributeSelector, '');\n if (this.autoZIndex) {\n ZIndex.set('modal', this.$refs.container, this.baseZIndex || this.$primevue.config.zIndex.modal);\n }\n },\n onLeave: function onLeave() {\n var _this = this;\n if (this.$refs.container && this.autoZIndex && isEmpty(this.messages)) {\n setTimeout(function () {\n ZIndex.clear(_this.$refs.container);\n }, 200);\n }\n },\n createStyle: function createStyle() {\n if (!this.styleElement && !this.isUnstyled) {\n var _this$$primevue;\n this.styleElement = document.createElement('style');\n this.styleElement.type = 'text/css';\n setAttribute(this.styleElement, 'nonce', (_this$$primevue = this.$primevue) === null || _this$$primevue === void 0 || (_this$$primevue = _this$$primevue.config) === null || _this$$primevue === void 0 || (_this$$primevue = _this$$primevue.csp) === null || _this$$primevue === void 0 ? void 0 : _this$$primevue.nonce);\n document.head.appendChild(this.styleElement);\n var innerHTML = '';\n for (var breakpoint in this.breakpoints) {\n var breakpointStyle = '';\n for (var styleProp in this.breakpoints[breakpoint]) {\n breakpointStyle += styleProp + ':' + this.breakpoints[breakpoint][styleProp] + '!important;';\n }\n innerHTML += \"\\n @media screen and (max-width: \".concat(breakpoint, \") {\\n .p-toast[\").concat(this.attributeSelector, \"] {\\n \").concat(breakpointStyle, \"\\n }\\n }\\n \");\n }\n this.styleElement.innerHTML = innerHTML;\n }\n },\n destroyStyle: function destroyStyle() {\n if (this.styleElement) {\n document.head.removeChild(this.styleElement);\n this.styleElement = null;\n }\n }\n },\n computed: {\n attributeSelector: function attributeSelector() {\n return UniqueComponentId();\n }\n },\n components: {\n ToastMessage: script$1,\n Portal: Portal\n }\n};\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_ToastMessage = resolveComponent(\"ToastMessage\");\n var _component_Portal = resolveComponent(\"Portal\");\n return openBlock(), createBlock(_component_Portal, null, {\n \"default\": withCtx(function () {\n return [createElementVNode(\"div\", mergeProps({\n ref: \"container\",\n \"class\": _ctx.cx('root'),\n style: _ctx.sx('root', true, {\n position: _ctx.position\n })\n }, _ctx.ptmi('root')), [createVNode(TransitionGroup, mergeProps({\n name: \"p-toast-message\",\n tag: \"div\",\n onEnter: $options.onEnter,\n onLeave: $options.onLeave\n }, _objectSpread({}, _ctx.ptm('transition'))), {\n \"default\": withCtx(function () {\n return [(openBlock(true), createElementBlock(Fragment, null, renderList($data.messages, function (msg) {\n return openBlock(), createBlock(_component_ToastMessage, {\n key: msg.id,\n message: msg,\n templates: _ctx.$slots,\n closeIcon: _ctx.closeIcon,\n infoIcon: _ctx.infoIcon,\n warnIcon: _ctx.warnIcon,\n errorIcon: _ctx.errorIcon,\n successIcon: _ctx.successIcon,\n closeButtonProps: _ctx.closeButtonProps,\n unstyled: _ctx.unstyled,\n onClose: _cache[0] || (_cache[0] = function ($event) {\n return $options.remove($event);\n }),\n pt: _ctx.pt\n }, null, 8, [\"message\", \"templates\", \"closeIcon\", \"infoIcon\", \"warnIcon\", \"errorIcon\", \"successIcon\", \"closeButtonProps\", \"unstyled\", \"pt\"]);\n }), 128))];\n }),\n _: 1\n }, 16, [\"onEnter\", \"onLeave\"])], 16)];\n }),\n _: 1\n });\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n","\n\n\n","\n\n\n","\n\n\n\n\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-menubar {\\n display: flex;\\n align-items: center;\\n background: \".concat(dt('menubar.background'), \";\\n border: 1px solid \").concat(dt('menubar.border.color'), \";\\n border-radius: \").concat(dt('menubar.border.radius'), \";\\n color: \").concat(dt('menubar.color'), \";\\n padding: \").concat(dt('menubar.padding'), \";\\n gap: \").concat(dt('menubar.gap'), \";\\n}\\n\\n.p-menubar-start,\\n.p-megamenu-end {\\n display: flex;\\n align-items: center;\\n}\\n\\n.p-menubar-root-list,\\n.p-menubar-submenu {\\n display: flex;\\n margin: 0;\\n padding: 0;\\n list-style: none;\\n outline: 0 none;\\n}\\n\\n.p-menubar-root-list {\\n align-items: center;\\n flex-wrap: wrap;\\n gap: \").concat(dt('menubar.gap'), \";\\n}\\n\\n.p-menubar-root-list > .p-menubar-item > .p-menubar-item-content {\\n border-radius: \").concat(dt('menubar.base.item.border.radius'), \";\\n}\\n\\n.p-menubar-root-list > .p-menubar-item > .p-menubar-item-content > .p-menubar-item-link {\\n padding: \").concat(dt('menubar.base.item.padding'), \";\\n}\\n\\n.p-menubar-item-content {\\n transition: background \").concat(dt('menubar.transition.duration'), \", color \").concat(dt('menubar.transition.duration'), \";\\n border-radius: \").concat(dt('menubar.item.border.radius'), \";\\n color: \").concat(dt('menubar.item.color'), \";\\n}\\n\\n.p-menubar-item-link {\\n cursor: pointer;\\n display: flex;\\n align-items: center;\\n text-decoration: none;\\n overflow: hidden;\\n position: relative;\\n color: inherit;\\n padding: \").concat(dt('menubar.item.padding'), \";\\n gap: \").concat(dt('menubar.item.gap'), \";\\n user-select: none;\\n outline: 0 none;\\n}\\n\\n.p-menubar-item-label {\\n line-height: 1;\\n}\\n\\n.p-menubar-item-icon {\\n color: \").concat(dt('menubar.item.icon.color'), \";\\n}\\n\\n.p-menubar-submenu-icon {\\n color: \").concat(dt('menubar.submenu.icon.color'), \";\\n margin-left: auto;\\n font-size: \").concat(dt('menubar.submenu.icon.size'), \";\\n width: \").concat(dt('menubar.submenu.icon.size'), \";\\n height: \").concat(dt('menubar.submenu.icon.size'), \";\\n}\\n\\n.p-menubar-item.p-focus > .p-menubar-item-content {\\n color: \").concat(dt('menubar.item.focus.color'), \";\\n background: \").concat(dt('menubar.item.focus.background'), \";\\n}\\n\\n.p-menubar-item.p-focus > .p-menubar-item-content .p-menubar-item-icon {\\n color: \").concat(dt('menubar.item.icon.focus.color'), \";\\n}\\n\\n.p-menubar-item.p-focus > .p-menubar-item-content .p-menubar-submenu-icon {\\n color: \").concat(dt('menubar.submenu.icon.focus.color'), \";\\n}\\n\\n.p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover {\\n color: \").concat(dt('menubar.item.focus.color'), \";\\n background: \").concat(dt('menubar.item.focus.background'), \";\\n}\\n\\n.p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover .p-menubar-item-icon {\\n color: \").concat(dt('menubar.item.icon.focus.color'), \";\\n}\\n\\n.p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover .p-menubar-submenu-icon {\\n color: \").concat(dt('menubar.submenu.icon.focus.color'), \";\\n}\\n\\n.p-menubar-item-active > .p-menubar-item-content {\\n color: \").concat(dt('menubar.item.active.color'), \";\\n background: \").concat(dt('menubar.item.active.background'), \";\\n}\\n\\n.p-menubar-item-active > .p-menubar-item-content .p-menubar-item-icon {\\n color: \").concat(dt('menubar.item.icon.active.color'), \";\\n}\\n\\n.p-menubar-item-active > .p-menubar-item-content .p-menubar-submenu-icon {\\n color: \").concat(dt('menubar.submenu.icon.active.color'), \";\\n}\\n\\n.p-menubar-submenu {\\n display: none;\\n position: absolute;\\n min-width: 12.5rem;\\n z-index: 1;\\n background: \").concat(dt('menubar.submenu.background'), \";\\n border: 1px solid \").concat(dt('menubar.submenu.border.color'), \";\\n border-radius: \").concat(dt('menubar.border.radius'), \";\\n box-shadow: \").concat(dt('menubar.submenu.shadow'), \";\\n color: \").concat(dt('menubar.submenu.color'), \";\\n flex-direction: column;\\n padding: \").concat(dt('menubar.submenu.padding'), \";\\n gap: \").concat(dt('menubar.submenu.gap'), \";\\n}\\n\\n.p-menubar-submenu .p-menubar-separator {\\n border-top: 1px solid \").concat(dt('menubar.separator.border.color'), \";\\n}\\n\\n.p-menubar-submenu .p-menubar-item {\\n position: relative;\\n}\\n\\n .p-menubar-submenu > .p-menubar-item-active > .p-menubar-submenu {\\n display: block;\\n left: 100%;\\n top: 0;\\n}\\n\\n.p-menubar-end {\\n margin-left: auto;\\n align-self: center;\\n}\\n\\n.p-menubar-button {\\n display: none;\\n justify-content: center;\\n align-items: center;\\n cursor: pointer;\\n width: \").concat(dt('menubar.mobile.button.size'), \";\\n height: \").concat(dt('menubar.mobile.button.size'), \";\\n position: relative;\\n color: \").concat(dt('menubar.mobile.button.color'), \";\\n border: 0 none;\\n background: transparent;\\n border-radius: \").concat(dt('menubar.mobile.button.border.radius'), \";\\n transition: background \").concat(dt('menubar.transition.duration'), \", color \").concat(dt('menubar.transition.duration'), \", outline-color \").concat(dt('menubar.transition.duration'), \";\\n outline-color: transparent;\\n}\\n\\n.p-menubar-button:hover {\\n color: \").concat(dt('menubar.mobile.button.hover.color'), \";\\n background: \").concat(dt('menubar.mobile.button.hover.background'), \";\\n}\\n\\n.p-menubar-button:focus-visible {\\n box-shadow: \").concat(dt('menubar.mobile.button.focus.ring.shadow'), \";\\n outline: \").concat(dt('menubar.mobile.button.focus.ring.width'), \" \").concat(dt('menubar.mobile.button.focus.ring.style'), \" \").concat(dt('menubar.mobile.button.focus.ring.color'), \";\\n outline-offset: \").concat(dt('menubar.mobile.button.focus.ring.offset'), \";\\n}\\n\\n.p-menubar-mobile {\\n position: relative;\\n}\\n\\n.p-menubar-mobile .p-menubar-button {\\n display: flex;\\n}\\n\\n.p-menubar-mobile .p-menubar-root-list {\\n position: absolute;\\n display: none;\\n width: 100%;\\n padding: \").concat(dt('menubar.submenu.padding'), \";\\n background: \").concat(dt('menubar.submenu.background'), \";\\n border: 1px solid \").concat(dt('menubar.submenu.border.color'), \";\\n box-shadow: \").concat(dt('menubar.submenu.shadow'), \";\\n}\\n\\n.p-menubar-mobile .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content {\\n border-radius: \").concat(dt('menubar.item.border.radius'), \";\\n}\\n\\n.p-menubar-mobile .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content > .p-menubar-item-link {\\n padding: \").concat(dt('menubar.item.padding'), \";\\n}\\n\\n.p-menubar-mobile-active .p-menubar-root-list {\\n display: flex;\\n flex-direction: column;\\n top: 100%;\\n left: 0;\\n z-index: 1;\\n}\\n\\n.p-menubar-mobile .p-menubar-root-list .p-menubar-item {\\n width: 100%;\\n position: static;\\n}\\n\\n.p-menubar-mobile .p-menubar-root-list .p-menubar-separator {\\n border-top: 1px solid \").concat(dt('menubar.separator.border.color'), \";\\n}\\n\\n.p-menubar-mobile .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content .p-menubar-submenu-icon {\\n margin-left: auto;\\n transition: transform 0.2s;\\n}\\n\\n.p-menubar-mobile .p-menubar-root-list > .p-menubar-item-active > .p-menubar-item-content .p-menubar-submenu-icon {\\n transform: rotate(-180deg);\\n}\\n\\n.p-menubar-mobile .p-menubar-submenu .p-menubar-submenu-icon {\\n transition: transform 0.2s;\\n transform: rotate(90deg);\\n}\\n\\n.p-menubar-mobile .p-menubar-item-active > .p-menubar-item-content .p-menubar-submenu-icon {\\n transform: rotate(-90deg);\\n}\\n\\n.p-menubar-mobile .p-menubar-submenu {\\n width: 100%;\\n position: static;\\n box-shadow: none;\\n border: 0 none;\\n padding-left: \").concat(dt('menubar.submenu.mobile.indent'), \";\\n}\\n\");\n};\nvar inlineStyles = {\n submenu: function submenu(_ref2) {\n var instance = _ref2.instance,\n processedItem = _ref2.processedItem;\n return {\n display: instance.isItemActive(processedItem) ? 'flex' : 'none'\n };\n }\n};\nvar classes = {\n root: function root(_ref3) {\n var instance = _ref3.instance;\n return ['p-menubar p-component', {\n 'p-menubar-mobile': instance.queryMatches,\n 'p-menubar-mobile-active': instance.mobileActive\n }];\n },\n start: 'p-menubar-start',\n button: 'p-menubar-button',\n rootList: 'p-menubar-root-list',\n item: function item(_ref4) {\n var instance = _ref4.instance,\n processedItem = _ref4.processedItem;\n return ['p-menubar-item', {\n 'p-menubar-item-active': instance.isItemActive(processedItem),\n 'p-focus': instance.isItemFocused(processedItem),\n 'p-disabled': instance.isItemDisabled(processedItem)\n }];\n },\n itemContent: 'p-menubar-item-content',\n itemLink: 'p-menubar-item-link',\n itemIcon: 'p-menubar-item-icon',\n itemLabel: 'p-menubar-item-label',\n submenuIcon: 'p-menubar-submenu-icon',\n submenu: 'p-menubar-submenu',\n separator: 'p-menubar-separator',\n end: 'p-menubar-end'\n};\nvar MenubarStyle = BaseStyle.extend({\n name: 'menubar',\n theme: theme,\n classes: classes,\n inlineStyles: inlineStyles\n});\n\nexport { MenubarStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { UniqueComponentId } from '@primevue/core/utils';\nimport { focus, findSingle, isTouchDevice } from '@primeuix/utils/dom';\nimport { resolve, isNotEmpty, isPrintableCharacter, isEmpty, findLastIndex } from '@primeuix/utils/object';\nimport { ZIndex } from '@primeuix/utils/zindex';\nimport BarsIcon from '@primevue/icons/bars';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport MenubarStyle from 'primevue/menubar/style';\nimport AngleDownIcon from '@primevue/icons/angledown';\nimport AngleRightIcon from '@primevue/icons/angleright';\nimport Ripple from 'primevue/ripple';\nimport { mergeProps, resolveComponent, resolveDirective, openBlock, createElementBlock, Fragment, renderList, createElementVNode, withDirectives, createBlock, resolveDynamicComponent, normalizeClass, createCommentVNode, toDisplayString, normalizeStyle, renderSlot, createVNode, normalizeProps, guardReactiveProps } from 'vue';\n\nvar script$2 = {\n name: 'BaseMenubar',\n \"extends\": BaseComponent,\n props: {\n model: {\n type: Array,\n \"default\": null\n },\n buttonProps: {\n type: null,\n \"default\": null\n },\n breakpoint: {\n type: String,\n \"default\": '960px'\n },\n ariaLabelledby: {\n type: String,\n \"default\": null\n },\n ariaLabel: {\n type: String,\n \"default\": null\n }\n },\n style: MenubarStyle,\n provide: function provide() {\n return {\n $pcMenubar: this,\n $parentInstance: this\n };\n }\n};\n\nvar script$1 = {\n name: 'MenubarSub',\n hostName: 'Menubar',\n \"extends\": BaseComponent,\n emits: ['item-mouseenter', 'item-click', 'item-mousemove'],\n props: {\n items: {\n type: Array,\n \"default\": null\n },\n root: {\n type: Boolean,\n \"default\": false\n },\n popup: {\n type: Boolean,\n \"default\": false\n },\n mobileActive: {\n type: Boolean,\n \"default\": false\n },\n templates: {\n type: Object,\n \"default\": null\n },\n level: {\n type: Number,\n \"default\": 0\n },\n menuId: {\n type: String,\n \"default\": null\n },\n focusedItemId: {\n type: String,\n \"default\": null\n },\n activeItemPath: {\n type: Object,\n \"default\": null\n }\n },\n list: null,\n methods: {\n getItemId: function getItemId(processedItem) {\n return \"\".concat(this.menuId, \"_\").concat(processedItem.key);\n },\n getItemKey: function getItemKey(processedItem) {\n return this.getItemId(processedItem);\n },\n getItemProp: function getItemProp(processedItem, name, params) {\n return processedItem && processedItem.item ? resolve(processedItem.item[name], params) : undefined;\n },\n getItemLabel: function getItemLabel(processedItem) {\n return this.getItemProp(processedItem, 'label');\n },\n getItemLabelId: function getItemLabelId(processedItem) {\n return \"\".concat(this.menuId, \"_\").concat(processedItem.key, \"_label\");\n },\n getPTOptions: function getPTOptions(processedItem, index, key) {\n return this.ptm(key, {\n context: {\n item: processedItem.item,\n index: index,\n active: this.isItemActive(processedItem),\n focused: this.isItemFocused(processedItem),\n disabled: this.isItemDisabled(processedItem),\n level: this.level\n }\n });\n },\n isItemActive: function isItemActive(processedItem) {\n return this.activeItemPath.some(function (path) {\n return path.key === processedItem.key;\n });\n },\n isItemVisible: function isItemVisible(processedItem) {\n return this.getItemProp(processedItem, 'visible') !== false;\n },\n isItemDisabled: function isItemDisabled(processedItem) {\n return this.getItemProp(processedItem, 'disabled');\n },\n isItemFocused: function isItemFocused(processedItem) {\n return this.focusedItemId === this.getItemId(processedItem);\n },\n isItemGroup: function isItemGroup(processedItem) {\n return isNotEmpty(processedItem.items);\n },\n onItemClick: function onItemClick(event, processedItem) {\n this.getItemProp(processedItem, 'command', {\n originalEvent: event,\n item: processedItem.item\n });\n this.$emit('item-click', {\n originalEvent: event,\n processedItem: processedItem,\n isFocus: true\n });\n },\n onItemMouseEnter: function onItemMouseEnter(event, processedItem) {\n this.$emit('item-mouseenter', {\n originalEvent: event,\n processedItem: processedItem\n });\n },\n onItemMouseMove: function onItemMouseMove(event, processedItem) {\n this.$emit('item-mousemove', {\n originalEvent: event,\n processedItem: processedItem\n });\n },\n getAriaPosInset: function getAriaPosInset(index) {\n return index - this.calculateAriaSetSize.slice(0, index).length + 1;\n },\n getMenuItemProps: function getMenuItemProps(processedItem, index) {\n return {\n action: mergeProps({\n \"class\": this.cx('itemLink'),\n tabindex: -1,\n 'aria-hidden': true\n }, this.getPTOptions(processedItem, index, 'itemLink')),\n icon: mergeProps({\n \"class\": [this.cx('itemIcon'), this.getItemProp(processedItem, 'icon')]\n }, this.getPTOptions(processedItem, index, 'itemIcon')),\n label: mergeProps({\n \"class\": this.cx('itemLabel')\n }, this.getPTOptions(processedItem, index, 'itemLabel')),\n submenuicon: mergeProps({\n \"class\": this.cx('submenuIcon')\n }, this.getPTOptions(processedItem, index, 'submenuIcon'))\n };\n }\n },\n computed: {\n calculateAriaSetSize: function calculateAriaSetSize() {\n var _this = this;\n return this.items.filter(function (processedItem) {\n return _this.isItemVisible(processedItem) && _this.getItemProp(processedItem, 'separator');\n });\n },\n getAriaSetSize: function getAriaSetSize() {\n var _this2 = this;\n return this.items.filter(function (processedItem) {\n return _this2.isItemVisible(processedItem) && !_this2.getItemProp(processedItem, 'separator');\n }).length;\n }\n },\n components: {\n AngleRightIcon: AngleRightIcon,\n AngleDownIcon: AngleDownIcon\n },\n directives: {\n ripple: Ripple\n }\n};\n\nvar _hoisted_1$1 = [\"id\", \"aria-label\", \"aria-disabled\", \"aria-expanded\", \"aria-haspopup\", \"aria-level\", \"aria-setsize\", \"aria-posinset\", \"data-p-active\", \"data-p-focused\", \"data-p-disabled\"];\nvar _hoisted_2 = [\"onClick\", \"onMouseenter\", \"onMousemove\"];\nvar _hoisted_3 = [\"href\", \"target\"];\nvar _hoisted_4 = [\"id\"];\nvar _hoisted_5 = [\"id\"];\nfunction render$1(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_MenubarSub = resolveComponent(\"MenubarSub\", true);\n var _directive_ripple = resolveDirective(\"ripple\");\n return openBlock(), createElementBlock(\"ul\", mergeProps({\n \"class\": $props.level === 0 ? _ctx.cx('rootList') : _ctx.cx('submenu')\n }, $props.level === 0 ? _ctx.ptm('rootList') : _ctx.ptm('submenu')), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.items, function (processedItem, index) {\n return openBlock(), createElementBlock(Fragment, {\n key: $options.getItemKey(processedItem)\n }, [$options.isItemVisible(processedItem) && !$options.getItemProp(processedItem, 'separator') ? (openBlock(), createElementBlock(\"li\", mergeProps({\n key: 0,\n id: $options.getItemId(processedItem),\n style: $options.getItemProp(processedItem, 'style'),\n \"class\": [_ctx.cx('item', {\n processedItem: processedItem\n }), $options.getItemProp(processedItem, 'class')],\n role: \"menuitem\",\n \"aria-label\": $options.getItemLabel(processedItem),\n \"aria-disabled\": $options.isItemDisabled(processedItem) || undefined,\n \"aria-expanded\": $options.isItemGroup(processedItem) ? $options.isItemActive(processedItem) : undefined,\n \"aria-haspopup\": $options.isItemGroup(processedItem) && !$options.getItemProp(processedItem, 'to') ? 'menu' : undefined,\n \"aria-level\": $props.level + 1,\n \"aria-setsize\": $options.getAriaSetSize,\n \"aria-posinset\": $options.getAriaPosInset(index),\n ref_for: true\n }, $options.getPTOptions(processedItem, index, 'item'), {\n \"data-p-active\": $options.isItemActive(processedItem),\n \"data-p-focused\": $options.isItemFocused(processedItem),\n \"data-p-disabled\": $options.isItemDisabled(processedItem)\n }), [createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('itemContent'),\n onClick: function onClick($event) {\n return $options.onItemClick($event, processedItem);\n },\n onMouseenter: function onMouseenter($event) {\n return $options.onItemMouseEnter($event, processedItem);\n },\n onMousemove: function onMousemove($event) {\n return $options.onItemMouseMove($event, processedItem);\n },\n ref_for: true\n }, $options.getPTOptions(processedItem, index, 'itemContent')), [!$props.templates.item ? withDirectives((openBlock(), createElementBlock(\"a\", mergeProps({\n key: 0,\n href: $options.getItemProp(processedItem, 'url'),\n \"class\": _ctx.cx('itemLink'),\n target: $options.getItemProp(processedItem, 'target'),\n tabindex: \"-1\",\n ref_for: true\n }, $options.getPTOptions(processedItem, index, 'itemLink')), [$props.templates.itemicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.itemicon), {\n key: 0,\n item: processedItem.item,\n \"class\": normalizeClass(_ctx.cx('itemIcon'))\n }, null, 8, [\"item\", \"class\"])) : $options.getItemProp(processedItem, 'icon') ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 1,\n \"class\": [_ctx.cx('itemIcon'), $options.getItemProp(processedItem, 'icon')],\n ref_for: true\n }, $options.getPTOptions(processedItem, index, 'itemIcon')), null, 16)) : createCommentVNode(\"\", true), createElementVNode(\"span\", mergeProps({\n id: $options.getItemLabelId(processedItem),\n \"class\": _ctx.cx('itemLabel'),\n ref_for: true\n }, $options.getPTOptions(processedItem, index, 'itemLabel')), toDisplayString($options.getItemLabel(processedItem)), 17, _hoisted_4), $options.getItemProp(processedItem, 'items') ? (openBlock(), createElementBlock(Fragment, {\n key: 2\n }, [$props.templates.submenuicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.submenuicon), {\n key: 0,\n root: $props.root,\n active: $options.isItemActive(processedItem),\n \"class\": normalizeClass(_ctx.cx('submenuIcon'))\n }, null, 8, [\"root\", \"active\", \"class\"])) : (openBlock(), createBlock(resolveDynamicComponent($props.root ? 'AngleDownIcon' : 'AngleRightIcon'), mergeProps({\n key: 1,\n \"class\": _ctx.cx('submenuIcon'),\n ref_for: true\n }, $options.getPTOptions(processedItem, index, 'submenuIcon')), null, 16, [\"class\"]))], 64)) : createCommentVNode(\"\", true)], 16, _hoisted_3)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), {\n key: 1,\n item: processedItem.item,\n root: $props.root,\n hasSubmenu: $options.getItemProp(processedItem, 'items'),\n label: $options.getItemLabel(processedItem),\n props: $options.getMenuItemProps(processedItem, index)\n }, null, 8, [\"item\", \"root\", \"hasSubmenu\", \"label\", \"props\"]))], 16, _hoisted_2), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_MenubarSub, {\n key: 0,\n id: $options.getItemId(processedItem) + '_list',\n menuId: $props.menuId,\n role: \"menu\",\n style: normalizeStyle(_ctx.sx('submenu', true, {\n processedItem: processedItem\n })),\n focusedItemId: $props.focusedItemId,\n items: processedItem.items,\n mobileActive: $props.mobileActive,\n activeItemPath: $props.activeItemPath,\n templates: $props.templates,\n level: $props.level + 1,\n \"aria-labelledby\": $options.getItemLabelId(processedItem),\n pt: _ctx.pt,\n unstyled: _ctx.unstyled,\n onItemClick: _cache[0] || (_cache[0] = function ($event) {\n return _ctx.$emit('item-click', $event);\n }),\n onItemMouseenter: _cache[1] || (_cache[1] = function ($event) {\n return _ctx.$emit('item-mouseenter', $event);\n }),\n onItemMousemove: _cache[2] || (_cache[2] = function ($event) {\n return _ctx.$emit('item-mousemove', $event);\n })\n }, null, 8, [\"id\", \"menuId\", \"style\", \"focusedItemId\", \"items\", \"mobileActive\", \"activeItemPath\", \"templates\", \"level\", \"aria-labelledby\", \"pt\", \"unstyled\"])) : createCommentVNode(\"\", true)], 16, _hoisted_1$1)) : createCommentVNode(\"\", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, 'separator') ? (openBlock(), createElementBlock(\"li\", mergeProps({\n key: 1,\n id: $options.getItemId(processedItem),\n \"class\": [_ctx.cx('separator'), $options.getItemProp(processedItem, 'class')],\n style: $options.getItemProp(processedItem, 'style'),\n role: \"separator\",\n ref_for: true\n }, _ctx.ptm('separator')), null, 16, _hoisted_5)) : createCommentVNode(\"\", true)], 64);\n }), 128))], 16);\n}\n\nscript$1.render = render$1;\n\nvar script = {\n name: 'Menubar',\n \"extends\": script$2,\n inheritAttrs: false,\n emits: ['focus', 'blur'],\n matchMediaListener: null,\n data: function data() {\n return {\n id: this.$attrs.id,\n mobileActive: false,\n focused: false,\n focusedItemInfo: {\n index: -1,\n level: 0,\n parentKey: ''\n },\n activeItemPath: [],\n dirty: false,\n query: null,\n queryMatches: false\n };\n },\n watch: {\n '$attrs.id': function $attrsId(newValue) {\n this.id = newValue || UniqueComponentId();\n },\n activeItemPath: function activeItemPath(newPath) {\n if (isNotEmpty(newPath)) {\n this.bindOutsideClickListener();\n this.bindResizeListener();\n } else {\n this.unbindOutsideClickListener();\n this.unbindResizeListener();\n }\n }\n },\n outsideClickListener: null,\n container: null,\n menubar: null,\n mounted: function mounted() {\n this.id = this.id || UniqueComponentId();\n this.bindMatchMediaListener();\n },\n beforeUnmount: function beforeUnmount() {\n this.mobileActive = false;\n this.unbindOutsideClickListener();\n this.unbindResizeListener();\n this.unbindMatchMediaListener();\n if (this.container) {\n ZIndex.clear(this.container);\n }\n this.container = null;\n },\n methods: {\n getItemProp: function getItemProp(item, name) {\n return item ? resolve(item[name]) : undefined;\n },\n getItemLabel: function getItemLabel(item) {\n return this.getItemProp(item, 'label');\n },\n isItemDisabled: function isItemDisabled(item) {\n return this.getItemProp(item, 'disabled');\n },\n isItemVisible: function isItemVisible(item) {\n return this.getItemProp(item, 'visible') !== false;\n },\n isItemGroup: function isItemGroup(item) {\n return isNotEmpty(this.getItemProp(item, 'items'));\n },\n isItemSeparator: function isItemSeparator(item) {\n return this.getItemProp(item, 'separator');\n },\n getProccessedItemLabel: function getProccessedItemLabel(processedItem) {\n return processedItem ? this.getItemLabel(processedItem.item) : undefined;\n },\n isProccessedItemGroup: function isProccessedItemGroup(processedItem) {\n return processedItem && isNotEmpty(processedItem.items);\n },\n toggle: function toggle(event) {\n var _this = this;\n if (this.mobileActive) {\n this.mobileActive = false;\n ZIndex.clear(this.menubar);\n this.hide();\n } else {\n this.mobileActive = true;\n ZIndex.set('menu', this.menubar, this.$primevue.config.zIndex.menu);\n setTimeout(function () {\n _this.show();\n }, 1);\n }\n this.bindOutsideClickListener();\n event.preventDefault();\n },\n show: function show() {\n focus(this.menubar);\n },\n hide: function hide(event, isFocus) {\n var _this2 = this;\n if (this.mobileActive) {\n this.mobileActive = false;\n setTimeout(function () {\n focus(_this2.$refs.menubutton);\n }, 0);\n }\n this.activeItemPath = [];\n this.focusedItemInfo = {\n index: -1,\n level: 0,\n parentKey: ''\n };\n isFocus && focus(this.menubar);\n this.dirty = false;\n },\n onFocus: function onFocus(event) {\n this.focused = true;\n this.focusedItemInfo = this.focusedItemInfo.index !== -1 ? this.focusedItemInfo : {\n index: this.findFirstFocusedItemIndex(),\n level: 0,\n parentKey: ''\n };\n this.$emit('focus', event);\n },\n onBlur: function onBlur(event) {\n this.focused = false;\n this.focusedItemInfo = {\n index: -1,\n level: 0,\n parentKey: ''\n };\n this.searchValue = '';\n this.dirty = false;\n this.$emit('blur', event);\n },\n onKeyDown: function onKeyDown(event) {\n var metaKey = event.metaKey || event.ctrlKey;\n switch (event.code) {\n case 'ArrowDown':\n this.onArrowDownKey(event);\n break;\n case 'ArrowUp':\n this.onArrowUpKey(event);\n break;\n case 'ArrowLeft':\n this.onArrowLeftKey(event);\n break;\n case 'ArrowRight':\n this.onArrowRightKey(event);\n break;\n case 'Home':\n this.onHomeKey(event);\n break;\n case 'End':\n this.onEndKey(event);\n break;\n case 'Space':\n this.onSpaceKey(event);\n break;\n case 'Enter':\n case 'NumpadEnter':\n this.onEnterKey(event);\n break;\n case 'Escape':\n this.onEscapeKey(event);\n break;\n case 'Tab':\n this.onTabKey(event);\n break;\n case 'PageDown':\n case 'PageUp':\n case 'Backspace':\n case 'ShiftLeft':\n case 'ShiftRight':\n //NOOP\n break;\n default:\n if (!metaKey && isPrintableCharacter(event.key)) {\n this.searchItems(event, event.key);\n }\n break;\n }\n },\n onItemChange: function onItemChange(event) {\n var processedItem = event.processedItem,\n isFocus = event.isFocus;\n if (isEmpty(processedItem)) return;\n var index = processedItem.index,\n key = processedItem.key,\n level = processedItem.level,\n parentKey = processedItem.parentKey,\n items = processedItem.items;\n var grouped = isNotEmpty(items);\n var activeItemPath = this.activeItemPath.filter(function (p) {\n return p.parentKey !== parentKey && p.parentKey !== key;\n });\n grouped && activeItemPath.push(processedItem);\n this.focusedItemInfo = {\n index: index,\n level: level,\n parentKey: parentKey\n };\n this.activeItemPath = activeItemPath;\n grouped && (this.dirty = true);\n isFocus && focus(this.menubar);\n },\n onItemClick: function onItemClick(event) {\n var originalEvent = event.originalEvent,\n processedItem = event.processedItem;\n var grouped = this.isProccessedItemGroup(processedItem);\n var root = isEmpty(processedItem.parent);\n var selected = this.isSelected(processedItem);\n if (selected) {\n var index = processedItem.index,\n key = processedItem.key,\n level = processedItem.level,\n parentKey = processedItem.parentKey;\n this.activeItemPath = this.activeItemPath.filter(function (p) {\n return key !== p.key && key.startsWith(p.key);\n });\n this.focusedItemInfo = {\n index: index,\n level: level,\n parentKey: parentKey\n };\n this.dirty = !root;\n focus(this.menubar);\n } else {\n if (grouped) {\n this.onItemChange(event);\n } else {\n var rootProcessedItem = root ? processedItem : this.activeItemPath.find(function (p) {\n return p.parentKey === '';\n });\n this.hide(originalEvent);\n this.changeFocusedItemIndex(originalEvent, rootProcessedItem ? rootProcessedItem.index : -1);\n this.mobileActive = false;\n focus(this.menubar);\n }\n }\n },\n onItemMouseEnter: function onItemMouseEnter(event) {\n if (this.dirty) {\n this.onItemChange(event);\n }\n },\n onItemMouseMove: function onItemMouseMove(event) {\n if (this.focused) {\n this.changeFocusedItemIndex(event, event.processedItem.index);\n }\n },\n menuButtonClick: function menuButtonClick(event) {\n this.toggle(event);\n },\n menuButtonKeydown: function menuButtonKeydown(event) {\n (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Space') && this.menuButtonClick(event);\n },\n onArrowDownKey: function onArrowDownKey(event) {\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var root = processedItem ? isEmpty(processedItem.parent) : null;\n if (root) {\n var grouped = this.isProccessedItemGroup(processedItem);\n if (grouped) {\n this.onItemChange({\n originalEvent: event,\n processedItem: processedItem\n });\n this.focusedItemInfo = {\n index: -1,\n parentKey: processedItem.key\n };\n this.onArrowRightKey(event);\n }\n } else {\n var itemIndex = this.focusedItemInfo.index !== -1 ? this.findNextItemIndex(this.focusedItemInfo.index) : this.findFirstFocusedItemIndex();\n this.changeFocusedItemIndex(event, itemIndex);\n }\n event.preventDefault();\n },\n onArrowUpKey: function onArrowUpKey(event) {\n var _this3 = this;\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var root = isEmpty(processedItem.parent);\n if (root) {\n var grouped = this.isProccessedItemGroup(processedItem);\n if (grouped) {\n this.onItemChange({\n originalEvent: event,\n processedItem: processedItem\n });\n this.focusedItemInfo = {\n index: -1,\n parentKey: processedItem.key\n };\n var itemIndex = this.findLastItemIndex();\n this.changeFocusedItemIndex(event, itemIndex);\n }\n } else {\n var parentItem = this.activeItemPath.find(function (p) {\n return p.key === processedItem.parentKey;\n });\n if (this.focusedItemInfo.index === 0) {\n this.focusedItemInfo = {\n index: -1,\n parentKey: parentItem ? parentItem.parentKey : ''\n };\n this.searchValue = '';\n this.onArrowLeftKey(event);\n this.activeItemPath = this.activeItemPath.filter(function (p) {\n return p.parentKey !== _this3.focusedItemInfo.parentKey;\n });\n } else {\n var _itemIndex = this.focusedItemInfo.index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo.index) : this.findLastFocusedItemIndex();\n this.changeFocusedItemIndex(event, _itemIndex);\n }\n }\n event.preventDefault();\n },\n onArrowLeftKey: function onArrowLeftKey(event) {\n var _this4 = this;\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var parentItem = processedItem ? this.activeItemPath.find(function (p) {\n return p.key === processedItem.parentKey;\n }) : null;\n if (parentItem) {\n this.onItemChange({\n originalEvent: event,\n processedItem: parentItem\n });\n this.activeItemPath = this.activeItemPath.filter(function (p) {\n return p.parentKey !== _this4.focusedItemInfo.parentKey;\n });\n event.preventDefault();\n } else {\n var itemIndex = this.focusedItemInfo.index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo.index) : this.findLastFocusedItemIndex();\n this.changeFocusedItemIndex(event, itemIndex);\n event.preventDefault();\n }\n },\n onArrowRightKey: function onArrowRightKey(event) {\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var parentItem = processedItem ? this.activeItemPath.find(function (p) {\n return p.key === processedItem.parentKey;\n }) : null;\n if (parentItem) {\n var grouped = this.isProccessedItemGroup(processedItem);\n if (grouped) {\n this.onItemChange({\n originalEvent: event,\n processedItem: processedItem\n });\n this.focusedItemInfo = {\n index: -1,\n parentKey: processedItem.key\n };\n this.onArrowDownKey(event);\n }\n } else {\n var itemIndex = this.focusedItemInfo.index !== -1 ? this.findNextItemIndex(this.focusedItemInfo.index) : this.findFirstFocusedItemIndex();\n this.changeFocusedItemIndex(event, itemIndex);\n event.preventDefault();\n }\n },\n onHomeKey: function onHomeKey(event) {\n this.changeFocusedItemIndex(event, this.findFirstItemIndex());\n event.preventDefault();\n },\n onEndKey: function onEndKey(event) {\n this.changeFocusedItemIndex(event, this.findLastItemIndex());\n event.preventDefault();\n },\n onEnterKey: function onEnterKey(event) {\n if (this.focusedItemInfo.index !== -1) {\n var element = findSingle(this.menubar, \"li[id=\\\"\".concat(\"\".concat(this.focusedItemId), \"\\\"]\"));\n var anchorElement = element && findSingle(element, 'a[data-pc-section=\"itemlink\"]');\n anchorElement ? anchorElement.click() : element && element.click();\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var grouped = this.isProccessedItemGroup(processedItem);\n !grouped && (this.focusedItemInfo.index = this.findFirstFocusedItemIndex());\n }\n event.preventDefault();\n },\n onSpaceKey: function onSpaceKey(event) {\n this.onEnterKey(event);\n },\n onEscapeKey: function onEscapeKey(event) {\n if (this.focusedItemInfo.level !== 0) {\n var _focusedItemInfo = this.focusedItemInfo;\n this.hide(event, false);\n this.focusedItemInfo = {\n index: Number(_focusedItemInfo.parentKey.split('_')[0]),\n level: 0,\n parentKey: ''\n };\n }\n event.preventDefault();\n },\n onTabKey: function onTabKey(event) {\n if (this.focusedItemInfo.index !== -1) {\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var grouped = this.isProccessedItemGroup(processedItem);\n !grouped && this.onItemChange({\n originalEvent: event,\n processedItem: processedItem\n });\n }\n this.hide();\n },\n bindOutsideClickListener: function bindOutsideClickListener() {\n var _this5 = this;\n if (!this.outsideClickListener) {\n this.outsideClickListener = function (event) {\n var isOutsideContainer = _this5.container && !_this5.container.contains(event.target);\n var isOutsideTarget = !(_this5.target && (_this5.target === event.target || _this5.target.contains(event.target)));\n if (isOutsideContainer && isOutsideTarget) {\n _this5.hide();\n }\n };\n document.addEventListener('click', this.outsideClickListener);\n }\n },\n unbindOutsideClickListener: function unbindOutsideClickListener() {\n if (this.outsideClickListener) {\n document.removeEventListener('click', this.outsideClickListener);\n this.outsideClickListener = null;\n }\n },\n bindResizeListener: function bindResizeListener() {\n var _this6 = this;\n if (!this.resizeListener) {\n this.resizeListener = function (event) {\n if (!isTouchDevice()) {\n _this6.hide(event, true);\n }\n _this6.mobileActive = false;\n };\n window.addEventListener('resize', this.resizeListener);\n }\n },\n unbindResizeListener: function unbindResizeListener() {\n if (this.resizeListener) {\n window.removeEventListener('resize', this.resizeListener);\n this.resizeListener = null;\n }\n },\n bindMatchMediaListener: function bindMatchMediaListener() {\n var _this7 = this;\n if (!this.matchMediaListener) {\n var query = matchMedia(\"(max-width: \".concat(this.breakpoint, \")\"));\n this.query = query;\n this.queryMatches = query.matches;\n this.matchMediaListener = function () {\n _this7.queryMatches = query.matches;\n _this7.mobileActive = false;\n };\n this.query.addEventListener('change', this.matchMediaListener);\n }\n },\n unbindMatchMediaListener: function unbindMatchMediaListener() {\n if (this.matchMediaListener) {\n this.query.removeEventListener('change', this.matchMediaListener);\n this.matchMediaListener = null;\n }\n },\n isItemMatched: function isItemMatched(processedItem) {\n var _this$getProccessedIt;\n return this.isValidItem(processedItem) && ((_this$getProccessedIt = this.getProccessedItemLabel(processedItem)) === null || _this$getProccessedIt === void 0 ? void 0 : _this$getProccessedIt.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase()));\n },\n isValidItem: function isValidItem(processedItem) {\n return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item) && this.isItemVisible(processedItem.item);\n },\n isValidSelectedItem: function isValidSelectedItem(processedItem) {\n return this.isValidItem(processedItem) && this.isSelected(processedItem);\n },\n isSelected: function isSelected(processedItem) {\n return this.activeItemPath.some(function (p) {\n return p.key === processedItem.key;\n });\n },\n findFirstItemIndex: function findFirstItemIndex() {\n var _this8 = this;\n return this.visibleItems.findIndex(function (processedItem) {\n return _this8.isValidItem(processedItem);\n });\n },\n findLastItemIndex: function findLastItemIndex() {\n var _this9 = this;\n return findLastIndex(this.visibleItems, function (processedItem) {\n return _this9.isValidItem(processedItem);\n });\n },\n findNextItemIndex: function findNextItemIndex(index) {\n var _this10 = this;\n var matchedItemIndex = index < this.visibleItems.length - 1 ? this.visibleItems.slice(index + 1).findIndex(function (processedItem) {\n return _this10.isValidItem(processedItem);\n }) : -1;\n return matchedItemIndex > -1 ? matchedItemIndex + index + 1 : index;\n },\n findPrevItemIndex: function findPrevItemIndex(index) {\n var _this11 = this;\n var matchedItemIndex = index > 0 ? findLastIndex(this.visibleItems.slice(0, index), function (processedItem) {\n return _this11.isValidItem(processedItem);\n }) : -1;\n return matchedItemIndex > -1 ? matchedItemIndex : index;\n },\n findSelectedItemIndex: function findSelectedItemIndex() {\n var _this12 = this;\n return this.visibleItems.findIndex(function (processedItem) {\n return _this12.isValidSelectedItem(processedItem);\n });\n },\n findFirstFocusedItemIndex: function findFirstFocusedItemIndex() {\n var selectedIndex = this.findSelectedItemIndex();\n return selectedIndex < 0 ? this.findFirstItemIndex() : selectedIndex;\n },\n findLastFocusedItemIndex: function findLastFocusedItemIndex() {\n var selectedIndex = this.findSelectedItemIndex();\n return selectedIndex < 0 ? this.findLastItemIndex() : selectedIndex;\n },\n searchItems: function searchItems(event, _char) {\n var _this13 = this;\n this.searchValue = (this.searchValue || '') + _char;\n var itemIndex = -1;\n var matched = false;\n if (this.focusedItemInfo.index !== -1) {\n itemIndex = this.visibleItems.slice(this.focusedItemInfo.index).findIndex(function (processedItem) {\n return _this13.isItemMatched(processedItem);\n });\n itemIndex = itemIndex === -1 ? this.visibleItems.slice(0, this.focusedItemInfo.index).findIndex(function (processedItem) {\n return _this13.isItemMatched(processedItem);\n }) : itemIndex + this.focusedItemInfo.index;\n } else {\n itemIndex = this.visibleItems.findIndex(function (processedItem) {\n return _this13.isItemMatched(processedItem);\n });\n }\n if (itemIndex !== -1) {\n matched = true;\n }\n if (itemIndex === -1 && this.focusedItemInfo.index === -1) {\n itemIndex = this.findFirstFocusedItemIndex();\n }\n if (itemIndex !== -1) {\n this.changeFocusedItemIndex(event, itemIndex);\n }\n if (this.searchTimeout) {\n clearTimeout(this.searchTimeout);\n }\n this.searchTimeout = setTimeout(function () {\n _this13.searchValue = '';\n _this13.searchTimeout = null;\n }, 500);\n return matched;\n },\n changeFocusedItemIndex: function changeFocusedItemIndex(event, index) {\n if (this.focusedItemInfo.index !== index) {\n this.focusedItemInfo.index = index;\n this.scrollInView();\n }\n },\n scrollInView: function scrollInView() {\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;\n var id = index !== -1 ? \"\".concat(this.id, \"_\").concat(index) : this.focusedItemId;\n var element = findSingle(this.menubar, \"li[id=\\\"\".concat(id, \"\\\"]\"));\n if (element) {\n element.scrollIntoView && element.scrollIntoView({\n block: 'nearest',\n inline: 'start'\n });\n }\n },\n createProcessedItems: function createProcessedItems(items) {\n var _this14 = this;\n var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var parentKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';\n var processedItems = [];\n items && items.forEach(function (item, index) {\n var key = (parentKey !== '' ? parentKey + '_' : '') + index;\n var newItem = {\n item: item,\n index: index,\n level: level,\n key: key,\n parent: parent,\n parentKey: parentKey\n };\n newItem['items'] = _this14.createProcessedItems(item.items, level + 1, newItem, key);\n processedItems.push(newItem);\n });\n return processedItems;\n },\n containerRef: function containerRef(el) {\n this.container = el;\n },\n menubarRef: function menubarRef(el) {\n this.menubar = el ? el.$el : undefined;\n }\n },\n computed: {\n processedItems: function processedItems() {\n return this.createProcessedItems(this.model || []);\n },\n visibleItems: function visibleItems() {\n var _this15 = this;\n var processedItem = this.activeItemPath.find(function (p) {\n return p.key === _this15.focusedItemInfo.parentKey;\n });\n return processedItem ? processedItem.items : this.processedItems;\n },\n focusedItemId: function focusedItemId() {\n return this.focusedItemInfo.index !== -1 ? \"\".concat(this.id).concat(isNotEmpty(this.focusedItemInfo.parentKey) ? '_' + this.focusedItemInfo.parentKey : '', \"_\").concat(this.focusedItemInfo.index) : null;\n }\n },\n components: {\n MenubarSub: script$1,\n BarsIcon: BarsIcon\n }\n};\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar _hoisted_1 = [\"aria-haspopup\", \"aria-expanded\", \"aria-controls\", \"aria-label\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_BarsIcon = resolveComponent(\"BarsIcon\");\n var _component_MenubarSub = resolveComponent(\"MenubarSub\");\n return openBlock(), createElementBlock(\"div\", mergeProps({\n ref: $options.containerRef,\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root')), [_ctx.$slots.start ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('start')\n }, _ctx.ptm('start')), [renderSlot(_ctx.$slots, \"start\")], 16)) : createCommentVNode(\"\", true), renderSlot(_ctx.$slots, _ctx.$slots.button ? 'button' : 'menubutton', {\n id: $data.id,\n \"class\": normalizeClass(_ctx.cx('button')),\n toggleCallback: function toggleCallback(event) {\n return $options.menuButtonClick(event);\n }\n }, function () {\n var _ctx$$primevue$config;\n return [_ctx.model && _ctx.model.length > 0 ? (openBlock(), createElementBlock(\"a\", mergeProps({\n key: 0,\n ref: \"menubutton\",\n role: \"button\",\n tabindex: \"0\",\n \"class\": _ctx.cx('button'),\n \"aria-haspopup\": _ctx.model.length && _ctx.model.length > 0 ? true : false,\n \"aria-expanded\": $data.mobileActive,\n \"aria-controls\": $data.id,\n \"aria-label\": (_ctx$$primevue$config = _ctx.$primevue.config.locale.aria) === null || _ctx$$primevue$config === void 0 ? void 0 : _ctx$$primevue$config.navigation,\n onClick: _cache[0] || (_cache[0] = function ($event) {\n return $options.menuButtonClick($event);\n }),\n onKeydown: _cache[1] || (_cache[1] = function ($event) {\n return $options.menuButtonKeydown($event);\n })\n }, _objectSpread(_objectSpread({}, _ctx.buttonProps), _ctx.ptm('button'))), [renderSlot(_ctx.$slots, _ctx.$slots.buttonicon ? 'buttonicon' : 'menubuttonicon', {}, function () {\n return [createVNode(_component_BarsIcon, normalizeProps(guardReactiveProps(_ctx.ptm('buttonicon'))), null, 16)];\n })], 16, _hoisted_1)) : createCommentVNode(\"\", true)];\n }), createVNode(_component_MenubarSub, {\n ref: $options.menubarRef,\n id: $data.id + '_list',\n role: \"menubar\",\n items: $options.processedItems,\n templates: _ctx.$slots,\n root: true,\n mobileActive: $data.mobileActive,\n tabindex: \"0\",\n \"aria-activedescendant\": $data.focused ? $options.focusedItemId : undefined,\n menuId: $data.id,\n focusedItemId: $data.focused ? $options.focusedItemId : undefined,\n activeItemPath: $data.activeItemPath,\n level: 0,\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-label\": _ctx.ariaLabel,\n pt: _ctx.pt,\n unstyled: _ctx.unstyled,\n onFocus: $options.onFocus,\n onBlur: $options.onBlur,\n onKeydown: $options.onKeyDown,\n onItemClick: $options.onItemClick,\n onItemMouseenter: $options.onItemMouseEnter,\n onItemMousemove: $options.onItemMouseMove\n }, null, 8, [\"id\", \"items\", \"templates\", \"mobileActive\", \"aria-activedescendant\", \"menuId\", \"focusedItemId\", \"activeItemPath\", \"aria-labelledby\", \"aria-label\", \"pt\", \"unstyled\", \"onFocus\", \"onBlur\", \"onKeydown\", \"onItemClick\", \"onItemMouseenter\", \"onItemMousemove\"]), _ctx.$slots.end ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 1,\n \"class\": _ctx.cx('end')\n }, _ctx.ptm('end')), [renderSlot(_ctx.$slots, \"end\")], 16)) : createCommentVNode(\"\", true)], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n\n\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-panel {\\n border: 1px solid \".concat(dt('panel.border.color'), \";\\n border-radius: \").concat(dt('panel.border.radius'), \";\\n background: \").concat(dt('panel.background'), \";\\n color: \").concat(dt('panel.color'), \";\\n}\\n\\n.p-panel-header {\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n padding: \").concat(dt('panel.header.padding'), \";\\n background: \").concat(dt('panel.header.background'), \";\\n color: \").concat(dt('panel.header.color'), \";\\n border-style: solid;\\n border-width: \").concat(dt('panel.header.border.width'), \";\\n border-color: \").concat(dt('panel.header.border.color'), \";\\n border-radius: \").concat(dt('panel.header.border.radius'), \";\\n}\\n\\n.p-panel-toggleable .p-panel-header {\\n padding: \").concat(dt('panel.toggleable.header.padding'), \";\\n}\\n\\n.p-panel-title {\\n line-height: 1;\\n font-weight: \").concat(dt('panel.title.font.weight'), \";\\n}\\n\\n.p-panel-content {\\n padding: \").concat(dt('panel.content.padding'), \";\\n}\\n\\n.p-panel-footer {\\n padding: \").concat(dt('panel.footer.padding'), \";\\n}\\n\");\n};\nvar classes = {\n root: function root(_ref2) {\n var props = _ref2.props;\n return ['p-panel p-component', {\n 'p-panel-toggleable': props.toggleable\n }];\n },\n header: 'p-panel-header',\n title: 'p-panel-title',\n headerActions: 'p-panel-header-actions',\n pcToggleButton: 'p-panel-toggle-button',\n contentContainer: 'p-panel-content-container',\n content: 'p-panel-content',\n footer: 'p-panel-footer'\n};\nvar PanelStyle = BaseStyle.extend({\n name: 'panel',\n theme: theme,\n classes: classes\n});\n\nexport { PanelStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { UniqueComponentId } from '@primevue/core/utils';\nimport MinusIcon from '@primevue/icons/minus';\nimport PlusIcon from '@primevue/icons/plus';\nimport Button from 'primevue/button';\nimport Ripple from 'primevue/ripple';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport PanelStyle from 'primevue/panel/style';\nimport { resolveComponent, openBlock, createElementBlock, mergeProps, createElementVNode, renderSlot, normalizeClass, toDisplayString, createCommentVNode, createBlock, withCtx, resolveDynamicComponent, createVNode, Transition, withDirectives, vShow } from 'vue';\n\nvar script$1 = {\n name: 'BasePanel',\n \"extends\": BaseComponent,\n props: {\n header: String,\n toggleable: Boolean,\n collapsed: Boolean,\n toggleButtonProps: {\n type: Object,\n \"default\": function _default() {\n return {\n severity: 'secondary',\n text: true,\n rounded: true\n };\n }\n }\n },\n style: PanelStyle,\n provide: function provide() {\n return {\n $pcPanel: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'Panel',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['update:collapsed', 'toggle'],\n data: function data() {\n return {\n id: this.$attrs.id,\n d_collapsed: this.collapsed\n };\n },\n watch: {\n '$attrs.id': function $attrsId(newValue) {\n this.id = newValue || UniqueComponentId();\n },\n collapsed: function collapsed(newValue) {\n this.d_collapsed = newValue;\n }\n },\n mounted: function mounted() {\n this.id = this.id || UniqueComponentId();\n },\n methods: {\n toggle: function toggle(event) {\n this.d_collapsed = !this.d_collapsed;\n this.$emit('update:collapsed', this.d_collapsed);\n this.$emit('toggle', {\n originalEvent: event,\n value: this.d_collapsed\n });\n },\n onKeyDown: function onKeyDown(event) {\n if (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Space') {\n this.toggle(event);\n event.preventDefault();\n }\n }\n },\n computed: {\n buttonAriaLabel: function buttonAriaLabel() {\n return this.toggleButtonProps && this.toggleButtonProps.ariaLabel ? this.toggleButtonProps.ariaLabel : this.header;\n }\n },\n components: {\n PlusIcon: PlusIcon,\n MinusIcon: MinusIcon,\n Button: Button\n },\n directives: {\n ripple: Ripple\n }\n};\n\nvar _hoisted_1 = [\"id\"];\nvar _hoisted_2 = [\"id\", \"aria-labelledby\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_Button = resolveComponent(\"Button\");\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root')), [createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('header')\n }, _ctx.ptm('header')), [renderSlot(_ctx.$slots, \"header\", {\n id: $data.id + '_header',\n \"class\": normalizeClass(_ctx.cx('title'))\n }, function () {\n return [_ctx.header ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 0,\n id: $data.id + '_header',\n \"class\": _ctx.cx('title')\n }, _ctx.ptm('title')), toDisplayString(_ctx.header), 17, _hoisted_1)) : createCommentVNode(\"\", true)];\n }), createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('headerActions')\n }, _ctx.ptm('headerActions')), [renderSlot(_ctx.$slots, \"icons\"), _ctx.toggleable ? (openBlock(), createBlock(_component_Button, mergeProps({\n key: 0,\n id: $data.id + '_header',\n \"class\": _ctx.cx('pcToggleButton'),\n \"aria-label\": $options.buttonAriaLabel,\n \"aria-controls\": $data.id + '_content',\n \"aria-expanded\": !$data.d_collapsed,\n unstyled: _ctx.unstyled,\n onClick: $options.toggle,\n onKeydown: $options.onKeyDown\n }, _ctx.toggleButtonProps, {\n pt: _ctx.ptm('pcToggleButton')\n }), {\n icon: withCtx(function (slotProps) {\n return [renderSlot(_ctx.$slots, _ctx.$slots.toggleicon ? 'toggleicon' : 'togglericon', {\n collapsed: $data.d_collapsed\n }, function () {\n return [(openBlock(), createBlock(resolveDynamicComponent($data.d_collapsed ? 'PlusIcon' : 'MinusIcon'), mergeProps({\n \"class\": slotProps[\"class\"]\n }, _ctx.ptm('pcToggleButton')['icon']), null, 16, [\"class\"]))];\n })];\n }),\n _: 3\n }, 16, [\"id\", \"class\", \"aria-label\", \"aria-controls\", \"aria-expanded\", \"unstyled\", \"onClick\", \"onKeydown\", \"pt\"])) : createCommentVNode(\"\", true)], 16)], 16), createVNode(Transition, mergeProps({\n name: \"p-toggleable-content\"\n }, _ctx.ptm('transition')), {\n \"default\": withCtx(function () {\n return [withDirectives(createElementVNode(\"div\", mergeProps({\n id: $data.id + '_content',\n \"class\": _ctx.cx('contentContainer'),\n role: \"region\",\n \"aria-labelledby\": $data.id + '_header'\n }, _ctx.ptm('contentContainer')), [createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('content')\n }, _ctx.ptm('content')), [renderSlot(_ctx.$slots, \"default\")], 16), _ctx.$slots.footer ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('footer')\n }, _ctx.ptm('footer')), [renderSlot(_ctx.$slots, \"footer\")], 16)) : createCommentVNode(\"\", true)], 16, _hoisted_2), [[vShow, !$data.d_collapsed]])];\n }),\n _: 3\n }, 16)], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-tieredmenu {\\n background: \".concat(dt('tieredmenu.background'), \";\\n color: \").concat(dt('tieredmenu.color'), \";\\n border: 1px solid \").concat(dt('tieredmenu.border.color'), \";\\n border-radius: \").concat(dt('tieredmenu.border.radius'), \";\\n min-width: 12.5rem;\\n}\\n\\n.p-tieredmenu-root-list,\\n.p-tieredmenu-submenu {\\n margin: 0;\\n padding: \").concat(dt('tieredmenu.list.padding'), \";\\n list-style: none;\\n outline: 0 none;\\n display: flex;\\n flex-direction: column;\\n gap: \").concat(dt('tieredmenu.list.gap'), \";\\n}\\n\\n.p-tieredmenu-submenu {\\n position: absolute;\\n min-width: 100%;\\n z-index: 1;\\n background: \").concat(dt('tieredmenu.background'), \";\\n color: \").concat(dt('tieredmenu.color'), \";\\n border: 1px solid \").concat(dt('tieredmenu.border.color'), \";\\n border-radius: \").concat(dt('tieredmenu.border.radius'), \";\\n box-shadow: \").concat(dt('tieredmenu.shadow'), \";\\n}\\n\\n.p-tieredmenu-item {\\n position: relative;\\n}\\n\\n.p-tieredmenu-item-content {\\n transition: background \").concat(dt('tieredmenu.transition.duration'), \", color \").concat(dt('tieredmenu.transition.duration'), \";\\n border-radius: \").concat(dt('tieredmenu.item.border.radius'), \";\\n color: \").concat(dt('tieredmenu.item.color'), \";\\n}\\n\\n.p-tieredmenu-item-link {\\n cursor: pointer;\\n display: flex;\\n align-items: center;\\n text-decoration: none;\\n overflow: hidden;\\n position: relative;\\n color: inherit;\\n padding: \").concat(dt('tieredmenu.item.padding'), \";\\n gap: \").concat(dt('tieredmenu.item.gap'), \";\\n user-select: none;\\n outline: 0 none;\\n}\\n\\n.p-tieredmenu-item-label {\\n line-height: 1;\\n}\\n\\n.p-tieredmenu-item-icon {\\n color: \").concat(dt('tieredmenu.item.icon.color'), \";\\n}\\n\\n.p-tieredmenu-submenu-icon {\\n color: \").concat(dt('tieredmenu.submenu.icon.color'), \";\\n margin-left: auto;\\n font-size: \").concat(dt('tieredmenu.submenu.icon.size'), \";\\n width: \").concat(dt('tieredmenu.submenu.icon.size'), \";\\n height: \").concat(dt('tieredmenu.submenu.icon.size'), \";\\n}\\n\\n.p-tieredmenu-item.p-focus > .p-tieredmenu-item-content {\\n color: \").concat(dt('tieredmenu.item.focus.color'), \";\\n background: \").concat(dt('tieredmenu.item.focus.background'), \";\\n}\\n\\n.p-tieredmenu-item.p-focus > .p-tieredmenu-item-content .p-tieredmenu-item-icon {\\n color: \").concat(dt('tieredmenu.item.icon.focus.color'), \";\\n}\\n\\n.p-tieredmenu-item.p-focus > .p-tieredmenu-item-content .p-tieredmenu-submenu-icon {\\n color: \").concat(dt('tieredmenu.submenu.icon.focus.color'), \";\\n}\\n\\n.p-tieredmenu-item:not(.p-disabled) > .p-tieredmenu-item-content:hover {\\n color: \").concat(dt('tieredmenu.item.focus.color'), \";\\n background: \").concat(dt('tieredmenu.item.focus.background'), \";\\n}\\n\\n.p-tieredmenu-item:not(.p-disabled) > .p-tieredmenu-item-content:hover .p-tieredmenu-item-icon {\\n color: \").concat(dt('tieredmenu.item.icon.focus.color'), \";\\n}\\n\\n.p-tieredmenu-item:not(.p-disabled) > .p-tieredmenu-item-content:hover .p-tieredmenu-submenu-icon {\\n color: \").concat(dt('tieredmenu.submenu.icon.focus.color'), \";\\n}\\n\\n.p-tieredmenu-item-active > .p-tieredmenu-item-content {\\n color: \").concat(dt('tieredmenu.item.active.color'), \";\\n background: \").concat(dt('tieredmenu.item.active.background'), \";\\n}\\n\\n.p-tieredmenu-item-active > .p-tieredmenu-item-content .p-tieredmenu-item-icon {\\n color: \").concat(dt('tieredmenu.item.icon.active.color'), \";\\n}\\n\\n.p-tieredmenu-item-active > .p-tieredmenu-item-content .p-tieredmenu-submenu-icon {\\n color: \").concat(dt('tieredmenu.submenu.icon.active.color'), \";\\n}\\n\\n.p-tieredmenu-separator {\\n border-top: 1px solid \").concat(dt('tieredmenu.separator.border.color'), \";\\n}\\n\\n.p-tieredmenu-overlay {\\n box-shadow: \").concat(dt('tieredmenu.shadow'), \";\\n}\\n\\n.p-tieredmenu-enter-from,\\n.p-tieredmenu-leave-active {\\n opacity: 0;\\n}\\n\\n.p-tieredmenu-enter-active {\\n transition: opacity 250ms;\\n}\\n\");\n};\nvar inlineStyles = {\n submenu: function submenu(_ref2) {\n var instance = _ref2.instance,\n processedItem = _ref2.processedItem;\n return {\n display: instance.isItemActive(processedItem) ? 'flex' : 'none'\n };\n }\n};\nvar classes = {\n root: function root(_ref3) {\n _ref3.instance;\n var props = _ref3.props;\n return ['p-tieredmenu p-component', {\n 'p-tieredmenu-overlay': props.popup\n }];\n },\n start: 'p-tieredmenu-start',\n rootList: 'p-tieredmenu-root-list',\n item: function item(_ref4) {\n var instance = _ref4.instance,\n processedItem = _ref4.processedItem;\n return ['p-tieredmenu-item', {\n 'p-tieredmenu-item-active': instance.isItemActive(processedItem),\n 'p-focus': instance.isItemFocused(processedItem),\n 'p-disabled': instance.isItemDisabled(processedItem)\n }];\n },\n itemContent: 'p-tieredmenu-item-content',\n itemLink: 'p-tieredmenu-item-link',\n itemIcon: 'p-tieredmenu-item-icon',\n itemLabel: 'p-tieredmenu-item-label',\n submenuIcon: 'p-tieredmenu-submenu-icon',\n submenu: 'p-tieredmenu-submenu',\n separator: 'p-tieredmenu-separator',\n end: 'p-tieredmenu-end'\n};\nvar TieredMenuStyle = BaseStyle.extend({\n name: 'tieredmenu',\n theme: theme,\n classes: classes,\n inlineStyles: inlineStyles\n});\n\nexport { TieredMenuStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { UniqueComponentId, ConnectedOverlayScrollHandler } from '@primevue/core/utils';\nimport { nestedPosition, focus, findSingle, addStyle, absolutePosition, getOuterWidth, isTouchDevice } from '@primeuix/utils/dom';\nimport { resolve, isNotEmpty, isPrintableCharacter, isEmpty, findLastIndex } from '@primeuix/utils/object';\nimport { ZIndex } from '@primeuix/utils/zindex';\nimport OverlayEventBus from 'primevue/overlayeventbus';\nimport Portal from 'primevue/portal';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport TieredMenuStyle from 'primevue/tieredmenu/style';\nimport AngleRightIcon from '@primevue/icons/angleright';\nimport Ripple from 'primevue/ripple';\nimport { mergeProps, resolveComponent, resolveDirective, openBlock, createBlock, Transition, withCtx, createElementBlock, Fragment, renderList, createElementVNode, withDirectives, resolveDynamicComponent, normalizeClass, createCommentVNode, toDisplayString, normalizeStyle, createVNode, renderSlot } from 'vue';\n\nvar script$2 = {\n name: 'BaseTieredMenu',\n \"extends\": BaseComponent,\n props: {\n popup: {\n type: Boolean,\n \"default\": false\n },\n model: {\n type: Array,\n \"default\": null\n },\n appendTo: {\n type: [String, Object],\n \"default\": 'body'\n },\n autoZIndex: {\n type: Boolean,\n \"default\": true\n },\n baseZIndex: {\n type: Number,\n \"default\": 0\n },\n disabled: {\n type: Boolean,\n \"default\": false\n },\n tabindex: {\n type: Number,\n \"default\": 0\n },\n ariaLabelledby: {\n type: String,\n \"default\": null\n },\n ariaLabel: {\n type: String,\n \"default\": null\n }\n },\n style: TieredMenuStyle,\n provide: function provide() {\n return {\n $pcTieredMenu: this,\n $parentInstance: this\n };\n }\n};\n\nvar script$1 = {\n name: 'TieredMenuSub',\n hostName: 'TieredMenu',\n \"extends\": BaseComponent,\n emits: ['item-click', 'item-mouseenter', 'item-mousemove'],\n container: null,\n props: {\n menuId: {\n type: String,\n \"default\": null\n },\n focusedItemId: {\n type: String,\n \"default\": null\n },\n items: {\n type: Array,\n \"default\": null\n },\n visible: {\n type: Boolean,\n \"default\": false\n },\n level: {\n type: Number,\n \"default\": 0\n },\n templates: {\n type: Object,\n \"default\": null\n },\n activeItemPath: {\n type: Object,\n \"default\": null\n },\n tabindex: {\n type: Number,\n \"default\": 0\n }\n },\n methods: {\n getItemId: function getItemId(processedItem) {\n return \"\".concat(this.menuId, \"_\").concat(processedItem.key);\n },\n getItemKey: function getItemKey(processedItem) {\n return this.getItemId(processedItem);\n },\n getItemProp: function getItemProp(processedItem, name, params) {\n return processedItem && processedItem.item ? resolve(processedItem.item[name], params) : undefined;\n },\n getItemLabel: function getItemLabel(processedItem) {\n return this.getItemProp(processedItem, 'label');\n },\n getItemLabelId: function getItemLabelId(processedItem) {\n return \"\".concat(this.menuId, \"_\").concat(processedItem.key, \"_label\");\n },\n getPTOptions: function getPTOptions(processedItem, index, key) {\n return this.ptm(key, {\n context: {\n item: processedItem.item,\n index: index,\n active: this.isItemActive(processedItem),\n focused: this.isItemFocused(processedItem),\n disabled: this.isItemDisabled(processedItem)\n }\n });\n },\n isItemActive: function isItemActive(processedItem) {\n return this.activeItemPath.some(function (path) {\n return path.key === processedItem.key;\n });\n },\n isItemVisible: function isItemVisible(processedItem) {\n return this.getItemProp(processedItem, 'visible') !== false;\n },\n isItemDisabled: function isItemDisabled(processedItem) {\n return this.getItemProp(processedItem, 'disabled');\n },\n isItemFocused: function isItemFocused(processedItem) {\n return this.focusedItemId === this.getItemId(processedItem);\n },\n isItemGroup: function isItemGroup(processedItem) {\n return isNotEmpty(processedItem.items);\n },\n onEnter: function onEnter() {\n nestedPosition(this.container, this.level);\n },\n onItemClick: function onItemClick(event, processedItem) {\n this.getItemProp(processedItem, 'command', {\n originalEvent: event,\n item: processedItem.item\n });\n this.$emit('item-click', {\n originalEvent: event,\n processedItem: processedItem,\n isFocus: true\n });\n },\n onItemMouseEnter: function onItemMouseEnter(event, processedItem) {\n this.$emit('item-mouseenter', {\n originalEvent: event,\n processedItem: processedItem\n });\n },\n onItemMouseMove: function onItemMouseMove(event, processedItem) {\n this.$emit('item-mousemove', {\n originalEvent: event,\n processedItem: processedItem\n });\n },\n getAriaSetSize: function getAriaSetSize() {\n var _this = this;\n return this.items.filter(function (processedItem) {\n return _this.isItemVisible(processedItem) && !_this.getItemProp(processedItem, 'separator');\n }).length;\n },\n getAriaPosInset: function getAriaPosInset(index) {\n var _this2 = this;\n return index - this.items.slice(0, index).filter(function (processedItem) {\n return _this2.isItemVisible(processedItem) && _this2.getItemProp(processedItem, 'separator');\n }).length + 1;\n },\n getMenuItemProps: function getMenuItemProps(processedItem, index) {\n return {\n action: mergeProps({\n \"class\": this.cx('itemLink'),\n tabindex: -1,\n 'aria-hidden': true\n }, this.getPTOptions(processedItem, index, 'itemLink')),\n icon: mergeProps({\n \"class\": [this.cx('itemIcon'), this.getItemProp(processedItem, 'icon')]\n }, this.getPTOptions(processedItem, index, 'itemIcon')),\n label: mergeProps({\n \"class\": this.cx('itemLabel')\n }, this.getPTOptions(processedItem, index, 'itemLabel')),\n submenuicon: mergeProps({\n \"class\": this.cx('submenuIcon')\n }, this.getPTOptions(processedItem, index, 'submenuIcon'))\n };\n },\n containerRef: function containerRef(el) {\n this.container = el;\n }\n },\n components: {\n AngleRightIcon: AngleRightIcon\n },\n directives: {\n ripple: Ripple\n }\n};\n\nvar _hoisted_1$1 = [\"tabindex\"];\nvar _hoisted_2 = [\"id\", \"aria-label\", \"aria-disabled\", \"aria-expanded\", \"aria-haspopup\", \"aria-level\", \"aria-setsize\", \"aria-posinset\", \"data-p-active\", \"data-p-focused\", \"data-p-disabled\"];\nvar _hoisted_3 = [\"onClick\", \"onMouseenter\", \"onMousemove\"];\nvar _hoisted_4 = [\"href\", \"target\"];\nvar _hoisted_5 = [\"id\"];\nvar _hoisted_6 = [\"id\"];\nfunction render$1(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_AngleRightIcon = resolveComponent(\"AngleRightIcon\");\n var _component_TieredMenuSub = resolveComponent(\"TieredMenuSub\", true);\n var _directive_ripple = resolveDirective(\"ripple\");\n return openBlock(), createBlock(Transition, mergeProps({\n name: \"p-tieredmenu\",\n onEnter: $options.onEnter\n }, _ctx.ptm('menu.transition')), {\n \"default\": withCtx(function () {\n return [($props.level === 0 ? true : $props.visible) ? (openBlock(), createElementBlock(\"ul\", mergeProps({\n key: 0,\n ref: $options.containerRef,\n \"class\": $props.level === 0 ? _ctx.cx('rootList') : _ctx.cx('submenu'),\n tabindex: $props.tabindex\n }, $props.level === 0 ? _ctx.ptm('rootList') : _ctx.ptm('submenu')), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.items, function (processedItem, index) {\n return openBlock(), createElementBlock(Fragment, {\n key: $options.getItemKey(processedItem)\n }, [$options.isItemVisible(processedItem) && !$options.getItemProp(processedItem, 'separator') ? (openBlock(), createElementBlock(\"li\", mergeProps({\n key: 0,\n id: $options.getItemId(processedItem),\n style: $options.getItemProp(processedItem, 'style'),\n \"class\": [_ctx.cx('item', {\n processedItem: processedItem\n }), $options.getItemProp(processedItem, 'class')],\n role: \"menuitem\",\n \"aria-label\": $options.getItemLabel(processedItem),\n \"aria-disabled\": $options.isItemDisabled(processedItem) || undefined,\n \"aria-expanded\": $options.isItemGroup(processedItem) ? $options.isItemActive(processedItem) : undefined,\n \"aria-haspopup\": $options.isItemGroup(processedItem) && !$options.getItemProp(processedItem, 'to') ? 'menu' : undefined,\n \"aria-level\": $props.level + 1,\n \"aria-setsize\": $options.getAriaSetSize(),\n \"aria-posinset\": $options.getAriaPosInset(index),\n ref_for: true\n }, $options.getPTOptions(processedItem, index, 'item'), {\n \"data-p-active\": $options.isItemActive(processedItem),\n \"data-p-focused\": $options.isItemFocused(processedItem),\n \"data-p-disabled\": $options.isItemDisabled(processedItem)\n }), [createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('itemContent'),\n onClick: function onClick($event) {\n return $options.onItemClick($event, processedItem);\n },\n onMouseenter: function onMouseenter($event) {\n return $options.onItemMouseEnter($event, processedItem);\n },\n onMousemove: function onMousemove($event) {\n return $options.onItemMouseMove($event, processedItem);\n },\n ref_for: true\n }, $options.getPTOptions(processedItem, index, 'itemContent')), [!$props.templates.item ? withDirectives((openBlock(), createElementBlock(\"a\", mergeProps({\n key: 0,\n href: $options.getItemProp(processedItem, 'url'),\n \"class\": _ctx.cx('itemLink'),\n target: $options.getItemProp(processedItem, 'target'),\n tabindex: \"-1\",\n ref_for: true\n }, $options.getPTOptions(processedItem, index, 'itemLink')), [$props.templates.itemicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.itemicon), {\n key: 0,\n item: processedItem.item,\n \"class\": normalizeClass(_ctx.cx('itemIcon'))\n }, null, 8, [\"item\", \"class\"])) : $options.getItemProp(processedItem, 'icon') ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 1,\n \"class\": [_ctx.cx('itemIcon'), $options.getItemProp(processedItem, 'icon')],\n ref_for: true\n }, $options.getPTOptions(processedItem, index, 'itemIcon')), null, 16)) : createCommentVNode(\"\", true), createElementVNode(\"span\", mergeProps({\n id: $options.getItemLabelId(processedItem),\n \"class\": _ctx.cx('itemLabel'),\n ref_for: true\n }, $options.getPTOptions(processedItem, index, 'itemLabel')), toDisplayString($options.getItemLabel(processedItem)), 17, _hoisted_5), $options.getItemProp(processedItem, 'items') ? (openBlock(), createElementBlock(Fragment, {\n key: 2\n }, [$props.templates.submenuicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.submenuicon), mergeProps({\n key: 0,\n \"class\": _ctx.cx('submenuIcon'),\n active: $options.isItemActive(processedItem),\n ref_for: true\n }, $options.getPTOptions(processedItem, index, 'submenuIcon')), null, 16, [\"class\", \"active\"])) : (openBlock(), createBlock(_component_AngleRightIcon, mergeProps({\n key: 1,\n \"class\": _ctx.cx('submenuIcon'),\n ref_for: true\n }, $options.getPTOptions(processedItem, index, 'submenuIcon')), null, 16, [\"class\"]))], 64)) : createCommentVNode(\"\", true)], 16, _hoisted_4)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), {\n key: 1,\n item: processedItem.item,\n hasSubmenu: $options.getItemProp(processedItem, 'items'),\n label: $options.getItemLabel(processedItem),\n props: $options.getMenuItemProps(processedItem, index)\n }, null, 8, [\"item\", \"hasSubmenu\", \"label\", \"props\"]))], 16, _hoisted_3), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_TieredMenuSub, {\n key: 0,\n id: $options.getItemId(processedItem) + '_list',\n style: normalizeStyle(_ctx.sx('submenu', true, {\n processedItem: processedItem\n })),\n \"aria-labelledby\": $options.getItemLabelId(processedItem),\n role: \"menu\",\n menuId: $props.menuId,\n focusedItemId: $props.focusedItemId,\n items: processedItem.items,\n templates: $props.templates,\n activeItemPath: $props.activeItemPath,\n level: $props.level + 1,\n visible: $options.isItemActive(processedItem) && $options.isItemGroup(processedItem),\n pt: _ctx.pt,\n unstyled: _ctx.unstyled,\n onItemClick: _cache[0] || (_cache[0] = function ($event) {\n return _ctx.$emit('item-click', $event);\n }),\n onItemMouseenter: _cache[1] || (_cache[1] = function ($event) {\n return _ctx.$emit('item-mouseenter', $event);\n }),\n onItemMousemove: _cache[2] || (_cache[2] = function ($event) {\n return _ctx.$emit('item-mousemove', $event);\n })\n }, null, 8, [\"id\", \"style\", \"aria-labelledby\", \"menuId\", \"focusedItemId\", \"items\", \"templates\", \"activeItemPath\", \"level\", \"visible\", \"pt\", \"unstyled\"])) : createCommentVNode(\"\", true)], 16, _hoisted_2)) : createCommentVNode(\"\", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, 'separator') ? (openBlock(), createElementBlock(\"li\", mergeProps({\n key: 1,\n id: $options.getItemId(processedItem),\n style: $options.getItemProp(processedItem, 'style'),\n \"class\": [_ctx.cx('separator'), $options.getItemProp(processedItem, 'class')],\n role: \"separator\",\n ref_for: true\n }, _ctx.ptm('separator')), null, 16, _hoisted_6)) : createCommentVNode(\"\", true)], 64);\n }), 128))], 16, _hoisted_1$1)) : createCommentVNode(\"\", true)];\n }),\n _: 1\n }, 16, [\"onEnter\"]);\n}\n\nscript$1.render = render$1;\n\nvar script = {\n name: 'TieredMenu',\n \"extends\": script$2,\n inheritAttrs: false,\n emits: ['focus', 'blur', 'before-show', 'before-hide', 'hide', 'show'],\n outsideClickListener: null,\n scrollHandler: null,\n resizeListener: null,\n target: null,\n container: null,\n menubar: null,\n searchTimeout: null,\n searchValue: null,\n data: function data() {\n return {\n id: this.$attrs.id,\n focused: false,\n focusedItemInfo: {\n index: -1,\n level: 0,\n parentKey: ''\n },\n activeItemPath: [],\n visible: !this.popup,\n submenuVisible: false,\n dirty: false\n };\n },\n watch: {\n '$attrs.id': function $attrsId(newValue) {\n this.id = newValue || UniqueComponentId();\n },\n activeItemPath: function activeItemPath(newPath) {\n if (!this.popup) {\n if (isNotEmpty(newPath)) {\n this.bindOutsideClickListener();\n this.bindResizeListener();\n } else {\n this.unbindOutsideClickListener();\n this.unbindResizeListener();\n }\n }\n }\n },\n mounted: function mounted() {\n this.id = this.id || UniqueComponentId();\n },\n beforeUnmount: function beforeUnmount() {\n this.unbindOutsideClickListener();\n this.unbindResizeListener();\n if (this.scrollHandler) {\n this.scrollHandler.destroy();\n this.scrollHandler = null;\n }\n if (this.container && this.autoZIndex) {\n ZIndex.clear(this.container);\n }\n this.target = null;\n this.container = null;\n },\n methods: {\n getItemProp: function getItemProp(item, name) {\n return item ? resolve(item[name]) : undefined;\n },\n getItemLabel: function getItemLabel(item) {\n return this.getItemProp(item, 'label');\n },\n isItemDisabled: function isItemDisabled(item) {\n return this.getItemProp(item, 'disabled');\n },\n isItemVisible: function isItemVisible(item) {\n return this.getItemProp(item, 'visible') !== false;\n },\n isItemGroup: function isItemGroup(item) {\n return isNotEmpty(this.getItemProp(item, 'items'));\n },\n isItemSeparator: function isItemSeparator(item) {\n return this.getItemProp(item, 'separator');\n },\n getProccessedItemLabel: function getProccessedItemLabel(processedItem) {\n return processedItem ? this.getItemLabel(processedItem.item) : undefined;\n },\n isProccessedItemGroup: function isProccessedItemGroup(processedItem) {\n return processedItem && isNotEmpty(processedItem.items);\n },\n toggle: function toggle(event) {\n this.visible ? this.hide(event, true) : this.show(event);\n },\n show: function show(event, isFocus) {\n if (this.popup) {\n this.$emit('before-show');\n this.visible = true;\n this.target = this.target || event.currentTarget;\n this.relatedTarget = event.relatedTarget || null;\n }\n isFocus && focus(this.menubar);\n },\n hide: function hide(event, isFocus) {\n if (this.popup) {\n this.$emit('before-hide');\n this.visible = false;\n }\n this.activeItemPath = [];\n this.focusedItemInfo = {\n index: -1,\n level: 0,\n parentKey: ''\n };\n isFocus && focus(this.relatedTarget || this.target || this.menubar);\n this.dirty = false;\n },\n onFocus: function onFocus(event) {\n this.focused = true;\n if (!this.popup) {\n this.focusedItemInfo = this.focusedItemInfo.index !== -1 ? this.focusedItemInfo : {\n index: this.findFirstFocusedItemIndex(),\n level: 0,\n parentKey: ''\n };\n }\n this.$emit('focus', event);\n },\n onBlur: function onBlur(event) {\n this.focused = false;\n this.focusedItemInfo = {\n index: -1,\n level: 0,\n parentKey: ''\n };\n this.searchValue = '';\n this.dirty = false;\n this.$emit('blur', event);\n },\n onKeyDown: function onKeyDown(event) {\n if (this.disabled) {\n event.preventDefault();\n return;\n }\n var metaKey = event.metaKey || event.ctrlKey;\n switch (event.code) {\n case 'ArrowDown':\n this.onArrowDownKey(event);\n break;\n case 'ArrowUp':\n this.onArrowUpKey(event);\n break;\n case 'ArrowLeft':\n this.onArrowLeftKey(event);\n break;\n case 'ArrowRight':\n this.onArrowRightKey(event);\n break;\n case 'Home':\n this.onHomeKey(event);\n break;\n case 'End':\n this.onEndKey(event);\n break;\n case 'Space':\n this.onSpaceKey(event);\n break;\n case 'Enter':\n case 'NumpadEnter':\n this.onEnterKey(event);\n break;\n case 'Escape':\n this.onEscapeKey(event);\n break;\n case 'Tab':\n this.onTabKey(event);\n break;\n case 'PageDown':\n case 'PageUp':\n case 'Backspace':\n case 'ShiftLeft':\n case 'ShiftRight':\n //NOOP\n break;\n default:\n if (!metaKey && isPrintableCharacter(event.key)) {\n this.searchItems(event, event.key);\n }\n break;\n }\n },\n onItemChange: function onItemChange(event) {\n var processedItem = event.processedItem,\n isFocus = event.isFocus;\n if (isEmpty(processedItem)) return;\n var index = processedItem.index,\n key = processedItem.key,\n level = processedItem.level,\n parentKey = processedItem.parentKey,\n items = processedItem.items;\n var grouped = isNotEmpty(items);\n var activeItemPath = this.activeItemPath.filter(function (p) {\n return p.parentKey !== parentKey && p.parentKey !== key;\n });\n if (grouped) {\n activeItemPath.push(processedItem);\n this.submenuVisible = true;\n }\n this.focusedItemInfo = {\n index: index,\n level: level,\n parentKey: parentKey\n };\n this.activeItemPath = activeItemPath;\n grouped && (this.dirty = true);\n isFocus && focus(this.menubar);\n },\n onOverlayClick: function onOverlayClick(event) {\n OverlayEventBus.emit('overlay-click', {\n originalEvent: event,\n target: this.target\n });\n },\n onItemClick: function onItemClick(event) {\n var originalEvent = event.originalEvent,\n processedItem = event.processedItem;\n var grouped = this.isProccessedItemGroup(processedItem);\n var root = isEmpty(processedItem.parent);\n var selected = this.isSelected(processedItem);\n if (selected) {\n var index = processedItem.index,\n key = processedItem.key,\n level = processedItem.level,\n parentKey = processedItem.parentKey;\n this.activeItemPath = this.activeItemPath.filter(function (p) {\n return key !== p.key && key.startsWith(p.key);\n });\n this.focusedItemInfo = {\n index: index,\n level: level,\n parentKey: parentKey\n };\n this.dirty = !root;\n focus(this.menubar);\n } else {\n if (grouped) {\n this.onItemChange(event);\n } else {\n var rootProcessedItem = root ? processedItem : this.activeItemPath.find(function (p) {\n return p.parentKey === '';\n });\n this.hide(originalEvent);\n this.changeFocusedItemIndex(originalEvent, rootProcessedItem ? rootProcessedItem.index : -1);\n focus(this.menubar);\n }\n }\n },\n onItemMouseEnter: function onItemMouseEnter(event) {\n if (this.dirty) {\n this.onItemChange(event);\n }\n },\n onItemMouseMove: function onItemMouseMove(event) {\n if (this.focused) {\n this.changeFocusedItemIndex(event, event.processedItem.index);\n }\n },\n onArrowDownKey: function onArrowDownKey(event) {\n var itemIndex = this.focusedItemInfo.index !== -1 ? this.findNextItemIndex(this.focusedItemInfo.index) : this.findFirstFocusedItemIndex();\n this.changeFocusedItemIndex(event, itemIndex);\n event.preventDefault();\n },\n onArrowUpKey: function onArrowUpKey(event) {\n if (event.altKey) {\n if (this.focusedItemInfo.index !== -1) {\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var grouped = this.isProccessedItemGroup(processedItem);\n !grouped && this.onItemChange({\n originalEvent: event,\n processedItem: processedItem\n });\n }\n this.popup && this.hide(event, true);\n event.preventDefault();\n } else {\n var itemIndex = this.focusedItemInfo.index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo.index) : this.findLastFocusedItemIndex();\n this.changeFocusedItemIndex(event, itemIndex);\n event.preventDefault();\n }\n },\n onArrowLeftKey: function onArrowLeftKey(event) {\n var _this = this;\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var parentItem = this.activeItemPath.find(function (p) {\n return p.key === processedItem.parentKey;\n });\n var root = isEmpty(processedItem.parent);\n if (!root) {\n this.focusedItemInfo = {\n index: -1,\n parentKey: parentItem ? parentItem.parentKey : ''\n };\n this.searchValue = '';\n this.onArrowDownKey(event);\n }\n this.activeItemPath = this.activeItemPath.filter(function (p) {\n return p.parentKey !== _this.focusedItemInfo.parentKey;\n });\n event.preventDefault();\n },\n onArrowRightKey: function onArrowRightKey(event) {\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var grouped = this.isProccessedItemGroup(processedItem);\n if (grouped) {\n this.onItemChange({\n originalEvent: event,\n processedItem: processedItem\n });\n this.focusedItemInfo = {\n index: -1,\n parentKey: processedItem.key\n };\n this.searchValue = '';\n this.onArrowDownKey(event);\n }\n event.preventDefault();\n },\n onHomeKey: function onHomeKey(event) {\n this.changeFocusedItemIndex(event, this.findFirstItemIndex());\n event.preventDefault();\n },\n onEndKey: function onEndKey(event) {\n this.changeFocusedItemIndex(event, this.findLastItemIndex());\n event.preventDefault();\n },\n onEnterKey: function onEnterKey(event) {\n if (this.focusedItemInfo.index !== -1) {\n var element = findSingle(this.menubar, \"li[id=\\\"\".concat(\"\".concat(this.focusedItemId), \"\\\"]\"));\n var anchorElement = element && findSingle(element, '[data-pc-section=\"itemlink\"]');\n anchorElement ? anchorElement.click() : element && element.click();\n if (!this.popup) {\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var grouped = this.isProccessedItemGroup(processedItem);\n !grouped && (this.focusedItemInfo.index = this.findFirstFocusedItemIndex());\n }\n }\n event.preventDefault();\n },\n onSpaceKey: function onSpaceKey(event) {\n this.onEnterKey(event);\n },\n onEscapeKey: function onEscapeKey(event) {\n if (this.popup || this.focusedItemInfo.level !== 0) {\n var _focusedItemInfo = this.focusedItemInfo;\n this.hide(event, false);\n this.focusedItemInfo = {\n index: Number(_focusedItemInfo.parentKey.split('_')[0]),\n level: 0,\n parentKey: ''\n };\n this.popup && focus(this.target);\n }\n event.preventDefault();\n },\n onTabKey: function onTabKey(event) {\n if (this.focusedItemInfo.index !== -1) {\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var grouped = this.isProccessedItemGroup(processedItem);\n !grouped && this.onItemChange({\n originalEvent: event,\n processedItem: processedItem\n });\n }\n this.hide();\n },\n onEnter: function onEnter(el) {\n if (this.autoZIndex) {\n ZIndex.set('menu', el, this.baseZIndex + this.$primevue.config.zIndex.menu);\n }\n addStyle(el, {\n position: 'absolute',\n top: '0',\n left: '0'\n });\n this.alignOverlay();\n focus(this.menubar);\n this.scrollInView();\n },\n onAfterEnter: function onAfterEnter() {\n this.bindOutsideClickListener();\n this.bindScrollListener();\n this.bindResizeListener();\n this.$emit('show');\n },\n onLeave: function onLeave() {\n this.unbindOutsideClickListener();\n this.unbindScrollListener();\n this.unbindResizeListener();\n this.$emit('hide');\n this.container = null;\n this.dirty = false;\n },\n onAfterLeave: function onAfterLeave(el) {\n if (this.autoZIndex) {\n ZIndex.clear(el);\n }\n },\n alignOverlay: function alignOverlay() {\n absolutePosition(this.container, this.target);\n var targetWidth = getOuterWidth(this.target);\n if (targetWidth > getOuterWidth(this.container)) {\n this.container.style.minWidth = getOuterWidth(this.target) + 'px';\n }\n },\n bindOutsideClickListener: function bindOutsideClickListener() {\n var _this2 = this;\n if (!this.outsideClickListener) {\n this.outsideClickListener = function (event) {\n var isOutsideContainer = _this2.container && !_this2.container.contains(event.target);\n var isOutsideTarget = _this2.popup ? !(_this2.target && (_this2.target === event.target || _this2.target.contains(event.target))) : true;\n if (isOutsideContainer && isOutsideTarget) {\n _this2.hide();\n }\n };\n document.addEventListener('click', this.outsideClickListener);\n }\n },\n unbindOutsideClickListener: function unbindOutsideClickListener() {\n if (this.outsideClickListener) {\n document.removeEventListener('click', this.outsideClickListener);\n this.outsideClickListener = null;\n }\n },\n bindScrollListener: function bindScrollListener() {\n var _this3 = this;\n if (!this.scrollHandler) {\n this.scrollHandler = new ConnectedOverlayScrollHandler(this.target, function (event) {\n _this3.hide(event, true);\n });\n }\n this.scrollHandler.bindScrollListener();\n },\n unbindScrollListener: function unbindScrollListener() {\n if (this.scrollHandler) {\n this.scrollHandler.unbindScrollListener();\n }\n },\n bindResizeListener: function bindResizeListener() {\n var _this4 = this;\n if (!this.resizeListener) {\n this.resizeListener = function (event) {\n if (!isTouchDevice()) {\n _this4.hide(event, true);\n }\n };\n window.addEventListener('resize', this.resizeListener);\n }\n },\n unbindResizeListener: function unbindResizeListener() {\n if (this.resizeListener) {\n window.removeEventListener('resize', this.resizeListener);\n this.resizeListener = null;\n }\n },\n isItemMatched: function isItemMatched(processedItem) {\n var _this$getProccessedIt;\n return this.isValidItem(processedItem) && ((_this$getProccessedIt = this.getProccessedItemLabel(processedItem)) === null || _this$getProccessedIt === void 0 ? void 0 : _this$getProccessedIt.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase()));\n },\n isValidItem: function isValidItem(processedItem) {\n return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item) && this.isItemVisible(processedItem.item);\n },\n isValidSelectedItem: function isValidSelectedItem(processedItem) {\n return this.isValidItem(processedItem) && this.isSelected(processedItem);\n },\n isSelected: function isSelected(processedItem) {\n return this.activeItemPath.some(function (p) {\n return p.key === processedItem.key;\n });\n },\n findFirstItemIndex: function findFirstItemIndex() {\n var _this5 = this;\n return this.visibleItems.findIndex(function (processedItem) {\n return _this5.isValidItem(processedItem);\n });\n },\n findLastItemIndex: function findLastItemIndex() {\n var _this6 = this;\n return findLastIndex(this.visibleItems, function (processedItem) {\n return _this6.isValidItem(processedItem);\n });\n },\n findNextItemIndex: function findNextItemIndex(index) {\n var _this7 = this;\n var matchedItemIndex = index < this.visibleItems.length - 1 ? this.visibleItems.slice(index + 1).findIndex(function (processedItem) {\n return _this7.isValidItem(processedItem);\n }) : -1;\n return matchedItemIndex > -1 ? matchedItemIndex + index + 1 : index;\n },\n findPrevItemIndex: function findPrevItemIndex(index) {\n var _this8 = this;\n var matchedItemIndex = index > 0 ? findLastIndex(this.visibleItems.slice(0, index), function (processedItem) {\n return _this8.isValidItem(processedItem);\n }) : -1;\n return matchedItemIndex > -1 ? matchedItemIndex : index;\n },\n findSelectedItemIndex: function findSelectedItemIndex() {\n var _this9 = this;\n return this.visibleItems.findIndex(function (processedItem) {\n return _this9.isValidSelectedItem(processedItem);\n });\n },\n findFirstFocusedItemIndex: function findFirstFocusedItemIndex() {\n var selectedIndex = this.findSelectedItemIndex();\n return selectedIndex < 0 ? this.findFirstItemIndex() : selectedIndex;\n },\n findLastFocusedItemIndex: function findLastFocusedItemIndex() {\n var selectedIndex = this.findSelectedItemIndex();\n return selectedIndex < 0 ? this.findLastItemIndex() : selectedIndex;\n },\n searchItems: function searchItems(event, _char) {\n var _this10 = this;\n this.searchValue = (this.searchValue || '') + _char;\n var itemIndex = -1;\n var matched = false;\n if (this.focusedItemInfo.index !== -1) {\n itemIndex = this.visibleItems.slice(this.focusedItemInfo.index).findIndex(function (processedItem) {\n return _this10.isItemMatched(processedItem);\n });\n itemIndex = itemIndex === -1 ? this.visibleItems.slice(0, this.focusedItemInfo.index).findIndex(function (processedItem) {\n return _this10.isItemMatched(processedItem);\n }) : itemIndex + this.focusedItemInfo.index;\n } else {\n itemIndex = this.visibleItems.findIndex(function (processedItem) {\n return _this10.isItemMatched(processedItem);\n });\n }\n if (itemIndex !== -1) {\n matched = true;\n }\n if (itemIndex === -1 && this.focusedItemInfo.index === -1) {\n itemIndex = this.findFirstFocusedItemIndex();\n }\n if (itemIndex !== -1) {\n this.changeFocusedItemIndex(event, itemIndex);\n }\n if (this.searchTimeout) {\n clearTimeout(this.searchTimeout);\n }\n this.searchTimeout = setTimeout(function () {\n _this10.searchValue = '';\n _this10.searchTimeout = null;\n }, 500);\n return matched;\n },\n changeFocusedItemIndex: function changeFocusedItemIndex(event, index) {\n if (this.focusedItemInfo.index !== index) {\n this.focusedItemInfo.index = index;\n this.scrollInView();\n }\n },\n scrollInView: function scrollInView() {\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;\n var id = index !== -1 ? \"\".concat(this.id, \"_\").concat(index) : this.focusedItemId;\n var element = findSingle(this.menubar, \"li[id=\\\"\".concat(id, \"\\\"]\"));\n if (element) {\n element.scrollIntoView && element.scrollIntoView({\n block: 'nearest',\n inline: 'start'\n });\n }\n },\n createProcessedItems: function createProcessedItems(items) {\n var _this11 = this;\n var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var parentKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';\n var processedItems = [];\n items && items.forEach(function (item, index) {\n var key = (parentKey !== '' ? parentKey + '_' : '') + index;\n var newItem = {\n item: item,\n index: index,\n level: level,\n key: key,\n parent: parent,\n parentKey: parentKey\n };\n newItem['items'] = _this11.createProcessedItems(item.items, level + 1, newItem, key);\n processedItems.push(newItem);\n });\n return processedItems;\n },\n containerRef: function containerRef(el) {\n this.container = el;\n },\n menubarRef: function menubarRef(el) {\n this.menubar = el ? el.$el : undefined;\n }\n },\n computed: {\n processedItems: function processedItems() {\n return this.createProcessedItems(this.model || []);\n },\n visibleItems: function visibleItems() {\n var _this12 = this;\n var processedItem = this.activeItemPath.find(function (p) {\n return p.key === _this12.focusedItemInfo.parentKey;\n });\n return processedItem ? processedItem.items : this.processedItems;\n },\n focusedItemId: function focusedItemId() {\n return this.focusedItemInfo.index !== -1 ? \"\".concat(this.id).concat(isNotEmpty(this.focusedItemInfo.parentKey) ? '_' + this.focusedItemInfo.parentKey : '', \"_\").concat(this.focusedItemInfo.index) : null;\n }\n },\n components: {\n TieredMenuSub: script$1,\n Portal: Portal\n }\n};\n\nvar _hoisted_1 = [\"id\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_TieredMenuSub = resolveComponent(\"TieredMenuSub\");\n var _component_Portal = resolveComponent(\"Portal\");\n return openBlock(), createBlock(_component_Portal, {\n appendTo: _ctx.appendTo,\n disabled: !_ctx.popup\n }, {\n \"default\": withCtx(function () {\n return [createVNode(Transition, mergeProps({\n name: \"p-connected-overlay\",\n onEnter: $options.onEnter,\n onAfterEnter: $options.onAfterEnter,\n onLeave: $options.onLeave,\n onAfterLeave: $options.onAfterLeave\n }, _ctx.ptm('transition')), {\n \"default\": withCtx(function () {\n return [$data.visible ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n ref: $options.containerRef,\n id: $data.id,\n \"class\": _ctx.cx('root'),\n onClick: _cache[0] || (_cache[0] = function () {\n return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments);\n })\n }, _ctx.ptmi('root')), [_ctx.$slots.start ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('start')\n }, _ctx.ptm('start')), [renderSlot(_ctx.$slots, \"start\")], 16)) : createCommentVNode(\"\", true), createVNode(_component_TieredMenuSub, {\n ref: $options.menubarRef,\n id: $data.id + '_list',\n tabindex: !_ctx.disabled ? _ctx.tabindex : -1,\n role: \"menubar\",\n \"aria-label\": _ctx.ariaLabel,\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-disabled\": _ctx.disabled || undefined,\n \"aria-orientation\": \"vertical\",\n \"aria-activedescendant\": $data.focused ? $options.focusedItemId : undefined,\n menuId: $data.id,\n focusedItemId: $data.focused ? $options.focusedItemId : undefined,\n items: $options.processedItems,\n templates: _ctx.$slots,\n activeItemPath: $data.activeItemPath,\n level: 0,\n visible: $data.submenuVisible,\n pt: _ctx.pt,\n unstyled: _ctx.unstyled,\n onFocus: $options.onFocus,\n onBlur: $options.onBlur,\n onKeydown: $options.onKeyDown,\n onItemClick: $options.onItemClick,\n onItemMouseenter: $options.onItemMouseEnter,\n onItemMousemove: $options.onItemMouseMove\n }, null, 8, [\"id\", \"tabindex\", \"aria-label\", \"aria-labelledby\", \"aria-disabled\", \"aria-activedescendant\", \"menuId\", \"focusedItemId\", \"items\", \"templates\", \"activeItemPath\", \"visible\", \"pt\", \"unstyled\", \"onFocus\", \"onBlur\", \"onKeydown\", \"onItemClick\", \"onItemMouseenter\", \"onItemMousemove\"]), _ctx.$slots.end ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 1,\n \"class\": _ctx.cx('end')\n }, _ctx.ptm('end')), [renderSlot(_ctx.$slots, \"end\")], 16)) : createCommentVNode(\"\", true)], 16, _hoisted_1)) : createCommentVNode(\"\", true)];\n }),\n _: 3\n }, 16, [\"onEnter\", \"onAfterEnter\", \"onLeave\", \"onAfterLeave\"])];\n }),\n _: 3\n }, 8, [\"appendTo\", \"disabled\"]);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-splitbutton {\\n display: inline-flex;\\n position: relative;\\n border-radius: \".concat(dt('splitbutton.border.radius'), \";\\n}\\n\\n.p-splitbutton-button {\\n border-top-right-radius: 0;\\n border-bottom-right-radius: 0;\\n border-right: 0 none;\\n}\\n\\n.p-splitbutton-button:focus-visible,\\n.p-splitbutton-dropdown:focus-visible {\\n z-index: 1;\\n}\\n\\n.p-splitbutton-button:not(:disabled):hover,\\n.p-splitbutton-button:not(:disabled):active {\\n border-right: 0 none;\\n}\\n\\n.p-splitbutton-dropdown {\\n border-top-left-radius: 0;\\n border-bottom-left-radius: 0;\\n}\\n\\n.p-splitbutton .p-menu {\\n min-width: 100%;\\n}\\n\\n.p-splitbutton-fluid {\\n display: flex;\\n}\\n\\n.p-splitbutton-rounded .p-splitbutton-dropdown {\\n border-top-right-radius: \").concat(dt('splitbutton.rounded.border.radius'), \";\\n border-bottom-right-radius: \").concat(dt('splitbutton.rounded.border.radius'), \";\\n}\\n\\n.p-splitbutton-rounded .p-splitbutton-button {\\n border-top-left-radius: \").concat(dt('splitbutton.rounded.border.radius'), \";\\n border-bottom-left-radius: \").concat(dt('splitbutton.rounded.border.radius'), \";\\n}\\n\\n.p-splitbutton-raised {\\n box-shadow: \").concat(dt('splitbutton.raised.shadow'), \";\\n}\\n\");\n};\nvar classes = {\n root: function root(_ref2) {\n var instance = _ref2.instance,\n props = _ref2.props;\n return ['p-splitbutton p-component', {\n 'p-splitbutton-raised': props.raised,\n 'p-splitbutton-rounded': props.rounded,\n 'p-splitbutton-fluid': instance.hasFluid\n }];\n },\n pcButton: 'p-splitbutton-button',\n pcDropdown: 'p-splitbutton-dropdown'\n};\nvar SplitButtonStyle = BaseStyle.extend({\n name: 'splitbutton',\n theme: theme,\n classes: classes\n});\n\nexport { SplitButtonStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { isEmpty } from '@primeuix/utils/object';\nimport { UniqueComponentId } from '@primevue/core/utils';\nimport ChevronDownIcon from '@primevue/icons/chevrondown';\nimport Button from 'primevue/button';\nimport TieredMenu from 'primevue/tieredmenu';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport SplitButtonStyle from 'primevue/splitbutton/style';\nimport { resolveComponent, openBlock, createElementBlock, mergeProps, createVNode, createSlots, withCtx, renderSlot, normalizeClass, createElementVNode, createBlock, resolveDynamicComponent } from 'vue';\n\nvar script$1 = {\n name: 'BaseSplitButton',\n \"extends\": BaseComponent,\n props: {\n label: {\n type: String,\n \"default\": null\n },\n icon: {\n type: String,\n \"default\": null\n },\n model: {\n type: Array,\n \"default\": null\n },\n autoZIndex: {\n type: Boolean,\n \"default\": true\n },\n baseZIndex: {\n type: Number,\n \"default\": 0\n },\n appendTo: {\n type: [String, Object],\n \"default\": 'body'\n },\n disabled: {\n type: Boolean,\n \"default\": false\n },\n fluid: {\n type: Boolean,\n \"default\": null\n },\n \"class\": {\n type: null,\n \"default\": null\n },\n style: {\n type: null,\n \"default\": null\n },\n buttonProps: {\n type: null,\n \"default\": null\n },\n menuButtonProps: {\n type: null,\n \"default\": null\n },\n menuButtonIcon: {\n type: String,\n \"default\": undefined\n },\n dropdownIcon: {\n type: String,\n \"default\": undefined\n },\n severity: {\n type: String,\n \"default\": null\n },\n raised: {\n type: Boolean,\n \"default\": false\n },\n rounded: {\n type: Boolean,\n \"default\": false\n },\n text: {\n type: Boolean,\n \"default\": false\n },\n outlined: {\n type: Boolean,\n \"default\": false\n },\n size: {\n type: String,\n \"default\": null\n },\n plain: {\n type: Boolean,\n \"default\": false\n }\n },\n style: SplitButtonStyle,\n provide: function provide() {\n return {\n $pcSplitButton: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'SplitButton',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['click'],\n inject: {\n $pcFluid: {\n \"default\": null\n }\n },\n data: function data() {\n return {\n id: this.$attrs.id,\n isExpanded: false\n };\n },\n watch: {\n '$attrs.id': function $attrsId(newValue) {\n this.id = newValue || UniqueComponentId();\n }\n },\n mounted: function mounted() {\n var _this = this;\n this.id = this.id || UniqueComponentId();\n this.$watch('$refs.menu.visible', function (newValue) {\n _this.isExpanded = newValue;\n });\n },\n methods: {\n onDropdownButtonClick: function onDropdownButtonClick(event) {\n if (event) {\n event.preventDefault();\n }\n this.$refs.menu.toggle({\n currentTarget: this.$el,\n relatedTarget: this.$refs.button.$el\n });\n this.isExpanded = this.$refs.menu.visible;\n },\n onDropdownKeydown: function onDropdownKeydown(event) {\n if (event.code === 'ArrowDown' || event.code === 'ArrowUp') {\n this.onDropdownButtonClick();\n event.preventDefault();\n }\n },\n onDefaultButtonClick: function onDefaultButtonClick(event) {\n if (this.isExpanded) {\n this.$refs.menu.hide(event);\n }\n this.$emit('click', event);\n }\n },\n computed: {\n containerClass: function containerClass() {\n return [this.cx('root'), this[\"class\"]];\n },\n hasFluid: function hasFluid() {\n return isEmpty(this.fluid) ? !!this.$pcFluid : this.fluid;\n }\n },\n components: {\n PVSButton: Button,\n PVSMenu: TieredMenu,\n ChevronDownIcon: ChevronDownIcon\n }\n};\n\nvar _hoisted_1 = [\"data-p-severity\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_PVSButton = resolveComponent(\"PVSButton\");\n var _component_PVSMenu = resolveComponent(\"PVSMenu\");\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": $options.containerClass,\n style: _ctx.style\n }, _ctx.ptmi('root'), {\n \"data-p-severity\": _ctx.severity\n }), [createVNode(_component_PVSButton, mergeProps({\n type: \"button\",\n \"class\": _ctx.cx('pcButton'),\n label: _ctx.label,\n disabled: _ctx.disabled,\n severity: _ctx.severity,\n text: _ctx.text,\n icon: _ctx.icon,\n outlined: _ctx.outlined,\n size: _ctx.size,\n fluid: _ctx.fluid,\n \"aria-label\": _ctx.label,\n onClick: $options.onDefaultButtonClick\n }, _ctx.buttonProps, {\n pt: _ctx.ptm('pcButton'),\n unstyled: _ctx.unstyled\n }), createSlots({\n \"default\": withCtx(function () {\n return [renderSlot(_ctx.$slots, \"default\")];\n }),\n _: 2\n }, [_ctx.$slots.icon ? {\n name: \"icon\",\n fn: withCtx(function (slotProps) {\n return [renderSlot(_ctx.$slots, \"icon\", {\n \"class\": normalizeClass(slotProps[\"class\"])\n }, function () {\n return [createElementVNode(\"span\", mergeProps({\n \"class\": [_ctx.icon, slotProps[\"class\"]]\n }, _ctx.ptm('pcButton')['icon'], {\n \"data-pc-section\": \"buttonicon\"\n }), null, 16)];\n })];\n }),\n key: \"0\"\n } : undefined]), 1040, [\"class\", \"label\", \"disabled\", \"severity\", \"text\", \"icon\", \"outlined\", \"size\", \"fluid\", \"aria-label\", \"onClick\", \"pt\", \"unstyled\"]), createVNode(_component_PVSButton, mergeProps({\n ref: \"button\",\n type: \"button\",\n \"class\": _ctx.cx('pcDropdown'),\n disabled: _ctx.disabled,\n \"aria-haspopup\": \"true\",\n \"aria-expanded\": $data.isExpanded,\n \"aria-controls\": $data.id + '_overlay',\n onClick: $options.onDropdownButtonClick,\n onKeydown: $options.onDropdownKeydown,\n severity: _ctx.severity,\n text: _ctx.text,\n outlined: _ctx.outlined,\n size: _ctx.size,\n unstyled: _ctx.unstyled\n }, _ctx.menuButtonProps, {\n pt: _ctx.ptm('pcDropdown')\n }), {\n icon: withCtx(function (slotProps) {\n return [renderSlot(_ctx.$slots, _ctx.$slots.dropdownicon ? 'dropdownicon' : 'menubuttonicon', {\n \"class\": normalizeClass(slotProps[\"class\"])\n }, function () {\n return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.menuButtonIcon || _ctx.dropdownIcon ? 'span' : 'ChevronDownIcon'), mergeProps({\n \"class\": [_ctx.dropdownIcon || _ctx.menuButtonIcon, slotProps[\"class\"]]\n }, _ctx.ptm('pcDropdown')['icon'], {\n \"data-pc-section\": \"menubuttonicon\"\n }), null, 16, [\"class\"]))];\n })];\n }),\n _: 3\n }, 16, [\"class\", \"disabled\", \"aria-expanded\", \"aria-controls\", \"onClick\", \"onKeydown\", \"severity\", \"text\", \"outlined\", \"size\", \"unstyled\", \"pt\"]), createVNode(_component_PVSMenu, {\n ref: \"menu\",\n id: $data.id + '_overlay',\n model: _ctx.model,\n popup: true,\n autoZIndex: _ctx.autoZIndex,\n baseZIndex: _ctx.baseZIndex,\n appendTo: _ctx.appendTo,\n unstyled: _ctx.unstyled,\n pt: _ctx.ptm('pcMenu')\n }, createSlots({\n _: 2\n }, [_ctx.$slots.menuitemicon ? {\n name: \"itemicon\",\n fn: withCtx(function (slotProps) {\n return [renderSlot(_ctx.$slots, \"menuitemicon\", {\n item: slotProps.item,\n \"class\": normalizeClass(slotProps[\"class\"])\n })];\n }),\n key: \"0\"\n } : undefined, _ctx.$slots.item ? {\n name: \"item\",\n fn: withCtx(function (slotProps) {\n return [renderSlot(_ctx.$slots, \"item\", {\n item: slotProps.item,\n hasSubmenu: slotProps.hasSubmenu,\n label: slotProps.label,\n props: slotProps.props\n })];\n }),\n key: \"1\"\n } : undefined]), 1032, [\"id\", \"model\", \"autoZIndex\", \"baseZIndex\", \"appendTo\", \"unstyled\", \"pt\"])], 16, _hoisted_1);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n\n\n","\n\n\n\n\n","\n\n\n\n\n","\n\n\n","\n\n\n\n\n","import {\n useQueueSettingsStore,\n useQueuePendingTaskCountStore\n} from '@/stores/queueStore'\nimport { app } from '@/scripts/app'\nimport { api } from '@/scripts/api'\n\nexport function setupAutoQueueHandler() {\n const queueCountStore = useQueuePendingTaskCountStore()\n const queueSettingsStore = useQueueSettingsStore()\n\n let graphHasChanged = false\n let internalCount = 0 // Use an internal counter here so it is instantly updated when re-queuing\n api.addEventListener('graphChanged', () => {\n if (queueSettingsStore.mode === 'change') {\n if (internalCount) {\n graphHasChanged = true\n } else {\n graphHasChanged = false\n app.queuePrompt(0, queueSettingsStore.batchCount)\n internalCount++\n }\n }\n })\n\n queueCountStore.$subscribe(\n () => {\n internalCount = queueCountStore.count\n if (!internalCount && !app.lastExecutionError) {\n if (\n queueSettingsStore.mode === 'instant' ||\n (queueSettingsStore.mode === 'change' && graphHasChanged)\n ) {\n graphHasChanged = false\n app.queuePrompt(0, queueSettingsStore.batchCount)\n }\n }\n },\n { detached: true }\n )\n}\n","export enum LatentPreviewMethod {\n NoPreviews = 'none',\n Auto = 'auto',\n Latent2RGB = 'latent2rgb',\n TAESD = 'taesd'\n}\n\nexport enum LogLevel {\n DEBUG = 'DEBUG',\n INFO = 'INFO',\n WARNING = 'WARNING',\n ERROR = 'ERROR',\n CRITICAL = 'CRITICAL'\n}\n\nexport enum HashFunction {\n MD5 = 'md5',\n SHA1 = 'sha1',\n SHA256 = 'sha256',\n SHA512 = 'sha512'\n}\n\nexport enum AutoLaunch {\n // Let server decide whether to auto launch based on the current environment\n Auto = 'auto',\n // Disable auto launch\n Disable = 'disable',\n // Enable auto launch\n Enable = 'enable'\n}\n\nexport enum CudaMalloc {\n // Let server decide whether to use CUDA malloc based on the current environment\n Auto = 'auto',\n // Disable CUDA malloc\n Disable = 'disable',\n // Enable CUDA malloc\n Enable = 'enable'\n}\n\nexport enum FloatingPointPrecision {\n AUTO = 'auto',\n FP64 = 'fp64',\n FP32 = 'fp32',\n FP16 = 'fp16',\n BF16 = 'bf16',\n FP8E4M3FN = 'fp8_e4m3fn',\n FP8E5M2 = 'fp8_e5m2'\n}\n\nexport enum CrossAttentionMethod {\n Auto = 'auto',\n Split = 'split',\n Quad = 'quad',\n Pytorch = 'pytorch'\n}\n\nexport enum VramManagement {\n Auto = 'auto',\n GPUOnly = 'gpu-only',\n HighVram = 'highvram',\n NormalVram = 'normalvram',\n LowVram = 'lowvram',\n NoVram = 'novram',\n CPU = 'cpu'\n}\n","import { FormItem } from '@/types/settingTypes'\nimport {\n LatentPreviewMethod,\n LogLevel,\n HashFunction,\n AutoLaunch,\n CudaMalloc,\n FloatingPointPrecision,\n CrossAttentionMethod,\n VramManagement\n} from '@/types/serverArgs'\n\nexport type ServerConfigValue = string | number | true | null | undefined\n\nexport interface ServerConfig extends FormItem {\n id: string\n defaultValue: T\n category?: string[]\n // Override the default value getter with a custom function.\n getValue?: (value: T) => Record\n}\n\nexport const WEB_ONLY_CONFIG_ITEMS: ServerConfig[] = [\n // Launch behavior\n {\n id: 'auto-launch',\n name: 'Automatically opens in the browser on startup',\n category: ['Launch'],\n type: 'combo',\n options: Object.values(AutoLaunch),\n defaultValue: AutoLaunch.Auto,\n getValue: (value: AutoLaunch) => {\n switch (value) {\n case AutoLaunch.Auto:\n return {}\n case AutoLaunch.Enable:\n return {\n ['auto-launch']: true\n }\n case AutoLaunch.Disable:\n return {\n ['disable-auto-launch']: true\n }\n }\n }\n }\n]\n\nexport const SERVER_CONFIG_ITEMS: ServerConfig[] = [\n // Network settings\n {\n id: 'listen',\n name: 'Host: The IP address to listen on',\n category: ['Network'],\n type: 'text',\n defaultValue: '127.0.0.1'\n },\n {\n id: 'port',\n name: 'Port: The port to listen on',\n category: ['Network'],\n type: 'number',\n // The default launch port for desktop app is 8000 instead of 8188.\n defaultValue: 8000\n },\n {\n id: 'tls-keyfile',\n name: 'TLS Key File: Path to TLS key file for HTTPS',\n category: ['Network'],\n type: 'text',\n defaultValue: ''\n },\n {\n id: 'tls-certfile',\n name: 'TLS Certificate File: Path to TLS certificate file for HTTPS',\n category: ['Network'],\n type: 'text',\n defaultValue: ''\n },\n {\n id: 'enable-cors-header',\n name: 'Enable CORS header: Use \"*\" for all origins or specify domain',\n category: ['Network'],\n type: 'text',\n defaultValue: ''\n },\n {\n id: 'max-upload-size',\n name: 'Maximum upload size (MB)',\n category: ['Network'],\n type: 'number',\n defaultValue: 100\n },\n\n // CUDA settings\n {\n id: 'cuda-device',\n name: 'CUDA device index to use',\n category: ['CUDA'],\n type: 'number',\n defaultValue: null\n },\n {\n id: 'cuda-malloc',\n name: 'Use CUDA malloc for memory allocation',\n category: ['CUDA'],\n type: 'combo',\n options: Object.values(CudaMalloc),\n defaultValue: CudaMalloc.Auto,\n getValue: (value: CudaMalloc) => {\n switch (value) {\n case CudaMalloc.Auto:\n return {}\n case CudaMalloc.Enable:\n return {\n ['cuda-malloc']: true\n }\n case CudaMalloc.Disable:\n return {\n ['disable-cuda-malloc']: true\n }\n }\n }\n },\n\n // Precision settings\n {\n id: 'global-precision',\n name: 'Global floating point precision',\n category: ['Inference'],\n type: 'combo',\n options: [\n FloatingPointPrecision.AUTO,\n FloatingPointPrecision.FP32,\n FloatingPointPrecision.FP16\n ],\n defaultValue: FloatingPointPrecision.AUTO,\n tooltip: 'Global floating point precision',\n getValue: (value: FloatingPointPrecision) => {\n switch (value) {\n case FloatingPointPrecision.AUTO:\n return {}\n case FloatingPointPrecision.FP32:\n return {\n ['force-fp32']: true\n }\n case FloatingPointPrecision.FP16:\n return {\n ['force-fp16']: true\n }\n default:\n return {}\n }\n }\n },\n\n // UNET precision\n {\n id: 'unet-precision',\n name: 'UNET precision',\n category: ['Inference'],\n type: 'combo',\n options: [\n FloatingPointPrecision.AUTO,\n FloatingPointPrecision.FP64,\n FloatingPointPrecision.FP32,\n FloatingPointPrecision.FP16,\n FloatingPointPrecision.BF16,\n FloatingPointPrecision.FP8E4M3FN,\n FloatingPointPrecision.FP8E5M2\n ],\n defaultValue: FloatingPointPrecision.AUTO,\n tooltip: 'UNET precision',\n getValue: (value: FloatingPointPrecision) => {\n switch (value) {\n case FloatingPointPrecision.AUTO:\n return {}\n default:\n return {\n [`${value.toLowerCase()}-unet`]: true\n }\n }\n }\n },\n\n // VAE settings\n {\n id: 'vae-precision',\n name: 'VAE precision',\n category: ['Inference'],\n type: 'combo',\n options: [\n FloatingPointPrecision.AUTO,\n FloatingPointPrecision.FP16,\n FloatingPointPrecision.FP32,\n FloatingPointPrecision.BF16\n ],\n defaultValue: FloatingPointPrecision.AUTO,\n tooltip: 'VAE precision',\n getValue: (value: FloatingPointPrecision) => {\n switch (value) {\n case FloatingPointPrecision.AUTO:\n return {}\n default:\n return {\n [`${value.toLowerCase()}-vae`]: true\n }\n }\n }\n },\n {\n id: 'cpu-vae',\n name: 'Run VAE on CPU',\n category: ['Inference'],\n type: 'boolean',\n defaultValue: false\n },\n\n // Text Encoder settings\n {\n id: 'text-encoder-precision',\n name: 'Text Encoder precision',\n category: ['Inference'],\n type: 'combo',\n options: [\n FloatingPointPrecision.AUTO,\n FloatingPointPrecision.FP8E4M3FN,\n FloatingPointPrecision.FP8E5M2,\n FloatingPointPrecision.FP16,\n FloatingPointPrecision.FP32\n ],\n defaultValue: FloatingPointPrecision.AUTO,\n tooltip: 'Text Encoder precision',\n getValue: (value: FloatingPointPrecision) => {\n switch (value) {\n case FloatingPointPrecision.AUTO:\n return {}\n default:\n return {\n [`${value.toLowerCase()}-text-enc`]: true\n }\n }\n }\n },\n\n // Memory and performance settings\n {\n id: 'force-channels-last',\n name: 'Force channels-last memory format',\n category: ['Memory'],\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'directml',\n name: 'DirectML device index',\n category: ['Memory'],\n type: 'number',\n defaultValue: null\n },\n {\n id: 'disable-ipex-optimize',\n name: 'Disable IPEX optimization',\n category: ['Memory'],\n type: 'boolean',\n defaultValue: false\n },\n\n // Preview settings\n {\n id: 'preview-method',\n name: 'Method used for latent previews',\n category: ['Preview'],\n type: 'combo',\n options: Object.values(LatentPreviewMethod),\n defaultValue: LatentPreviewMethod.NoPreviews\n },\n {\n id: 'preview-size',\n name: 'Size of preview images',\n category: ['Preview'],\n type: 'slider',\n defaultValue: 512,\n attrs: {\n min: 128,\n max: 2048,\n step: 128\n }\n },\n\n // Cache settings\n {\n id: 'cache-classic',\n name: 'Use classic cache system',\n category: ['Cache'],\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'cache-lru',\n name: 'Use LRU caching with a maximum of N node results cached.',\n category: ['Cache'],\n type: 'number',\n defaultValue: null,\n tooltip: 'May use more RAM/VRAM.'\n },\n\n // Attention settings\n {\n id: 'cross-attention-method',\n name: 'Cross attention method',\n category: ['Attention'],\n type: 'combo',\n options: Object.values(CrossAttentionMethod),\n defaultValue: CrossAttentionMethod.Auto,\n getValue: (value: CrossAttentionMethod) => {\n switch (value) {\n case CrossAttentionMethod.Auto:\n return {}\n default:\n return {\n [`use-${value.toLowerCase()}-cross-attention`]: true\n }\n }\n }\n },\n {\n id: 'disable-xformers',\n name: 'Disable xFormers optimization',\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'force-upcast-attention',\n name: 'Force attention upcast',\n category: ['Attention'],\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'dont-upcast-attention',\n name: 'Prevent attention upcast',\n category: ['Attention'],\n type: 'boolean',\n defaultValue: false\n },\n\n // VRAM management\n {\n id: 'vram-management',\n name: 'VRAM management mode',\n category: ['Memory'],\n type: 'combo',\n options: Object.values(VramManagement),\n defaultValue: VramManagement.Auto,\n getValue: (value: VramManagement) => {\n switch (value) {\n case VramManagement.Auto:\n return {}\n default:\n return {\n [value]: true\n }\n }\n }\n },\n {\n id: 'reserve-vram',\n name: 'Reserved VRAM (GB)',\n category: ['Memory'],\n type: 'number',\n defaultValue: null,\n tooltip:\n 'Set the amount of vram in GB you want to reserve for use by your OS/other software. By default some amount is reverved depending on your OS.'\n },\n\n // Misc settings\n {\n id: 'default-hashing-function',\n name: 'Default hashing function for model files',\n type: 'combo',\n options: Object.values(HashFunction),\n defaultValue: HashFunction.SHA256\n },\n {\n id: 'disable-smart-memory',\n name: 'Disable smart memory management',\n tooltip:\n 'Force ComfyUI to aggressively offload to regular ram instead of keeping models in vram when it can.',\n category: ['Memory'],\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'deterministic',\n name: 'Make pytorch use slower deterministic algorithms when it can.',\n type: 'boolean',\n defaultValue: false,\n tooltip: 'Note that this might not make images deterministic in all cases.'\n },\n {\n id: 'fast',\n name: 'Enable some untested and potentially quality deteriorating optimizations.',\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'dont-print-server',\n name: \"Don't print server output to console.\",\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'disable-metadata',\n name: 'Disable saving prompt metadata in files.',\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'disable-all-custom-nodes',\n name: 'Disable loading all custom nodes.',\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'log-level',\n name: 'Logging verbosity level',\n type: 'combo',\n options: Object.values(LogLevel),\n defaultValue: LogLevel.INFO,\n getValue: (value: LogLevel) => {\n return {\n verbose: value\n }\n }\n },\n // Directories\n {\n id: 'input-directory',\n name: 'Input directory',\n category: ['Directories'],\n type: 'text',\n defaultValue: ''\n },\n {\n id: 'output-directory',\n name: 'Output directory',\n category: ['Directories'],\n type: 'text',\n defaultValue: ''\n }\n]\n","import { app } from '@/scripts/app'\nimport { api } from '@/scripts/api'\nimport {\n showSettingsDialog,\n showTemplateWorkflowsDialog\n} from '@/services/dialogService'\nimport { workflowService } from '@/services/workflowService'\nimport type { ComfyCommand } from '@/stores/commandStore'\nimport { useTitleEditorStore } from '@/stores/graphStore'\nimport { useQueueSettingsStore, useQueueStore } from '@/stores/queueStore'\nimport { useSettingStore } from '@/stores/settingStore'\nimport { useToastStore } from '@/stores/toastStore'\nimport { type ComfyWorkflow, useWorkflowStore } from '@/stores/workflowStore'\nimport { useBottomPanelStore } from '@/stores/workspace/bottomPanelStore'\nimport { useWorkspaceStore } from '@/stores/workspaceStore'\nimport {\n LiteGraph,\n LGraphEventMode,\n LGraphNode,\n LGraphGroup\n} from '@comfyorg/litegraph'\nimport { useSearchBoxStore } from '@/stores/workspace/searchBoxStore'\n\nexport function useCoreCommands(): ComfyCommand[] {\n const getTracker = () => useWorkflowStore()?.activeWorkflow?.changeTracker\n\n const getSelectedNodes = (): LGraphNode[] => {\n const selectedNodes = app.canvas.selected_nodes\n const result: LGraphNode[] = []\n if (selectedNodes) {\n for (const i in selectedNodes) {\n const node = selectedNodes[i]\n result.push(node)\n }\n }\n return result\n }\n\n const toggleSelectedNodesMode = (mode: LGraphEventMode) => {\n getSelectedNodes().forEach((node) => {\n if (node.mode === mode) {\n node.mode = LGraphEventMode.ALWAYS\n } else {\n node.mode = mode\n }\n })\n }\n\n return [\n {\n id: 'Comfy.NewBlankWorkflow',\n icon: 'pi pi-plus',\n label: 'New Blank Workflow',\n menubarLabel: 'New',\n function: () => workflowService.loadBlankWorkflow()\n },\n {\n id: 'Comfy.OpenWorkflow',\n icon: 'pi pi-folder-open',\n label: 'Open Workflow',\n menubarLabel: 'Open',\n function: () => {\n app.ui.loadFile()\n }\n },\n {\n id: 'Comfy.LoadDefaultWorkflow',\n icon: 'pi pi-code',\n label: 'Load Default Workflow',\n function: () => workflowService.loadDefaultWorkflow()\n },\n {\n id: 'Comfy.SaveWorkflow',\n icon: 'pi pi-save',\n label: 'Save Workflow',\n menubarLabel: 'Save',\n function: async () => {\n const workflow = useWorkflowStore().activeWorkflow as ComfyWorkflow\n if (!workflow) return\n\n await workflowService.saveWorkflow(workflow)\n }\n },\n {\n id: 'Comfy.SaveWorkflowAs',\n icon: 'pi pi-save',\n label: 'Save Workflow As',\n menubarLabel: 'Save As',\n function: async () => {\n const workflow = useWorkflowStore().activeWorkflow as ComfyWorkflow\n if (!workflow) return\n\n await workflowService.saveWorkflowAs(workflow)\n }\n },\n {\n id: 'Comfy.ExportWorkflow',\n icon: 'pi pi-download',\n label: 'Export Workflow',\n menubarLabel: 'Export',\n function: () => {\n workflowService.exportWorkflow('workflow', 'workflow')\n }\n },\n {\n id: 'Comfy.ExportWorkflowAPI',\n icon: 'pi pi-download',\n label: 'Export Workflow (API Format)',\n menubarLabel: 'Export (API)',\n function: () => {\n workflowService.exportWorkflow('workflow_api', 'output')\n }\n },\n {\n id: 'Comfy.Undo',\n icon: 'pi pi-undo',\n label: 'Undo',\n function: async () => {\n await getTracker()?.undo?.()\n }\n },\n {\n id: 'Comfy.Redo',\n icon: 'pi pi-refresh',\n label: 'Redo',\n function: async () => {\n await getTracker()?.redo?.()\n }\n },\n {\n id: 'Comfy.ClearWorkflow',\n icon: 'pi pi-trash',\n label: 'Clear Workflow',\n function: () => {\n const settingStore = useSettingStore()\n if (\n !settingStore.get('Comfy.ComfirmClear') ||\n confirm('Clear workflow?')\n ) {\n app.clean()\n app.graph.clear()\n api.dispatchCustomEvent('graphCleared')\n }\n }\n },\n {\n id: 'Comfy.Canvas.ResetView',\n icon: 'pi pi-expand',\n label: 'Reset View',\n function: () => {\n app.resetView()\n }\n },\n {\n id: 'Comfy.OpenClipspace',\n icon: 'pi pi-clipboard',\n label: 'Clipspace',\n function: () => {\n app.openClipspace()\n }\n },\n {\n id: 'Comfy.RefreshNodeDefinitions',\n icon: 'pi pi-refresh',\n label: 'Refresh Node Definitions',\n function: async () => {\n await app.refreshComboInNodes()\n }\n },\n {\n id: 'Comfy.Interrupt',\n icon: 'pi pi-stop',\n label: 'Interrupt',\n function: async () => {\n await api.interrupt()\n useToastStore().add({\n severity: 'info',\n summary: 'Interrupted',\n detail: 'Execution has been interrupted',\n life: 1000\n })\n }\n },\n {\n id: 'Comfy.ClearPendingTasks',\n icon: 'pi pi-stop',\n label: 'Clear Pending Tasks',\n function: async () => {\n await useQueueStore().clear(['queue'])\n useToastStore().add({\n severity: 'info',\n summary: 'Confirmed',\n detail: 'Pending tasks deleted',\n life: 3000\n })\n }\n },\n {\n id: 'Comfy.BrowseTemplates',\n icon: 'pi pi-folder-open',\n label: 'Browse Templates',\n function: showTemplateWorkflowsDialog\n },\n {\n id: 'Comfy.Canvas.ZoomIn',\n icon: 'pi pi-plus',\n label: 'Zoom In',\n function: () => {\n const ds = app.canvas.ds\n ds.changeScale(\n ds.scale * 1.1,\n ds.element ? [ds.element.width / 2, ds.element.height / 2] : undefined\n )\n app.canvas.setDirty(true, true)\n }\n },\n {\n id: 'Comfy.Canvas.ZoomOut',\n icon: 'pi pi-minus',\n label: 'Zoom Out',\n function: () => {\n const ds = app.canvas.ds\n ds.changeScale(\n ds.scale / 1.1,\n ds.element ? [ds.element.width / 2, ds.element.height / 2] : undefined\n )\n app.canvas.setDirty(true, true)\n }\n },\n {\n id: 'Comfy.Canvas.FitView',\n icon: 'pi pi-expand',\n label: 'Fit view to selected nodes',\n function: () => {\n if (app.canvas.empty) {\n useToastStore().add({\n severity: 'error',\n summary: 'Empty canvas',\n life: 3000\n })\n return\n }\n app.canvas.fitViewToSelectionAnimated()\n }\n },\n {\n id: 'Comfy.Canvas.ToggleLock',\n icon: 'pi pi-lock',\n label: 'Canvas Toggle Lock',\n function: () => {\n app.canvas['read_only'] = !app.canvas['read_only']\n }\n },\n {\n id: 'Comfy.Canvas.ToggleLinkVisibility',\n icon: 'pi pi-eye',\n label: 'Canvas Toggle Link Visibility',\n versionAdded: '1.3.6',\n\n function: (() => {\n const settingStore = useSettingStore()\n let lastLinksRenderMode = LiteGraph.SPLINE_LINK\n\n return () => {\n const currentMode = settingStore.get('Comfy.LinkRenderMode')\n\n if (currentMode === LiteGraph.HIDDEN_LINK) {\n // If links are hidden, restore the last positive value or default to spline mode\n settingStore.set('Comfy.LinkRenderMode', lastLinksRenderMode)\n } else {\n // If links are visible, store the current mode and hide links\n lastLinksRenderMode = currentMode\n settingStore.set('Comfy.LinkRenderMode', LiteGraph.HIDDEN_LINK)\n }\n }\n })()\n },\n {\n id: 'Comfy.QueuePrompt',\n icon: 'pi pi-play',\n label: 'Queue Prompt',\n versionAdded: '1.3.7',\n function: () => {\n const batchCount = useQueueSettingsStore().batchCount\n app.queuePrompt(0, batchCount)\n }\n },\n {\n id: 'Comfy.QueuePromptFront',\n icon: 'pi pi-play',\n label: 'Queue Prompt (Front)',\n versionAdded: '1.3.7',\n function: () => {\n const batchCount = useQueueSettingsStore().batchCount\n app.queuePrompt(-1, batchCount)\n }\n },\n {\n id: 'Comfy.ShowSettingsDialog',\n icon: 'pi pi-cog',\n label: 'Show Settings Dialog',\n versionAdded: '1.3.7',\n function: () => {\n showSettingsDialog()\n }\n },\n {\n id: 'Comfy.Graph.GroupSelectedNodes',\n icon: 'pi pi-sitemap',\n label: 'Group Selected Nodes',\n versionAdded: '1.3.7',\n function: () => {\n const { canvas } = app\n if (!canvas.selectedItems?.size) {\n useToastStore().add({\n severity: 'error',\n summary: 'Nothing to group',\n detail:\n 'Please select the nodes (or other groups) to create a group for',\n life: 3000\n })\n return\n }\n const group = new LGraphGroup()\n const padding = useSettingStore().get(\n 'Comfy.GroupSelectedNodes.Padding'\n )\n group.resizeTo(canvas.selectedItems, padding)\n canvas.graph.add(group)\n useTitleEditorStore().titleEditorTarget = group\n }\n },\n {\n id: 'Workspace.NextOpenedWorkflow',\n icon: 'pi pi-step-forward',\n label: 'Next Opened Workflow',\n versionAdded: '1.3.9',\n function: () => {\n workflowService.loadNextOpenedWorkflow()\n }\n },\n {\n id: 'Workspace.PreviousOpenedWorkflow',\n icon: 'pi pi-step-backward',\n label: 'Previous Opened Workflow',\n versionAdded: '1.3.9',\n function: () => {\n workflowService.loadPreviousOpenedWorkflow()\n }\n },\n {\n id: 'Comfy.Canvas.ToggleSelectedNodes.Mute',\n icon: 'pi pi-volume-off',\n label: 'Mute/Unmute Selected Nodes',\n versionAdded: '1.3.11',\n function: () => {\n toggleSelectedNodesMode(LGraphEventMode.NEVER)\n }\n },\n {\n id: 'Comfy.Canvas.ToggleSelectedNodes.Bypass',\n icon: 'pi pi-shield',\n label: 'Bypass/Unbypass Selected Nodes',\n versionAdded: '1.3.11',\n function: () => {\n toggleSelectedNodesMode(LGraphEventMode.BYPASS)\n }\n },\n {\n id: 'Comfy.Canvas.ToggleSelectedNodes.Pin',\n icon: 'pi pi-pin',\n label: 'Pin/Unpin Selected Nodes',\n versionAdded: '1.3.11',\n function: () => {\n getSelectedNodes().forEach((node) => {\n node.pin(!node.pinned)\n })\n }\n },\n {\n id: 'Comfy.Canvas.ToggleSelected.Pin',\n icon: 'pi pi-pin',\n label: 'Pin/Unpin Selected Items',\n versionAdded: '1.3.33',\n function: () => {\n for (const item of app.canvas.selectedItems) {\n if (item instanceof LGraphNode || item instanceof LGraphGroup) {\n item.pin(!item.pinned)\n }\n }\n }\n },\n {\n id: 'Comfy.Canvas.ToggleSelectedNodes.Collapse',\n icon: 'pi pi-minus',\n label: 'Collapse/Expand Selected Nodes',\n versionAdded: '1.3.11',\n function: () => {\n getSelectedNodes().forEach((node) => {\n node.collapse()\n })\n }\n },\n {\n id: 'Comfy.ToggleTheme',\n icon: 'pi pi-moon',\n label: 'Toggle Theme (Dark/Light)',\n versionAdded: '1.3.12',\n function: (() => {\n let previousDarkTheme: string = 'dark'\n\n // Official light theme is the only light theme supported now.\n const isDarkMode = (themeId: string) => themeId !== 'light'\n return () => {\n const settingStore = useSettingStore()\n const currentTheme = settingStore.get('Comfy.ColorPalette')\n if (isDarkMode(currentTheme)) {\n previousDarkTheme = currentTheme\n settingStore.set('Comfy.ColorPalette', 'light')\n } else {\n settingStore.set('Comfy.ColorPalette', previousDarkTheme)\n }\n }\n })()\n },\n {\n id: 'Workspace.ToggleBottomPanel',\n icon: 'pi pi-list',\n label: 'Toggle Bottom Panel',\n versionAdded: '1.3.22',\n function: () => {\n useBottomPanelStore().toggleBottomPanel()\n }\n },\n {\n id: 'Workspace.ToggleFocusMode',\n icon: 'pi pi-eye',\n label: 'Toggle Focus Mode',\n versionAdded: '1.3.27',\n function: () => {\n useWorkspaceStore().toggleFocusMode()\n }\n },\n {\n id: 'Comfy.Graph.FitGroupToContents',\n icon: 'pi pi-expand',\n label: 'Fit Group To Contents',\n versionAdded: '1.4.9',\n function: () => {\n for (const group of app.canvas.selectedItems) {\n if (group instanceof LGraphGroup) {\n group.recomputeInsideNodes()\n const padding = useSettingStore().get(\n 'Comfy.GroupSelectedNodes.Padding'\n )\n group.resizeTo(group.children, padding)\n app.graph.change()\n }\n }\n }\n },\n {\n id: 'Comfy.Help.OpenComfyUIIssues',\n icon: 'pi pi-github',\n label: 'Open ComfyUI Issues',\n menubarLabel: 'ComfyUI Issues',\n versionAdded: '1.5.5',\n function: () => {\n window.open(\n 'https://github.com/comfyanonymous/ComfyUI/issues',\n '_blank'\n )\n }\n },\n {\n id: 'Comfy.Help.OpenComfyUIDocs',\n icon: 'pi pi-info-circle',\n label: 'Open ComfyUI Docs',\n menubarLabel: 'ComfyUI Docs',\n versionAdded: '1.5.5',\n function: () => {\n window.open('https://docs.comfy.org/', '_blank')\n }\n },\n {\n id: 'Comfy.Help.OpenComfyOrgDiscord',\n icon: 'pi pi-discord',\n label: 'Open Comfy-Org Discord',\n menubarLabel: 'Comfy-Org Discord',\n versionAdded: '1.5.5',\n function: () => {\n window.open('https://www.comfy.org/discord', '_blank')\n }\n },\n {\n id: 'Workspace.SearchBox.Toggle',\n icon: 'pi pi-search',\n label: 'Toggle Search Box',\n versionAdded: '1.5.7',\n function: () => {\n useSearchBoxStore().toggleVisible()\n }\n }\n ]\n}\n","\n\n\n"],"names":["theme","classes","script$1","Badge","provide","script","render","item","BaseComponent","content","showNavigators","ChevronLeftIcon","ChevronRightIcon","_hoisted_1","_hoisted_2","_hoisted_3","createElementVNode","root","inlineStyles","_toConsumableArray","_arrayWithoutHoles","_iterableToArray","_unsupportedIterableToArray","_nonIterableSpread","_arrayLikeToArray","data","mounted","beforeUnmount","panels","onKeydown","getPTOptions","_typeof$1","o","updated","option","_hide","onFocus","onArrowLeftKey","onArrowRightKey","onHomeKey","onEndKey","onPageUpKey","onPageDownKey","onEnterKey","_","scrollInView","id","InputText","VirtualScroller","Portal","ChevronDownIcon","SpinnerIcon","Chip","_typeof","ownKeys","r","_objectSpread","_defineProperty","_toPropertyKey","_toPrimitive","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","onRemove","ref","onClick","_sfc_main","AutoComplete","suggestions","search","comfyApp","repeat","widget","script$2","InfoCircleIcon","CheckIcon","ExclamationTriangleIcon","TimesCircleIcon","TimesIcon","render$1","message","options","getAriaPosInset","AngleRightIcon","AngleDownIcon","_hoisted_1$1","$attrsId","getItemProp","getItemLabel","isItemDisabled","isItemVisible","isItemGroup","show","hide","onBlur","onKeyDown","activeItemPath","onItemClick","onItemMouseEnter","onItemMouseMove","onArrowDownKey","onArrowUpKey","onEscapeKey","onTabKey","bindOutsideClickListener","unbindOutsideClickListener","bindResizeListener","unbindResizeListener","isSelected","processedItems","BarsIcon","toggle","PlusIcon","MinusIcon","Button","submenu","getItemId","getItemKey","getItemLabelId","isItemActive","isItemFocused","onEnter","getAriaSetSize","getMenuItemProps","containerRef","isItemSeparator","getProccessedItemLabel","isProccessedItemGroup","onItemChange","onOverlayClick","onSpaceKey","onLeave","alignOverlay","bindScrollListener","unbindScrollListener","isItemMatched","isValidItem","isValidSelectedItem","findFirstItemIndex","findLastItemIndex","findNextItemIndex","findPrevItemIndex","findSelectedItemIndex","findFirstFocusedItemIndex","findLastFocusedItemIndex","searchItems","changeFocusedItemIndex","createProcessedItems","menubarRef","visibleItems","focusedItemId","hasFluid","TieredMenu","clamp","LatentPreviewMethod","LogLevel","HashFunction","AutoLaunch","CudaMalloc","FloatingPointPrecision","CrossAttentionMethod","VramManagement"],"mappings":";;;;;AAIa,MAAA,sBAAsB,YAAY,eAAe,MAAM;AAC5D,QAAA,oBAAoB,WAA4C,IAAI;AAEnE,SAAA;AAAA,IACL;AAAA,EAAA;AAEJ,CAAC;AAEY,MAAA,iBAAiB,YAAY,UAAU,MAAM;AAMlD,QAAA,SAAS,WAAgC,IAAI;AAE5C,SAAA;AAAA,IACL;AAAA,EAAA;AAEJ,CAAC;;;;ACCD,UAAM,eAAe;AAEf,UAAA,YAAY,IAAI,KAAK;AACrB,UAAA,cAAc,IAAI,EAAE;AAC1B,UAAM,aAAa,IAAmB;AAAA,MACpC,UAAU;AAAA,MACV,MAAM;AAAA,MACN,KAAK;AAAA,MACL,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,UAAU;AAAA,IAAA,CACX;AAED,UAAM,mBAAmB;AACzB,UAAM,cAAc;AACd,UAAA,0BAA0B,IAAI,IAAI;AAElC,UAAA,SAAS,wBAAC,aAAqB;AACnC,UAAI,iBAAiB,qBAAqB,SAAS,KAAA,MAAW,IAAI;AAC/C,yBAAA,kBAAkB,QAAQ,SAAS,KAAK;AACrD,YAAA,MAAM,eAAe,MAAM,IAAI;AAAA,MACrC;AACA,gBAAU,QAAQ;AAClB,uBAAiB,oBAAoB;AACzB,kBAAA,OAAQ,mBAAmB,wBAAwB;AAAA,IAAA,GAPlD;AAUf;AAAA,MACE,MAAM,iBAAiB;AAAA,MACvB,CAAC,WAAW;AACV,YAAI,WAAW,MAAM;AACnB;AAAA,QACF;AACA,oBAAY,QAAQ,OAAO;AAC3B,kBAAU,QAAQ;AACM,gCAA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EAAA;AAAA,YACrB;AAAA,YACA,aAAa,IAAI,iCAAiC;AAAA,UAAA;AAIpD,wBAAA,EAAgB;AAKA,4BAAE,kBAAkB,4BAA4B,EAAE;AAGlE,gCAAA,EAAwB;QAC1B;AAAA,QACA,EAAE,SAAS,IAAK;AAAA,MAAA;AAAA,IAClB,GAzBmB;;;;;;;;;;;;;","x_google_ignoreList":[2,3,10,11,12,13,15,16,17,18,20,21,30,31,35,36,41,42,44,45,46,47,48,49]} \ No newline at end of file diff --git a/web/assets/GraphView-B3TpSwhZ.css b/web/assets/GraphView-CIRWBKTm.css similarity index 71% rename from web/assets/GraphView-B3TpSwhZ.css rename to web/assets/GraphView-CIRWBKTm.css index 34ba43b1..59d1b3d1 100644 --- a/web/assets/GraphView-B3TpSwhZ.css +++ b/web/assets/GraphView-CIRWBKTm.css @@ -1,90 +1,31 @@ -.group-title-editor.node-title-editor[data-v-8a100d5a] { +.comfy-menu-hamburger[data-v-5661bed0] { + pointer-events: auto; + position: fixed; z-index: 9999; - padding: 0.25rem; -} -[data-v-8a100d5a] .editable-text { - width: 100%; - height: 100%; -} -[data-v-8a100d5a] .editable-text input { - width: 100%; - height: 100%; - /* Override the default font size */ - font-size: inherit; } -.side-bar-button-icon { - font-size: var(--sidebar-icon-size) !important; -} -.side-bar-button-selected .side-bar-button-icon { - font-size: var(--sidebar-icon-size) !important; - font-weight: bold; -} - -.side-bar-button[data-v-caa3ee9c] { - width: var(--sidebar-width); - height: var(--sidebar-width); - border-radius: 0; -} -.comfyui-body-left .side-bar-button.side-bar-button-selected[data-v-caa3ee9c], -.comfyui-body-left .side-bar-button.side-bar-button-selected[data-v-caa3ee9c]:hover { - border-left: 4px solid var(--p-button-text-primary-color); -} -.comfyui-body-right .side-bar-button.side-bar-button-selected[data-v-caa3ee9c], -.comfyui-body-right .side-bar-button.side-bar-button-selected[data-v-caa3ee9c]:hover { - border-right: 4px solid var(--p-button-text-primary-color); -} - -:root { - --sidebar-width: 64px; - --sidebar-icon-size: 1.5rem; -} -:root .small-sidebar { - --sidebar-width: 40px; - --sidebar-icon-size: 1rem; -} - -.side-tool-bar-container[data-v-7851c166] { - display: flex; - flex-direction: column; - align-items: center; - - pointer-events: auto; - - width: var(--sidebar-width); - height: 100%; - - background-color: var(--comfy-menu-secondary-bg); - color: var(--fg-color); - box-shadow: var(--bar-shadow); -} -.side-tool-bar-end[data-v-7851c166] { - align-self: flex-end; - margin-top: auto; -} - -[data-v-7c3279c1] .p-splitter-gutter { +[data-v-e50caa15] .p-splitter-gutter { pointer-events: auto; } -[data-v-7c3279c1] .p-splitter-gutter:hover,[data-v-7c3279c1] .p-splitter-gutter[data-p-gutter-resizing='true'] { +[data-v-e50caa15] .p-splitter-gutter:hover,[data-v-e50caa15] .p-splitter-gutter[data-p-gutter-resizing='true'] { transition: background-color 0.2s ease 300ms; background-color: var(--p-primary-color); } -.side-bar-panel[data-v-7c3279c1] { +.side-bar-panel[data-v-e50caa15] { background-color: var(--bg-color); pointer-events: auto; } -.bottom-panel[data-v-7c3279c1] { +.bottom-panel[data-v-e50caa15] { background-color: var(--bg-color); pointer-events: auto; } -.splitter-overlay[data-v-7c3279c1] { +.splitter-overlay[data-v-e50caa15] { pointer-events: none; border-style: none; background-color: transparent; } -.splitter-overlay-root[data-v-7c3279c1] { +.splitter-overlay-root[data-v-e50caa15] { position: absolute; top: 0px; left: 0px; @@ -98,7 +39,50 @@ z-index: 999; } -[data-v-d7cc0bce] .highlight { +.p-buttongroup-vertical[data-v-cf40dd39] { + display: flex; + flex-direction: column; + border-radius: var(--p-button-border-radius); + overflow: hidden; + border: 1px solid var(--p-panel-border-color); +} +.p-buttongroup-vertical .p-button[data-v-cf40dd39] { + margin: 0; + border-radius: 0; +} + +.node-tooltip[data-v-46859edf] { + background: var(--comfy-input-bg); + border-radius: 5px; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.4); + color: var(--input-text); + font-family: sans-serif; + left: 0; + max-width: 30vw; + padding: 4px 8px; + position: absolute; + top: 0; + transform: translate(5px, calc(-100% - 5px)); + white-space: pre-wrap; + z-index: 99999; +} + +.group-title-editor.node-title-editor[data-v-12d3fd12] { + z-index: 9999; + padding: 0.25rem; +} +[data-v-12d3fd12] .editable-text { + width: 100%; + height: 100%; +} +[data-v-12d3fd12] .editable-text input { + width: 100%; + height: 100%; + /* Override the default font size */ + font-size: inherit; +} + +[data-v-5741c9ae] .highlight { background-color: var(--p-primary-color); color: var(--p-primary-contrast-color); font-weight: bold; @@ -125,58 +109,107 @@ align-items: flex-start !important; } -.node-tooltip[data-v-9ecc8adc] { - background: var(--comfy-input-bg); - border-radius: 5px; - box-shadow: 0 0 5px rgba(0, 0, 0, 0.4); - color: var(--input-text); - font-family: sans-serif; - left: 0; - max-width: 30vw; - padding: 4px 8px; - position: absolute; - top: 0; - transform: translate(5px, calc(-100% - 5px)); - white-space: pre-wrap; - z-index: 99999; +.side-bar-button-icon { + font-size: var(--sidebar-icon-size) !important; +} +.side-bar-button-selected .side-bar-button-icon { + font-size: var(--sidebar-icon-size) !important; + font-weight: bold; } -.p-buttongroup-vertical[data-v-94481f39] { - display: flex; - flex-direction: column; - border-radius: var(--p-button-border-radius); - overflow: hidden; - border: 1px solid var(--p-panel-border-color); -} -.p-buttongroup-vertical .p-button[data-v-94481f39] { - margin: 0; +.side-bar-button[data-v-6ab4daa6] { + width: var(--sidebar-width); + height: var(--sidebar-width); border-radius: 0; } +.comfyui-body-left .side-bar-button.side-bar-button-selected[data-v-6ab4daa6], +.comfyui-body-left .side-bar-button.side-bar-button-selected[data-v-6ab4daa6]:hover { + border-left: 4px solid var(--p-button-text-primary-color); +} +.comfyui-body-right .side-bar-button.side-bar-button-selected[data-v-6ab4daa6], +.comfyui-body-right .side-bar-button.side-bar-button-selected[data-v-6ab4daa6]:hover { + border-right: 4px solid var(--p-button-text-primary-color); +} + +:root { + --sidebar-width: 64px; + --sidebar-icon-size: 1.5rem; +} +:root .small-sidebar { + --sidebar-width: 40px; + --sidebar-icon-size: 1rem; +} + +.side-tool-bar-container[data-v-37d8d7b4] { + display: flex; + flex-direction: column; + align-items: center; -.comfy-menu-hamburger[data-v-962c4073] { pointer-events: auto; - position: fixed; - z-index: 9999; + + width: var(--sidebar-width); + height: 100%; + + background-color: var(--comfy-menu-secondary-bg); + color: var(--fg-color); + box-shadow: var(--bar-shadow); +} +.side-tool-bar-end[data-v-37d8d7b4] { + align-self: flex-end; + margin-top: auto; } -[data-v-4cb762cb] .p-togglebutton::before { - display: none +[data-v-b9328350] .p-inputtext { + border-top-left-radius: 0; + border-bottom-left-radius: 0; } -[data-v-4cb762cb] .p-togglebutton { - position: relative; - flex-shrink: 0; - border-radius: 0px; + +.comfyui-queue-button[data-v-7f4f551b] .p-splitbutton-dropdown { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} + +.actionbar[data-v-915e5456] { + pointer-events: all; + position: fixed; + z-index: 1000; +} +.actionbar.is-docked[data-v-915e5456] { + position: static; + border-style: none; background-color: transparent; - padding: 0px + padding: 0px; } -[data-v-4cb762cb] .p-togglebutton.p-togglebutton-checked { - border-bottom-width: 2px; - border-bottom-color: var(--p-button-text-primary-color) +.actionbar.is-dragging[data-v-915e5456] { + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; } -[data-v-4cb762cb] .p-togglebutton-checked .close-button,[data-v-4cb762cb] .p-togglebutton:hover .close-button { - visibility: visible +[data-v-915e5456] .p-panel-content { + padding: 0.25rem; } -.status-indicator[data-v-4cb762cb] { +.is-docked[data-v-915e5456] .p-panel-content { + padding: 0px; +} +[data-v-915e5456] .p-panel-header { + display: none; +} + +.top-menubar[data-v-6fecd137] .p-menubar-item-link svg { + display: none; +} +[data-v-6fecd137] .p-menubar-submenu.dropdown-direction-up { + top: auto; + bottom: 100%; + flex-direction: column-reverse; +} +.keybinding-tag[data-v-6fecd137] { + background: var(--p-content-hover-background); + border-color: var(--p-content-border-color); + border-style: solid; +} + +.status-indicator[data-v-8d011a31] { position: absolute; font-weight: 700; font-size: 1.5rem; @@ -184,61 +217,32 @@ left: 50%; transform: translate(-50%, -50%) } -[data-v-4cb762cb] .p-togglebutton:hover .status-indicator { + +[data-v-d485c044] .p-togglebutton::before { display: none } -[data-v-4cb762cb] .p-togglebutton .close-button { +[data-v-d485c044] .p-togglebutton { + position: relative; + flex-shrink: 0; + border-radius: 0px; + background-color: transparent; + padding: 0px +} +[data-v-d485c044] .p-togglebutton.p-togglebutton-checked { + border-bottom-width: 2px; + border-bottom-color: var(--p-button-text-primary-color) +} +[data-v-d485c044] .p-togglebutton-checked .close-button,[data-v-d485c044] .p-togglebutton:hover .close-button { + visibility: visible +} +[data-v-d485c044] .p-togglebutton:hover .status-indicator { + display: none +} +[data-v-d485c044] .p-togglebutton .close-button { visibility: hidden } -.top-menubar[data-v-a2b12676] .p-menubar-item-link svg { - display: none; -} -[data-v-a2b12676] .p-menubar-submenu.dropdown-direction-up { - top: auto; - bottom: 100%; - flex-direction: column-reverse; -} -.keybinding-tag[data-v-a2b12676] { - background: var(--p-content-hover-background); - border-color: var(--p-content-border-color); - border-style: solid; -} - -[data-v-713442be] .p-inputtext { - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} - -.comfyui-queue-button[data-v-d3897845] .p-splitbutton-dropdown { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} - -.actionbar[data-v-542a7001] { - pointer-events: all; - position: fixed; - z-index: 1000; -} -.actionbar.is-docked[data-v-542a7001] { - position: static; - border-style: none; - background-color: transparent; - padding: 0px; -} -.actionbar.is-dragging[data-v-542a7001] { - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; -} -[data-v-542a7001] .p-panel-content { - padding: 0.25rem; -} -[data-v-542a7001] .p-panel-header { - display: none; -} - -.comfyui-menu[data-v-d792da31] { +.comfyui-menu[data-v-878b63b8] { width: 100vw; background: var(--comfy-menu-bg); color: var(--fg-color); @@ -251,16 +255,16 @@ grid-column: 1/-1; max-height: 90vh; } -.comfyui-menu.dropzone[data-v-d792da31] { +.comfyui-menu.dropzone[data-v-878b63b8] { background: var(--p-highlight-background); } -.comfyui-menu.dropzone-active[data-v-d792da31] { +.comfyui-menu.dropzone-active[data-v-878b63b8] { background: var(--p-highlight-background-focus); } -[data-v-d792da31] .p-menubar-item-label { +[data-v-878b63b8] .p-menubar-item-label { line-height: revert; } -.comfyui-logo[data-v-d792da31] { +.comfyui-logo[data-v-878b63b8] { font-size: 1.2em; -webkit-user-select: none; -moz-user-select: none; diff --git a/web/assets/GraphView-BWxgNrh6.js b/web/assets/GraphView-DswvqURL.js similarity index 88% rename from web/assets/GraphView-BWxgNrh6.js rename to web/assets/GraphView-DswvqURL.js index e4de07c3..14d9f192 100644 --- a/web/assets/GraphView-BWxgNrh6.js +++ b/web/assets/GraphView-DswvqURL.js @@ -1,881 +1,118 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineStore, s as shallowRef, a as defineComponent, u as useSettingStore, r as ref, w as watch, L as LGraphGroup, b as app, c as LGraphNode, o as onMounted, e as onUnmounted, f as openBlock, g as createElementBlock, h as createVNode, E as EditableText, n as normalizeStyle, i as createCommentVNode, j as LiteGraph, _ as _export_sfc, B as BaseStyle, k as script$e, l as resolveComponent, m as mergeProps, p as renderSlot, q as computed, t as resolveDirective, v as withDirectives, x as createBlock, y as withCtx, z as unref, A as createBaseVNode, C as normalizeClass, D as script$f, F as useCommandStore, G as useDialogStore, S as SettingDialogHeader, H as SettingDialogContent, I as useI18n, J as useUserStore, K as onBeforeUnmount, M as resolveDynamicComponent, N as useWorkspaceStore, O as useKeybindingStore, P as Fragment, Q as renderList, T as Teleport, R as pushScopeId, U as popScopeId, V as script$g, W as getWidth, X as findSingle, Y as getOuterHeight, Z as getOffset, $ as getOuterWidth, a0 as getHeight, a1 as script$h, a2 as script$i, a3 as Ripple, a4 as getAttribute, a5 as focus, a6 as equals, a7 as useBottomPanelStore, a8 as toDisplayString, a9 as script$j, aa as getVNodeProp, ab as isArray, ac as useSidebarTabStore, ad as vShow, ae as isNotEmpty, af as UniqueComponentId, ag as ZIndex, ah as resolveFieldData, ai as OverlayEventBus, aj as isEmpty, ak as addStyle, al as relativePosition, am as absolutePosition, an as ConnectedOverlayScrollHandler, ao as isTouchDevice, ap as findLastIndex, aq as script$k, ar as script$l, as as script$m, at as script$n, au as script$o, av as script$p, aw as Transition, ax as createSlots, ay as createTextVNode, az as useNodeFrequencyStore, aA as useNodeBookmarkStore, aB as highlightQuery, aC as script$q, aD as formatNumberWithSuffix, aE as NodeSourceType, aF as useNodeDefStore, aG as NodePreview, aH as NodeSearchFilter, aI as script$r, aJ as SearchFilterChip, aK as storeToRefs, aL as watchEffect, aM as useEventListener, aN as isRef, aO as toRaw, aP as LinkReleaseTriggerAction, aQ as nextTick, aR as st, aS as normalizeI18nKey, aT as getColorPalette, aU as BadgePosition, aV as LGraphBadge, aW as _, aX as defaultColorPalette, aY as NodeBadgeMode, aZ as markRaw, a_ as useModelToNodeStore, a$ as CanvasPointer, b0 as useWorkflowStore, b1 as setStorageValue, b2 as api, b3 as usePragmaticDroppable, b4 as ComfyNodeDefImpl, b5 as ComfyModelDef, b6 as LGraph, b7 as LLink, b8 as DragAndScale, b9 as LGraphCanvas, ba as ContextMenu, bb as ChangeTracker, bc as workflowService, bd as showNativeMenu, be as script$s, bf as script$t, bg as script$u, bh as script$v, bi as script$w, bj as normalizeProps, bk as ToastEventBus, bl as setAttribute, bm as TransitionGroup, bn as useToast, bo as useToastStore, bp as useExecutionStore, bq as useTitle, br as withModifiers, bs as script$x, bt as script$y, bu as resolve, bv as script$z, bw as script$A, bx as isPrintableCharacter, by as guardReactiveProps, bz as useMenuItemStore, bA as script$D, bB as nestedPosition, bC as useQueueSettingsStore, bD as script$E, bE as useQueuePendingTaskCountStore, bF as useLocalStorage, bG as useDraggable, bH as watchDebounced, bI as inject, bJ as useElementBounding, bK as lodashExports, bL as useEventBus, bM as provide, bN as script$F, bO as LGraphEventMode, bP as useQueueStore, bQ as showTemplateWorkflowsDialog, bR as showSettingsDialog, bS as i18n, bT as useModelStore } from "./index-DIU5yZe9.js"; -import { s as script$B, a as script$C } from "./index-d698Brhb.js"; -import { u as useServerConfigStore } from "./serverConfigStore-DYv7_Nld.js"; -const useTitleEditorStore = defineStore("titleEditor", () => { - const titleEditorTarget = shallowRef(null); - return { - titleEditorTarget - }; -}); -const useCanvasStore = defineStore("canvas", () => { - const canvas = shallowRef(null); - return { - canvas - }; +import { d as defineComponent, u as useExecutionStore, c as computed, a as useSettingStore, b as useWorkflowStore, e as useTitle, o as openBlock, f as createElementBlock, g as useWorkspaceStore, w as watchEffect, h as app, r as resolveDirective, i as withDirectives, v as vShow, j as unref, k as createBlock, n as normalizeStyle, s as showNativeMenu, l as script$d, _ as _export_sfc, m as onMounted, p as onBeforeUnmount, B as BaseStyle, q as script$e, t as getWidth, x as getHeight, y as getOuterWidth, z as getOuterHeight, A as getVNodeProp, C as isArray, D as mergeProps, F as Fragment, E as renderList, G as resolveDynamicComponent, H as createBaseVNode, I as createCommentVNode, J as renderSlot, K as useSidebarTabStore, L as useBottomPanelStore, M as withCtx, N as createVNode, O as getAttribute, P as findSingle, Q as focus, R as equals, S as Ripple, T as normalizeClass, U as getOffset, V as script$f, W as script$g, X as toDisplayString, Y as script$h, Z as markRaw, $ as defineStore, a0 as shallowRef, a1 as useI18n, a2 as useCommandStore, a3 as LiteGraph, a4 as useColorPaletteStore, a5 as watch, a6 as useNodeDefStore, a7 as BadgePosition, a8 as LGraphBadge, a9 as _, aa as NodeBadgeMode, ab as ref, ac as useEventListener, ad as nextTick, ae as st, af as normalizeI18nKey, ag as LGraphGroup, ah as LGraphNode, ai as EditableText, aj as isNotEmpty, ak as UniqueComponentId, al as ZIndex, am as resolveFieldData, an as OverlayEventBus, ao as isEmpty, ap as addStyle, aq as relativePosition, ar as absolutePosition, as as ConnectedOverlayScrollHandler, at as isTouchDevice, au as findLastIndex, av as script$i, aw as script$j, ax as script$k, ay as script$l, az as script$m, aA as script$n, aB as resolveComponent, aC as Transition, aD as createSlots, aE as createTextVNode, aF as useNodeFrequencyStore, aG as useNodeBookmarkStore, aH as highlightQuery, aI as script$o, aJ as formatNumberWithSuffix, aK as NodeSourceType, aL as pushScopeId, aM as popScopeId, aN as NodePreview, aO as NodeSearchFilter, aP as script$p, aQ as SearchFilterChip, aR as useLitegraphService, aS as storeToRefs, aT as isRef, aU as toRaw, aV as LinkReleaseTriggerAction, aW as script$q, aX as useUserStore, aY as useDialogStore, aZ as SettingDialogHeader, a_ as SettingDialogContent, a$ as useKeybindingStore, b0 as Teleport, b1 as LinkMarkerShape, b2 as useModelToNodeStore, b3 as CanvasPointer, b4 as IS_CONTROL_WIDGET, b5 as updateControlWidgetLabel, b6 as useColorPaletteService, b7 as setStorageValue, b8 as api, b9 as usePragmaticDroppable, ba as LGraph, bb as LLink, bc as DragAndScale, bd as LGraphCanvas, be as ContextMenu, bf as ChangeTracker, bg as useWorkflowService, bh as ComfyNodeDefImpl, bi as ComfyModelDef, bj as script$r, bk as script$s, bl as script$t, bm as script$u, bn as script$v, bo as normalizeProps, bp as ToastEventBus, bq as setAttribute, br as TransitionGroup, bs as useToast, bt as useToastStore, bu as resolve, bv as nestedPosition, bw as script$w, bx as isPrintableCharacter, by as useQueueSettingsStore, bz as script$x, bA as useQueuePendingTaskCountStore, bB as useLocalStorage, bC as useDraggable, bD as watchDebounced, bE as inject, bF as useElementBounding, bG as lodashExports, bH as useEventBus, bI as script$z, bJ as guardReactiveProps, bK as useMenuItemStore, bL as usePragmaticDraggable, bM as withModifiers, bN as script$B, bO as script$C, bP as provide, bQ as script$D, bR as useDialogService, bS as LGraphEventMode, bT as useQueueStore, bU as i18n, bV as useModelStore } from "./index-C4Fk50Nx.js"; +import { s as script$y } from "./index-hdfnBvYs.js"; +import { s as script$A } from "./index-lMQBwSDj.js"; +import { u as useKeybindingService } from "./keybindingService-D48fkLBy.js"; +import { u as useServerConfigStore } from "./serverConfigStore-BawYAb1j.js"; +import "./index-B7ycxfFq.js"; +const DEFAULT_TITLE = "ComfyUI"; +const TITLE_SUFFIX = " - ComfyUI"; +const _sfc_main$t = /* @__PURE__ */ defineComponent({ + __name: "BrowserTabTitle", + setup(__props) { + const executionStore = useExecutionStore(); + const executionText = computed( + () => executionStore.isIdle ? "" : `[${executionStore.executionProgress}%]` + ); + const settingStore = useSettingStore(); + const betaMenuEnabled = computed( + () => settingStore.get("Comfy.UseNewMenu") !== "Disabled" + ); + const workflowStore = useWorkflowStore(); + const isUnsavedText = computed( + () => workflowStore.activeWorkflow?.isModified || !workflowStore.activeWorkflow?.isPersisted ? " *" : "" + ); + const workflowNameText = computed(() => { + const workflowName = workflowStore.activeWorkflow?.filename; + return workflowName ? isUnsavedText.value + workflowName + TITLE_SUFFIX : DEFAULT_TITLE; + }); + const nodeExecutionTitle = computed( + () => executionStore.executingNode && executionStore.executingNodeProgress ? `${executionText.value}[${executionStore.executingNodeProgress}%] ${executionStore.executingNode.type}` : "" + ); + const workflowTitle = computed( + () => executionText.value + (betaMenuEnabled.value ? workflowNameText.value : DEFAULT_TITLE) + ); + const title = computed(() => nodeExecutionTitle.value || workflowTitle.value); + useTitle(title); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div"); + }; + } }); const _sfc_main$s = /* @__PURE__ */ defineComponent({ - __name: "TitleEditor", + __name: "MenuHamburger", setup(__props) { + const workspaceState = useWorkspaceStore(); const settingStore = useSettingStore(); - const showInput = ref(false); - const editedTitle = ref(""); - const inputStyle = ref({ - position: "fixed", - left: "0px", - top: "0px", - width: "200px", - height: "20px", - fontSize: "12px" - }); - const titleEditorStore = useTitleEditorStore(); - const canvasStore = useCanvasStore(); - const previousCanvasDraggable = ref(true); - const onEdit = /* @__PURE__ */ __name((newValue) => { - if (titleEditorStore.titleEditorTarget && newValue.trim() !== "") { - titleEditorStore.titleEditorTarget.title = newValue.trim(); - app.graph.setDirtyCanvas(true, true); - } - showInput.value = false; - titleEditorStore.titleEditorTarget = null; - canvasStore.canvas.allow_dragcanvas = previousCanvasDraggable.value; - }, "onEdit"); - watch( - () => titleEditorStore.titleEditorTarget, - (target) => { - if (target === null) { - return; - } - editedTitle.value = target.title; - showInput.value = true; - previousCanvasDraggable.value = canvasStore.canvas.allow_dragcanvas; - canvasStore.canvas.allow_dragcanvas = false; - if (target instanceof LGraphGroup) { - const group = target; - const [x, y] = group.pos; - const [w, h] = group.size; - const [left, top] = app.canvasPosToClientPos([x, y]); - inputStyle.value.left = `${left}px`; - inputStyle.value.top = `${top}px`; - const width = w * app.canvas.ds.scale; - const height = group.titleHeight * app.canvas.ds.scale; - inputStyle.value.width = `${width}px`; - inputStyle.value.height = `${height}px`; - const fontSize = group.font_size * app.canvas.ds.scale; - inputStyle.value.fontSize = `${fontSize}px`; - } else if (target instanceof LGraphNode) { - const node = target; - const [x, y] = node.getBounding(); - const canvasWidth = node.width; - const canvasHeight = LiteGraph.NODE_TITLE_HEIGHT; - const [left, top] = app.canvasPosToClientPos([x, y]); - inputStyle.value.left = `${left}px`; - inputStyle.value.top = `${top}px`; - const width = canvasWidth * app.canvas.ds.scale; - const height = canvasHeight * app.canvas.ds.scale; - inputStyle.value.width = `${width}px`; - inputStyle.value.height = `${height}px`; - const fontSize = 12 * app.canvas.ds.scale; - inputStyle.value.fontSize = `${fontSize}px`; - } - } - ); - const canvasEventHandler = /* @__PURE__ */ __name((event) => { - if (!settingStore.get("Comfy.Group.DoubleClickTitleToEdit")) { + const exitFocusMode = /* @__PURE__ */ __name(() => { + workspaceState.focusMode = false; + }, "exitFocusMode"); + watchEffect(() => { + if (settingStore.get("Comfy.UseNewMenu") !== "Disabled") { return; } - if (event.detail.subType === "group-double-click") { - const group = event.detail.group; - const [x, y] = group.pos; - const e = event.detail.originalEvent; - const relativeY = e.canvasY - y; - if (relativeY > group.titleHeight) { - return; - } - titleEditorStore.titleEditorTarget = group; + if (workspaceState.focusMode) { + app.ui.menuContainer.style.display = "none"; + } else { + app.ui.menuContainer.style.display = "block"; } - }, "canvasEventHandler"); - const extension = { - name: "Comfy.NodeTitleEditor", - nodeCreated(node) { - const originalCallback = node.onNodeTitleDblClick; - node.onNodeTitleDblClick = function(e, ...args) { - if (!settingStore.get("Comfy.Node.DoubleClickTitleToEdit")) { - return; - } - titleEditorStore.titleEditorTarget = this; - if (typeof originalCallback === "function") { - originalCallback.call(this, e, ...args); - } - }; - } - }; - onMounted(() => { - document.addEventListener("litegraph:canvas", canvasEventHandler); - app.registerExtension(extension); }); - onUnmounted(() => { - document.removeEventListener("litegraph:canvas", canvasEventHandler); - }); - return (_ctx, _cache) => { - return showInput.value ? (openBlock(), createElementBlock("div", { - key: 0, - class: "group-title-editor node-title-editor", - style: normalizeStyle(inputStyle.value) - }, [ - createVNode(EditableText, { - isEditing: showInput.value, - modelValue: editedTitle.value, - onEdit - }, null, 8, ["isEditing", "modelValue"]) - ], 4)) : createCommentVNode("", true); - }; - } -}); -const TitleEditor = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-8a100d5a"]]); -var theme$8 = /* @__PURE__ */ __name(function theme(_ref) { - var dt = _ref.dt; - return "\n.p-overlaybadge {\n position: relative;\n}\n\n.p-overlaybadge .p-badge {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n transform-origin: 100% 0;\n margin: 0;\n outline-width: ".concat(dt("overlaybadge.outline.width"), ";\n outline-style: solid;\n outline-color: ").concat(dt("overlaybadge.outline.color"), ";\n}\n"); -}, "theme"); -var classes$b = { - root: "p-overlaybadge" -}; -var OverlayBadgeStyle = BaseStyle.extend({ - name: "overlaybadge", - theme: theme$8, - classes: classes$b -}); -var script$1$b = { - name: "OverlayBadge", - "extends": script$e, - style: OverlayBadgeStyle, - provide: /* @__PURE__ */ __name(function provide2() { - return { - $pcOverlayBadge: this, - $parentInstance: this - }; - }, "provide") -}; -var script$d = { - name: "OverlayBadge", - "extends": script$1$b, - inheritAttrs: false, - components: { - Badge: script$e - } -}; -function render$j(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Badge = resolveComponent("Badge"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default"), createVNode(_component_Badge, mergeProps(_ctx.$props, { - pt: _ctx.ptm("pcBadge") - }), null, 16, ["pt"])], 16); -} -__name(render$j, "render$j"); -script$d.render = render$j; -const _sfc_main$r = /* @__PURE__ */ defineComponent({ - __name: "SidebarIcon", - props: { - icon: String, - selected: Boolean, - tooltip: { - type: String, - default: "" - }, - class: { - type: String, - default: "" - }, - iconBadge: { - type: [String, Function], - default: "" - } - }, - emits: ["click"], - setup(__props, { emit: __emit }) { - const props = __props; - const emit = __emit; - const overlayValue = computed( - () => typeof props.iconBadge === "function" ? props.iconBadge() || "" : props.iconBadge + const menuSetting = computed(() => settingStore.get("Comfy.UseNewMenu")); + const positionCSS = computed( + () => ( + // 'Bottom' menuSetting shows the hamburger button in the bottom right corner + // 'Disabled', 'Top' menuSetting shows the hamburger button in the top right corner + menuSetting.value === "Bottom" ? { bottom: "0px", right: "0px" } : { top: "0px", right: "0px" } + ) ); - const shouldShowBadge = computed(() => !!overlayValue.value); return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); - return withDirectives((openBlock(), createBlock(unref(script$f), { - class: normalizeClass(props.class), + return withDirectives((openBlock(), createBlock(unref(script$d), { + class: "comfy-menu-hamburger", + style: normalizeStyle(positionCSS.value), + icon: "pi pi-bars", + severity: "secondary", text: "", - pt: { - root: { - class: `side-bar-button ${props.selected ? "p-button-primary side-bar-button-selected" : "p-button-secondary"}`, - "aria-label": props.tooltip - } - }, - onClick: _cache[0] || (_cache[0] = ($event) => emit("click", $event)) - }, { - icon: withCtx(() => [ - shouldShowBadge.value ? (openBlock(), createBlock(unref(script$d), { - key: 0, - value: overlayValue.value - }, { - default: withCtx(() => [ - createBaseVNode("i", { - class: normalizeClass(props.icon + " side-bar-button-icon") - }, null, 2) - ]), - _: 1 - }, 8, ["value"])) : (openBlock(), createElementBlock("i", { - key: 1, - class: normalizeClass(props.icon + " side-bar-button-icon") - }, null, 2)) - ]), - _: 1 - }, 8, ["class", "pt"])), [ - [_directive_tooltip, { value: props.tooltip, showDelay: 300, hideDelay: 300 }] + size: "large", + onClick: exitFocusMode, + onContextmenu: unref(showNativeMenu) + }, null, 8, ["style", "onContextmenu"])), [ + [vShow, unref(workspaceState).focusMode], + [_directive_tooltip, { value: _ctx.$t("menu.showMenu"), showDelay: 300 }] ]); }; } }); -const SidebarIcon = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-caa3ee9c"]]); -const _sfc_main$q = /* @__PURE__ */ defineComponent({ - __name: "SidebarThemeToggleIcon", +const MenuHamburger = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-5661bed0"]]); +const _sfc_main$r = /* @__PURE__ */ defineComponent({ + __name: "UnloadWindowConfirmDialog", setup(__props) { const settingStore = useSettingStore(); - const currentTheme = computed(() => settingStore.get("Comfy.ColorPalette")); - const icon = computed( - () => currentTheme.value !== "light" ? "pi pi-moon" : "pi pi-sun" - ); - const commandStore = useCommandStore(); - const toggleTheme = /* @__PURE__ */ __name(() => { - commandStore.execute("Comfy.ToggleTheme"); - }, "toggleTheme"); - return (_ctx, _cache) => { - return openBlock(), createBlock(SidebarIcon, { - icon: icon.value, - onClick: toggleTheme, - tooltip: _ctx.$t("sideToolbar.themeToggle"), - class: "comfy-vue-theme-toggle" - }, null, 8, ["icon", "tooltip"]); - }; - } -}); -const _sfc_main$p = /* @__PURE__ */ defineComponent({ - __name: "SidebarSettingsToggleIcon", - setup(__props) { - const dialogStore = useDialogStore(); - const showSetting = /* @__PURE__ */ __name(() => { - dialogStore.showDialog({ - key: "global-settings", - headerComponent: SettingDialogHeader, - component: SettingDialogContent - }); - }, "showSetting"); - return (_ctx, _cache) => { - return openBlock(), createBlock(SidebarIcon, { - icon: "pi pi-cog", - class: "comfy-settings-btn", - onClick: showSetting, - tooltip: _ctx.$t("g.settings") - }, null, 8, ["tooltip"]); - }; - } -}); -const _sfc_main$o = /* @__PURE__ */ defineComponent({ - __name: "SidebarLogoutIcon", - setup(__props) { - const { t } = useI18n(); - const userStore = useUserStore(); - const tooltip = computed( - () => `${t("sideToolbar.logout")} (${userStore.currentUser?.username})` - ); - const logout = /* @__PURE__ */ __name(() => { - userStore.logout(); - window.location.reload(); - }, "logout"); - return (_ctx, _cache) => { - return openBlock(), createBlock(SidebarIcon, { - icon: "pi pi-sign-out", - tooltip: tooltip.value, - onClick: logout - }, null, 8, ["tooltip"]); - }; - } -}); -const _sfc_main$n = /* @__PURE__ */ defineComponent({ - __name: "ExtensionSlot", - props: { - extension: {} - }, - setup(__props) { - const props = __props; - const mountCustomExtension = /* @__PURE__ */ __name((extension, el) => { - extension.render(el); - }, "mountCustomExtension"); + const handleBeforeUnload = /* @__PURE__ */ __name((event) => { + if (settingStore.get("Comfy.Window.UnloadConfirmation")) { + event.preventDefault(); + return true; + } + return void 0; + }, "handleBeforeUnload"); + onMounted(() => { + window.addEventListener("beforeunload", handleBeforeUnload); + }); onBeforeUnmount(() => { - if (props.extension.type === "custom" && props.extension.destroy) { - props.extension.destroy(); - } + window.removeEventListener("beforeunload", handleBeforeUnload); }); return (_ctx, _cache) => { - return _ctx.extension.type === "vue" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.extension.component), { key: 0 })) : (openBlock(), createElementBlock("div", { - key: 1, - ref: /* @__PURE__ */ __name((el) => { - if (el) - mountCustomExtension( - props.extension, - el - ); - }, "ref") - }, null, 512)); + return openBlock(), createElementBlock("div"); }; } }); -const _withScopeId$5 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-7851c166"), n = n(), popScopeId(), n), "_withScopeId$5"); -const _hoisted_1$n = { class: "side-tool-bar-end" }; -const _hoisted_2$k = { - key: 0, - class: "sidebar-content-container h-full overflow-y-auto overflow-x-hidden" -}; -const _sfc_main$m = /* @__PURE__ */ defineComponent({ - __name: "SideToolbar", - setup(__props) { - const workspaceStore = useWorkspaceStore(); - const settingStore = useSettingStore(); - const userStore = useUserStore(); - const teleportTarget = computed( - () => settingStore.get("Comfy.Sidebar.Location") === "left" ? ".comfyui-body-left" : ".comfyui-body-right" - ); - const isSmall = computed( - () => settingStore.get("Comfy.Sidebar.Size") === "small" - ); - const tabs = computed(() => workspaceStore.getSidebarTabs()); - const selectedTab = computed(() => workspaceStore.sidebarTab.activeSidebarTab); - const onTabClick = /* @__PURE__ */ __name((item3) => { - workspaceStore.sidebarTab.toggleSidebarTab(item3.id); - }, "onTabClick"); - const keybindingStore = useKeybindingStore(); - const getTabTooltipSuffix = /* @__PURE__ */ __name((tab) => { - const keybinding = keybindingStore.getKeybindingByCommandId( - `Workspace.ToggleSidebarTab.${tab.id}` - ); - return keybinding ? ` (${keybinding.combo.toString()})` : ""; - }, "getTabTooltipSuffix"); - return (_ctx, _cache) => { - return openBlock(), createElementBlock(Fragment, null, [ - (openBlock(), createBlock(Teleport, { to: teleportTarget.value }, [ - createBaseVNode("nav", { - class: normalizeClass("side-tool-bar-container" + (isSmall.value ? " small-sidebar" : "")) - }, [ - (openBlock(true), createElementBlock(Fragment, null, renderList(tabs.value, (tab) => { - return openBlock(), createBlock(SidebarIcon, { - key: tab.id, - icon: tab.icon, - iconBadge: tab.iconBadge, - tooltip: tab.tooltip + getTabTooltipSuffix(tab), - selected: tab.id === selectedTab.value?.id, - class: normalizeClass(tab.id + "-tab-button"), - onClick: /* @__PURE__ */ __name(($event) => onTabClick(tab), "onClick") - }, null, 8, ["icon", "iconBadge", "tooltip", "selected", "class", "onClick"]); - }), 128)), - createBaseVNode("div", _hoisted_1$n, [ - unref(userStore).isMultiUserServer ? (openBlock(), createBlock(_sfc_main$o, { key: 0 })) : createCommentVNode("", true), - createVNode(_sfc_main$q), - createVNode(_sfc_main$p) - ]) - ], 2) - ], 8, ["to"])), - selectedTab.value ? (openBlock(), createElementBlock("div", _hoisted_2$k, [ - createVNode(_sfc_main$n, { extension: selectedTab.value }, null, 8, ["extension"]) - ])) : createCommentVNode("", true) - ], 64); - }; - } -}); -const SideToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-7851c166"]]); -var classes$a = { - root: "p-tablist", - content: /* @__PURE__ */ __name(function content(_ref) { - var instance = _ref.instance; - return ["p-tablist-content", { - "p-tablist-viewport": instance.$pcTabs.scrollable - }]; - }, "content"), - tabList: "p-tablist-tab-list", - activeBar: "p-tablist-active-bar", - prevButton: "p-tablist-prev-button p-tablist-nav-button", - nextButton: "p-tablist-next-button p-tablist-nav-button" -}; -var TabListStyle = BaseStyle.extend({ - name: "tablist", - classes: classes$a -}); -var script$1$a = { - name: "BaseTabList", - "extends": script$g, - props: {}, - style: TabListStyle, - provide: /* @__PURE__ */ __name(function provide3() { - return { - $pcTabList: this, - $parentInstance: this - }; - }, "provide") -}; -var script$c = { - name: "TabList", - "extends": script$1$a, - inheritAttrs: false, - inject: ["$pcTabs"], - data: /* @__PURE__ */ __name(function data() { - return { - isPrevButtonEnabled: false, - isNextButtonEnabled: true - }; - }, "data"), - resizeObserver: void 0, - watch: { - showNavigators: /* @__PURE__ */ __name(function showNavigators(newValue) { - newValue ? this.bindResizeObserver() : this.unbindResizeObserver(); - }, "showNavigators"), - activeValue: { - flush: "post", - handler: /* @__PURE__ */ __name(function handler() { - this.updateInkBar(); - }, "handler") - } - }, - mounted: /* @__PURE__ */ __name(function mounted() { - var _this = this; - this.$nextTick(function() { - _this.updateInkBar(); - }); - if (this.showNavigators) { - this.updateButtonState(); - this.bindResizeObserver(); - } - }, "mounted"), - updated: /* @__PURE__ */ __name(function updated() { - this.showNavigators && this.updateButtonState(); - }, "updated"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount() { - this.unbindResizeObserver(); - }, "beforeUnmount"), - methods: { - onScroll: /* @__PURE__ */ __name(function onScroll(event) { - this.showNavigators && this.updateButtonState(); - event.preventDefault(); - }, "onScroll"), - onPrevButtonClick: /* @__PURE__ */ __name(function onPrevButtonClick() { - var content2 = this.$refs.content; - var width = getWidth(content2); - var pos = content2.scrollLeft - width; - content2.scrollLeft = pos <= 0 ? 0 : pos; - }, "onPrevButtonClick"), - onNextButtonClick: /* @__PURE__ */ __name(function onNextButtonClick() { - var content2 = this.$refs.content; - var width = getWidth(content2) - this.getVisibleButtonWidths(); - var pos = content2.scrollLeft + width; - var lastPos = content2.scrollWidth - width; - content2.scrollLeft = pos >= lastPos ? lastPos : pos; - }, "onNextButtonClick"), - bindResizeObserver: /* @__PURE__ */ __name(function bindResizeObserver() { - var _this2 = this; - this.resizeObserver = new ResizeObserver(function() { - return _this2.updateButtonState(); - }); - this.resizeObserver.observe(this.$refs.list); - }, "bindResizeObserver"), - unbindResizeObserver: /* @__PURE__ */ __name(function unbindResizeObserver() { - var _this$resizeObserver; - (_this$resizeObserver = this.resizeObserver) === null || _this$resizeObserver === void 0 || _this$resizeObserver.unobserve(this.$refs.list); - this.resizeObserver = void 0; - }, "unbindResizeObserver"), - updateInkBar: /* @__PURE__ */ __name(function updateInkBar() { - var _this$$refs = this.$refs, content2 = _this$$refs.content, inkbar = _this$$refs.inkbar, tabs = _this$$refs.tabs; - var activeTab = findSingle(content2, '[data-pc-name="tab"][data-p-active="true"]'); - if (this.$pcTabs.isVertical()) { - inkbar.style.height = getOuterHeight(activeTab) + "px"; - inkbar.style.top = getOffset(activeTab).top - getOffset(tabs).top + "px"; - } else { - inkbar.style.width = getOuterWidth(activeTab) + "px"; - inkbar.style.left = getOffset(activeTab).left - getOffset(tabs).left + "px"; - } - }, "updateInkBar"), - updateButtonState: /* @__PURE__ */ __name(function updateButtonState() { - var _this$$refs2 = this.$refs, list = _this$$refs2.list, content2 = _this$$refs2.content; - var scrollLeft = content2.scrollLeft, scrollTop = content2.scrollTop, scrollWidth = content2.scrollWidth, scrollHeight = content2.scrollHeight, offsetWidth = content2.offsetWidth, offsetHeight = content2.offsetHeight; - var _ref = [getWidth(content2), getHeight(content2)], width = _ref[0], height = _ref[1]; - if (this.$pcTabs.isVertical()) { - this.isPrevButtonEnabled = scrollTop !== 0; - this.isNextButtonEnabled = list.offsetHeight >= offsetHeight && parseInt(scrollTop) !== scrollHeight - height; - } else { - this.isPrevButtonEnabled = scrollLeft !== 0; - this.isNextButtonEnabled = list.offsetWidth >= offsetWidth && parseInt(scrollLeft) !== scrollWidth - width; - } - }, "updateButtonState"), - getVisibleButtonWidths: /* @__PURE__ */ __name(function getVisibleButtonWidths() { - var _this$$refs3 = this.$refs, prevBtn = _this$$refs3.prevBtn, nextBtn = _this$$refs3.nextBtn; - return [prevBtn, nextBtn].reduce(function(acc, el) { - return el ? acc + getWidth(el) : acc; - }, 0); - }, "getVisibleButtonWidths") - }, - computed: { - templates: /* @__PURE__ */ __name(function templates() { - return this.$pcTabs.$slots; - }, "templates"), - activeValue: /* @__PURE__ */ __name(function activeValue() { - return this.$pcTabs.d_value; - }, "activeValue"), - showNavigators: /* @__PURE__ */ __name(function showNavigators2() { - return this.$pcTabs.scrollable && this.$pcTabs.showNavigators; - }, "showNavigators"), - prevButtonAriaLabel: /* @__PURE__ */ __name(function prevButtonAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.previous : void 0; - }, "prevButtonAriaLabel"), - nextButtonAriaLabel: /* @__PURE__ */ __name(function nextButtonAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.next : void 0; - }, "nextButtonAriaLabel") - }, - components: { - ChevronLeftIcon: script$h, - ChevronRightIcon: script$i - }, - directives: { - ripple: Ripple - } -}; -var _hoisted_1$m = ["aria-label", "tabindex"]; -var _hoisted_2$j = ["aria-orientation"]; -var _hoisted_3$g = ["aria-label", "tabindex"]; -function render$i(_ctx, _cache, $props, $setup, $data, $options) { - var _directive_ripple = resolveDirective("ripple"); - return openBlock(), createElementBlock("div", mergeProps({ - ref: "list", - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [$options.showNavigators && $data.isPrevButtonEnabled ? withDirectives((openBlock(), createElementBlock("button", mergeProps({ - key: 0, - ref: "prevButton", - "class": _ctx.cx("prevButton"), - "aria-label": $options.prevButtonAriaLabel, - tabindex: $options.$pcTabs.tabindex, - onClick: _cache[0] || (_cache[0] = function() { - return $options.onPrevButtonClick && $options.onPrevButtonClick.apply($options, arguments); - }) - }, _ctx.ptm("prevButton"), { - "data-pc-group-section": "navigator" - }), [(openBlock(), createBlock(resolveDynamicComponent($options.templates.previcon || "ChevronLeftIcon"), mergeProps({ - "aria-hidden": "true" - }, _ctx.ptm("prevIcon")), null, 16))], 16, _hoisted_1$m)), [[_directive_ripple]]) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ - ref: "content", - "class": _ctx.cx("content"), - onScroll: _cache[1] || (_cache[1] = function() { - return $options.onScroll && $options.onScroll.apply($options, arguments); - }) - }, _ctx.ptm("content")), [createBaseVNode("div", mergeProps({ - ref: "tabs", - "class": _ctx.cx("tabList"), - role: "tablist", - "aria-orientation": $options.$pcTabs.orientation || "horizontal" - }, _ctx.ptm("tabList")), [renderSlot(_ctx.$slots, "default"), createBaseVNode("span", mergeProps({ - ref: "inkbar", - "class": _ctx.cx("activeBar"), - role: "presentation", - "aria-hidden": "true" - }, _ctx.ptm("activeBar")), null, 16)], 16, _hoisted_2$j)], 16), $options.showNavigators && $data.isNextButtonEnabled ? withDirectives((openBlock(), createElementBlock("button", mergeProps({ - key: 1, - ref: "nextButton", - "class": _ctx.cx("nextButton"), - "aria-label": $options.nextButtonAriaLabel, - tabindex: $options.$pcTabs.tabindex, - onClick: _cache[2] || (_cache[2] = function() { - return $options.onNextButtonClick && $options.onNextButtonClick.apply($options, arguments); - }) - }, _ctx.ptm("nextButton"), { - "data-pc-group-section": "navigator" - }), [(openBlock(), createBlock(resolveDynamicComponent($options.templates.nexticon || "ChevronRightIcon"), mergeProps({ - "aria-hidden": "true" - }, _ctx.ptm("nextIcon")), null, 16))], 16, _hoisted_3$g)), [[_directive_ripple]]) : createCommentVNode("", true)], 16); -} -__name(render$i, "render$i"); -script$c.render = render$i; -var classes$9 = { - root: /* @__PURE__ */ __name(function root(_ref) { - var instance = _ref.instance, props = _ref.props; - return ["p-tab", { - "p-tab-active": instance.active, - "p-disabled": props.disabled - }]; - }, "root") -}; -var TabStyle = BaseStyle.extend({ - name: "tab", - classes: classes$9 -}); -var script$1$9 = { - name: "BaseTab", - "extends": script$g, - props: { - value: { - type: [String, Number], - "default": void 0 - }, - disabled: { - type: Boolean, - "default": false - }, - as: { - type: [String, Object], - "default": "BUTTON" - }, - asChild: { - type: Boolean, - "default": false - } - }, - style: TabStyle, - provide: /* @__PURE__ */ __name(function provide4() { - return { - $pcTab: this, - $parentInstance: this - }; - }, "provide") -}; -var script$b = { - name: "Tab", - "extends": script$1$9, - inheritAttrs: false, - inject: ["$pcTabs", "$pcTabList"], - methods: { - onFocus: /* @__PURE__ */ __name(function onFocus() { - this.$pcTabs.selectOnFocus && this.changeActiveValue(); - }, "onFocus"), - onClick: /* @__PURE__ */ __name(function onClick() { - this.changeActiveValue(); - }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown(event) { - switch (event.code) { - case "ArrowRight": - this.onArrowRightKey(event); - break; - case "ArrowLeft": - this.onArrowLeftKey(event); - break; - case "Home": - this.onHomeKey(event); - break; - case "End": - this.onEndKey(event); - break; - case "PageDown": - this.onPageDownKey(event); - break; - case "PageUp": - this.onPageUpKey(event); - break; - case "Enter": - case "NumpadEnter": - case "Space": - this.onEnterKey(event); - break; - } - }, "onKeydown"), - onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey(event) { - var nextTab = this.findNextTab(event.currentTarget); - nextTab ? this.changeFocusedTab(event, nextTab) : this.onHomeKey(event); - event.preventDefault(); - }, "onArrowRightKey"), - onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey(event) { - var prevTab = this.findPrevTab(event.currentTarget); - prevTab ? this.changeFocusedTab(event, prevTab) : this.onEndKey(event); - event.preventDefault(); - }, "onArrowLeftKey"), - onHomeKey: /* @__PURE__ */ __name(function onHomeKey(event) { - var firstTab = this.findFirstTab(); - this.changeFocusedTab(event, firstTab); - event.preventDefault(); - }, "onHomeKey"), - onEndKey: /* @__PURE__ */ __name(function onEndKey(event) { - var lastTab = this.findLastTab(); - this.changeFocusedTab(event, lastTab); - event.preventDefault(); - }, "onEndKey"), - onPageDownKey: /* @__PURE__ */ __name(function onPageDownKey(event) { - this.scrollInView(this.findLastTab()); - event.preventDefault(); - }, "onPageDownKey"), - onPageUpKey: /* @__PURE__ */ __name(function onPageUpKey(event) { - this.scrollInView(this.findFirstTab()); - event.preventDefault(); - }, "onPageUpKey"), - onEnterKey: /* @__PURE__ */ __name(function onEnterKey(event) { - this.changeActiveValue(); - event.preventDefault(); - }, "onEnterKey"), - findNextTab: /* @__PURE__ */ __name(function findNextTab(tabElement) { - var selfCheck = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - var element = selfCheck ? tabElement : tabElement.nextElementSibling; - return element ? getAttribute(element, "data-p-disabled") || getAttribute(element, "data-pc-section") === "inkbar" ? this.findNextTab(element) : findSingle(element, '[data-pc-name="tab"]') : null; - }, "findNextTab"), - findPrevTab: /* @__PURE__ */ __name(function findPrevTab(tabElement) { - var selfCheck = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - var element = selfCheck ? tabElement : tabElement.previousElementSibling; - return element ? getAttribute(element, "data-p-disabled") || getAttribute(element, "data-pc-section") === "inkbar" ? this.findPrevTab(element) : findSingle(element, '[data-pc-name="tab"]') : null; - }, "findPrevTab"), - findFirstTab: /* @__PURE__ */ __name(function findFirstTab() { - return this.findNextTab(this.$pcTabList.$refs.content.firstElementChild, true); - }, "findFirstTab"), - findLastTab: /* @__PURE__ */ __name(function findLastTab() { - return this.findPrevTab(this.$pcTabList.$refs.content.lastElementChild, true); - }, "findLastTab"), - changeActiveValue: /* @__PURE__ */ __name(function changeActiveValue() { - this.$pcTabs.updateValue(this.value); - }, "changeActiveValue"), - changeFocusedTab: /* @__PURE__ */ __name(function changeFocusedTab(event, element) { - focus(element); - this.scrollInView(element); - }, "changeFocusedTab"), - scrollInView: /* @__PURE__ */ __name(function scrollInView(element) { - var _element$scrollIntoVi; - element === null || element === void 0 || (_element$scrollIntoVi = element.scrollIntoView) === null || _element$scrollIntoVi === void 0 || _element$scrollIntoVi.call(element, { - block: "nearest" - }); - }, "scrollInView") - }, - computed: { - active: /* @__PURE__ */ __name(function active() { - var _this$$pcTabs; - return equals((_this$$pcTabs = this.$pcTabs) === null || _this$$pcTabs === void 0 ? void 0 : _this$$pcTabs.d_value, this.value); - }, "active"), - id: /* @__PURE__ */ __name(function id() { - var _this$$pcTabs2; - return "".concat((_this$$pcTabs2 = this.$pcTabs) === null || _this$$pcTabs2 === void 0 ? void 0 : _this$$pcTabs2.id, "_tab_").concat(this.value); - }, "id"), - ariaControls: /* @__PURE__ */ __name(function ariaControls() { - var _this$$pcTabs3; - return "".concat((_this$$pcTabs3 = this.$pcTabs) === null || _this$$pcTabs3 === void 0 ? void 0 : _this$$pcTabs3.id, "_tabpanel_").concat(this.value); - }, "ariaControls"), - attrs: /* @__PURE__ */ __name(function attrs() { - return mergeProps(this.asAttrs, this.a11yAttrs, this.ptmi("root", this.ptParams)); - }, "attrs"), - asAttrs: /* @__PURE__ */ __name(function asAttrs() { - return this.as === "BUTTON" ? { - type: "button", - disabled: this.disabled - } : void 0; - }, "asAttrs"), - a11yAttrs: /* @__PURE__ */ __name(function a11yAttrs() { - return { - id: this.id, - tabindex: this.active ? this.$pcTabs.tabindex : -1, - role: "tab", - "aria-selected": this.active, - "aria-controls": this.ariaControls, - "data-pc-name": "tab", - "data-p-disabled": this.disabled, - "data-p-active": this.active, - onFocus: this.onFocus, - onKeydown: this.onKeydown - }; - }, "a11yAttrs"), - ptParams: /* @__PURE__ */ __name(function ptParams() { - return { - context: { - active: this.active - } - }; - }, "ptParams") - }, - directives: { - ripple: Ripple - } -}; -function render$h(_ctx, _cache, $props, $setup, $data, $options) { - var _directive_ripple = resolveDirective("ripple"); - return !_ctx.asChild ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ - key: 0, - "class": _ctx.cx("root"), - onClick: $options.onClick - }, $options.attrs), { - "default": withCtx(function() { - return [renderSlot(_ctx.$slots, "default")]; - }), - _: 3 - }, 16, ["class", "onClick"])), [[_directive_ripple]]) : renderSlot(_ctx.$slots, "default", { - key: 1, - "class": normalizeClass(_ctx.cx("root")), - active: $options.active, - a11yAttrs: $options.a11yAttrs, - onClick: $options.onClick - }); -} -__name(render$h, "render$h"); -script$b.render = render$h; -const _hoisted_1$l = { class: "flex flex-col h-full" }; -const _hoisted_2$i = { class: "w-full flex justify-between" }; -const _hoisted_3$f = { class: "tabs-container" }; -const _hoisted_4$6 = { class: "font-bold" }; -const _hoisted_5$4 = { class: "flex-grow h-0" }; -const _sfc_main$l = /* @__PURE__ */ defineComponent({ - __name: "BottomPanel", - setup(__props) { - const bottomPanelStore = useBottomPanelStore(); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$l, [ - createVNode(unref(script$j), { - value: unref(bottomPanelStore).activeBottomPanelTabId, - "onUpdate:value": _cache[1] || (_cache[1] = ($event) => unref(bottomPanelStore).activeBottomPanelTabId = $event) - }, { - default: withCtx(() => [ - createVNode(unref(script$c), { "pt:tabList": "border-none" }, { - default: withCtx(() => [ - createBaseVNode("div", _hoisted_2$i, [ - createBaseVNode("div", _hoisted_3$f, [ - (openBlock(true), createElementBlock(Fragment, null, renderList(unref(bottomPanelStore).bottomPanelTabs, (tab) => { - return openBlock(), createBlock(unref(script$b), { - key: tab.id, - value: tab.id, - class: "p-3 border-none" - }, { - default: withCtx(() => [ - createBaseVNode("span", _hoisted_4$6, toDisplayString(tab.title.toUpperCase()), 1) - ]), - _: 2 - }, 1032, ["value"]); - }), 128)) - ]), - createVNode(unref(script$f), { - class: "justify-self-end", - icon: "pi pi-times", - severity: "secondary", - size: "small", - text: "", - onClick: _cache[0] || (_cache[0] = ($event) => unref(bottomPanelStore).bottomPanelVisible = false) - }) - ]) - ]), - _: 1 - }) - ]), - _: 1 - }, 8, ["value"]), - createBaseVNode("div", _hoisted_5$4, [ - unref(bottomPanelStore).bottomPanelVisible && unref(bottomPanelStore).activeBottomPanelTab ? (openBlock(), createBlock(_sfc_main$n, { - key: 0, - extension: unref(bottomPanelStore).activeBottomPanelTab - }, null, 8, ["extension"])) : createCommentVNode("", true) - ]) - ]); - }; - } -}); -var theme$7 = /* @__PURE__ */ __name(function theme2(_ref) { +var theme$7 = /* @__PURE__ */ __name(function theme(_ref) { var dt = _ref.dt; return "\n.p-splitter {\n display: flex;\n flex-wrap: nowrap;\n border: 1px solid ".concat(dt("splitter.border.color"), ";\n background: ").concat(dt("splitter.background"), ";\n border-radius: ").concat(dt("border.radius.md"), ";\n color: ").concat(dt("splitter.color"), ";\n}\n\n.p-splitter-vertical {\n flex-direction: column;\n}\n\n.p-splitter-gutter {\n flex-grow: 0;\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1;\n background: ").concat(dt("splitter.gutter.background"), ";\n}\n\n.p-splitter-gutter-handle {\n border-radius: ").concat(dt("splitter.handle.border.radius"), ";\n background: ").concat(dt("splitter.handle.background"), ";\n transition: outline-color ").concat(dt("splitter.transition.duration"), ", box-shadow ").concat(dt("splitter.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-splitter-gutter-handle:focus-visible {\n box-shadow: ").concat(dt("splitter.handle.focus.ring.shadow"), ";\n outline: ").concat(dt("splitter.handle.focus.ring.width"), " ").concat(dt("splitter.handle.focus.ring.style"), " ").concat(dt("splitter.handle.focus.ring.color"), ";\n outline-offset: ").concat(dt("splitter.handle.focus.ring.offset"), ";\n}\n\n.p-splitter-horizontal.p-splitter-resizing {\n cursor: col-resize;\n user-select: none;\n}\n\n.p-splitter-vertical.p-splitter-resizing {\n cursor: row-resize;\n user-select: none;\n}\n\n.p-splitter-horizontal > .p-splitter-gutter > .p-splitter-gutter-handle {\n height: ").concat(dt("splitter.handle.size"), ";\n width: 100%;\n}\n\n.p-splitter-vertical > .p-splitter-gutter > .p-splitter-gutter-handle {\n width: ").concat(dt("splitter.handle.size"), ";\n height: 100%;\n}\n\n.p-splitter-horizontal > .p-splitter-gutter {\n cursor: col-resize;\n}\n\n.p-splitter-vertical > .p-splitter-gutter {\n cursor: row-resize;\n}\n\n.p-splitterpanel {\n flex-grow: 1;\n overflow: hidden;\n}\n\n.p-splitterpanel-nested {\n display: flex;\n}\n\n.p-splitterpanel .p-splitter {\n flex-grow: 1;\n border: 0 none;\n}\n"); }, "theme"); -var classes$8 = { - root: /* @__PURE__ */ __name(function root2(_ref2) { +var classes$a = { + root: /* @__PURE__ */ __name(function root(_ref2) { var props = _ref2.props; return ["p-splitter p-component", "p-splitter-" + props.layout]; }, "root"), @@ -883,7 +120,7 @@ var classes$8 = { gutterHandle: "p-splitter-gutter-handle" }; var inlineStyles$4 = { - root: /* @__PURE__ */ __name(function root3(_ref3) { + root: /* @__PURE__ */ __name(function root2(_ref3) { var props = _ref3.props; return [{ display: "flex", @@ -896,12 +133,12 @@ var inlineStyles$4 = { var SplitterStyle = BaseStyle.extend({ name: "splitter", theme: theme$7, - classes: classes$8, + classes: classes$a, inlineStyles: inlineStyles$4 }); -var script$1$8 = { +var script$1$a = { name: "BaseSplitter", - "extends": script$g, + "extends": script$e, props: { layout: { type: String, @@ -925,7 +162,7 @@ var script$1$8 = { } }, style: SplitterStyle, - provide: /* @__PURE__ */ __name(function provide5() { + provide: /* @__PURE__ */ __name(function provide2() { return { $pcSplitter: this, $parentInstance: this @@ -962,9 +199,9 @@ function _arrayLikeToArray$2(r, a) { return n; } __name(_arrayLikeToArray$2, "_arrayLikeToArray$2"); -var script$a = { +var script$c = { name: "Splitter", - "extends": script$1$8, + "extends": script$1$a, inheritAttrs: false, emits: ["resizestart", "resizeend", "resize"], dragging: false, @@ -982,12 +219,12 @@ var script$a = { panelSizes: null, prevPanelIndex: null, timer: null, - data: /* @__PURE__ */ __name(function data2() { + data: /* @__PURE__ */ __name(function data() { return { prevSize: null }; }, "data"), - mounted: /* @__PURE__ */ __name(function mounted2() { + mounted: /* @__PURE__ */ __name(function mounted() { var _this = this; if (this.panels && this.panels.length) { var initialized = false; @@ -1010,7 +247,7 @@ var script$a = { } } }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount2() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount() { this.clear(); this.unbindMouseListeners(); }, "beforeUnmount"), @@ -1305,9 +542,9 @@ var script$a = { }, "getPTOptions") } }; -var _hoisted_1$k = ["onMousedown", "onTouchstart", "onTouchmove", "onTouchend"]; -var _hoisted_2$h = ["aria-orientation", "aria-valuenow", "onKeydown"]; -function render$g(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$m = ["onMousedown", "onTouchstart", "onTouchmove", "onTouchend"]; +var _hoisted_2$j = ["aria-orientation", "aria-valuenow", "onKeydown"]; +function render$j(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root"), style: _ctx.sx("root"), @@ -1350,13 +587,13 @@ function render$g(_ctx, _cache, $props, $setup, $data, $options) { return $options.onGutterKeyDown($event, i); }, "onKeydown"), ref_for: true - }, _ctx.ptm("gutterHandle")), null, 16, _hoisted_2$h)], 16, _hoisted_1$k)) : createCommentVNode("", true)], 64); + }, _ctx.ptm("gutterHandle")), null, 16, _hoisted_2$j)], 16, _hoisted_1$m)) : createCommentVNode("", true)], 64); }), 128))], 16); } -__name(render$g, "render$g"); -script$a.render = render$g; -var classes$7 = { - root: /* @__PURE__ */ __name(function root4(_ref) { +__name(render$j, "render$j"); +script$c.render = render$j; +var classes$9 = { + root: /* @__PURE__ */ __name(function root3(_ref) { var instance = _ref.instance; return ["p-splitterpanel", { "p-splitterpanel-nested": instance.isNested @@ -1365,11 +602,11 @@ var classes$7 = { }; var SplitterPanelStyle = BaseStyle.extend({ name: "splitterpanel", - classes: classes$7 + classes: classes$9 }); -var script$1$7 = { +var script$1$9 = { name: "BaseSplitterPanel", - "extends": script$g, + "extends": script$e, props: { size: { type: Number, @@ -1381,18 +618,18 @@ var script$1$7 = { } }, style: SplitterPanelStyle, - provide: /* @__PURE__ */ __name(function provide6() { + provide: /* @__PURE__ */ __name(function provide3() { return { $pcSplitterPanel: this, $parentInstance: this }; }, "provide") }; -var script$9 = { +var script$b = { name: "SplitterPanel", - "extends": script$1$7, + "extends": script$1$9, inheritAttrs: false, - data: /* @__PURE__ */ __name(function data3() { + data: /* @__PURE__ */ __name(function data2() { return { nestedState: null }; @@ -1414,15 +651,15 @@ var script$9 = { }, "getPTOptions") } }; -function render$f(_ctx, _cache, $props, $setup, $data, $options) { +function render$i(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ ref: "container", "class": _ctx.cx("root") }, _ctx.ptmi("root", $options.getPTOptions)), [renderSlot(_ctx.$slots, "default")], 16); } -__name(render$f, "render$f"); -script$9.render = render$f; -const _sfc_main$k = /* @__PURE__ */ defineComponent({ +__name(render$i, "render$i"); +script$b.render = render$i; +const _sfc_main$q = /* @__PURE__ */ defineComponent({ __name: "LiteGraphCanvasSplitterOverlay", setup(__props) { const settingStore = useSettingStore(); @@ -1435,15 +672,19 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({ const bottomPanelVisible = computed( () => useBottomPanelStore().bottomPanelVisible ); + const activeSidebarTabId = computed( + () => useSidebarTabStore().activeSidebarTabId + ); return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$a), { + return openBlock(), createBlock(unref(script$c), { class: "splitter-overlay-root splitter-overlay", "pt:gutter": sidebarPanelVisible.value ? "" : "hidden", - stateKey: "sidebar-splitter", + key: activeSidebarTabId.value, + stateKey: activeSidebarTabId.value, stateStorage: "local" }, { default: withCtx(() => [ - sidebarLocation.value === "left" ? withDirectives((openBlock(), createBlock(unref(script$9), { + sidebarLocation.value === "left" ? withDirectives((openBlock(), createBlock(unref(script$b), { key: 0, class: "side-bar-panel", minSize: 10, @@ -1456,9 +697,9 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({ }, 512)), [ [vShow, sidebarPanelVisible.value] ]) : createCommentVNode("", true), - createVNode(unref(script$9), { size: 100 }, { + createVNode(unref(script$b), { size: 100 }, { default: withCtx(() => [ - createVNode(unref(script$a), { + createVNode(unref(script$c), { class: "splitter-overlay max-w-full", layout: "vertical", "pt:gutter": bottomPanelVisible.value ? "" : "hidden", @@ -1466,13 +707,13 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({ stateStorage: "local" }, { default: withCtx(() => [ - createVNode(unref(script$9), { class: "graph-canvas-panel relative" }, { + createVNode(unref(script$b), { class: "graph-canvas-panel relative" }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "graph-canvas-panel", {}, void 0, true) ]), _: 3 }), - withDirectives(createVNode(unref(script$9), { class: "bottom-panel" }, { + withDirectives(createVNode(unref(script$b), { class: "bottom-panel" }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "bottom-panel", {}, void 0, true) ]), @@ -1486,7 +727,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({ ]), _: 3 }), - sidebarLocation.value === "right" ? withDirectives((openBlock(), createBlock(unref(script$9), { + sidebarLocation.value === "right" ? withDirectives((openBlock(), createBlock(unref(script$b), { key: 1, class: "side-bar-panel", minSize: 10, @@ -1501,12 +742,1019 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({ ]) : createCommentVNode("", true) ]), _: 3 - }, 8, ["pt:gutter"]); + }, 8, ["pt:gutter", "stateKey"]); }; } }); -const LiteGraphCanvasSplitterOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-7c3279c1"]]); -var theme$6 = /* @__PURE__ */ __name(function theme3(_ref) { +const LiteGraphCanvasSplitterOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-e50caa15"]]); +var classes$8 = { + root: /* @__PURE__ */ __name(function root4(_ref) { + var instance = _ref.instance, props = _ref.props; + return ["p-tab", { + "p-tab-active": instance.active, + "p-disabled": props.disabled + }]; + }, "root") +}; +var TabStyle = BaseStyle.extend({ + name: "tab", + classes: classes$8 +}); +var script$1$8 = { + name: "BaseTab", + "extends": script$e, + props: { + value: { + type: [String, Number], + "default": void 0 + }, + disabled: { + type: Boolean, + "default": false + }, + as: { + type: [String, Object], + "default": "BUTTON" + }, + asChild: { + type: Boolean, + "default": false + } + }, + style: TabStyle, + provide: /* @__PURE__ */ __name(function provide4() { + return { + $pcTab: this, + $parentInstance: this + }; + }, "provide") +}; +var script$a = { + name: "Tab", + "extends": script$1$8, + inheritAttrs: false, + inject: ["$pcTabs", "$pcTabList"], + methods: { + onFocus: /* @__PURE__ */ __name(function onFocus() { + this.$pcTabs.selectOnFocus && this.changeActiveValue(); + }, "onFocus"), + onClick: /* @__PURE__ */ __name(function onClick() { + this.changeActiveValue(); + }, "onClick"), + onKeydown: /* @__PURE__ */ __name(function onKeydown(event) { + switch (event.code) { + case "ArrowRight": + this.onArrowRightKey(event); + break; + case "ArrowLeft": + this.onArrowLeftKey(event); + break; + case "Home": + this.onHomeKey(event); + break; + case "End": + this.onEndKey(event); + break; + case "PageDown": + this.onPageDownKey(event); + break; + case "PageUp": + this.onPageUpKey(event); + break; + case "Enter": + case "NumpadEnter": + case "Space": + this.onEnterKey(event); + break; + } + }, "onKeydown"), + onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey(event) { + var nextTab = this.findNextTab(event.currentTarget); + nextTab ? this.changeFocusedTab(event, nextTab) : this.onHomeKey(event); + event.preventDefault(); + }, "onArrowRightKey"), + onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey(event) { + var prevTab = this.findPrevTab(event.currentTarget); + prevTab ? this.changeFocusedTab(event, prevTab) : this.onEndKey(event); + event.preventDefault(); + }, "onArrowLeftKey"), + onHomeKey: /* @__PURE__ */ __name(function onHomeKey(event) { + var firstTab = this.findFirstTab(); + this.changeFocusedTab(event, firstTab); + event.preventDefault(); + }, "onHomeKey"), + onEndKey: /* @__PURE__ */ __name(function onEndKey(event) { + var lastTab = this.findLastTab(); + this.changeFocusedTab(event, lastTab); + event.preventDefault(); + }, "onEndKey"), + onPageDownKey: /* @__PURE__ */ __name(function onPageDownKey(event) { + this.scrollInView(this.findLastTab()); + event.preventDefault(); + }, "onPageDownKey"), + onPageUpKey: /* @__PURE__ */ __name(function onPageUpKey(event) { + this.scrollInView(this.findFirstTab()); + event.preventDefault(); + }, "onPageUpKey"), + onEnterKey: /* @__PURE__ */ __name(function onEnterKey(event) { + this.changeActiveValue(); + event.preventDefault(); + }, "onEnterKey"), + findNextTab: /* @__PURE__ */ __name(function findNextTab(tabElement) { + var selfCheck = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + var element = selfCheck ? tabElement : tabElement.nextElementSibling; + return element ? getAttribute(element, "data-p-disabled") || getAttribute(element, "data-pc-section") === "inkbar" ? this.findNextTab(element) : findSingle(element, '[data-pc-name="tab"]') : null; + }, "findNextTab"), + findPrevTab: /* @__PURE__ */ __name(function findPrevTab(tabElement) { + var selfCheck = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + var element = selfCheck ? tabElement : tabElement.previousElementSibling; + return element ? getAttribute(element, "data-p-disabled") || getAttribute(element, "data-pc-section") === "inkbar" ? this.findPrevTab(element) : findSingle(element, '[data-pc-name="tab"]') : null; + }, "findPrevTab"), + findFirstTab: /* @__PURE__ */ __name(function findFirstTab() { + return this.findNextTab(this.$pcTabList.$refs.content.firstElementChild, true); + }, "findFirstTab"), + findLastTab: /* @__PURE__ */ __name(function findLastTab() { + return this.findPrevTab(this.$pcTabList.$refs.content.lastElementChild, true); + }, "findLastTab"), + changeActiveValue: /* @__PURE__ */ __name(function changeActiveValue() { + this.$pcTabs.updateValue(this.value); + }, "changeActiveValue"), + changeFocusedTab: /* @__PURE__ */ __name(function changeFocusedTab(event, element) { + focus(element); + this.scrollInView(element); + }, "changeFocusedTab"), + scrollInView: /* @__PURE__ */ __name(function scrollInView(element) { + var _element$scrollIntoVi; + element === null || element === void 0 || (_element$scrollIntoVi = element.scrollIntoView) === null || _element$scrollIntoVi === void 0 || _element$scrollIntoVi.call(element, { + block: "nearest" + }); + }, "scrollInView") + }, + computed: { + active: /* @__PURE__ */ __name(function active() { + var _this$$pcTabs; + return equals((_this$$pcTabs = this.$pcTabs) === null || _this$$pcTabs === void 0 ? void 0 : _this$$pcTabs.d_value, this.value); + }, "active"), + id: /* @__PURE__ */ __name(function id() { + var _this$$pcTabs2; + return "".concat((_this$$pcTabs2 = this.$pcTabs) === null || _this$$pcTabs2 === void 0 ? void 0 : _this$$pcTabs2.id, "_tab_").concat(this.value); + }, "id"), + ariaControls: /* @__PURE__ */ __name(function ariaControls() { + var _this$$pcTabs3; + return "".concat((_this$$pcTabs3 = this.$pcTabs) === null || _this$$pcTabs3 === void 0 ? void 0 : _this$$pcTabs3.id, "_tabpanel_").concat(this.value); + }, "ariaControls"), + attrs: /* @__PURE__ */ __name(function attrs() { + return mergeProps(this.asAttrs, this.a11yAttrs, this.ptmi("root", this.ptParams)); + }, "attrs"), + asAttrs: /* @__PURE__ */ __name(function asAttrs() { + return this.as === "BUTTON" ? { + type: "button", + disabled: this.disabled + } : void 0; + }, "asAttrs"), + a11yAttrs: /* @__PURE__ */ __name(function a11yAttrs() { + return { + id: this.id, + tabindex: this.active ? this.$pcTabs.tabindex : -1, + role: "tab", + "aria-selected": this.active, + "aria-controls": this.ariaControls, + "data-pc-name": "tab", + "data-p-disabled": this.disabled, + "data-p-active": this.active, + onFocus: this.onFocus, + onKeydown: this.onKeydown + }; + }, "a11yAttrs"), + ptParams: /* @__PURE__ */ __name(function ptParams() { + return { + context: { + active: this.active + } + }; + }, "ptParams") + }, + directives: { + ripple: Ripple + } +}; +function render$h(_ctx, _cache, $props, $setup, $data, $options) { + var _directive_ripple = resolveDirective("ripple"); + return !_ctx.asChild ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ + key: 0, + "class": _ctx.cx("root"), + onClick: $options.onClick + }, $options.attrs), { + "default": withCtx(function() { + return [renderSlot(_ctx.$slots, "default")]; + }), + _: 3 + }, 16, ["class", "onClick"])), [[_directive_ripple]]) : renderSlot(_ctx.$slots, "default", { + key: 1, + "class": normalizeClass(_ctx.cx("root")), + active: $options.active, + a11yAttrs: $options.a11yAttrs, + onClick: $options.onClick + }); +} +__name(render$h, "render$h"); +script$a.render = render$h; +var classes$7 = { + root: "p-tablist", + content: /* @__PURE__ */ __name(function content(_ref) { + var instance = _ref.instance; + return ["p-tablist-content", { + "p-tablist-viewport": instance.$pcTabs.scrollable + }]; + }, "content"), + tabList: "p-tablist-tab-list", + activeBar: "p-tablist-active-bar", + prevButton: "p-tablist-prev-button p-tablist-nav-button", + nextButton: "p-tablist-next-button p-tablist-nav-button" +}; +var TabListStyle = BaseStyle.extend({ + name: "tablist", + classes: classes$7 +}); +var script$1$7 = { + name: "BaseTabList", + "extends": script$e, + props: {}, + style: TabListStyle, + provide: /* @__PURE__ */ __name(function provide5() { + return { + $pcTabList: this, + $parentInstance: this + }; + }, "provide") +}; +var script$9 = { + name: "TabList", + "extends": script$1$7, + inheritAttrs: false, + inject: ["$pcTabs"], + data: /* @__PURE__ */ __name(function data3() { + return { + isPrevButtonEnabled: false, + isNextButtonEnabled: true + }; + }, "data"), + resizeObserver: void 0, + watch: { + showNavigators: /* @__PURE__ */ __name(function showNavigators(newValue) { + newValue ? this.bindResizeObserver() : this.unbindResizeObserver(); + }, "showNavigators"), + activeValue: { + flush: "post", + handler: /* @__PURE__ */ __name(function handler() { + this.updateInkBar(); + }, "handler") + } + }, + mounted: /* @__PURE__ */ __name(function mounted2() { + var _this = this; + this.$nextTick(function() { + _this.updateInkBar(); + }); + if (this.showNavigators) { + this.updateButtonState(); + this.bindResizeObserver(); + } + }, "mounted"), + updated: /* @__PURE__ */ __name(function updated() { + this.showNavigators && this.updateButtonState(); + }, "updated"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount2() { + this.unbindResizeObserver(); + }, "beforeUnmount"), + methods: { + onScroll: /* @__PURE__ */ __name(function onScroll(event) { + this.showNavigators && this.updateButtonState(); + event.preventDefault(); + }, "onScroll"), + onPrevButtonClick: /* @__PURE__ */ __name(function onPrevButtonClick() { + var content2 = this.$refs.content; + var width = getWidth(content2); + var pos = content2.scrollLeft - width; + content2.scrollLeft = pos <= 0 ? 0 : pos; + }, "onPrevButtonClick"), + onNextButtonClick: /* @__PURE__ */ __name(function onNextButtonClick() { + var content2 = this.$refs.content; + var width = getWidth(content2) - this.getVisibleButtonWidths(); + var pos = content2.scrollLeft + width; + var lastPos = content2.scrollWidth - width; + content2.scrollLeft = pos >= lastPos ? lastPos : pos; + }, "onNextButtonClick"), + bindResizeObserver: /* @__PURE__ */ __name(function bindResizeObserver() { + var _this2 = this; + this.resizeObserver = new ResizeObserver(function() { + return _this2.updateButtonState(); + }); + this.resizeObserver.observe(this.$refs.list); + }, "bindResizeObserver"), + unbindResizeObserver: /* @__PURE__ */ __name(function unbindResizeObserver() { + var _this$resizeObserver; + (_this$resizeObserver = this.resizeObserver) === null || _this$resizeObserver === void 0 || _this$resizeObserver.unobserve(this.$refs.list); + this.resizeObserver = void 0; + }, "unbindResizeObserver"), + updateInkBar: /* @__PURE__ */ __name(function updateInkBar() { + var _this$$refs = this.$refs, content2 = _this$$refs.content, inkbar = _this$$refs.inkbar, tabs = _this$$refs.tabs; + var activeTab = findSingle(content2, '[data-pc-name="tab"][data-p-active="true"]'); + if (this.$pcTabs.isVertical()) { + inkbar.style.height = getOuterHeight(activeTab) + "px"; + inkbar.style.top = getOffset(activeTab).top - getOffset(tabs).top + "px"; + } else { + inkbar.style.width = getOuterWidth(activeTab) + "px"; + inkbar.style.left = getOffset(activeTab).left - getOffset(tabs).left + "px"; + } + }, "updateInkBar"), + updateButtonState: /* @__PURE__ */ __name(function updateButtonState() { + var _this$$refs2 = this.$refs, list = _this$$refs2.list, content2 = _this$$refs2.content; + var scrollLeft = content2.scrollLeft, scrollTop = content2.scrollTop, scrollWidth = content2.scrollWidth, scrollHeight = content2.scrollHeight, offsetWidth = content2.offsetWidth, offsetHeight = content2.offsetHeight; + var _ref = [getWidth(content2), getHeight(content2)], width = _ref[0], height = _ref[1]; + if (this.$pcTabs.isVertical()) { + this.isPrevButtonEnabled = scrollTop !== 0; + this.isNextButtonEnabled = list.offsetHeight >= offsetHeight && parseInt(scrollTop) !== scrollHeight - height; + } else { + this.isPrevButtonEnabled = scrollLeft !== 0; + this.isNextButtonEnabled = list.offsetWidth >= offsetWidth && parseInt(scrollLeft) !== scrollWidth - width; + } + }, "updateButtonState"), + getVisibleButtonWidths: /* @__PURE__ */ __name(function getVisibleButtonWidths() { + var _this$$refs3 = this.$refs, prevBtn = _this$$refs3.prevBtn, nextBtn = _this$$refs3.nextBtn; + return [prevBtn, nextBtn].reduce(function(acc, el) { + return el ? acc + getWidth(el) : acc; + }, 0); + }, "getVisibleButtonWidths") + }, + computed: { + templates: /* @__PURE__ */ __name(function templates() { + return this.$pcTabs.$slots; + }, "templates"), + activeValue: /* @__PURE__ */ __name(function activeValue() { + return this.$pcTabs.d_value; + }, "activeValue"), + showNavigators: /* @__PURE__ */ __name(function showNavigators2() { + return this.$pcTabs.scrollable && this.$pcTabs.showNavigators; + }, "showNavigators"), + prevButtonAriaLabel: /* @__PURE__ */ __name(function prevButtonAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.previous : void 0; + }, "prevButtonAriaLabel"), + nextButtonAriaLabel: /* @__PURE__ */ __name(function nextButtonAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.next : void 0; + }, "nextButtonAriaLabel") + }, + components: { + ChevronLeftIcon: script$f, + ChevronRightIcon: script$g + }, + directives: { + ripple: Ripple + } +}; +var _hoisted_1$l = ["aria-label", "tabindex"]; +var _hoisted_2$i = ["aria-orientation"]; +var _hoisted_3$g = ["aria-label", "tabindex"]; +function render$g(_ctx, _cache, $props, $setup, $data, $options) { + var _directive_ripple = resolveDirective("ripple"); + return openBlock(), createElementBlock("div", mergeProps({ + ref: "list", + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [$options.showNavigators && $data.isPrevButtonEnabled ? withDirectives((openBlock(), createElementBlock("button", mergeProps({ + key: 0, + ref: "prevButton", + "class": _ctx.cx("prevButton"), + "aria-label": $options.prevButtonAriaLabel, + tabindex: $options.$pcTabs.tabindex, + onClick: _cache[0] || (_cache[0] = function() { + return $options.onPrevButtonClick && $options.onPrevButtonClick.apply($options, arguments); + }) + }, _ctx.ptm("prevButton"), { + "data-pc-group-section": "navigator" + }), [(openBlock(), createBlock(resolveDynamicComponent($options.templates.previcon || "ChevronLeftIcon"), mergeProps({ + "aria-hidden": "true" + }, _ctx.ptm("prevIcon")), null, 16))], 16, _hoisted_1$l)), [[_directive_ripple]]) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + ref: "content", + "class": _ctx.cx("content"), + onScroll: _cache[1] || (_cache[1] = function() { + return $options.onScroll && $options.onScroll.apply($options, arguments); + }) + }, _ctx.ptm("content")), [createBaseVNode("div", mergeProps({ + ref: "tabs", + "class": _ctx.cx("tabList"), + role: "tablist", + "aria-orientation": $options.$pcTabs.orientation || "horizontal" + }, _ctx.ptm("tabList")), [renderSlot(_ctx.$slots, "default"), createBaseVNode("span", mergeProps({ + ref: "inkbar", + "class": _ctx.cx("activeBar"), + role: "presentation", + "aria-hidden": "true" + }, _ctx.ptm("activeBar")), null, 16)], 16, _hoisted_2$i)], 16), $options.showNavigators && $data.isNextButtonEnabled ? withDirectives((openBlock(), createElementBlock("button", mergeProps({ + key: 1, + ref: "nextButton", + "class": _ctx.cx("nextButton"), + "aria-label": $options.nextButtonAriaLabel, + tabindex: $options.$pcTabs.tabindex, + onClick: _cache[2] || (_cache[2] = function() { + return $options.onNextButtonClick && $options.onNextButtonClick.apply($options, arguments); + }) + }, _ctx.ptm("nextButton"), { + "data-pc-group-section": "navigator" + }), [(openBlock(), createBlock(resolveDynamicComponent($options.templates.nexticon || "ChevronRightIcon"), mergeProps({ + "aria-hidden": "true" + }, _ctx.ptm("nextIcon")), null, 16))], 16, _hoisted_3$g)), [[_directive_ripple]]) : createCommentVNode("", true)], 16); +} +__name(render$g, "render$g"); +script$9.render = render$g; +const _sfc_main$p = /* @__PURE__ */ defineComponent({ + __name: "ExtensionSlot", + props: { + extension: {} + }, + setup(__props) { + const props = __props; + const mountCustomExtension = /* @__PURE__ */ __name((extension, el) => { + extension.render(el); + }, "mountCustomExtension"); + onBeforeUnmount(() => { + if (props.extension.type === "custom" && props.extension.destroy) { + props.extension.destroy(); + } + }); + return (_ctx, _cache) => { + return _ctx.extension.type === "vue" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.extension.component), { key: 0 })) : (openBlock(), createElementBlock("div", { + key: 1, + ref: /* @__PURE__ */ __name((el) => { + if (el) + mountCustomExtension( + props.extension, + el + ); + }, "ref") + }, null, 512)); + }; + } +}); +const _hoisted_1$k = { class: "flex flex-col h-full" }; +const _hoisted_2$h = { class: "w-full flex justify-between" }; +const _hoisted_3$f = { class: "tabs-container" }; +const _hoisted_4$5 = { class: "font-bold" }; +const _hoisted_5$4 = { class: "flex-grow h-0" }; +const _sfc_main$o = /* @__PURE__ */ defineComponent({ + __name: "BottomPanel", + setup(__props) { + const bottomPanelStore = useBottomPanelStore(); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", _hoisted_1$k, [ + createVNode(unref(script$h), { + value: unref(bottomPanelStore).activeBottomPanelTabId, + "onUpdate:value": _cache[1] || (_cache[1] = ($event) => unref(bottomPanelStore).activeBottomPanelTabId = $event) + }, { + default: withCtx(() => [ + createVNode(unref(script$9), { "pt:tabList": "border-none" }, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_2$h, [ + createBaseVNode("div", _hoisted_3$f, [ + (openBlock(true), createElementBlock(Fragment, null, renderList(unref(bottomPanelStore).bottomPanelTabs, (tab) => { + return openBlock(), createBlock(unref(script$a), { + key: tab.id, + value: tab.id, + class: "p-3 border-none" + }, { + default: withCtx(() => [ + createBaseVNode("span", _hoisted_4$5, toDisplayString(tab.title.toUpperCase()), 1) + ]), + _: 2 + }, 1032, ["value"]); + }), 128)) + ]), + createVNode(unref(script$d), { + class: "justify-self-end", + icon: "pi pi-times", + severity: "secondary", + size: "small", + text: "", + onClick: _cache[0] || (_cache[0] = ($event) => unref(bottomPanelStore).bottomPanelVisible = false) + }) + ]) + ]), + _: 1 + }) + ]), + _: 1 + }, 8, ["value"]), + createBaseVNode("div", _hoisted_5$4, [ + unref(bottomPanelStore).bottomPanelVisible && unref(bottomPanelStore).activeBottomPanelTab ? (openBlock(), createBlock(_sfc_main$p, { + key: 0, + extension: unref(bottomPanelStore).activeBottomPanelTab + }, null, 8, ["extension"])) : createCommentVNode("", true) + ]) + ]); + }; + } +}); +const _hoisted_1$j = { + viewBox: "0 0 1024 1024", + width: "1.2em", + height: "1.2em" +}; +const _hoisted_2$g = /* @__PURE__ */ createBaseVNode("path", { + fill: "currentColor", + d: "M921.088 103.232L584.832 889.024L465.52 544.512L121.328 440.48zM1004.46.769c-6.096 0-13.52 1.728-22.096 5.36L27.708 411.2c-34.383 14.592-36.56 42.704-4.847 62.464l395.296 123.584l129.36 403.264c9.28 15.184 20.496 22.72 31.263 22.72c11.936 0 23.296-9.152 31.04-27.248l408.272-953.728C1029.148 16.368 1022.86.769 1004.46.769" +}, null, -1); +const _hoisted_3$e = [ + _hoisted_2$g +]; +function render$f(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$j, [..._hoisted_3$e]); +} +__name(render$f, "render$f"); +const __unplugin_components_1$2 = markRaw({ name: "simple-line-icons-cursor", render: render$f }); +const _hoisted_1$i = { + viewBox: "0 0 24 24", + width: "1.2em", + height: "1.2em" +}; +const _hoisted_2$f = /* @__PURE__ */ createBaseVNode("path", { + fill: "currentColor", + d: "M10.05 23q-.75 0-1.4-.337T7.575 21.7L1.2 12.375l.6-.575q.475-.475 1.125-.55t1.175.3L7 13.575V4q0-.425.288-.712T8 3t.713.288T9 4v13.425l-3.7-2.6l3.925 5.725q.125.2.35.325t.475.125H17q.825 0 1.413-.587T19 19V5q0-.425.288-.712T20 4t.713.288T21 5v14q0 1.65-1.175 2.825T17 23zM11 12V2q0-.425.288-.712T12 1t.713.288T13 2v10zm4 0V3q0-.425.288-.712T16 2t.713.288T17 3v9zm-2.85 4.5" +}, null, -1); +const _hoisted_3$d = [ + _hoisted_2$f +]; +function render$e(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$i, [..._hoisted_3$d]); +} +__name(render$e, "render$e"); +const __unplugin_components_0$2 = markRaw({ name: "material-symbols-pan-tool-outline", render: render$e }); +var theme$6 = /* @__PURE__ */ __name(function theme2(_ref) { + _ref.dt; + return "\n.p-buttongroup .p-button {\n margin: 0;\n}\n\n.p-buttongroup .p-button:not(:last-child),\n.p-buttongroup .p-button:not(:last-child):hover {\n border-right: 0 none;\n}\n\n.p-buttongroup .p-button:not(:first-of-type):not(:last-of-type) {\n border-radius: 0;\n}\n\n.p-buttongroup .p-button:first-of-type:not(:only-of-type) {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.p-buttongroup .p-button:last-of-type:not(:only-of-type) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.p-buttongroup .p-button:focus {\n position: relative;\n z-index: 1;\n}\n"; +}, "theme"); +var classes$6 = { + root: "p-buttongroup p-component" +}; +var ButtonGroupStyle = BaseStyle.extend({ + name: "buttongroup", + theme: theme$6, + classes: classes$6 +}); +var script$1$6 = { + name: "BaseButtonGroup", + "extends": script$e, + style: ButtonGroupStyle, + provide: /* @__PURE__ */ __name(function provide6() { + return { + $pcButtonGroup: this, + $parentInstance: this + }; + }, "provide") +}; +var script$8 = { + name: "ButtonGroup", + "extends": script$1$6, + inheritAttrs: false +}; +function render$d(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("span", mergeProps({ + "class": _ctx.cx("root"), + role: "group" + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16); +} +__name(render$d, "render$d"); +script$8.render = render$d; +const useTitleEditorStore = defineStore("titleEditor", () => { + const titleEditorTarget = shallowRef(null); + return { + titleEditorTarget + }; +}); +const useCanvasStore = defineStore("canvas", () => { + const canvas = shallowRef(null); + return { + canvas + }; +}); +const _sfc_main$n = /* @__PURE__ */ defineComponent({ + __name: "GraphCanvasMenu", + setup(__props) { + const { t } = useI18n(); + const commandStore = useCommandStore(); + const canvasStore = useCanvasStore(); + const settingStore = useSettingStore(); + const linkHidden = computed( + () => settingStore.get("Comfy.LinkRenderMode") === LiteGraph.HIDDEN_LINK + ); + let interval = null; + const repeat2 = /* @__PURE__ */ __name((command) => { + if (interval) return; + const cmd = /* @__PURE__ */ __name(() => commandStore.execute(command), "cmd"); + cmd(); + interval = window.setInterval(cmd, 100); + }, "repeat"); + const stopRepeat = /* @__PURE__ */ __name(() => { + if (interval) { + clearInterval(interval); + interval = null; + } + }, "stopRepeat"); + return (_ctx, _cache) => { + const _component_i_material_symbols58pan_tool_outline = __unplugin_components_0$2; + const _component_i_simple_line_icons58cursor = __unplugin_components_1$2; + const _directive_tooltip = resolveDirective("tooltip"); + return openBlock(), createBlock(unref(script$8), { class: "p-buttongroup-vertical absolute bottom-[10px] right-[10px] z-[1000] pointer-events-auto" }, { + default: withCtx(() => [ + withDirectives(createVNode(unref(script$d), { + severity: "secondary", + icon: "pi pi-plus", + onMousedown: _cache[0] || (_cache[0] = ($event) => repeat2("Comfy.Canvas.ZoomIn")), + onMouseup: stopRepeat + }, null, 512), [ + [ + _directive_tooltip, + unref(t)("graphCanvasMenu.zoomIn"), + void 0, + { left: true } + ] + ]), + withDirectives(createVNode(unref(script$d), { + severity: "secondary", + icon: "pi pi-minus", + onMousedown: _cache[1] || (_cache[1] = ($event) => repeat2("Comfy.Canvas.ZoomOut")), + onMouseup: stopRepeat + }, null, 512), [ + [ + _directive_tooltip, + unref(t)("graphCanvasMenu.zoomOut"), + void 0, + { left: true } + ] + ]), + withDirectives(createVNode(unref(script$d), { + severity: "secondary", + icon: "pi pi-expand", + onClick: _cache[2] || (_cache[2] = () => unref(commandStore).execute("Comfy.Canvas.FitView")) + }, null, 512), [ + [ + _directive_tooltip, + unref(t)("graphCanvasMenu.fitView"), + void 0, + { left: true } + ] + ]), + withDirectives((openBlock(), createBlock(unref(script$d), { + severity: "secondary", + onClick: _cache[3] || (_cache[3] = () => unref(commandStore).execute("Comfy.Canvas.ToggleLock")) + }, { + icon: withCtx(() => [ + unref(canvasStore).canvas?.read_only ? (openBlock(), createBlock(_component_i_material_symbols58pan_tool_outline, { key: 0 })) : (openBlock(), createBlock(_component_i_simple_line_icons58cursor, { key: 1 })) + ]), + _: 1 + })), [ + [ + _directive_tooltip, + unref(t)( + "graphCanvasMenu." + (unref(canvasStore).canvas?.read_only ? "panMode" : "selectMode") + ) + " (Space)", + void 0, + { left: true } + ] + ]), + withDirectives(createVNode(unref(script$d), { + severity: "secondary", + icon: linkHidden.value ? "pi pi-eye-slash" : "pi pi-eye", + onClick: _cache[4] || (_cache[4] = () => unref(commandStore).execute("Comfy.Canvas.ToggleLinkVisibility")), + "data-testid": "toggle-link-visibility-button" + }, null, 8, ["icon"]), [ + [ + _directive_tooltip, + unref(t)("graphCanvasMenu.toggleLinkVisibility"), + void 0, + { left: true } + ] + ]) + ]), + _: 1 + }); + }; + } +}); +const GraphCanvasMenu = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-cf40dd39"]]); +const _sfc_main$m = /* @__PURE__ */ defineComponent({ + __name: "NodeBadge", + setup(__props) { + const settingStore = useSettingStore(); + const colorPaletteStore = useColorPaletteStore(); + const nodeSourceBadgeMode = computed( + () => settingStore.get("Comfy.NodeBadge.NodeSourceBadgeMode") + ); + const nodeIdBadgeMode = computed( + () => settingStore.get("Comfy.NodeBadge.NodeIdBadgeMode") + ); + const nodeLifeCycleBadgeMode = computed( + () => settingStore.get("Comfy.NodeBadge.NodeLifeCycleBadgeMode") + ); + watch([nodeSourceBadgeMode, nodeIdBadgeMode, nodeLifeCycleBadgeMode], () => { + app.graph?.setDirtyCanvas(true, true); + }); + const nodeDefStore = useNodeDefStore(); + function badgeTextVisible(nodeDef, badgeMode) { + return !(badgeMode === NodeBadgeMode.None || nodeDef?.isCoreNode && badgeMode === NodeBadgeMode.HideBuiltIn); + } + __name(badgeTextVisible, "badgeTextVisible"); + onMounted(() => { + app.registerExtension({ + name: "Comfy.NodeBadge", + nodeCreated(node) { + node.badgePosition = BadgePosition.TopRight; + const badge = computed(() => { + const nodeDef = nodeDefStore.fromLGraphNode(node); + return new LGraphBadge({ + text: _.truncate( + [ + badgeTextVisible(nodeDef, nodeIdBadgeMode.value) ? `#${node.id}` : "", + badgeTextVisible(nodeDef, nodeLifeCycleBadgeMode.value) ? nodeDef?.nodeLifeCycleBadgeText ?? "" : "", + badgeTextVisible(nodeDef, nodeSourceBadgeMode.value) ? nodeDef?.nodeSource?.badgeText ?? "" : "" + ].filter((s) => s.length > 0).join(" "), + { + length: 31 + } + ), + fgColor: colorPaletteStore.completedActivePalette.colors.litegraph_base.BADGE_FG_COLOR, + bgColor: colorPaletteStore.completedActivePalette.colors.litegraph_base.BADGE_BG_COLOR + }); + }); + node.badges.push(() => badge.value); + } + }); + }); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div"); + }; + } +}); +const _sfc_main$l = /* @__PURE__ */ defineComponent({ + __name: "NodeTooltip", + setup(__props) { + let idleTimeout; + const nodeDefStore = useNodeDefStore(); + const tooltipRef = ref(); + const tooltipText = ref(""); + const left = ref(); + const top = ref(); + const hideTooltip = /* @__PURE__ */ __name(() => tooltipText.value = null, "hideTooltip"); + const showTooltip = /* @__PURE__ */ __name(async (tooltip) => { + if (!tooltip) return; + left.value = app.canvas.mouse[0] + "px"; + top.value = app.canvas.mouse[1] + "px"; + tooltipText.value = tooltip; + await nextTick(); + const rect = tooltipRef.value.getBoundingClientRect(); + if (rect.right > window.innerWidth) { + left.value = app.canvas.mouse[0] - rect.width + "px"; + } + if (rect.top < 0) { + top.value = app.canvas.mouse[1] + rect.height + "px"; + } + }, "showTooltip"); + const onIdle = /* @__PURE__ */ __name(() => { + const { canvas } = app; + const node = canvas.node_over; + if (!node) return; + const ctor = node.constructor; + const nodeDef = nodeDefStore.nodeDefsByName[node.type]; + if (ctor.title_mode !== LiteGraph.NO_TITLE && canvas.graph_mouse[1] < node.pos[1]) { + return showTooltip(nodeDef.description); + } + if (node.flags?.collapsed) return; + const inputSlot = canvas.isOverNodeInput( + node, + canvas.graph_mouse[0], + canvas.graph_mouse[1], + [0, 0] + ); + if (inputSlot !== -1) { + const inputName = node.inputs[inputSlot].name; + const translatedTooltip = st( + `nodeDefs.${normalizeI18nKey(node.type)}.inputs.${normalizeI18nKey(inputName)}.tooltip`, + nodeDef.inputs.getInput(inputName)?.tooltip + ); + return showTooltip(translatedTooltip); + } + const outputSlot = canvas.isOverNodeOutput( + node, + canvas.graph_mouse[0], + canvas.graph_mouse[1], + [0, 0] + ); + if (outputSlot !== -1) { + const translatedTooltip = st( + `nodeDefs.${normalizeI18nKey(node.type)}.outputs.${outputSlot}.tooltip`, + nodeDef.outputs.all?.[outputSlot]?.tooltip + ); + return showTooltip(translatedTooltip); + } + const widget = app.canvas.getWidgetAtCursor(); + if (widget && !widget.element) { + const translatedTooltip = st( + `nodeDefs.${normalizeI18nKey(node.type)}.inputs.${normalizeI18nKey(widget.name)}.tooltip`, + nodeDef.inputs.getInput(widget.name)?.tooltip + ); + return showTooltip(widget.tooltip ?? translatedTooltip); + } + }, "onIdle"); + const onMouseMove = /* @__PURE__ */ __name((e) => { + hideTooltip(); + clearTimeout(idleTimeout); + if (e.target.nodeName !== "CANVAS") return; + idleTimeout = window.setTimeout(onIdle, 500); + }, "onMouseMove"); + useEventListener(window, "mousemove", onMouseMove); + useEventListener(window, "click", hideTooltip); + return (_ctx, _cache) => { + return tooltipText.value ? (openBlock(), createElementBlock("div", { + key: 0, + ref_key: "tooltipRef", + ref: tooltipRef, + class: "node-tooltip", + style: normalizeStyle({ left: left.value, top: top.value }) + }, toDisplayString(tooltipText.value), 5)) : createCommentVNode("", true); + }; + } +}); +const NodeTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-46859edf"]]); +const _sfc_main$k = /* @__PURE__ */ defineComponent({ + __name: "TitleEditor", + setup(__props) { + const settingStore = useSettingStore(); + const showInput = ref(false); + const editedTitle = ref(""); + const inputStyle = ref({ + position: "fixed", + left: "0px", + top: "0px", + width: "200px", + height: "20px", + fontSize: "12px" + }); + const titleEditorStore = useTitleEditorStore(); + const canvasStore = useCanvasStore(); + const previousCanvasDraggable = ref(true); + const onEdit = /* @__PURE__ */ __name((newValue) => { + if (titleEditorStore.titleEditorTarget && newValue.trim() !== "") { + titleEditorStore.titleEditorTarget.title = newValue.trim(); + app.graph.setDirtyCanvas(true, true); + } + showInput.value = false; + titleEditorStore.titleEditorTarget = null; + canvasStore.canvas.allow_dragcanvas = previousCanvasDraggable.value; + }, "onEdit"); + watch( + () => titleEditorStore.titleEditorTarget, + (target) => { + if (target === null) { + return; + } + editedTitle.value = target.title; + showInput.value = true; + previousCanvasDraggable.value = canvasStore.canvas.allow_dragcanvas; + canvasStore.canvas.allow_dragcanvas = false; + if (target instanceof LGraphGroup) { + const group = target; + const [x, y] = group.pos; + const [w, h] = group.size; + const [left, top] = app.canvasPosToClientPos([x, y]); + inputStyle.value.left = `${left}px`; + inputStyle.value.top = `${top}px`; + const width = w * app.canvas.ds.scale; + const height = group.titleHeight * app.canvas.ds.scale; + inputStyle.value.width = `${width}px`; + inputStyle.value.height = `${height}px`; + const fontSize = group.font_size * app.canvas.ds.scale; + inputStyle.value.fontSize = `${fontSize}px`; + } else if (target instanceof LGraphNode) { + const node = target; + const [x, y] = node.getBounding(); + const canvasWidth = node.width; + const canvasHeight = LiteGraph.NODE_TITLE_HEIGHT; + const [left, top] = app.canvasPosToClientPos([x, y]); + inputStyle.value.left = `${left}px`; + inputStyle.value.top = `${top}px`; + const width = canvasWidth * app.canvas.ds.scale; + const height = canvasHeight * app.canvas.ds.scale; + inputStyle.value.width = `${width}px`; + inputStyle.value.height = `${height}px`; + const fontSize = 12 * app.canvas.ds.scale; + inputStyle.value.fontSize = `${fontSize}px`; + } + } + ); + const canvasEventHandler = /* @__PURE__ */ __name((event) => { + if (event.detail.subType === "group-double-click") { + if (!settingStore.get("Comfy.Group.DoubleClickTitleToEdit")) { + return; + } + const group = event.detail.group; + const [x, y] = group.pos; + const e = event.detail.originalEvent; + const relativeY = e.canvasY - y; + if (relativeY <= group.titleHeight) { + titleEditorStore.titleEditorTarget = group; + } + } else if (event.detail.subType === "node-double-click") { + if (!settingStore.get("Comfy.Node.DoubleClickTitleToEdit")) { + return; + } + const node = event.detail.node; + const [x, y] = node.pos; + const e = event.detail.originalEvent; + const relativeY = e.canvasY - y; + if (relativeY <= 0) { + titleEditorStore.titleEditorTarget = node; + } + } + }, "canvasEventHandler"); + useEventListener(document, "litegraph:canvas", canvasEventHandler); + return (_ctx, _cache) => { + return showInput.value ? (openBlock(), createElementBlock("div", { + key: 0, + class: "group-title-editor node-title-editor", + style: normalizeStyle(inputStyle.value) + }, [ + createVNode(EditableText, { + isEditing: showInput.value, + modelValue: editedTitle.value, + onEdit + }, null, 8, ["isEditing", "modelValue"]) + ], 4)) : createCommentVNode("", true); + }; + } +}); +const TitleEditor = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-12d3fd12"]]); +const useSearchBoxStore = defineStore("searchBox", () => { + const visible = ref(false); + function toggleVisible() { + visible.value = !visible.value; + } + __name(toggleVisible, "toggleVisible"); + return { + visible, + toggleVisible + }; +}); +class ConnectingLinkImpl { + static { + __name(this, "ConnectingLinkImpl"); + } + constructor(node, slot, input, output, pos, afterRerouteId) { + this.node = node; + this.slot = slot; + this.input = input; + this.output = output; + this.pos = pos; + this.afterRerouteId = afterRerouteId; + } + static createFromPlainObject(obj) { + return new ConnectingLinkImpl( + obj.node, + obj.slot, + obj.input, + obj.output, + obj.pos, + obj.afterRerouteId + ); + } + get type() { + const result = this.input ? this.input.type : this.output?.type ?? null; + return result === -1 ? null : result; + } + /** + * Which slot type is release and need to be reconnected. + * - 'output' means we need a new node's outputs slot to connect with this link + */ + get releaseSlotType() { + return this.output ? "input" : "output"; + } + connectTo(newNode) { + const newNodeSlots = this.releaseSlotType === "output" ? newNode.outputs : newNode.inputs; + if (!newNodeSlots) return; + const newNodeSlot = newNodeSlots.findIndex( + (slot) => LiteGraph.isValidConnection(slot.type, this.type) + ); + if (newNodeSlot === -1) { + console.warn( + `Could not find slot with type ${this.type} on node ${newNode.title}. This should never happen` + ); + return; + } + if (this.releaseSlotType === "input") { + this.node.connect(this.slot, newNode, newNodeSlot, this.afterRerouteId); + } else { + newNode.connect(newNodeSlot, this.node, this.slot, this.afterRerouteId); + } + } +} +var theme$5 = /* @__PURE__ */ __name(function theme3(_ref) { var dt = _ref.dt; return "\n.p-autocomplete {\n display: inline-flex;\n}\n\n.p-autocomplete-loader {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n right: ".concat(dt("autocomplete.padding.x"), ";\n}\n\n.p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-loader {\n right: calc(").concat(dt("autocomplete.dropdown.width"), " + ").concat(dt("autocomplete.padding.x"), ");\n}\n\n.p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-input {\n flex: 1 1 auto;\n width: 1%;\n}\n\n.p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-input,\n.p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-input-multiple {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.p-autocomplete-dropdown {\n cursor: pointer;\n display: inline-flex;\n cursor: pointer;\n user-select: none;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n width: ").concat(dt("autocomplete.dropdown.width"), ";\n border-top-right-radius: ").concat(dt("autocomplete.dropdown.border.radius"), ";\n border-bottom-right-radius: ").concat(dt("autocomplete.dropdown.border.radius"), ";\n background: ").concat(dt("autocomplete.dropdown.background"), ";\n border: 1px solid ").concat(dt("autocomplete.dropdown.border.color"), ";\n border-left: 0 none;\n color: ").concat(dt("autocomplete.dropdown.color"), ";\n transition: background ").concat(dt("autocomplete.transition.duration"), ", color ").concat(dt("autocomplete.transition.duration"), ", border-color ").concat(dt("autocomplete.transition.duration"), ", outline-color ").concat(dt("autocomplete.transition.duration"), ", box-shadow ").concat(dt("autocomplete.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-autocomplete-dropdown:not(:disabled):hover {\n background: ").concat(dt("autocomplete.dropdown.hover.background"), ";\n border-color: ").concat(dt("autocomplete.dropdown.hover.border.color"), ";\n color: ").concat(dt("autocomplete.dropdown.hover.color"), ";\n}\n\n.p-autocomplete-dropdown:not(:disabled):active {\n background: ").concat(dt("autocomplete.dropdown.active.background"), ";\n border-color: ").concat(dt("autocomplete.dropdown.active.border.color"), ";\n color: ").concat(dt("autocomplete.dropdown.active.color"), ";\n}\n\n.p-autocomplete-dropdown:focus-visible {\n box-shadow: ").concat(dt("autocomplete.dropdown.focus.ring.shadow"), ";\n outline: ").concat(dt("autocomplete.dropdown.focus.ring.width"), " ").concat(dt("autocomplete.dropdown.focus.ring.style"), " ").concat(dt("autocomplete.dropdown.focus.ring.color"), ";\n outline-offset: ").concat(dt("autocomplete.dropdown.focus.ring.offset"), ";\n}\n\n.p-autocomplete .p-autocomplete-overlay {\n min-width: 100%;\n}\n\n.p-autocomplete-overlay {\n position: absolute;\n overflow: auto;\n top: 0;\n left: 0;\n background: ").concat(dt("autocomplete.overlay.background"), ";\n color: ").concat(dt("autocomplete.overlay.color"), ";\n border: 1px solid ").concat(dt("autocomplete.overlay.border.color"), ";\n border-radius: ").concat(dt("autocomplete.overlay.border.radius"), ";\n box-shadow: ").concat(dt("autocomplete.overlay.shadow"), ";\n}\n\n.p-autocomplete-list {\n margin: 0;\n padding: 0;\n list-style-type: none;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("autocomplete.list.gap"), ";\n padding: ").concat(dt("autocomplete.list.padding"), ";\n}\n\n.p-autocomplete-option {\n cursor: pointer;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n display: flex;\n align-items: center;\n padding: ").concat(dt("autocomplete.option.padding"), ";\n border: 0 none;\n color: ").concat(dt("autocomplete.option.color"), ";\n background: transparent;\n transition: background ").concat(dt("autocomplete.transition.duration"), ", color ").concat(dt("autocomplete.transition.duration"), ", border-color ").concat(dt("autocomplete.transition.duration"), ";\n border-radius: ").concat(dt("autocomplete.option.border.radius"), ";\n}\n\n.p-autocomplete-option:not(.p-autocomplete-option-selected):not(.p-disabled).p-focus {\n background: ").concat(dt("autocomplete.option.focus.background"), ";\n color: ").concat(dt("autocomplete.option.focus.color"), ";\n}\n\n.p-autocomplete-option-selected {\n background: ").concat(dt("autocomplete.option.selected.background"), ";\n color: ").concat(dt("autocomplete.option.selected.color"), ";\n}\n\n.p-autocomplete-option-selected.p-focus {\n background: ").concat(dt("autocomplete.option.selected.focus.background"), ";\n color: ").concat(dt("autocomplete.option.selected.focus.color"), ";\n}\n\n.p-autocomplete-option-group {\n margin: 0;\n padding: ").concat(dt("autocomplete.option.group.padding"), ";\n color: ").concat(dt("autocomplete.option.group.color"), ";\n background: ").concat(dt("autocomplete.option.group.background"), ";\n font-weight: ").concat(dt("autocomplete.option.group.font.weight"), ";\n}\n\n.p-autocomplete-input-multiple {\n margin: 0;\n list-style-type: none;\n cursor: text;\n overflow: hidden;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n padding: calc(").concat(dt("autocomplete.padding.y"), " / 2) ").concat(dt("autocomplete.padding.x"), ";\n gap: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n color: ").concat(dt("autocomplete.color"), ";\n background: ").concat(dt("autocomplete.background"), ";\n border: 1px solid ").concat(dt("autocomplete.border.color"), ";\n border-radius: ").concat(dt("autocomplete.border.radius"), ";\n width: 100%;\n transition: background ").concat(dt("autocomplete.transition.duration"), ", color ").concat(dt("autocomplete.transition.duration"), ", border-color ").concat(dt("autocomplete.transition.duration"), ", outline-color ").concat(dt("autocomplete.transition.duration"), ", box-shadow ").concat(dt("autocomplete.transition.duration"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("autocomplete.shadow"), ";\n}\n\n.p-autocomplete:not(.p-disabled):hover .p-autocomplete-input-multiple {\n border-color: ").concat(dt("autocomplete.hover.border.color"), ";\n}\n\n.p-autocomplete:not(.p-disabled).p-focus .p-autocomplete-input-multiple {\n border-color: ").concat(dt("autocomplete.focus.border.color"), ";\n box-shadow: ").concat(dt("autocomplete.focus.ring.shadow"), ";\n outline: ").concat(dt("autocomplete.focus.ring.width"), " ").concat(dt("autocomplete.focus.ring.style"), " ").concat(dt("autocomplete.focus.ring.color"), ";\n outline-offset: ").concat(dt("autocomplete.focus.ring.offset"), ";\n}\n\n.p-autocomplete.p-invalid .p-autocomplete-input-multiple {\n border-color: ").concat(dt("autocomplete.invalid.border.color"), ";\n}\n\n.p-variant-filled.p-autocomplete-input-multiple {\n background: ").concat(dt("autocomplete.filled.background"), ";\n}\n\n.p-autocomplete:not(.p-disabled).p-focus .p-variant-filled.p-autocomplete-input-multiple {\n background: ").concat(dt("autocomplete.filled.focus.background"), ";\n}\n\n.p-autocomplete.p-disabled .p-autocomplete-input-multiple {\n opacity: 1;\n background: ").concat(dt("autocomplete.disabled.background"), ";\n color: ").concat(dt("autocomplete.disabled.color"), ";\n}\n\n.p-autocomplete-chip.p-chip {\n padding-top: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n padding-bottom: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n border-radius: ").concat(dt("autocomplete.chip.border.radius"), ";\n}\n\n.p-autocomplete-input-multiple:has(.p-autocomplete-chip) {\n padding-left: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n padding-right: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n}\n\n.p-autocomplete-chip-item.p-focus .p-autocomplete-chip {\n background: ").concat(dt("inputchips.chip.focus.background"), ";\n color: ").concat(dt("inputchips.chip.focus.color"), ";\n}\n\n.p-autocomplete-input-chip {\n flex: 1 1 auto;\n display: inline-flex;\n padding-top: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n padding-bottom: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n}\n\n.p-autocomplete-input-chip input {\n border: 0 none;\n outline: 0 none;\n background: transparent;\n margin: 0;\n padding: 0;\n box-shadow: none;\n border-radius: 0;\n width: 100%;\n font-family: inherit;\n font-feature-settings: inherit;\n font-size: 1rem;\n color: inherit;\n}\n\n.p-autocomplete-input-chip input::placeholder {\n color: ").concat(dt("autocomplete.placeholder.color"), ";\n}\n\n.p-autocomplete-empty-message {\n padding: ").concat(dt("autocomplete.empty.message.padding"), ";\n}\n\n.p-autocomplete-fluid {\n display: flex;\n}\n\n.p-autocomplete-fluid:has(.p-autocomplete-dropdown) .p-autocomplete-input {\n width: 1%;\n}\n"); }, "theme"); @@ -1515,7 +1763,7 @@ var inlineStyles$3 = { position: "relative" } }; -var classes$6 = { +var classes$5 = { root: /* @__PURE__ */ __name(function root5(_ref2) { var instance = _ref2.instance, props = _ref2.props; return ["p-autocomplete p-component p-inputwrapper", { @@ -1561,13 +1809,13 @@ var classes$6 = { }; var AutoCompleteStyle = BaseStyle.extend({ name: "autocomplete", - theme: theme$6, - classes: classes$6, + theme: theme$5, + classes: classes$5, inlineStyles: inlineStyles$3 }); -var script$1$6 = { +var script$1$5 = { name: "BaseAutoComplete", - "extends": script$g, + "extends": script$e, props: { modelValue: null, suggestions: { @@ -1794,9 +2042,9 @@ function _arrayLikeToArray$1(r, a) { return n; } __name(_arrayLikeToArray$1, "_arrayLikeToArray$1"); -var script$8 = { +var script$7 = { name: "AutoComplete", - "extends": script$1$6, + "extends": script$1$5, inheritAttrs: false, emits: ["update:modelValue", "change", "focus", "blur", "item-select", "item-unselect", "option-select", "option-unselect", "dropdown-click", "clear", "complete", "before-show", "before-hide", "show", "hide"], inject: { @@ -2562,12 +2810,12 @@ var script$8 = { }, "hasFluid") }, components: { - InputText: script$k, - VirtualScroller: script$l, - Portal: script$m, - ChevronDownIcon: script$n, - SpinnerIcon: script$o, - Chip: script$p + InputText: script$i, + VirtualScroller: script$j, + Portal: script$k, + ChevronDownIcon: script$l, + SpinnerIcon: script$m, + Chip: script$n }, directives: { ripple: Ripple @@ -2625,15 +2873,15 @@ function _toPrimitive$4(t, r) { return ("string" === r ? String : Number)(t); } __name(_toPrimitive$4, "_toPrimitive$4"); -var _hoisted_1$j = ["aria-activedescendant"]; -var _hoisted_2$g = ["id", "aria-label", "aria-setsize", "aria-posinset"]; -var _hoisted_3$e = ["id", "placeholder", "tabindex", "disabled", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-invalid"]; -var _hoisted_4$5 = ["disabled", "aria-expanded", "aria-controls"]; +var _hoisted_1$h = ["aria-activedescendant"]; +var _hoisted_2$e = ["id", "aria-label", "aria-setsize", "aria-posinset"]; +var _hoisted_3$c = ["id", "placeholder", "tabindex", "disabled", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-invalid"]; +var _hoisted_4$4 = ["disabled", "aria-expanded", "aria-controls"]; var _hoisted_5$3 = ["id"]; var _hoisted_6$2 = ["id", "aria-label"]; var _hoisted_7$1 = ["id"]; var _hoisted_8$1 = ["id", "aria-label", "aria-selected", "aria-disabled", "aria-setsize", "aria-posinset", "onClick", "onMousemove", "data-p-selected", "data-p-focus", "data-p-disabled"]; -function render$e(_ctx, _cache, $props, $setup, $data, $options) { +function render$c(_ctx, _cache, $props, $setup, $data, $options) { var _component_InputText = resolveComponent("InputText"); var _component_Chip = resolveComponent("Chip"); var _component_SpinnerIcon = resolveComponent("SpinnerIcon"); @@ -2738,7 +2986,7 @@ function render$e(_ctx, _cache, $props, $setup, $data, $options) { }), _: 2 }, 1032, ["class", "label", "removeIcon", "unstyled", "onRemove", "pt"])]; - })], 16, _hoisted_2$g); + })], 16, _hoisted_2$e); }), 128)), createBaseVNode("li", mergeProps({ "class": _ctx.cx("inputChip"), role: "option" @@ -2776,7 +3024,7 @@ function render$e(_ctx, _cache, $props, $setup, $data, $options) { onChange: _cache[4] || (_cache[4] = function() { return $options.onChange && $options.onChange.apply($options, arguments); }) - }, _ctx.ptm("input")), null, 16, _hoisted_3$e)], 16)], 16, _hoisted_1$j)) : createCommentVNode("", true), $data.searching || _ctx.loading ? renderSlot(_ctx.$slots, _ctx.$slots.loader ? "loader" : "loadingicon", { + }, _ctx.ptm("input")), null, 16, _hoisted_3$c)], 16)], 16, _hoisted_1$h)) : createCommentVNode("", true), $data.searching || _ctx.loading ? renderSlot(_ctx.$slots, _ctx.$slots.loader ? "loader" : "loadingicon", { key: 2, "class": normalizeClass(_ctx.cx("loader")) }, function() { @@ -2813,7 +3061,7 @@ function render$e(_ctx, _cache, $props, $setup, $data, $options) { return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.dropdownIcon ? "span" : "ChevronDownIcon"), mergeProps({ "class": _ctx.dropdownIcon }, _ctx.ptm("dropdownIcon")), null, 16, ["class"]))]; - })], 16, _hoisted_4$5)) : createCommentVNode("", true)]; + })], 16, _hoisted_4$4)) : createCommentVNode("", true)]; }), createBaseVNode("span", mergeProps({ role: "status", "aria-live": "polite", @@ -2956,15 +3204,15 @@ function render$e(_ctx, _cache, $props, $setup, $data, $options) { _: 3 }, 8, ["appendTo"])], 16); } -__name(render$e, "render$e"); -script$8.render = render$e; +__name(render$c, "render$c"); +script$7.render = render$c; const _sfc_main$j = { name: "AutoCompletePlus", - extends: script$8, + extends: script$7, emits: ["focused-option-changed"], mounted() { - if (typeof script$8.mounted === "function") { - script$8.mounted.call(this); + if (typeof script$7.mounted === "function") { + script$7.mounted.call(this); } this.$watch( () => this.focusedOptionIndex, @@ -2974,16 +3222,16 @@ const _sfc_main$j = { ); } }; -const _withScopeId$4 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-d7cc0bce"), n = n(), popScopeId(), n), "_withScopeId$4"); -const _hoisted_1$i = { class: "option-container flex justify-between items-center px-2 py-0 cursor-pointer overflow-hidden w-full" }; -const _hoisted_2$f = { class: "option-display-name font-semibold flex flex-col" }; -const _hoisted_3$d = { key: 0 }; -const _hoisted_4$4 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ createBaseVNode("i", { class: "pi pi-bookmark-fill text-sm mr-1" }, null, -1)); +const _withScopeId$5 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-5741c9ae"), n = n(), popScopeId(), n), "_withScopeId$5"); +const _hoisted_1$g = { class: "option-container flex justify-between items-center px-2 py-0 cursor-pointer overflow-hidden w-full" }; +const _hoisted_2$d = { class: "option-display-name font-semibold flex flex-col" }; +const _hoisted_3$b = { key: 0 }; +const _hoisted_4$3 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ createBaseVNode("i", { class: "pi pi-bookmark-fill text-sm mr-1" }, null, -1)); const _hoisted_5$2 = [ - _hoisted_4$4 + _hoisted_4$3 ]; const _hoisted_6$1 = ["innerHTML"]; -const _hoisted_7 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ createBaseVNode("span", null, " ", -1)); +const _hoisted_7 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ createBaseVNode("span", null, " ", -1)); const _hoisted_8 = ["innerHTML"]; const _hoisted_9 = { key: 0, @@ -3017,15 +3265,15 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ ); const props = __props; return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$i, [ - createBaseVNode("div", _hoisted_2$f, [ + return openBlock(), createElementBlock("div", _hoisted_1$g, [ + createBaseVNode("div", _hoisted_2$d, [ createBaseVNode("div", null, [ - isBookmarked.value ? (openBlock(), createElementBlock("span", _hoisted_3$d, _hoisted_5$2)) : createCommentVNode("", true), + isBookmarked.value ? (openBlock(), createElementBlock("span", _hoisted_3$b, _hoisted_5$2)) : createCommentVNode("", true), createBaseVNode("span", { innerHTML: unref(highlightQuery)(_ctx.nodeDef.display_name, _ctx.currentQuery) }, null, 8, _hoisted_6$1), _hoisted_7, - showIdName.value ? (openBlock(), createBlock(unref(script$q), { + showIdName.value ? (openBlock(), createBlock(unref(script$o), { key: 1, severity: "secondary" }, { @@ -3040,22 +3288,22 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ showCategory.value ? (openBlock(), createElementBlock("div", _hoisted_9, toDisplayString(_ctx.nodeDef.category.replaceAll("/", " > ")), 1)) : createCommentVNode("", true) ]), createBaseVNode("div", _hoisted_10, [ - _ctx.nodeDef.experimental ? (openBlock(), createBlock(unref(script$q), { + _ctx.nodeDef.experimental ? (openBlock(), createBlock(unref(script$o), { key: 0, value: _ctx.$t("g.experimental"), severity: "primary" }, null, 8, ["value"])) : createCommentVNode("", true), - _ctx.nodeDef.deprecated ? (openBlock(), createBlock(unref(script$q), { + _ctx.nodeDef.deprecated ? (openBlock(), createBlock(unref(script$o), { key: 1, value: _ctx.$t("g.deprecated"), severity: "danger" }, null, 8, ["value"])) : createCommentVNode("", true), - showNodeFrequency.value && nodeFrequency.value > 0 ? (openBlock(), createBlock(unref(script$q), { + showNodeFrequency.value && nodeFrequency.value > 0 ? (openBlock(), createBlock(unref(script$o), { key: 2, value: unref(formatNumberWithSuffix)(nodeFrequency.value, { roundToInt: true }), severity: "secondary" }, null, 8, ["value"])) : createCommentVNode("", true), - _ctx.nodeDef.nodeSource.type !== unref(NodeSourceType).Unknown ? (openBlock(), createBlock(unref(script$p), { + _ctx.nodeDef.nodeSource.type !== unref(NodeSourceType).Unknown ? (openBlock(), createBlock(unref(script$n), { key: 3, class: "text-sm font-light" }, { @@ -3069,14 +3317,14 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ }; } }); -const NodeSearchItem = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-d7cc0bce"]]); -const _hoisted_1$h = { class: "comfy-vue-node-search-container flex justify-center items-center w-full min-w-96 pointer-events-auto" }; -const _hoisted_2$e = { +const NodeSearchItem = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-5741c9ae"]]); +const _hoisted_1$f = { class: "comfy-vue-node-search-container flex justify-center items-center w-full min-w-96 pointer-events-auto" }; +const _hoisted_2$c = { key: 0, class: "comfy-vue-node-preview-container absolute left-[-350px] top-[50px]" }; -const _hoisted_3$c = /* @__PURE__ */ createBaseVNode("h3", null, "Add node filter condition", -1); -const _hoisted_4$3 = { class: "_dialog-body" }; +const _hoisted_3$a = /* @__PURE__ */ createBaseVNode("h3", null, "Add node filter condition", -1); +const _hoisted_4$2 = { class: "_dialog-body" }; const _sfc_main$h = /* @__PURE__ */ defineComponent({ __name: "NodeSearchBox", props: { @@ -3111,11 +3359,12 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ ]; }, "search"); const emit = __emit; + let inputElement = null; const reFocusInput = /* @__PURE__ */ __name(() => { - const inputElement = document.getElementById(inputId); + inputElement ??= document.getElementById(inputId); if (inputElement) { inputElement.blur(); - inputElement.focus(); + nextTick(() => inputElement?.focus()); } }, "reFocusInput"); onMounted(reFocusInput); @@ -3139,29 +3388,29 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ hoveredSuggestion.value = value; }, "setHoverSuggestion"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$h, [ - enableNodePreview.value ? (openBlock(), createElementBlock("div", _hoisted_2$e, [ + return openBlock(), createElementBlock("div", _hoisted_1$f, [ + enableNodePreview.value ? (openBlock(), createElementBlock("div", _hoisted_2$c, [ hoveredSuggestion.value ? (openBlock(), createBlock(NodePreview, { nodeDef: hoveredSuggestion.value, key: hoveredSuggestion.value?.name || "" }, null, 8, ["nodeDef"])) : createCommentVNode("", true) ])) : createCommentVNode("", true), - createVNode(unref(script$f), { + createVNode(unref(script$d), { icon: "pi pi-filter", severity: "secondary", class: "filter-button z-10", onClick: _cache[0] || (_cache[0] = ($event) => nodeSearchFilterVisible.value = true) }), - createVNode(unref(script$r), { + createVNode(unref(script$p), { visible: nodeSearchFilterVisible.value, "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => nodeSearchFilterVisible.value = $event), class: "min-w-96" }, { header: withCtx(() => [ - _hoisted_3$c + _hoisted_3$a ]), default: withCtx(() => [ - createBaseVNode("div", _hoisted_4$3, [ + createBaseVNode("div", _hoisted_4$2, [ createVNode(NodeSearchFilter, { onAddFilter }) ]) ]), @@ -3194,12 +3443,13 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ }, null, 8, ["nodeDef", "currentQuery"]) ]), chip: withCtx(({ value }) => [ - createVNode(SearchFilterChip, { + (openBlock(), createBlock(SearchFilterChip, { + key: `${value[0].id}-${value[1]}`, onRemove: /* @__PURE__ */ __name(($event) => onRemoveFilter($event, value), "onRemove"), text: value[1], badge: value[0].invokeSequence.toUpperCase(), "badge-class": value[0].invokeSequence + "-badge" - }, null, 8, ["onRemove", "text", "badge", "badge-class"]) + }, null, 8, ["onRemove", "text", "badge", "badge-class"])) ]), _: 1 }, 8, ["model-value", "placeholder", "suggestions", "loading"]) @@ -3207,79 +3457,17 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ }; } }); -class ConnectingLinkImpl { - static { - __name(this, "ConnectingLinkImpl"); - } - constructor(node, slot, input, output, pos, afterRerouteId) { - this.node = node; - this.slot = slot; - this.input = input; - this.output = output; - this.pos = pos; - this.afterRerouteId = afterRerouteId; - } - static createFromPlainObject(obj) { - return new ConnectingLinkImpl( - obj.node, - obj.slot, - obj.input, - obj.output, - obj.pos, - obj.afterRerouteId - ); - } - get type() { - const result = this.input ? this.input.type : this.output?.type ?? null; - return result === -1 ? null : result; - } - /** - * Which slot type is release and need to be reconnected. - * - 'output' means we need a new node's outputs slot to connect with this link - */ - get releaseSlotType() { - return this.output ? "input" : "output"; - } - connectTo(newNode) { - const newNodeSlots = this.releaseSlotType === "output" ? newNode.outputs : newNode.inputs; - if (!newNodeSlots) return; - const newNodeSlot = newNodeSlots.findIndex( - (slot) => LiteGraph.isValidConnection(slot.type, this.type) - ); - if (newNodeSlot === -1) { - console.warn( - `Could not find slot with type ${this.type} on node ${newNode.title}. This should never happen` - ); - return; - } - if (this.releaseSlotType === "input") { - this.node.connect(this.slot, newNode, newNodeSlot, this.afterRerouteId); - } else { - newNode.connect(newNodeSlot, this.node, this.slot, this.afterRerouteId); - } - } -} -const useSearchBoxStore = defineStore("searchBox", () => { - const visible = ref(false); - function toggleVisible() { - visible.value = !visible.value; - } - __name(toggleVisible, "toggleVisible"); - return { - visible, - toggleVisible - }; -}); const _sfc_main$g = /* @__PURE__ */ defineComponent({ __name: "NodeSearchBoxPopover", setup(__props) { const settingStore = useSettingStore(); + const litegraphService = useLitegraphService(); const { visible } = storeToRefs(useSearchBoxStore()); const dismissable = ref(true); const triggerEvent = ref(null); const getNewNodeLocation = /* @__PURE__ */ __name(() => { if (!triggerEvent.value) { - return app.getCanvasCenter(); + return litegraphService.getCanvasCenter(); } const originalEvent = triggerEvent.value.detail.originalEvent; return [originalEvent.canvasX, originalEvent.canvasY]; @@ -3300,7 +3488,9 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({ visible.value = false; }, "closeDialog"); const addNode = /* @__PURE__ */ __name((nodeDef) => { - const node = app.addNodeOnGraph(nodeDef, { pos: getNewNodeLocation() }); + const node = litegraphService.addNodeOnGraph(nodeDef, { + pos: getNewNodeLocation() + }); const eventDetail = triggerEvent.value?.detail; if (eventDetail && eventDetail.subType === "empty-release") { eventDetail.linkReleaseContext.links.forEach((link) => { @@ -3426,7 +3616,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({ useEventListener(document, "litegraph:canvas", canvasEventHandler); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", null, [ - createVNode(unref(script$r), { + createVNode(unref(script$p), { visible: unref(visible), "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => isRef(visible) ? visible.value = $event : null), modal: "", @@ -3461,332 +3651,912 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({ }; } }); -const _sfc_main$f = /* @__PURE__ */ defineComponent({ - __name: "NodeTooltip", - setup(__props) { - let idleTimeout; - const nodeDefStore = useNodeDefStore(); - const tooltipRef = ref(); - const tooltipText = ref(""); - const left = ref(); - const top = ref(); - const hideTooltip = /* @__PURE__ */ __name(() => tooltipText.value = null, "hideTooltip"); - const showTooltip = /* @__PURE__ */ __name(async (tooltip) => { - if (!tooltip) return; - left.value = app.canvas.mouse[0] + "px"; - top.value = app.canvas.mouse[1] + "px"; - tooltipText.value = tooltip; - await nextTick(); - const rect = tooltipRef.value.getBoundingClientRect(); - if (rect.right > window.innerWidth) { - left.value = app.canvas.mouse[0] - rect.width + "px"; - } - if (rect.top < 0) { - top.value = app.canvas.mouse[1] + rect.height + "px"; - } - }, "showTooltip"); - const onIdle = /* @__PURE__ */ __name(() => { - const { canvas } = app; - const node = canvas.node_over; - if (!node) return; - const ctor = node.constructor; - const nodeDef = nodeDefStore.nodeDefsByName[node.type]; - if (ctor.title_mode !== LiteGraph.NO_TITLE && canvas.graph_mouse[1] < node.pos[1]) { - return showTooltip(nodeDef.description); - } - if (node.flags?.collapsed) return; - const inputSlot = canvas.isOverNodeInput( - node, - canvas.graph_mouse[0], - canvas.graph_mouse[1], - [0, 0] - ); - if (inputSlot !== -1) { - const inputName = node.inputs[inputSlot].name; - const translatedTooltip = st( - `nodeDefs.${normalizeI18nKey(node.type)}.inputs.${normalizeI18nKey(inputName)}.tooltip`, - nodeDef.inputs.getInput(inputName)?.tooltip - ); - return showTooltip(translatedTooltip); - } - const outputSlot = canvas.isOverNodeOutput( - node, - canvas.graph_mouse[0], - canvas.graph_mouse[1], - [0, 0] - ); - if (outputSlot !== -1) { - const translatedTooltip = st( - `nodeDefs.${normalizeI18nKey(node.type)}.outputs.${outputSlot}.tooltip`, - nodeDef.outputs.all?.[outputSlot]?.tooltip - ); - return showTooltip(translatedTooltip); - } - const widget = app.canvas.getWidgetAtCursor(); - if (widget && !widget.element) { - const translatedTooltip = st( - `nodeDefs.${normalizeI18nKey(node.type)}.inputs.${normalizeI18nKey(widget.name)}.tooltip`, - nodeDef.inputs.getInput(widget.name)?.tooltip - ); - return showTooltip(widget.tooltip ?? translatedTooltip); - } - }, "onIdle"); - const onMouseMove = /* @__PURE__ */ __name((e) => { - hideTooltip(); - clearTimeout(idleTimeout); - if (e.target.nodeName !== "CANVAS") return; - idleTimeout = window.setTimeout(onIdle, 500); - }, "onMouseMove"); - useEventListener(window, "mousemove", onMouseMove); - useEventListener(window, "click", hideTooltip); - return (_ctx, _cache) => { - return tooltipText.value ? (openBlock(), createElementBlock("div", { - key: 0, - ref_key: "tooltipRef", - ref: tooltipRef, - class: "node-tooltip", - style: normalizeStyle({ left: left.value, top: top.value }) - }, toDisplayString(tooltipText.value), 5)) : createCommentVNode("", true); - }; - } -}); -const NodeTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-9ecc8adc"]]); -const _sfc_main$e = /* @__PURE__ */ defineComponent({ - __name: "NodeBadge", - setup(__props) { - const settingStore = useSettingStore(); - const nodeSourceBadgeMode = computed( - () => settingStore.get("Comfy.NodeBadge.NodeSourceBadgeMode") - ); - const nodeIdBadgeMode = computed( - () => settingStore.get("Comfy.NodeBadge.NodeIdBadgeMode") - ); - const nodeLifeCycleBadgeMode = computed( - () => settingStore.get("Comfy.NodeBadge.NodeLifeCycleBadgeMode") - ); - watch([nodeSourceBadgeMode, nodeIdBadgeMode, nodeLifeCycleBadgeMode], () => { - app.graph?.setDirtyCanvas(true, true); - }); - const colorPalette = computed( - () => getColorPalette(settingStore.get("Comfy.ColorPalette")) - ); - const nodeDefStore = useNodeDefStore(); - function badgeTextVisible(nodeDef, badgeMode) { - return !(badgeMode === NodeBadgeMode.None || nodeDef?.isCoreNode && badgeMode === NodeBadgeMode.HideBuiltIn); - } - __name(badgeTextVisible, "badgeTextVisible"); - onMounted(() => { - app.registerExtension({ - name: "Comfy.NodeBadge", - nodeCreated(node) { - node.badgePosition = BadgePosition.TopRight; - const badge = computed(() => { - const nodeDef = nodeDefStore.fromLGraphNode(node); - return new LGraphBadge({ - text: _.truncate( - [ - badgeTextVisible(nodeDef, nodeIdBadgeMode.value) ? `#${node.id}` : "", - badgeTextVisible(nodeDef, nodeLifeCycleBadgeMode.value) ? nodeDef?.nodeLifeCycleBadgeText ?? "" : "", - badgeTextVisible(nodeDef, nodeSourceBadgeMode.value) ? nodeDef?.nodeSource?.badgeText ?? "" : "" - ].filter((s) => s.length > 0).join(" "), - { - length: 31 - } - ), - fgColor: colorPalette.value?.colors?.litegraph_base?.BADGE_FG_COLOR || defaultColorPalette.colors.litegraph_base.BADGE_FG_COLOR, - bgColor: colorPalette.value?.colors?.litegraph_base?.BADGE_BG_COLOR || defaultColorPalette.colors.litegraph_base.BADGE_BG_COLOR - }); - }); - node.badges.push(() => badge.value); - } - }); - }); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div"); - }; - } -}); -const _hoisted_1$g = { - viewBox: "0 0 1024 1024", - width: "1.2em", - height: "1.2em" -}; -const _hoisted_2$d = /* @__PURE__ */ createBaseVNode("path", { - fill: "currentColor", - d: "M921.088 103.232L584.832 889.024L465.52 544.512L121.328 440.48zM1004.46.769c-6.096 0-13.52 1.728-22.096 5.36L27.708 411.2c-34.383 14.592-36.56 42.704-4.847 62.464l395.296 123.584l129.36 403.264c9.28 15.184 20.496 22.72 31.263 22.72c11.936 0 23.296-9.152 31.04-27.248l408.272-953.728C1029.148 16.368 1022.86.769 1004.46.769" -}, null, -1); -const _hoisted_3$b = [ - _hoisted_2$d -]; -function render$d(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$g, [..._hoisted_3$b]); -} -__name(render$d, "render$d"); -const __unplugin_components_1$2 = markRaw({ name: "simple-line-icons-cursor", render: render$d }); -const _hoisted_1$f = { - viewBox: "0 0 24 24", - width: "1.2em", - height: "1.2em" -}; -const _hoisted_2$c = /* @__PURE__ */ createBaseVNode("path", { - fill: "currentColor", - d: "M10.05 23q-.75 0-1.4-.337T7.575 21.7L1.2 12.375l.6-.575q.475-.475 1.125-.55t1.175.3L7 13.575V4q0-.425.288-.712T8 3t.713.288T9 4v13.425l-3.7-2.6l3.925 5.725q.125.2.35.325t.475.125H17q.825 0 1.413-.587T19 19V5q0-.425.288-.712T20 4t.713.288T21 5v14q0 1.65-1.175 2.825T17 23zM11 12V2q0-.425.288-.712T12 1t.713.288T13 2v10zm4 0V3q0-.425.288-.712T16 2t.713.288T17 3v9zm-2.85 4.5" -}, null, -1); -const _hoisted_3$a = [ - _hoisted_2$c -]; -function render$c(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$f, [..._hoisted_3$a]); -} -__name(render$c, "render$c"); -const __unplugin_components_0$2 = markRaw({ name: "material-symbols-pan-tool-outline", render: render$c }); -var theme$5 = /* @__PURE__ */ __name(function theme4(_ref) { - _ref.dt; - return "\n.p-buttongroup .p-button {\n margin: 0;\n}\n\n.p-buttongroup .p-button:not(:last-child),\n.p-buttongroup .p-button:not(:last-child):hover {\n border-right: 0 none;\n}\n\n.p-buttongroup .p-button:not(:first-of-type):not(:last-of-type) {\n border-radius: 0;\n}\n\n.p-buttongroup .p-button:first-of-type:not(:only-of-type) {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.p-buttongroup .p-button:last-of-type:not(:only-of-type) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.p-buttongroup .p-button:focus {\n position: relative;\n z-index: 1;\n}\n"; +var theme$4 = /* @__PURE__ */ __name(function theme4(_ref) { + var dt = _ref.dt; + return "\n.p-overlaybadge {\n position: relative;\n}\n\n.p-overlaybadge .p-badge {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n transform-origin: 100% 0;\n margin: 0;\n outline-width: ".concat(dt("overlaybadge.outline.width"), ";\n outline-style: solid;\n outline-color: ").concat(dt("overlaybadge.outline.color"), ";\n}\n"); }, "theme"); -var classes$5 = { - root: "p-buttongroup p-component" +var classes$4 = { + root: "p-overlaybadge" }; -var ButtonGroupStyle = BaseStyle.extend({ - name: "buttongroup", - theme: theme$5, - classes: classes$5 +var OverlayBadgeStyle = BaseStyle.extend({ + name: "overlaybadge", + theme: theme$4, + classes: classes$4 }); -var script$1$5 = { - name: "BaseButtonGroup", - "extends": script$g, - style: ButtonGroupStyle, +var script$1$4 = { + name: "OverlayBadge", + "extends": script$q, + style: OverlayBadgeStyle, provide: /* @__PURE__ */ __name(function provide8() { return { - $pcButtonGroup: this, + $pcOverlayBadge: this, $parentInstance: this }; }, "provide") }; -var script$7 = { - name: "ButtonGroup", - "extends": script$1$5, - inheritAttrs: false +var script$6 = { + name: "OverlayBadge", + "extends": script$1$4, + inheritAttrs: false, + components: { + Badge: script$q + } }; function render$b(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("span", mergeProps({ - "class": _ctx.cx("root"), - role: "group" - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16); + var _component_Badge = resolveComponent("Badge"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default"), createVNode(_component_Badge, mergeProps(_ctx.$props, { + pt: _ctx.ptm("pcBadge") + }), null, 16, ["pt"])], 16); } __name(render$b, "render$b"); -script$7.render = render$b; -const _sfc_main$d = /* @__PURE__ */ defineComponent({ - __name: "GraphCanvasMenu", - setup(__props) { - const { t } = useI18n(); - const commandStore = useCommandStore(); - const canvasStore = useCanvasStore(); - const settingStore = useSettingStore(); - const linkHidden = computed( - () => settingStore.get("Comfy.LinkRenderMode") === LiteGraph.HIDDEN_LINK +script$6.render = render$b; +const _sfc_main$f = /* @__PURE__ */ defineComponent({ + __name: "SidebarIcon", + props: { + icon: String, + selected: Boolean, + tooltip: { + type: String, + default: "" + }, + class: { + type: String, + default: "" + }, + iconBadge: { + type: [String, Function], + default: "" + } + }, + emits: ["click"], + setup(__props, { emit: __emit }) { + const props = __props; + const emit = __emit; + const overlayValue = computed( + () => typeof props.iconBadge === "function" ? props.iconBadge() || "" : props.iconBadge ); - let interval = null; - const repeat2 = /* @__PURE__ */ __name((command) => { - if (interval) return; - const cmd = /* @__PURE__ */ __name(() => commandStore.execute(command), "cmd"); - cmd(); - interval = window.setInterval(cmd, 100); - }, "repeat"); - const stopRepeat = /* @__PURE__ */ __name(() => { - if (interval) { - clearInterval(interval); - interval = null; - } - }, "stopRepeat"); + const shouldShowBadge = computed(() => !!overlayValue.value); return (_ctx, _cache) => { - const _component_i_material_symbols58pan_tool_outline = __unplugin_components_0$2; - const _component_i_simple_line_icons58cursor = __unplugin_components_1$2; const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createBlock(unref(script$7), { class: "p-buttongroup-vertical absolute bottom-[10px] right-[10px] z-[1000] pointer-events-auto" }, { - default: withCtx(() => [ - withDirectives(createVNode(unref(script$f), { - severity: "secondary", - icon: "pi pi-plus", - onMousedown: _cache[0] || (_cache[0] = ($event) => repeat2("Comfy.Canvas.ZoomIn")), - onMouseup: stopRepeat - }, null, 512), [ - [ - _directive_tooltip, - unref(t)("graphCanvasMenu.zoomIn"), - void 0, - { left: true } - ] - ]), - withDirectives(createVNode(unref(script$f), { - severity: "secondary", - icon: "pi pi-minus", - onMousedown: _cache[1] || (_cache[1] = ($event) => repeat2("Comfy.Canvas.ZoomOut")), - onMouseup: stopRepeat - }, null, 512), [ - [ - _directive_tooltip, - unref(t)("graphCanvasMenu.zoomOut"), - void 0, - { left: true } - ] - ]), - withDirectives(createVNode(unref(script$f), { - severity: "secondary", - icon: "pi pi-expand", - onClick: _cache[2] || (_cache[2] = () => unref(commandStore).execute("Comfy.Canvas.FitView")) - }, null, 512), [ - [ - _directive_tooltip, - unref(t)("graphCanvasMenu.fitView"), - void 0, - { left: true } - ] - ]), - withDirectives((openBlock(), createBlock(unref(script$f), { - severity: "secondary", - onClick: _cache[3] || (_cache[3] = () => unref(commandStore).execute("Comfy.Canvas.ToggleLock")) + return withDirectives((openBlock(), createBlock(unref(script$d), { + class: normalizeClass(props.class), + text: "", + pt: { + root: { + class: `side-bar-button ${props.selected ? "p-button-primary side-bar-button-selected" : "p-button-secondary"}`, + "aria-label": props.tooltip + } + }, + onClick: _cache[0] || (_cache[0] = ($event) => emit("click", $event)) + }, { + icon: withCtx(() => [ + shouldShowBadge.value ? (openBlock(), createBlock(unref(script$6), { + key: 0, + value: overlayValue.value }, { - icon: withCtx(() => [ - unref(canvasStore).canvas?.read_only ? (openBlock(), createBlock(_component_i_material_symbols58pan_tool_outline, { key: 0 })) : (openBlock(), createBlock(_component_i_simple_line_icons58cursor, { key: 1 })) + default: withCtx(() => [ + createBaseVNode("i", { + class: normalizeClass(props.icon + " side-bar-button-icon") + }, null, 2) ]), _: 1 - })), [ - [ - _directive_tooltip, - unref(t)( - "graphCanvasMenu." + (unref(canvasStore).canvas?.read_only ? "panMode" : "selectMode") - ) + " (Space)", - void 0, - { left: true } - ] - ]), - withDirectives(createVNode(unref(script$f), { - severity: "secondary", - icon: linkHidden.value ? "pi pi-eye-slash" : "pi pi-eye", - onClick: _cache[4] || (_cache[4] = () => unref(commandStore).execute("Comfy.Canvas.ToggleLinkVisibility")), - "data-testid": "toggle-link-visibility-button" - }, null, 8, ["icon"]), [ - [ - _directive_tooltip, - unref(t)("graphCanvasMenu.toggleLinkVisibility"), - void 0, - { left: true } - ] - ]) + }, 8, ["value"])) : (openBlock(), createElementBlock("i", { + key: 1, + class: normalizeClass(props.icon + " side-bar-button-icon") + }, null, 2)) ]), _: 1 - }); + }, 8, ["class", "pt"])), [ + [_directive_tooltip, { value: props.tooltip, showDelay: 300, hideDelay: 300 }] + ]); + }; + } +}); +const SidebarIcon = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-6ab4daa6"]]); +const _sfc_main$e = /* @__PURE__ */ defineComponent({ + __name: "SidebarLogoutIcon", + setup(__props) { + const { t } = useI18n(); + const userStore = useUserStore(); + const tooltip = computed( + () => `${t("sideToolbar.logout")} (${userStore.currentUser?.username})` + ); + const logout = /* @__PURE__ */ __name(() => { + userStore.logout(); + window.location.reload(); + }, "logout"); + return (_ctx, _cache) => { + return openBlock(), createBlock(SidebarIcon, { + icon: "pi pi-sign-out", + tooltip: tooltip.value, + onClick: logout + }, null, 8, ["tooltip"]); + }; + } +}); +const _sfc_main$d = /* @__PURE__ */ defineComponent({ + __name: "SidebarSettingsToggleIcon", + setup(__props) { + const dialogStore = useDialogStore(); + const showSetting = /* @__PURE__ */ __name(() => { + dialogStore.showDialog({ + key: "global-settings", + headerComponent: SettingDialogHeader, + component: SettingDialogContent + }); + }, "showSetting"); + return (_ctx, _cache) => { + return openBlock(), createBlock(SidebarIcon, { + icon: "pi pi-cog", + class: "comfy-settings-btn", + onClick: showSetting, + tooltip: _ctx.$t("g.settings") + }, null, 8, ["tooltip"]); }; } }); -const GraphCanvasMenu = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-94481f39"]]); const _sfc_main$c = /* @__PURE__ */ defineComponent({ + __name: "SidebarThemeToggleIcon", + setup(__props) { + const settingStore = useSettingStore(); + const currentTheme = computed(() => settingStore.get("Comfy.ColorPalette")); + const icon = computed( + () => currentTheme.value !== "light" ? "pi pi-moon" : "pi pi-sun" + ); + const commandStore = useCommandStore(); + const toggleTheme = /* @__PURE__ */ __name(() => { + commandStore.execute("Comfy.ToggleTheme"); + }, "toggleTheme"); + return (_ctx, _cache) => { + return openBlock(), createBlock(SidebarIcon, { + icon: icon.value, + onClick: toggleTheme, + tooltip: _ctx.$t("sideToolbar.themeToggle"), + class: "comfy-vue-theme-toggle" + }, null, 8, ["icon", "tooltip"]); + }; + } +}); +const _withScopeId$4 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-37d8d7b4"), n = n(), popScopeId(), n), "_withScopeId$4"); +const _hoisted_1$e = { class: "side-tool-bar-end" }; +const _hoisted_2$b = { + key: 0, + class: "sidebar-content-container h-full overflow-y-auto overflow-x-hidden" +}; +const _sfc_main$b = /* @__PURE__ */ defineComponent({ + __name: "SideToolbar", + setup(__props) { + const workspaceStore = useWorkspaceStore(); + const settingStore = useSettingStore(); + const userStore = useUserStore(); + const teleportTarget = computed( + () => settingStore.get("Comfy.Sidebar.Location") === "left" ? ".comfyui-body-left" : ".comfyui-body-right" + ); + const isSmall = computed( + () => settingStore.get("Comfy.Sidebar.Size") === "small" + ); + const tabs = computed(() => workspaceStore.getSidebarTabs()); + const selectedTab = computed(() => workspaceStore.sidebarTab.activeSidebarTab); + const onTabClick = /* @__PURE__ */ __name((item3) => { + workspaceStore.sidebarTab.toggleSidebarTab(item3.id); + }, "onTabClick"); + const keybindingStore = useKeybindingStore(); + const getTabTooltipSuffix = /* @__PURE__ */ __name((tab) => { + const keybinding = keybindingStore.getKeybindingByCommandId( + `Workspace.ToggleSidebarTab.${tab.id}` + ); + return keybinding ? ` (${keybinding.combo.toString()})` : ""; + }, "getTabTooltipSuffix"); + return (_ctx, _cache) => { + return openBlock(), createElementBlock(Fragment, null, [ + (openBlock(), createBlock(Teleport, { to: teleportTarget.value }, [ + createBaseVNode("nav", { + class: normalizeClass("side-tool-bar-container" + (isSmall.value ? " small-sidebar" : "")) + }, [ + (openBlock(true), createElementBlock(Fragment, null, renderList(tabs.value, (tab) => { + return openBlock(), createBlock(SidebarIcon, { + key: tab.id, + icon: tab.icon, + iconBadge: tab.iconBadge, + tooltip: tab.tooltip + getTabTooltipSuffix(tab), + selected: tab.id === selectedTab.value?.id, + class: normalizeClass(tab.id + "-tab-button"), + onClick: /* @__PURE__ */ __name(($event) => onTabClick(tab), "onClick") + }, null, 8, ["icon", "iconBadge", "tooltip", "selected", "class", "onClick"]); + }), 128)), + createBaseVNode("div", _hoisted_1$e, [ + unref(userStore).isMultiUserServer ? (openBlock(), createBlock(_sfc_main$e, { key: 0 })) : createCommentVNode("", true), + createVNode(_sfc_main$c), + createVNode(_sfc_main$d) + ]) + ], 2) + ], 8, ["to"])), + selectedTab.value ? (openBlock(), createElementBlock("div", _hoisted_2$b, [ + createVNode(_sfc_main$p, { extension: selectedTab.value }, null, 8, ["extension"]) + ])) : createCommentVNode("", true) + ], 64); + }; + } +}); +const SideToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-37d8d7b4"]]); +const CORE_SETTINGS = [ + { + id: "Comfy.Validation.Workflows", + name: "Validate workflows", + type: "boolean", + defaultValue: true + }, + { + id: "Comfy.NodeSearchBoxImpl", + category: ["Comfy", "Node Search Box", "Implementation"], + experimental: true, + name: "Node search box implementation", + type: "combo", + options: ["default", "litegraph (legacy)"], + defaultValue: "default" + }, + { + id: "Comfy.LinkRelease.Action", + category: ["LiteGraph", "LinkRelease", "Action"], + name: "Action on link release (No modifier)", + type: "combo", + options: Object.values(LinkReleaseTriggerAction), + defaultValue: LinkReleaseTriggerAction.CONTEXT_MENU + }, + { + id: "Comfy.LinkRelease.ActionShift", + category: ["LiteGraph", "LinkRelease", "ActionShift"], + name: "Action on link release (Shift)", + type: "combo", + options: Object.values(LinkReleaseTriggerAction), + defaultValue: LinkReleaseTriggerAction.SEARCH_BOX + }, + { + id: "Comfy.NodeSearchBoxImpl.NodePreview", + category: ["Comfy", "Node Search Box", "NodePreview"], + name: "Node preview", + tooltip: "Only applies to the default implementation", + type: "boolean", + defaultValue: true + }, + { + id: "Comfy.NodeSearchBoxImpl.ShowCategory", + category: ["Comfy", "Node Search Box", "ShowCategory"], + name: "Show node category in search results", + tooltip: "Only applies to the default implementation", + type: "boolean", + defaultValue: true + }, + { + id: "Comfy.NodeSearchBoxImpl.ShowIdName", + category: ["Comfy", "Node Search Box", "ShowIdName"], + name: "Show node id name in search results", + tooltip: "Only applies to the default implementation", + type: "boolean", + defaultValue: false + }, + { + id: "Comfy.NodeSearchBoxImpl.ShowNodeFrequency", + category: ["Comfy", "Node Search Box", "ShowNodeFrequency"], + name: "Show node frequency in search results", + tooltip: "Only applies to the default implementation", + type: "boolean", + defaultValue: false + }, + { + id: "Comfy.Sidebar.Location", + category: ["Appearance", "Sidebar", "Location"], + name: "Sidebar location", + type: "combo", + options: ["left", "right"], + defaultValue: "left" + }, + { + id: "Comfy.Sidebar.Size", + category: ["Appearance", "Sidebar", "Size"], + name: "Sidebar size", + type: "combo", + options: ["normal", "small"], + defaultValue: /* @__PURE__ */ __name(() => window.innerWidth < 1600 ? "small" : "normal", "defaultValue") + }, + { + id: "Comfy.TextareaWidget.FontSize", + category: ["Appearance", "Node Widget", "TextareaWidget", "FontSize"], + name: "Textarea widget font size", + type: "slider", + defaultValue: 10, + attrs: { + min: 8, + max: 24 + } + }, + { + id: "Comfy.TextareaWidget.Spellcheck", + category: ["Comfy", "Node Widget", "TextareaWidget", "Spellcheck"], + name: "Textarea widget spellcheck", + type: "boolean", + defaultValue: false + }, + { + id: "Comfy.Workflow.SortNodeIdOnSave", + name: "Sort node IDs when saving workflow", + type: "boolean", + defaultValue: false + }, + { + id: "Comfy.Graph.CanvasInfo", + category: ["LiteGraph", "Canvas", "CanvasInfo"], + name: "Show canvas info on bottom left corner (fps, etc.)", + type: "boolean", + defaultValue: true + }, + { + id: "Comfy.Node.ShowDeprecated", + name: "Show deprecated nodes in search", + tooltip: "Deprecated nodes are hidden by default in the UI, but remain functional in existing workflows that use them.", + type: "boolean", + defaultValue: false + }, + { + id: "Comfy.Node.ShowExperimental", + name: "Show experimental nodes in search", + tooltip: "Experimental nodes are marked as such in the UI and may be subject to significant changes or removal in future versions. Use with caution in production workflows", + type: "boolean", + defaultValue: true + }, + { + id: "Comfy.Node.Opacity", + category: ["Appearance", "Node", "Opacity"], + name: "Node opacity", + type: "slider", + defaultValue: 1, + attrs: { + min: 0.01, + max: 1, + step: 0.01 + } + }, + { + id: "Comfy.Workflow.ShowMissingNodesWarning", + name: "Show missing nodes warning", + type: "boolean", + defaultValue: true + }, + { + id: "Comfy.Workflow.ShowMissingModelsWarning", + name: "Show missing models warning", + type: "boolean", + defaultValue: false, + experimental: true + }, + { + id: "Comfy.Graph.ZoomSpeed", + category: ["LiteGraph", "Canvas", "ZoomSpeed"], + name: "Canvas zoom speed", + type: "slider", + defaultValue: 1.1, + attrs: { + min: 1.01, + max: 2.5, + step: 0.01 + } + }, + // Bookmarks are stored in the settings store. + // Bookmarks are in format of category/display_name. e.g. "conditioning/CLIPTextEncode" + { + id: "Comfy.NodeLibrary.Bookmarks", + name: "Node library bookmarks with display name (deprecated)", + type: "hidden", + defaultValue: [], + deprecated: true + }, + { + id: "Comfy.NodeLibrary.Bookmarks.V2", + name: "Node library bookmarks v2 with unique name", + type: "hidden", + defaultValue: [] + }, + // Stores mapping from bookmark folder name to its customization. + { + id: "Comfy.NodeLibrary.BookmarksCustomization", + name: "Node library bookmarks customization", + type: "hidden", + defaultValue: {} + }, + // Hidden setting used by the queue for how to fit images + { + id: "Comfy.Queue.ImageFit", + name: "Queue image fit", + type: "hidden", + defaultValue: "cover" + }, + { + id: "Comfy.GroupSelectedNodes.Padding", + category: ["LiteGraph", "Group", "Padding"], + name: "Group selected nodes padding", + type: "slider", + defaultValue: 10, + attrs: { + min: 0, + max: 100 + } + }, + { + id: "Comfy.Node.DoubleClickTitleToEdit", + category: ["LiteGraph", "Node", "DoubleClickTitleToEdit"], + name: "Double click node title to edit", + type: "boolean", + defaultValue: true + }, + { + id: "Comfy.Group.DoubleClickTitleToEdit", + category: ["LiteGraph", "Group", "DoubleClickTitleToEdit"], + name: "Double click group title to edit", + type: "boolean", + defaultValue: true + }, + { + id: "Comfy.Window.UnloadConfirmation", + name: "Show confirmation when closing window", + type: "boolean", + defaultValue: false + }, + { + id: "Comfy.TreeExplorer.ItemPadding", + category: ["Appearance", "Tree Explorer", "ItemPadding"], + name: "Tree explorer item padding", + type: "slider", + defaultValue: 2, + attrs: { + min: 0, + max: 8, + step: 1 + } + }, + { + id: "Comfy.ModelLibrary.AutoLoadAll", + name: "Automatically load all model folders", + tooltip: "If true, all folders will load as soon as you open the model library (this may cause delays while it loads). If false, root level model folders will only load once you click on them.", + type: "boolean", + defaultValue: false + }, + { + id: "Comfy.ModelLibrary.NameFormat", + name: "What name to display in the model library tree view", + tooltip: 'Select "filename" to render a simplified view of the raw filename (without directory or ".safetensors" extension) in the model list. Select "title" to display the configurable model metadata title.', + type: "combo", + options: ["filename", "title"], + defaultValue: "title" + }, + { + id: "Comfy.Locale", + name: "Language", + type: "combo", + options: [ + { value: "en", text: "English" }, + { value: "zh", text: "中文" }, + { value: "ru", text: "Русский" }, + { value: "ja", text: "日本語" }, + { value: "ko", text: "한국어" }, + { value: "fr", text: "Français" } + ], + defaultValue: /* @__PURE__ */ __name(() => navigator.language.split("-")[0] || "en", "defaultValue") + }, + { + id: "Comfy.NodeBadge.NodeSourceBadgeMode", + category: ["LiteGraph", "Node", "NodeSourceBadgeMode"], + name: "Node source badge mode", + type: "combo", + options: Object.values(NodeBadgeMode), + defaultValue: NodeBadgeMode.HideBuiltIn + }, + { + id: "Comfy.NodeBadge.NodeIdBadgeMode", + category: ["LiteGraph", "Node", "NodeIdBadgeMode"], + name: "Node ID badge mode", + type: "combo", + options: [NodeBadgeMode.None, NodeBadgeMode.ShowAll], + defaultValue: NodeBadgeMode.ShowAll + }, + { + id: "Comfy.NodeBadge.NodeLifeCycleBadgeMode", + category: ["LiteGraph", "Node", "NodeLifeCycleBadgeMode"], + name: "Node life cycle badge mode", + type: "combo", + options: [NodeBadgeMode.None, NodeBadgeMode.ShowAll], + defaultValue: NodeBadgeMode.ShowAll + }, + { + id: "Comfy.ConfirmClear", + category: ["Comfy", "Workflow", "ConfirmClear"], + name: "Require confirmation when clearing workflow", + type: "boolean", + defaultValue: true + }, + { + id: "Comfy.PromptFilename", + category: ["Comfy", "Workflow", "PromptFilename"], + name: "Prompt for filename when saving workflow", + type: "boolean", + defaultValue: true + }, + /** + * file format for preview + * + * format;quality + * + * ex) + * webp;50 -> webp, quality 50 + * jpeg;80 -> rgb, jpeg, quality 80 + * + * @type {string} + */ + { + id: "Comfy.PreviewFormat", + category: ["LiteGraph", "Node Widget", "PreviewFormat"], + name: "Preview image format", + tooltip: "When displaying a preview in the image widget, convert it to a lightweight image, e.g. webp, jpeg, webp;50, etc.", + type: "text", + defaultValue: "" + }, + { + id: "Comfy.DisableSliders", + category: ["LiteGraph", "Node Widget", "DisableSliders"], + name: "Disable node widget sliders", + type: "boolean", + defaultValue: false + }, + { + id: "Comfy.DisableFloatRounding", + category: ["LiteGraph", "Node Widget", "DisableFloatRounding"], + name: "Disable default float widget rounding.", + tooltip: "(requires page reload) Cannot disable round when round is set by the node in the backend.", + type: "boolean", + defaultValue: false + }, + { + id: "Comfy.FloatRoundingPrecision", + category: ["LiteGraph", "Node Widget", "FloatRoundingPrecision"], + name: "Float widget rounding decimal places [0 = auto].", + tooltip: "(requires page reload)", + type: "slider", + attrs: { + min: 0, + max: 6, + step: 1 + }, + defaultValue: 0 + }, + { + id: "Comfy.EnableTooltips", + category: ["LiteGraph", "Node", "EnableTooltips"], + name: "Enable Tooltips", + type: "boolean", + defaultValue: true + }, + { + id: "Comfy.DevMode", + name: "Enable dev mode options (API save, etc.)", + type: "boolean", + defaultValue: false, + onChange: /* @__PURE__ */ __name((value) => { + const element = document.getElementById("comfy-dev-save-api-button"); + if (element) { + element.style.display = value ? "flex" : "none"; + } + }, "onChange") + }, + { + id: "Comfy.UseNewMenu", + category: ["Comfy", "Menu", "UseNewMenu"], + defaultValue: "Top", + name: "Use new menu", + type: "combo", + options: ["Disabled", "Top", "Bottom"], + migrateDeprecatedValue: /* @__PURE__ */ __name((value) => { + if (value === "Floating") { + return "Top"; + } + return value; + }, "migrateDeprecatedValue") + }, + { + id: "Comfy.Workflow.WorkflowTabsPosition", + name: "Opened workflows position", + type: "combo", + options: ["Sidebar", "Topbar"], + defaultValue: "Topbar" + }, + { + id: "Comfy.Graph.CanvasMenu", + category: ["LiteGraph", "Canvas", "CanvasMenu"], + name: "Show graph canvas menu", + type: "boolean", + defaultValue: true + }, + { + id: "Comfy.QueueButton.BatchCountLimit", + name: "Batch count limit", + tooltip: "The maximum number of tasks added to the queue at one button click", + type: "number", + defaultValue: 100, + versionAdded: "1.3.5" + }, + { + id: "Comfy.Keybinding.UnsetBindings", + name: "Keybindings unset by the user", + type: "hidden", + defaultValue: [], + versionAdded: "1.3.7" + }, + { + id: "Comfy.Keybinding.NewBindings", + name: "Keybindings set by the user", + type: "hidden", + defaultValue: [], + versionAdded: "1.3.7" + }, + { + id: "Comfy.Extension.Disabled", + name: "Disabled extension names", + type: "hidden", + defaultValue: [], + versionAdded: "1.3.11" + }, + { + id: "Comfy.Validation.NodeDefs", + name: "Validate node definitions (slow)", + type: "boolean", + tooltip: "Recommended for node developers. This will validate all node definitions on startup.", + defaultValue: false, + versionAdded: "1.3.14" + }, + { + id: "Comfy.LinkRenderMode", + category: ["LiteGraph", "Graph", "LinkRenderMode"], + name: "Link Render Mode", + defaultValue: 2, + type: "combo", + options: [ + { value: LiteGraph.STRAIGHT_LINK, text: "Straight" }, + { value: LiteGraph.LINEAR_LINK, text: "Linear" }, + { value: LiteGraph.SPLINE_LINK, text: "Spline" }, + { value: LiteGraph.HIDDEN_LINK, text: "Hidden" } + ] + }, + { + id: "Comfy.Node.AutoSnapLinkToSlot", + category: ["LiteGraph", "Node", "AutoSnapLinkToSlot"], + name: "Auto snap link to node slot", + tooltip: "When dragging a link over a node, the link automatically snap to a viable input slot on the node", + type: "boolean", + defaultValue: true, + versionAdded: "1.3.29" + }, + { + id: "Comfy.Node.SnapHighlightsNode", + category: ["LiteGraph", "Node", "SnapHighlightsNode"], + name: "Snap highlights node", + tooltip: "When dragging a link over a node with viable input slot, highlight the node", + type: "boolean", + defaultValue: true, + versionAdded: "1.3.29" + }, + { + id: "Comfy.Node.BypassAllLinksOnDelete", + category: ["LiteGraph", "Node", "BypassAllLinksOnDelete"], + name: "Keep all links when deleting nodes", + tooltip: "When deleting a node, attempt to reconnect all of its input and output links (bypassing the deleted node)", + type: "boolean", + defaultValue: true, + versionAdded: "1.3.40" + }, + { + id: "Comfy.Node.MiddleClickRerouteNode", + category: ["LiteGraph", "Node", "MiddleClickRerouteNode"], + name: "Middle-click creates a new Reroute node", + type: "boolean", + defaultValue: true, + versionAdded: "1.3.42" + }, + { + id: "Comfy.RerouteBeta", + category: ["LiteGraph", "RerouteBeta"], + name: "Opt-in to the reroute beta test", + tooltip: "Enables the new native reroutes.\n\nReroutes can be added by holding alt and dragging from a link line, or on the link menu.\n\nDisabling this option is non-destructive - reroutes are hidden.", + experimental: true, + type: "boolean", + defaultValue: false, + versionAdded: "1.3.42" + }, + { + id: "Comfy.Graph.LinkMarkers", + category: ["LiteGraph", "Link", "LinkMarkers"], + name: "Link midpoint markers", + defaultValue: LinkMarkerShape.Circle, + type: "combo", + options: [ + { value: LinkMarkerShape.None, text: "None" }, + { value: LinkMarkerShape.Circle, text: "Circle" }, + { value: LinkMarkerShape.Arrow, text: "Arrow" } + ], + versionAdded: "1.3.42" + }, + { + id: "Comfy.DOMClippingEnabled", + category: ["LiteGraph", "Node", "DOMClippingEnabled"], + name: "Enable DOM element clipping (enabling may reduce performance)", + type: "boolean", + defaultValue: true + }, + { + id: "Comfy.Graph.CtrlShiftZoom", + category: ["LiteGraph", "Canvas", "CtrlShiftZoom"], + name: "Enable fast-zoom shortcut (Ctrl + Shift + Drag)", + type: "boolean", + defaultValue: true, + versionAdded: "1.4.0" + }, + { + id: "Comfy.Pointer.ClickDrift", + category: ["LiteGraph", "Pointer", "ClickDrift"], + name: "Pointer click drift (maximum distance)", + tooltip: "If the pointer moves more than this distance while holding a button down, it is considered dragging (rather than clicking).\n\nHelps prevent objects from being unintentionally nudged if the pointer is moved whilst clicking.", + experimental: true, + type: "slider", + attrs: { + min: 0, + max: 20, + step: 1 + }, + defaultValue: 6, + versionAdded: "1.4.3" + }, + { + id: "Comfy.Pointer.ClickBufferTime", + category: ["LiteGraph", "Pointer", "ClickBufferTime"], + name: "Pointer click drift delay", + tooltip: "After pressing a pointer button down, this is the maximum time (in milliseconds) that pointer movement can be ignored for.\n\nHelps prevent objects from being unintentionally nudged if the pointer is moved whilst clicking.", + experimental: true, + type: "slider", + attrs: { + min: 0, + max: 1e3, + step: 25 + }, + defaultValue: 150, + versionAdded: "1.4.3" + }, + { + id: "Comfy.Pointer.DoubleClickTime", + category: ["LiteGraph", "Pointer", "DoubleClickTime"], + name: "Double click interval (maximum)", + tooltip: "The maximum time in milliseconds between the two clicks of a double-click. Increasing this value may assist if double-clicks are sometimes not registered.", + type: "slider", + attrs: { + min: 100, + max: 1e3, + step: 50 + }, + defaultValue: 300, + versionAdded: "1.4.3" + }, + { + id: "Comfy.SnapToGrid.GridSize", + category: ["LiteGraph", "Canvas", "GridSize"], + name: "Snap to grid size", + type: "slider", + attrs: { + min: 1, + max: 500 + }, + tooltip: "When dragging and resizing nodes while holding shift they will be aligned to the grid, this controls the size of that grid.", + defaultValue: LiteGraph.CANVAS_GRID_SIZE + }, + // Keep the 'pysssss.SnapToGrid' setting id so we don't need to migrate setting values. + // Using a new setting id can cause existing users to lose their existing settings. + { + id: "pysssss.SnapToGrid", + category: ["LiteGraph", "Canvas", "AlwaysSnapToGrid"], + name: "Always snap to grid", + type: "boolean", + defaultValue: false, + versionAdded: "1.3.13" + }, + { + id: "Comfy.Server.ServerConfigValues", + name: "Server config values for frontend display", + tooltip: "Server config values used for frontend display only", + type: "hidden", + // Mapping from server config id to value. + defaultValue: {}, + versionAdded: "1.4.8" + }, + { + id: "Comfy.Server.LaunchArgs", + name: "Server launch arguments", + tooltip: "These are the actual arguments that are passed to the server when it is launched.", + type: "hidden", + defaultValue: {}, + versionAdded: "1.4.8" + }, + { + id: "Comfy.Queue.MaxHistoryItems", + name: "Queue history size", + tooltip: "The maximum number of tasks that show in the queue history.", + type: "slider", + attrs: { + min: 16, + max: 256, + step: 16 + }, + defaultValue: 64, + versionAdded: "1.4.12" + }, + { + id: "LiteGraph.Canvas.MaximumFps", + name: "Maxium FPS", + tooltip: "The maximum frames per second that the canvas is allowed to render. Caps GPU usage at the cost of smoothness. If 0, the screen refresh rate is used. Default: 0", + type: "slider", + attrs: { + min: 0, + max: 120 + }, + defaultValue: 0, + versionAdded: "1.5.1" + }, + { + id: "Comfy.EnableWorkflowViewRestore", + category: ["Comfy", "Workflow", "EnableWorkflowViewRestore"], + name: "Save and restore canvas position and zoom level in workflows", + type: "boolean", + defaultValue: true, + versionModified: "1.5.4" + }, + { + id: "Comfy.Workflow.ConfirmDelete", + name: "Show confirmation when deleting workflows", + type: "boolean", + defaultValue: true, + versionAdded: "1.5.6" + }, + { + id: "Comfy.ColorPalette", + name: "The active color palette id", + type: "hidden", + defaultValue: "dark", + versionModified: "1.6.7", + migrateDeprecatedValue(value) { + return value.startsWith("custom_") ? value.replace("custom_", "") : value; + } + }, + { + id: "Comfy.CustomColorPalettes", + name: "Custom color palettes", + type: "hidden", + defaultValue: {}, + versionModified: "1.6.7" + }, + { + id: "Comfy.WidgetControlMode", + category: ["Comfy", "Node Widget", "WidgetControlMode"], + name: "Widget control mode", + tooltip: "Controls when widget values are updated (randomize/increment/decrement), either before the prompt is queued or after.", + type: "combo", + defaultValue: "after", + options: ["before", "after"], + versionModified: "1.6.10" + } +]; +const _sfc_main$a = /* @__PURE__ */ defineComponent({ __name: "GraphCanvas", emits: ["ready"], setup(__props, { emit: __emit }) { const emit = __emit; const canvasRef = ref(null); + const litegraphService = useLitegraphService(); const settingStore = useSettingStore(); const nodeDefStore = useNodeDefStore(); const workspaceStore = useWorkspaceStore(); @@ -3896,18 +4666,41 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ watchEffect(() => { LiteGraph.alwaysSnapToGrid = settingStore.get("pysssss.SnapToGrid"); }); - watchEffect(() => { - if (!canvasStore.canvas) return; - if (canvasStore.canvas.state.draggingCanvas) { - canvasStore.canvas.canvas.style.cursor = "grabbing"; - return; + watch( + () => settingStore.get("Comfy.WidgetControlMode"), + () => { + if (!canvasStore.canvas) return; + for (const n of app.graph.nodes) { + if (!n.widgets) continue; + for (const w of n.widgets) { + if (w[IS_CONTROL_WIDGET]) { + updateControlWidgetLabel(w); + if (w.linkedWidgets) { + for (const l of w.linkedWidgets) { + updateControlWidgetLabel(l); + } + } + } + } + } + app.graph.setDirtyCanvas(true); } - if (canvasStore.canvas.state.readOnly) { - canvasStore.canvas.canvas.style.cursor = "grab"; - return; + ); + const colorPaletteService = useColorPaletteService(); + const colorPaletteStore = useColorPaletteStore(); + watch( + [() => canvasStore.canvas, () => settingStore.get("Comfy.ColorPalette")], + ([canvas, currentPaletteId]) => { + if (!canvas) return; + colorPaletteService.loadColorPalette(currentPaletteId); } - canvasStore.canvas.canvas.style.cursor = "default"; - }); + ); + watch( + () => colorPaletteStore.activePaletteId, + (newValue) => { + settingStore.set("Comfy.ColorPalette", newValue); + } + ); const workflowStore = useWorkflowStore(); const persistCurrentWorkflow = /* @__PURE__ */ __name(() => { const workflow = JSON.stringify(app.serializeGraph()); @@ -3936,7 +4729,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ loc.clientX - 20, loc.clientY ]); - app.addNodeOnGraph(nodeDef, { pos }); + litegraphService.addNodeOnGraph(nodeDef, { pos }); } else if (node.data instanceof ComfyModelDef) { const model = node.data; const pos = app.clientPosToCanvasPos([loc.clientX, loc.clientY]); @@ -3957,9 +4750,12 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ if (!targetGraphNode) { const provider = modelToNodeStore.getNodeProvider(model.directory); if (provider) { - targetGraphNode = app.addNodeOnGraph(provider.nodeDef, { - pos - }); + targetGraphNode = litegraphService.addNodeOnGraph( + provider.nodeDef, + { + pos + } + ); targetProvider = provider; } } @@ -3989,6 +4785,10 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ app.vueAppReady = true; workspaceStore.spinner = true; ChangeTracker.init(app); + await settingStore.loadSettingValues(); + CORE_SETTINGS.forEach((setting) => { + settingStore.addSetting(setting); + }); await app.setup(canvasRef.value); canvasStore.canvas = app.canvas; canvasStore.canvas.render_canvas_border = false; @@ -3996,11 +4796,14 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ window["app"] = app; window["graph"] = app.graph; comfyAppReady.value = true; + colorPaletteStore.customPalettes = settingStore.get( + "Comfy.CustomColorPalettes" + ); watch( () => settingStore.get("Comfy.Locale"), async () => { await useCommandStore().execute("Comfy.RefreshNodeDefinitions"); - workflowService.reloadCurrentWorkflow(); + useWorkflowService().reloadCurrentWorkflow(); } ); emit("ready"); @@ -4013,7 +4816,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ createVNode(SideToolbar) ]), "bottom-panel": withCtx(() => [ - createVNode(_sfc_main$l) + createVNode(_sfc_main$o) ]), "graph-canvas-panel": withCtx(() => [ canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { key: 0 })) : createCommentVNode("", true) @@ -4031,56 +4834,11 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ ])), createVNode(_sfc_main$g), tooltipEnabled.value ? (openBlock(), createBlock(NodeTooltip, { key: 0 })) : createCommentVNode("", true), - createVNode(_sfc_main$e) + createVNode(_sfc_main$m) ], 64); }; } }); -const _sfc_main$b = /* @__PURE__ */ defineComponent({ - __name: "MenuHamburger", - setup(__props) { - const workspaceState = useWorkspaceStore(); - const settingStore = useSettingStore(); - const exitFocusMode = /* @__PURE__ */ __name(() => { - workspaceState.focusMode = false; - }, "exitFocusMode"); - watchEffect(() => { - if (settingStore.get("Comfy.UseNewMenu") !== "Disabled") { - return; - } - if (workspaceState.focusMode) { - app.ui.menuContainer.style.display = "none"; - } else { - app.ui.menuContainer.style.display = "block"; - } - }); - const menuSetting = computed(() => settingStore.get("Comfy.UseNewMenu")); - const positionCSS = computed( - () => ( - // 'Bottom' menuSetting shows the hamburger button in the bottom right corner - // 'Disabled', 'Top' menuSetting shows the hamburger button in the top right corner - menuSetting.value === "Bottom" ? { bottom: "0px", right: "0px" } : { top: "0px", right: "0px" } - ) - ); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return withDirectives((openBlock(), createBlock(unref(script$f), { - class: "comfy-menu-hamburger", - style: normalizeStyle(positionCSS.value), - icon: "pi pi-bars", - severity: "secondary", - text: "", - size: "large", - onClick: exitFocusMode, - onContextmenu: unref(showNativeMenu) - }, null, 8, ["style", "onContextmenu"])), [ - [vShow, unref(workspaceState).focusMode], - [_directive_tooltip, { value: _ctx.$t("menu.showMenu"), showDelay: 300 }] - ]); - }; - } -}); -const MenuHamburger = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-962c4073"]]); function _typeof$3(o) { "@babel/helpers - typeof"; return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { @@ -4110,7 +4868,7 @@ function _toPrimitive$3(t, r) { return ("string" === r ? String : Number)(t); } __name(_toPrimitive$3, "_toPrimitive$3"); -var theme$4 = /* @__PURE__ */ __name(function theme5(_ref) { +var theme$3 = /* @__PURE__ */ __name(function theme5(_ref) { var dt = _ref.dt; return "\n.p-toast {\n width: ".concat(dt("toast.width"), ";\n white-space: pre-line;\n word-break: break-word;\n}\n\n.p-toast-message {\n margin: 0 0 1rem 0;\n}\n\n.p-toast-message-icon {\n flex-shrink: 0;\n font-size: ").concat(dt("toast.icon.size"), ";\n width: ").concat(dt("toast.icon.size"), ";\n height: ").concat(dt("toast.icon.size"), ";\n}\n\n.p-toast-message-content {\n display: flex;\n align-items: flex-start;\n padding: ").concat(dt("toast.content.padding"), ";\n gap: ").concat(dt("toast.content.gap"), ";\n}\n\n.p-toast-message-text {\n flex: 1 1 auto;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("toast.text.gap"), ";\n}\n\n.p-toast-summary {\n font-weight: ").concat(dt("toast.summary.font.weight"), ";\n font-size: ").concat(dt("toast.summary.font.size"), ";\n}\n\n.p-toast-detail {\n font-weight: ").concat(dt("toast.detail.font.weight"), ";\n font-size: ").concat(dt("toast.detail.font.size"), ";\n}\n\n.p-toast-close-button {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n cursor: pointer;\n background: transparent;\n transition: background ").concat(dt("toast.transition.duration"), ", color ").concat(dt("toast.transition.duration"), ", outline-color ").concat(dt("toast.transition.duration"), ", box-shadow ").concat(dt("toast.transition.duration"), ";\n outline-color: transparent;\n color: inherit;\n width: ").concat(dt("toast.close.button.width"), ";\n height: ").concat(dt("toast.close.button.height"), ";\n border-radius: ").concat(dt("toast.close.button.border.radius"), ";\n margin: -25% 0 0 0;\n right: -25%;\n padding: 0;\n border: none;\n user-select: none;\n}\n\n.p-toast-message-info,\n.p-toast-message-success,\n.p-toast-message-warn,\n.p-toast-message-error,\n.p-toast-message-secondary,\n.p-toast-message-contrast {\n border-width: ").concat(dt("toast.border.width"), ";\n border-style: solid;\n backdrop-filter: blur(").concat(dt("toast.blur"), ");\n border-radius: ").concat(dt("toast.border.radius"), ";\n}\n\n.p-toast-close-icon {\n font-size: ").concat(dt("toast.close.icon.size"), ";\n width: ").concat(dt("toast.close.icon.size"), ";\n height: ").concat(dt("toast.close.icon.size"), ";\n}\n\n.p-toast-close-button:focus-visible {\n outline-width: ").concat(dt("focus.ring.width"), ";\n outline-style: ").concat(dt("focus.ring.style"), ";\n outline-offset: ").concat(dt("focus.ring.offset"), ";\n}\n\n.p-toast-message-info {\n background: ").concat(dt("toast.info.background"), ";\n border-color: ").concat(dt("toast.info.border.color"), ";\n color: ").concat(dt("toast.info.color"), ";\n box-shadow: ").concat(dt("toast.info.shadow"), ";\n}\n\n.p-toast-message-info .p-toast-detail {\n color: ").concat(dt("toast.info.detail.color"), ";\n}\n\n.p-toast-message-info .p-toast-close-button:focus-visible {\n outline-color: ").concat(dt("toast.info.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt("toast.info.close.button.focus.ring.shadow"), ";\n}\n\n.p-toast-message-info .p-toast-close-button:hover {\n background: ").concat(dt("toast.info.close.button.hover.background"), ";\n}\n\n.p-toast-message-success {\n background: ").concat(dt("toast.success.background"), ";\n border-color: ").concat(dt("toast.success.border.color"), ";\n color: ").concat(dt("toast.success.color"), ";\n box-shadow: ").concat(dt("toast.success.shadow"), ";\n}\n\n.p-toast-message-success .p-toast-detail {\n color: ").concat(dt("toast.success.detail.color"), ";\n}\n\n.p-toast-message-success .p-toast-close-button:focus-visible {\n outline-color: ").concat(dt("toast.success.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt("toast.success.close.button.focus.ring.shadow"), ";\n}\n\n.p-toast-message-success .p-toast-close-button:hover {\n background: ").concat(dt("toast.success.close.button.hover.background"), ";\n}\n\n.p-toast-message-warn {\n background: ").concat(dt("toast.warn.background"), ";\n border-color: ").concat(dt("toast.warn.border.color"), ";\n color: ").concat(dt("toast.warn.color"), ";\n box-shadow: ").concat(dt("toast.warn.shadow"), ";\n}\n\n.p-toast-message-warn .p-toast-detail {\n color: ").concat(dt("toast.warn.detail.color"), ";\n}\n\n.p-toast-message-warn .p-toast-close-button:focus-visible {\n outline-color: ").concat(dt("toast.warn.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt("toast.warn.close.button.focus.ring.shadow"), ";\n}\n\n.p-toast-message-warn .p-toast-close-button:hover {\n background: ").concat(dt("toast.warn.close.button.hover.background"), ";\n}\n\n.p-toast-message-error {\n background: ").concat(dt("toast.error.background"), ";\n border-color: ").concat(dt("toast.error.border.color"), ";\n color: ").concat(dt("toast.error.color"), ";\n box-shadow: ").concat(dt("toast.error.shadow"), ";\n}\n\n.p-toast-message-error .p-toast-detail {\n color: ").concat(dt("toast.error.detail.color"), ";\n}\n\n.p-toast-message-error .p-toast-close-button:focus-visible {\n outline-color: ").concat(dt("toast.error.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt("toast.error.close.button.focus.ring.shadow"), ";\n}\n\n.p-toast-message-error .p-toast-close-button:hover {\n background: ").concat(dt("toast.error.close.button.hover.background"), ";\n}\n\n.p-toast-message-secondary {\n background: ").concat(dt("toast.secondary.background"), ";\n border-color: ").concat(dt("toast.secondary.border.color"), ";\n color: ").concat(dt("toast.secondary.color"), ";\n box-shadow: ").concat(dt("toast.secondary.shadow"), ";\n}\n\n.p-toast-message-secondary .p-toast-detail {\n color: ").concat(dt("toast.secondary.detail.color"), ";\n}\n\n.p-toast-message-secondary .p-toast-close-button:focus-visible {\n outline-color: ").concat(dt("toast.secondary.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt("toast.secondary.close.button.focus.ring.shadow"), ";\n}\n\n.p-toast-message-secondary .p-toast-close-button:hover {\n background: ").concat(dt("toast.secondary.close.button.hover.background"), ";\n}\n\n.p-toast-message-contrast {\n background: ").concat(dt("toast.contrast.background"), ";\n border-color: ").concat(dt("toast.contrast.border.color"), ";\n color: ").concat(dt("toast.contrast.color"), ";\n box-shadow: ").concat(dt("toast.contrast.shadow"), ";\n}\n\n.p-toast-message-contrast .p-toast-detail {\n color: ").concat(dt("toast.contrast.detail.color"), ";\n}\n\n.p-toast-message-contrast .p-toast-close-button:focus-visible {\n outline-color: ").concat(dt("toast.contrast.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt("toast.contrast.close.button.focus.ring.shadow"), ";\n}\n\n.p-toast-message-contrast .p-toast-close-button:hover {\n background: ").concat(dt("toast.contrast.close.button.hover.background"), ";\n}\n\n.p-toast-top-center {\n transform: translateX(-50%);\n}\n\n.p-toast-bottom-center {\n transform: translateX(-50%);\n}\n\n.p-toast-center {\n min-width: 20vw;\n transform: translate(-50%, -50%);\n}\n\n.p-toast-message-enter-from {\n opacity: 0;\n transform: translateY(50%);\n}\n\n.p-toast-message-leave-from {\n max-height: 1000px;\n}\n\n.p-toast .p-toast-message.p-toast-message-leave-to {\n max-height: 0;\n opacity: 0;\n margin-bottom: 0;\n overflow: hidden;\n}\n\n.p-toast-message-enter-active {\n transition: transform 0.3s, opacity 0.3s;\n}\n\n.p-toast-message-leave-active {\n transition: max-height 0.45s cubic-bezier(0, 1, 0, 1), opacity 0.3s, margin-bottom 0.3s;\n}\n"); }, "theme"); @@ -4126,7 +4884,7 @@ var inlineStyles$2 = { }; }, "root") }; -var classes$4 = { +var classes$3 = { root: /* @__PURE__ */ __name(function root7(_ref3) { var props = _ref3.props; return ["p-toast p-component p-toast-" + props.position]; @@ -4155,13 +4913,13 @@ var classes$4 = { }; var ToastStyle = BaseStyle.extend({ name: "toast", - theme: theme$4, - classes: classes$4, + theme: theme$3, + classes: classes$3, inlineStyles: inlineStyles$2 }); var script$2$2 = { name: "BaseToast", - "extends": script$g, + "extends": script$e, props: { group: { type: String, @@ -4216,10 +4974,10 @@ var script$2$2 = { }; }, "provide") }; -var script$1$4 = { +var script$1$3 = { name: "ToastMessage", hostName: "Toast", - "extends": script$g, + "extends": script$e, emits: ["close"], closeTimeout: null, props: { @@ -4291,10 +5049,10 @@ var script$1$4 = { computed: { iconComponent: /* @__PURE__ */ __name(function iconComponent() { return { - info: !this.infoIcon && script$s, - success: !this.successIcon && script$t, - warn: !this.warnIcon && script$u, - error: !this.errorIcon && script$v + info: !this.infoIcon && script$r, + success: !this.successIcon && script$s, + warn: !this.warnIcon && script$t, + error: !this.errorIcon && script$u }[this.message.severity]; }, "iconComponent"), closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel() { @@ -4302,11 +5060,11 @@ var script$1$4 = { }, "closeAriaLabel") }, components: { - TimesIcon: script$w, - InfoCircleIcon: script$s, - CheckIcon: script$t, - ExclamationTriangleIcon: script$u, - TimesCircleIcon: script$v + TimesIcon: script$v, + InfoCircleIcon: script$r, + CheckIcon: script$s, + ExclamationTriangleIcon: script$t, + TimesCircleIcon: script$u }, directives: { ripple: Ripple @@ -4364,8 +5122,8 @@ function _toPrimitive$1(t, r) { return ("string" === r ? String : Number)(t); } __name(_toPrimitive$1, "_toPrimitive$1"); -var _hoisted_1$e = ["aria-label"]; -function render$1$3(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$d = ["aria-label"]; +function render$1$2(_ctx, _cache, $props, $setup, $data, $options) { var _directive_ripple = resolveDirective("ripple"); return openBlock(), createElementBlock("div", mergeProps({ "class": [_ctx.cx("message"), $props.message.styleClass], @@ -4404,10 +5162,10 @@ function render$1$3(_ctx, _cache, $props, $setup, $data, $options) { autofocus: "" }, _objectSpread$1(_objectSpread$1({}, $props.closeButtonProps), _ctx.ptm("closeButton"))), [(openBlock(), createBlock(resolveDynamicComponent($props.templates.closeicon || "TimesIcon"), mergeProps({ "class": [_ctx.cx("closeIcon"), $props.closeIcon] - }, _ctx.ptm("closeIcon")), null, 16, ["class"]))], 16, _hoisted_1$e)), [[_directive_ripple]])], 16)) : createCommentVNode("", true)], 16))], 16); + }, _ctx.ptm("closeIcon")), null, 16, ["class"]))], 16, _hoisted_1$d)), [[_directive_ripple]])], 16)) : createCommentVNode("", true)], 16))], 16); } -__name(render$1$3, "render$1$3"); -script$1$4.render = render$1$3; +__name(render$1$2, "render$1$2"); +script$1$3.render = render$1$2; function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } @@ -4439,7 +5197,7 @@ function _arrayLikeToArray(r, a) { } __name(_arrayLikeToArray, "_arrayLikeToArray"); var messageIdx = 0; -var script$6 = { +var script$5 = { name: "Toast", "extends": script$2$2, inheritAttrs: false, @@ -4551,8 +5309,8 @@ var script$6 = { }, "attributeSelector") }, components: { - ToastMessage: script$1$4, - Portal: script$m + ToastMessage: script$1$3, + Portal: script$k } }; function _typeof$2(o) { @@ -4651,8 +5409,8 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) { }); } __name(render$a, "render$a"); -script$6.render = render$a; -const _sfc_main$a = /* @__PURE__ */ defineComponent({ +script$5.render = render$a; +const _sfc_main$9 = /* @__PURE__ */ defineComponent({ __name: "GlobalToast", setup(__props) { const toast = useToast(); @@ -4722,1530 +5480,16 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({ { immediate: true } ); return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$6)); + return openBlock(), createBlock(unref(script$5)); }; } }); -const _sfc_main$9 = /* @__PURE__ */ defineComponent({ - __name: "UnloadWindowConfirmDialog", - setup(__props) { - const settingStore = useSettingStore(); - const handleBeforeUnload = /* @__PURE__ */ __name((event) => { - if (settingStore.get("Comfy.Window.UnloadConfirmation")) { - event.preventDefault(); - return true; - } - return void 0; - }, "handleBeforeUnload"); - onMounted(() => { - window.addEventListener("beforeunload", handleBeforeUnload); - }); - onBeforeUnmount(() => { - window.removeEventListener("beforeunload", handleBeforeUnload); - }); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div"); - }; - } -}); -const DEFAULT_TITLE = "ComfyUI"; -const TITLE_SUFFIX = " - ComfyUI"; -const _sfc_main$8 = /* @__PURE__ */ defineComponent({ - __name: "BrowserTabTitle", - setup(__props) { - const executionStore = useExecutionStore(); - const executionText = computed( - () => executionStore.isIdle ? "" : `[${executionStore.executionProgress}%]` - ); - const settingStore = useSettingStore(); - const betaMenuEnabled = computed( - () => settingStore.get("Comfy.UseNewMenu") !== "Disabled" - ); - const workflowStore = useWorkflowStore(); - const isUnsavedText = computed( - () => workflowStore.activeWorkflow?.isModified || !workflowStore.activeWorkflow?.isPersisted ? " *" : "" - ); - const workflowNameText = computed(() => { - const workflowName = workflowStore.activeWorkflow?.filename; - return workflowName ? isUnsavedText.value + workflowName + TITLE_SUFFIX : DEFAULT_TITLE; - }); - const nodeExecutionTitle = computed( - () => executionStore.executingNode && executionStore.executingNodeProgress ? `${executionText.value}[${executionStore.executingNodeProgress}%] ${executionStore.executingNode.type}` : "" - ); - const workflowTitle = computed( - () => executionText.value + (betaMenuEnabled.value ? workflowNameText.value : DEFAULT_TITLE) - ); - const title = computed(() => nodeExecutionTitle.value || workflowTitle.value); - useTitle(title); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div"); - }; - } -}); -const _withScopeId$3 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-4cb762cb"), n = n(), popScopeId(), n), "_withScopeId$3"); -const _hoisted_1$d = ["onContextmenu", "onMouseup"]; -const _hoisted_2$b = { class: "workflow-label text-sm max-w-[150px] truncate inline-block" }; -const _hoisted_3$9 = { class: "relative" }; -const _hoisted_4$2 = { - key: 0, - class: "status-indicator" -}; -const _sfc_main$7 = /* @__PURE__ */ defineComponent({ - __name: "WorkflowTabs", - props: { - class: {} - }, - setup(__props) { - const props = __props; - const { t } = useI18n(); - const workspaceStore = useWorkspaceStore(); - const workflowStore = useWorkflowStore(); - const rightClickedTab = ref(null); - const menu = ref(); - const showContextMenu = /* @__PURE__ */ __name((event, option2) => { - rightClickedTab.value = option2; - menu.value.show(event); - }, "showContextMenu"); - const workflowToOption = /* @__PURE__ */ __name((workflow) => ({ - value: workflow.path, - workflow - }), "workflowToOption"); - const options = computed( - () => workflowStore.openWorkflows.map(workflowToOption) - ); - const selectedWorkflow = computed( - () => workflowStore.activeWorkflow ? workflowToOption(workflowStore.activeWorkflow) : null - ); - const onWorkflowChange = /* @__PURE__ */ __name((option2) => { - if (!option2) { - return; - } - if (selectedWorkflow.value?.value === option2.value) { - return; - } - workflowService.openWorkflow(option2.workflow); - }, "onWorkflowChange"); - const closeWorkflows = /* @__PURE__ */ __name(async (options2) => { - for (const opt of options2) { - if (!await workflowService.closeWorkflow(opt.workflow, { - warnIfUnsaved: !workspaceStore.shiftDown - })) { - break; - } - } - }, "closeWorkflows"); - const onCloseWorkflow = /* @__PURE__ */ __name((option2) => { - closeWorkflows([option2]); - }, "onCloseWorkflow"); - const contextMenuItems = computed(() => { - const tab = rightClickedTab.value; - if (!tab) return []; - const index = options.value.findIndex((v) => v.workflow === tab.workflow); - return [ - { - label: t("tabMenu.duplicateTab"), - command: /* @__PURE__ */ __name(() => { - workflowService.duplicateWorkflow(tab.workflow); - }, "command") - }, - { - separator: true - }, - { - label: t("tabMenu.closeTab"), - command: /* @__PURE__ */ __name(() => onCloseWorkflow(tab), "command") - }, - { - label: t("tabMenu.closeTabsToLeft"), - command: /* @__PURE__ */ __name(() => closeWorkflows(options.value.slice(0, index)), "command"), - disabled: index <= 0 - }, - { - label: t("tabMenu.closeTabsToRight"), - command: /* @__PURE__ */ __name(() => closeWorkflows(options.value.slice(index + 1)), "command"), - disabled: index === options.value.length - 1 - }, - { - label: t("tabMenu.closeOtherTabs"), - command: /* @__PURE__ */ __name(() => closeWorkflows([ - ...options.value.slice(index + 1), - ...options.value.slice(0, index) - ]), "command"), - disabled: options.value.length <= 1 - } - ]; - }); - const commandStore = useCommandStore(); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock(Fragment, null, [ - createVNode(unref(script$x), { - class: normalizeClass(["workflow-tabs bg-transparent inline", props.class]), - modelValue: selectedWorkflow.value, - "onUpdate:modelValue": onWorkflowChange, - options: options.value, - optionLabel: "label", - dataKey: "value" - }, { - option: withCtx(({ option: option2 }) => [ - createBaseVNode("div", { - class: "flex p-2 gap-2", - onContextmenu: /* @__PURE__ */ __name(($event) => showContextMenu($event, option2), "onContextmenu"), - onMouseup: withModifiers(($event) => onCloseWorkflow(option2), ["middle"]) - }, [ - withDirectives((openBlock(), createElementBlock("span", _hoisted_2$b, [ - createTextVNode(toDisplayString(option2.workflow.filename), 1) - ])), [ - [ - _directive_tooltip, - option2.workflow.key, - void 0, - { bottom: true } - ] - ]), - createBaseVNode("div", _hoisted_3$9, [ - !unref(workspaceStore).shiftDown && (option2.workflow.isModified || !option2.workflow.isPersisted) ? (openBlock(), createElementBlock("span", _hoisted_4$2, "•")) : createCommentVNode("", true), - createVNode(unref(script$f), { - class: "close-button p-0 w-auto", - icon: "pi pi-times", - text: "", - severity: "secondary", - size: "small", - onClick: withModifiers(($event) => onCloseWorkflow(option2), ["stop"]) - }, null, 8, ["onClick"]) - ]) - ], 40, _hoisted_1$d) - ]), - _: 1 - }, 8, ["class", "modelValue", "options"]), - createVNode(unref(script$f), { - class: "new-blank-workflow-button", - icon: "pi pi-plus", - text: "", - severity: "secondary", - onClick: _cache[0] || (_cache[0] = () => unref(commandStore).execute("Comfy.NewBlankWorkflow")) - }), - createVNode(unref(script$y), { - ref_key: "menu", - ref: menu, - model: contextMenuItems.value - }, null, 8, ["model"]) - ], 64); - }; - } -}); -const WorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-4cb762cb"]]); -var theme$3 = /* @__PURE__ */ __name(function theme6(_ref) { - var dt = _ref.dt; - return "\n.p-menubar {\n display: flex;\n align-items: center;\n background: ".concat(dt("menubar.background"), ";\n border: 1px solid ").concat(dt("menubar.border.color"), ";\n border-radius: ").concat(dt("menubar.border.radius"), ";\n color: ").concat(dt("menubar.color"), ";\n padding: ").concat(dt("menubar.padding"), ";\n gap: ").concat(dt("menubar.gap"), ";\n}\n\n.p-menubar-start,\n.p-megamenu-end {\n display: flex;\n align-items: center;\n}\n\n.p-menubar-root-list,\n.p-menubar-submenu {\n display: flex;\n margin: 0;\n padding: 0;\n list-style: none;\n outline: 0 none;\n}\n\n.p-menubar-root-list {\n align-items: center;\n flex-wrap: wrap;\n gap: ").concat(dt("menubar.gap"), ";\n}\n\n.p-menubar-root-list > .p-menubar-item > .p-menubar-item-content {\n border-radius: ").concat(dt("menubar.base.item.border.radius"), ";\n}\n\n.p-menubar-root-list > .p-menubar-item > .p-menubar-item-content > .p-menubar-item-link {\n padding: ").concat(dt("menubar.base.item.padding"), ";\n}\n\n.p-menubar-item-content {\n transition: background ").concat(dt("menubar.transition.duration"), ", color ").concat(dt("menubar.transition.duration"), ";\n border-radius: ").concat(dt("menubar.item.border.radius"), ";\n color: ").concat(dt("menubar.item.color"), ";\n}\n\n.p-menubar-item-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n color: inherit;\n padding: ").concat(dt("menubar.item.padding"), ";\n gap: ").concat(dt("menubar.item.gap"), ";\n user-select: none;\n outline: 0 none;\n}\n\n.p-menubar-item-label {\n line-height: 1;\n}\n\n.p-menubar-item-icon {\n color: ").concat(dt("menubar.item.icon.color"), ";\n}\n\n.p-menubar-submenu-icon {\n color: ").concat(dt("menubar.submenu.icon.color"), ";\n margin-left: auto;\n font-size: ").concat(dt("menubar.submenu.icon.size"), ";\n width: ").concat(dt("menubar.submenu.icon.size"), ";\n height: ").concat(dt("menubar.submenu.icon.size"), ";\n}\n\n.p-menubar-item.p-focus > .p-menubar-item-content {\n color: ").concat(dt("menubar.item.focus.color"), ";\n background: ").concat(dt("menubar.item.focus.background"), ";\n}\n\n.p-menubar-item.p-focus > .p-menubar-item-content .p-menubar-item-icon {\n color: ").concat(dt("menubar.item.icon.focus.color"), ";\n}\n\n.p-menubar-item.p-focus > .p-menubar-item-content .p-menubar-submenu-icon {\n color: ").concat(dt("menubar.submenu.icon.focus.color"), ";\n}\n\n.p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover {\n color: ").concat(dt("menubar.item.focus.color"), ";\n background: ").concat(dt("menubar.item.focus.background"), ";\n}\n\n.p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover .p-menubar-item-icon {\n color: ").concat(dt("menubar.item.icon.focus.color"), ";\n}\n\n.p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover .p-menubar-submenu-icon {\n color: ").concat(dt("menubar.submenu.icon.focus.color"), ";\n}\n\n.p-menubar-item-active > .p-menubar-item-content {\n color: ").concat(dt("menubar.item.active.color"), ";\n background: ").concat(dt("menubar.item.active.background"), ";\n}\n\n.p-menubar-item-active > .p-menubar-item-content .p-menubar-item-icon {\n color: ").concat(dt("menubar.item.icon.active.color"), ";\n}\n\n.p-menubar-item-active > .p-menubar-item-content .p-menubar-submenu-icon {\n color: ").concat(dt("menubar.submenu.icon.active.color"), ";\n}\n\n.p-menubar-submenu {\n display: none;\n position: absolute;\n min-width: 12.5rem;\n z-index: 1;\n background: ").concat(dt("menubar.submenu.background"), ";\n border: 1px solid ").concat(dt("menubar.submenu.border.color"), ";\n border-radius: ").concat(dt("menubar.border.radius"), ";\n box-shadow: ").concat(dt("menubar.submenu.shadow"), ";\n color: ").concat(dt("menubar.submenu.color"), ";\n flex-direction: column;\n padding: ").concat(dt("menubar.submenu.padding"), ";\n gap: ").concat(dt("menubar.submenu.gap"), ";\n}\n\n.p-menubar-submenu .p-menubar-separator {\n border-top: 1px solid ").concat(dt("menubar.separator.border.color"), ";\n}\n\n.p-menubar-submenu .p-menubar-item {\n position: relative;\n}\n\n .p-menubar-submenu > .p-menubar-item-active > .p-menubar-submenu {\n display: block;\n left: 100%;\n top: 0;\n}\n\n.p-menubar-end {\n margin-left: auto;\n align-self: center;\n}\n\n.p-menubar-button {\n display: none;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n width: ").concat(dt("menubar.mobile.button.size"), ";\n height: ").concat(dt("menubar.mobile.button.size"), ";\n position: relative;\n color: ").concat(dt("menubar.mobile.button.color"), ";\n border: 0 none;\n background: transparent;\n border-radius: ").concat(dt("menubar.mobile.button.border.radius"), ";\n transition: background ").concat(dt("menubar.transition.duration"), ", color ").concat(dt("menubar.transition.duration"), ", outline-color ").concat(dt("menubar.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-menubar-button:hover {\n color: ").concat(dt("menubar.mobile.button.hover.color"), ";\n background: ").concat(dt("menubar.mobile.button.hover.background"), ";\n}\n\n.p-menubar-button:focus-visible {\n box-shadow: ").concat(dt("menubar.mobile.button.focus.ring.shadow"), ";\n outline: ").concat(dt("menubar.mobile.button.focus.ring.width"), " ").concat(dt("menubar.mobile.button.focus.ring.style"), " ").concat(dt("menubar.mobile.button.focus.ring.color"), ";\n outline-offset: ").concat(dt("menubar.mobile.button.focus.ring.offset"), ";\n}\n\n.p-menubar-mobile {\n position: relative;\n}\n\n.p-menubar-mobile .p-menubar-button {\n display: flex;\n}\n\n.p-menubar-mobile .p-menubar-root-list {\n position: absolute;\n display: none;\n width: 100%;\n padding: ").concat(dt("menubar.submenu.padding"), ";\n background: ").concat(dt("menubar.submenu.background"), ";\n border: 1px solid ").concat(dt("menubar.submenu.border.color"), ";\n box-shadow: ").concat(dt("menubar.submenu.shadow"), ";\n}\n\n.p-menubar-mobile .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content {\n border-radius: ").concat(dt("menubar.item.border.radius"), ";\n}\n\n.p-menubar-mobile .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content > .p-menubar-item-link {\n padding: ").concat(dt("menubar.item.padding"), ";\n}\n\n.p-menubar-mobile-active .p-menubar-root-list {\n display: flex;\n flex-direction: column;\n top: 100%;\n left: 0;\n z-index: 1;\n}\n\n.p-menubar-mobile .p-menubar-root-list .p-menubar-item {\n width: 100%;\n position: static;\n}\n\n.p-menubar-mobile .p-menubar-root-list .p-menubar-separator {\n border-top: 1px solid ").concat(dt("menubar.separator.border.color"), ";\n}\n\n.p-menubar-mobile .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content .p-menubar-submenu-icon {\n margin-left: auto;\n transition: transform 0.2s;\n}\n\n.p-menubar-mobile .p-menubar-root-list > .p-menubar-item-active > .p-menubar-item-content .p-menubar-submenu-icon {\n transform: rotate(-180deg);\n}\n\n.p-menubar-mobile .p-menubar-submenu .p-menubar-submenu-icon {\n transition: transform 0.2s;\n transform: rotate(90deg);\n}\n\n.p-menubar-mobile .p-menubar-item-active > .p-menubar-item-content .p-menubar-submenu-icon {\n transform: rotate(-90deg);\n}\n\n.p-menubar-mobile .p-menubar-submenu {\n width: 100%;\n position: static;\n box-shadow: none;\n border: 0 none;\n padding-left: ").concat(dt("menubar.submenu.mobile.indent"), ";\n}\n"); -}, "theme"); -var inlineStyles$1 = { - submenu: /* @__PURE__ */ __name(function submenu(_ref2) { - var instance = _ref2.instance, processedItem = _ref2.processedItem; - return { - display: instance.isItemActive(processedItem) ? "flex" : "none" - }; - }, "submenu") -}; -var classes$3 = { - root: /* @__PURE__ */ __name(function root8(_ref3) { - var instance = _ref3.instance; - return ["p-menubar p-component", { - "p-menubar-mobile": instance.queryMatches, - "p-menubar-mobile-active": instance.mobileActive - }]; - }, "root"), - start: "p-menubar-start", - button: "p-menubar-button", - rootList: "p-menubar-root-list", - item: /* @__PURE__ */ __name(function item(_ref4) { - var instance = _ref4.instance, processedItem = _ref4.processedItem; - return ["p-menubar-item", { - "p-menubar-item-active": instance.isItemActive(processedItem), - "p-focus": instance.isItemFocused(processedItem), - "p-disabled": instance.isItemDisabled(processedItem) - }]; - }, "item"), - itemContent: "p-menubar-item-content", - itemLink: "p-menubar-item-link", - itemIcon: "p-menubar-item-icon", - itemLabel: "p-menubar-item-label", - submenuIcon: "p-menubar-submenu-icon", - submenu: "p-menubar-submenu", - separator: "p-menubar-separator", - end: "p-menubar-end" -}; -var MenubarStyle = BaseStyle.extend({ - name: "menubar", - theme: theme$3, - classes: classes$3, - inlineStyles: inlineStyles$1 -}); -var script$2$1 = { - name: "BaseMenubar", - "extends": script$g, - props: { - model: { - type: Array, - "default": null - }, - buttonProps: { - type: null, - "default": null - }, - breakpoint: { - type: String, - "default": "960px" - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - } - }, - style: MenubarStyle, - provide: /* @__PURE__ */ __name(function provide10() { - return { - $pcMenubar: this, - $parentInstance: this - }; - }, "provide") -}; -var script$1$3 = { - name: "MenubarSub", - hostName: "Menubar", - "extends": script$g, - emits: ["item-mouseenter", "item-click", "item-mousemove"], - props: { - items: { - type: Array, - "default": null - }, - root: { - type: Boolean, - "default": false - }, - popup: { - type: Boolean, - "default": false - }, - mobileActive: { - type: Boolean, - "default": false - }, - templates: { - type: Object, - "default": null - }, - level: { - type: Number, - "default": 0 - }, - menuId: { - type: String, - "default": null - }, - focusedItemId: { - type: String, - "default": null - }, - activeItemPath: { - type: Object, - "default": null - } - }, - list: null, - methods: { - getItemId: /* @__PURE__ */ __name(function getItemId(processedItem) { - return "".concat(this.menuId, "_").concat(processedItem.key); - }, "getItemId"), - getItemKey: /* @__PURE__ */ __name(function getItemKey(processedItem) { - return this.getItemId(processedItem); - }, "getItemKey"), - getItemProp: /* @__PURE__ */ __name(function getItemProp(processedItem, name, params) { - return processedItem && processedItem.item ? resolve(processedItem.item[name], params) : void 0; - }, "getItemProp"), - getItemLabel: /* @__PURE__ */ __name(function getItemLabel(processedItem) { - return this.getItemProp(processedItem, "label"); - }, "getItemLabel"), - getItemLabelId: /* @__PURE__ */ __name(function getItemLabelId(processedItem) { - return "".concat(this.menuId, "_").concat(processedItem.key, "_label"); - }, "getItemLabelId"), - getPTOptions: /* @__PURE__ */ __name(function getPTOptions4(processedItem, index, key) { - return this.ptm(key, { - context: { - item: processedItem.item, - index, - active: this.isItemActive(processedItem), - focused: this.isItemFocused(processedItem), - disabled: this.isItemDisabled(processedItem), - level: this.level - } - }); - }, "getPTOptions"), - isItemActive: /* @__PURE__ */ __name(function isItemActive(processedItem) { - return this.activeItemPath.some(function(path) { - return path.key === processedItem.key; - }); - }, "isItemActive"), - isItemVisible: /* @__PURE__ */ __name(function isItemVisible(processedItem) { - return this.getItemProp(processedItem, "visible") !== false; - }, "isItemVisible"), - isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled(processedItem) { - return this.getItemProp(processedItem, "disabled"); - }, "isItemDisabled"), - isItemFocused: /* @__PURE__ */ __name(function isItemFocused(processedItem) { - return this.focusedItemId === this.getItemId(processedItem); - }, "isItemFocused"), - isItemGroup: /* @__PURE__ */ __name(function isItemGroup(processedItem) { - return isNotEmpty(processedItem.items); - }, "isItemGroup"), - onItemClick: /* @__PURE__ */ __name(function onItemClick(event, processedItem) { - this.getItemProp(processedItem, "command", { - originalEvent: event, - item: processedItem.item - }); - this.$emit("item-click", { - originalEvent: event, - processedItem, - isFocus: true - }); - }, "onItemClick"), - onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter(event, processedItem) { - this.$emit("item-mouseenter", { - originalEvent: event, - processedItem - }); - }, "onItemMouseEnter"), - onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove(event, processedItem) { - this.$emit("item-mousemove", { - originalEvent: event, - processedItem - }); - }, "onItemMouseMove"), - getAriaPosInset: /* @__PURE__ */ __name(function getAriaPosInset2(index) { - return index - this.calculateAriaSetSize.slice(0, index).length + 1; - }, "getAriaPosInset"), - getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps(processedItem, index) { - return { - action: mergeProps({ - "class": this.cx("itemLink"), - tabindex: -1, - "aria-hidden": true - }, this.getPTOptions(processedItem, index, "itemLink")), - icon: mergeProps({ - "class": [this.cx("itemIcon"), this.getItemProp(processedItem, "icon")] - }, this.getPTOptions(processedItem, index, "itemIcon")), - label: mergeProps({ - "class": this.cx("itemLabel") - }, this.getPTOptions(processedItem, index, "itemLabel")), - submenuicon: mergeProps({ - "class": this.cx("submenuIcon") - }, this.getPTOptions(processedItem, index, "submenuIcon")) - }; - }, "getMenuItemProps") - }, - computed: { - calculateAriaSetSize: /* @__PURE__ */ __name(function calculateAriaSetSize() { - var _this = this; - return this.items.filter(function(processedItem) { - return _this.isItemVisible(processedItem) && _this.getItemProp(processedItem, "separator"); - }); - }, "calculateAriaSetSize"), - getAriaSetSize: /* @__PURE__ */ __name(function getAriaSetSize() { - var _this2 = this; - return this.items.filter(function(processedItem) { - return _this2.isItemVisible(processedItem) && !_this2.getItemProp(processedItem, "separator"); - }).length; - }, "getAriaSetSize") - }, - components: { - AngleRightIcon: script$z, - AngleDownIcon: script$A - }, - directives: { - ripple: Ripple - } -}; -var _hoisted_1$1$2 = ["id", "aria-label", "aria-disabled", "aria-expanded", "aria-haspopup", "aria-level", "aria-setsize", "aria-posinset", "data-p-active", "data-p-focused", "data-p-disabled"]; -var _hoisted_2$a = ["onClick", "onMouseenter", "onMousemove"]; -var _hoisted_3$8 = ["href", "target"]; -var _hoisted_4$1 = ["id"]; -var _hoisted_5$1 = ["id"]; -function render$1$2(_ctx, _cache, $props, $setup, $data, $options) { - var _component_MenubarSub = resolveComponent("MenubarSub", true); - var _directive_ripple = resolveDirective("ripple"); - return openBlock(), createElementBlock("ul", mergeProps({ - "class": $props.level === 0 ? _ctx.cx("rootList") : _ctx.cx("submenu") - }, $props.level === 0 ? _ctx.ptm("rootList") : _ctx.ptm("submenu")), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.items, function(processedItem, index) { - return openBlock(), createElementBlock(Fragment, { - key: $options.getItemKey(processedItem) - }, [$options.isItemVisible(processedItem) && !$options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ - key: 0, - id: $options.getItemId(processedItem), - style: $options.getItemProp(processedItem, "style"), - "class": [_ctx.cx("item", { - processedItem - }), $options.getItemProp(processedItem, "class")], - role: "menuitem", - "aria-label": $options.getItemLabel(processedItem), - "aria-disabled": $options.isItemDisabled(processedItem) || void 0, - "aria-expanded": $options.isItemGroup(processedItem) ? $options.isItemActive(processedItem) : void 0, - "aria-haspopup": $options.isItemGroup(processedItem) && !$options.getItemProp(processedItem, "to") ? "menu" : void 0, - "aria-level": $props.level + 1, - "aria-setsize": $options.getAriaSetSize, - "aria-posinset": $options.getAriaPosInset(index), - ref_for: true - }, $options.getPTOptions(processedItem, index, "item"), { - "data-p-active": $options.isItemActive(processedItem), - "data-p-focused": $options.isItemFocused(processedItem), - "data-p-disabled": $options.isItemDisabled(processedItem) - }), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("itemContent"), - onClick: /* @__PURE__ */ __name(function onClick2($event) { - return $options.onItemClick($event, processedItem); - }, "onClick"), - onMouseenter: /* @__PURE__ */ __name(function onMouseenter($event) { - return $options.onItemMouseEnter($event, processedItem); - }, "onMouseenter"), - onMousemove: /* @__PURE__ */ __name(function onMousemove($event) { - return $options.onItemMouseMove($event, processedItem); - }, "onMousemove"), - ref_for: true - }, $options.getPTOptions(processedItem, index, "itemContent")), [!$props.templates.item ? withDirectives((openBlock(), createElementBlock("a", mergeProps({ - key: 0, - href: $options.getItemProp(processedItem, "url"), - "class": _ctx.cx("itemLink"), - target: $options.getItemProp(processedItem, "target"), - tabindex: "-1", - ref_for: true - }, $options.getPTOptions(processedItem, index, "itemLink")), [$props.templates.itemicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.itemicon), { - key: 0, - item: processedItem.item, - "class": normalizeClass(_ctx.cx("itemIcon")) - }, null, 8, ["item", "class"])) : $options.getItemProp(processedItem, "icon") ? (openBlock(), createElementBlock("span", mergeProps({ - key: 1, - "class": [_ctx.cx("itemIcon"), $options.getItemProp(processedItem, "icon")], - ref_for: true - }, $options.getPTOptions(processedItem, index, "itemIcon")), null, 16)) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ - id: $options.getItemLabelId(processedItem), - "class": _ctx.cx("itemLabel"), - ref_for: true - }, $options.getPTOptions(processedItem, index, "itemLabel")), toDisplayString($options.getItemLabel(processedItem)), 17, _hoisted_4$1), $options.getItemProp(processedItem, "items") ? (openBlock(), createElementBlock(Fragment, { - key: 2 - }, [$props.templates.submenuicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.submenuicon), { - key: 0, - root: $props.root, - active: $options.isItemActive(processedItem), - "class": normalizeClass(_ctx.cx("submenuIcon")) - }, null, 8, ["root", "active", "class"])) : (openBlock(), createBlock(resolveDynamicComponent($props.root ? "AngleDownIcon" : "AngleRightIcon"), mergeProps({ - key: 1, - "class": _ctx.cx("submenuIcon"), - ref_for: true - }, $options.getPTOptions(processedItem, index, "submenuIcon")), null, 16, ["class"]))], 64)) : createCommentVNode("", true)], 16, _hoisted_3$8)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { - key: 1, - item: processedItem.item, - root: $props.root, - hasSubmenu: $options.getItemProp(processedItem, "items"), - label: $options.getItemLabel(processedItem), - props: $options.getMenuItemProps(processedItem, index) - }, null, 8, ["item", "root", "hasSubmenu", "label", "props"]))], 16, _hoisted_2$a), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_MenubarSub, { - key: 0, - id: $options.getItemId(processedItem) + "_list", - menuId: $props.menuId, - role: "menu", - style: normalizeStyle(_ctx.sx("submenu", true, { - processedItem - })), - focusedItemId: $props.focusedItemId, - items: processedItem.items, - mobileActive: $props.mobileActive, - activeItemPath: $props.activeItemPath, - templates: $props.templates, - level: $props.level + 1, - "aria-labelledby": $options.getItemLabelId(processedItem), - pt: _ctx.pt, - unstyled: _ctx.unstyled, - onItemClick: _cache[0] || (_cache[0] = function($event) { - return _ctx.$emit("item-click", $event); - }), - onItemMouseenter: _cache[1] || (_cache[1] = function($event) { - return _ctx.$emit("item-mouseenter", $event); - }), - onItemMousemove: _cache[2] || (_cache[2] = function($event) { - return _ctx.$emit("item-mousemove", $event); - }) - }, null, 8, ["id", "menuId", "style", "focusedItemId", "items", "mobileActive", "activeItemPath", "templates", "level", "aria-labelledby", "pt", "unstyled"])) : createCommentVNode("", true)], 16, _hoisted_1$1$2)) : createCommentVNode("", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ - key: 1, - id: $options.getItemId(processedItem), - "class": [_ctx.cx("separator"), $options.getItemProp(processedItem, "class")], - style: $options.getItemProp(processedItem, "style"), - role: "separator", - ref_for: true - }, _ctx.ptm("separator")), null, 16, _hoisted_5$1)) : createCommentVNode("", true)], 64); - }), 128))], 16); -} -__name(render$1$2, "render$1$2"); -script$1$3.render = render$1$2; -var script$5 = { - name: "Menubar", - "extends": script$2$1, - inheritAttrs: false, - emits: ["focus", "blur"], - matchMediaListener: null, - data: /* @__PURE__ */ __name(function data6() { - return { - id: this.$attrs.id, - mobileActive: false, - focused: false, - focusedItemInfo: { - index: -1, - level: 0, - parentKey: "" - }, - activeItemPath: [], - dirty: false, - query: null, - queryMatches: false - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId2(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId"), - activeItemPath: /* @__PURE__ */ __name(function activeItemPath(newPath) { - if (isNotEmpty(newPath)) { - this.bindOutsideClickListener(); - this.bindResizeListener(); - } else { - this.unbindOutsideClickListener(); - this.unbindResizeListener(); - } - }, "activeItemPath") - }, - outsideClickListener: null, - container: null, - menubar: null, - mounted: /* @__PURE__ */ __name(function mounted6() { - this.id = this.id || UniqueComponentId(); - this.bindMatchMediaListener(); - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount6() { - this.mobileActive = false; - this.unbindOutsideClickListener(); - this.unbindResizeListener(); - this.unbindMatchMediaListener(); - if (this.container) { - ZIndex.clear(this.container); - } - this.container = null; - }, "beforeUnmount"), - methods: { - getItemProp: /* @__PURE__ */ __name(function getItemProp2(item3, name) { - return item3 ? resolve(item3[name]) : void 0; - }, "getItemProp"), - getItemLabel: /* @__PURE__ */ __name(function getItemLabel2(item3) { - return this.getItemProp(item3, "label"); - }, "getItemLabel"), - isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled2(item3) { - return this.getItemProp(item3, "disabled"); - }, "isItemDisabled"), - isItemVisible: /* @__PURE__ */ __name(function isItemVisible2(item3) { - return this.getItemProp(item3, "visible") !== false; - }, "isItemVisible"), - isItemGroup: /* @__PURE__ */ __name(function isItemGroup2(item3) { - return isNotEmpty(this.getItemProp(item3, "items")); - }, "isItemGroup"), - isItemSeparator: /* @__PURE__ */ __name(function isItemSeparator(item3) { - return this.getItemProp(item3, "separator"); - }, "isItemSeparator"), - getProccessedItemLabel: /* @__PURE__ */ __name(function getProccessedItemLabel(processedItem) { - return processedItem ? this.getItemLabel(processedItem.item) : void 0; - }, "getProccessedItemLabel"), - isProccessedItemGroup: /* @__PURE__ */ __name(function isProccessedItemGroup(processedItem) { - return processedItem && isNotEmpty(processedItem.items); - }, "isProccessedItemGroup"), - toggle: /* @__PURE__ */ __name(function toggle(event) { - var _this = this; - if (this.mobileActive) { - this.mobileActive = false; - ZIndex.clear(this.menubar); - this.hide(); - } else { - this.mobileActive = true; - ZIndex.set("menu", this.menubar, this.$primevue.config.zIndex.menu); - setTimeout(function() { - _this.show(); - }, 1); - } - this.bindOutsideClickListener(); - event.preventDefault(); - }, "toggle"), - show: /* @__PURE__ */ __name(function show2() { - focus(this.menubar); - }, "show"), - hide: /* @__PURE__ */ __name(function hide2(event, isFocus) { - var _this2 = this; - if (this.mobileActive) { - this.mobileActive = false; - setTimeout(function() { - focus(_this2.$refs.menubutton); - }, 0); - } - this.activeItemPath = []; - this.focusedItemInfo = { - index: -1, - level: 0, - parentKey: "" - }; - isFocus && focus(this.menubar); - this.dirty = false; - }, "hide"), - onFocus: /* @__PURE__ */ __name(function onFocus3(event) { - this.focused = true; - this.focusedItemInfo = this.focusedItemInfo.index !== -1 ? this.focusedItemInfo : { - index: this.findFirstFocusedItemIndex(), - level: 0, - parentKey: "" - }; - this.$emit("focus", event); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur2(event) { - this.focused = false; - this.focusedItemInfo = { - index: -1, - level: 0, - parentKey: "" - }; - this.searchValue = ""; - this.dirty = false; - this.$emit("blur", event); - }, "onBlur"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown2(event) { - var metaKey = event.metaKey || event.ctrlKey; - switch (event.code) { - case "ArrowDown": - this.onArrowDownKey(event); - break; - case "ArrowUp": - this.onArrowUpKey(event); - break; - case "ArrowLeft": - this.onArrowLeftKey(event); - break; - case "ArrowRight": - this.onArrowRightKey(event); - break; - case "Home": - this.onHomeKey(event); - break; - case "End": - this.onEndKey(event); - break; - case "Space": - this.onSpaceKey(event); - break; - case "Enter": - case "NumpadEnter": - this.onEnterKey(event); - break; - case "Escape": - this.onEscapeKey(event); - break; - case "Tab": - this.onTabKey(event); - break; - case "PageDown": - case "PageUp": - case "Backspace": - case "ShiftLeft": - case "ShiftRight": - break; - default: - if (!metaKey && isPrintableCharacter(event.key)) { - this.searchItems(event, event.key); - } - break; - } - }, "onKeyDown"), - onItemChange: /* @__PURE__ */ __name(function onItemChange(event) { - var processedItem = event.processedItem, isFocus = event.isFocus; - if (isEmpty(processedItem)) return; - var index = processedItem.index, key = processedItem.key, level = processedItem.level, parentKey = processedItem.parentKey, items = processedItem.items; - var grouped = isNotEmpty(items); - var activeItemPath3 = this.activeItemPath.filter(function(p) { - return p.parentKey !== parentKey && p.parentKey !== key; - }); - grouped && activeItemPath3.push(processedItem); - this.focusedItemInfo = { - index, - level, - parentKey - }; - this.activeItemPath = activeItemPath3; - grouped && (this.dirty = true); - isFocus && focus(this.menubar); - }, "onItemChange"), - onItemClick: /* @__PURE__ */ __name(function onItemClick2(event) { - var originalEvent = event.originalEvent, processedItem = event.processedItem; - var grouped = this.isProccessedItemGroup(processedItem); - var root12 = isEmpty(processedItem.parent); - var selected = this.isSelected(processedItem); - if (selected) { - var index = processedItem.index, key = processedItem.key, level = processedItem.level, parentKey = processedItem.parentKey; - this.activeItemPath = this.activeItemPath.filter(function(p) { - return key !== p.key && key.startsWith(p.key); - }); - this.focusedItemInfo = { - index, - level, - parentKey - }; - this.dirty = !root12; - focus(this.menubar); - } else { - if (grouped) { - this.onItemChange(event); - } else { - var rootProcessedItem = root12 ? processedItem : this.activeItemPath.find(function(p) { - return p.parentKey === ""; - }); - this.hide(originalEvent); - this.changeFocusedItemIndex(originalEvent, rootProcessedItem ? rootProcessedItem.index : -1); - this.mobileActive = false; - focus(this.menubar); - } - } - }, "onItemClick"), - onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter2(event) { - if (this.dirty) { - this.onItemChange(event); - } - }, "onItemMouseEnter"), - onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove2(event) { - if (this.focused) { - this.changeFocusedItemIndex(event, event.processedItem.index); - } - }, "onItemMouseMove"), - menuButtonClick: /* @__PURE__ */ __name(function menuButtonClick(event) { - this.toggle(event); - }, "menuButtonClick"), - menuButtonKeydown: /* @__PURE__ */ __name(function menuButtonKeydown(event) { - (event.code === "Enter" || event.code === "NumpadEnter" || event.code === "Space") && this.menuButtonClick(event); - }, "menuButtonKeydown"), - onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey2(event) { - var processedItem = this.visibleItems[this.focusedItemInfo.index]; - var root12 = processedItem ? isEmpty(processedItem.parent) : null; - if (root12) { - var grouped = this.isProccessedItemGroup(processedItem); - if (grouped) { - this.onItemChange({ - originalEvent: event, - processedItem - }); - this.focusedItemInfo = { - index: -1, - parentKey: processedItem.key - }; - this.onArrowRightKey(event); - } - } else { - var itemIndex = this.focusedItemInfo.index !== -1 ? this.findNextItemIndex(this.focusedItemInfo.index) : this.findFirstFocusedItemIndex(); - this.changeFocusedItemIndex(event, itemIndex); - } - event.preventDefault(); - }, "onArrowDownKey"), - onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey2(event) { - var _this3 = this; - var processedItem = this.visibleItems[this.focusedItemInfo.index]; - var root12 = isEmpty(processedItem.parent); - if (root12) { - var grouped = this.isProccessedItemGroup(processedItem); - if (grouped) { - this.onItemChange({ - originalEvent: event, - processedItem - }); - this.focusedItemInfo = { - index: -1, - parentKey: processedItem.key - }; - var itemIndex = this.findLastItemIndex(); - this.changeFocusedItemIndex(event, itemIndex); - } - } else { - var parentItem = this.activeItemPath.find(function(p) { - return p.key === processedItem.parentKey; - }); - if (this.focusedItemInfo.index === 0) { - this.focusedItemInfo = { - index: -1, - parentKey: parentItem ? parentItem.parentKey : "" - }; - this.searchValue = ""; - this.onArrowLeftKey(event); - this.activeItemPath = this.activeItemPath.filter(function(p) { - return p.parentKey !== _this3.focusedItemInfo.parentKey; - }); - } else { - var _itemIndex = this.focusedItemInfo.index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo.index) : this.findLastFocusedItemIndex(); - this.changeFocusedItemIndex(event, _itemIndex); - } - } - event.preventDefault(); - }, "onArrowUpKey"), - onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey3(event) { - var _this4 = this; - var processedItem = this.visibleItems[this.focusedItemInfo.index]; - var parentItem = processedItem ? this.activeItemPath.find(function(p) { - return p.key === processedItem.parentKey; - }) : null; - if (parentItem) { - this.onItemChange({ - originalEvent: event, - processedItem: parentItem - }); - this.activeItemPath = this.activeItemPath.filter(function(p) { - return p.parentKey !== _this4.focusedItemInfo.parentKey; - }); - event.preventDefault(); - } else { - var itemIndex = this.focusedItemInfo.index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo.index) : this.findLastFocusedItemIndex(); - this.changeFocusedItemIndex(event, itemIndex); - event.preventDefault(); - } - }, "onArrowLeftKey"), - onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey3(event) { - var processedItem = this.visibleItems[this.focusedItemInfo.index]; - var parentItem = processedItem ? this.activeItemPath.find(function(p) { - return p.key === processedItem.parentKey; - }) : null; - if (parentItem) { - var grouped = this.isProccessedItemGroup(processedItem); - if (grouped) { - this.onItemChange({ - originalEvent: event, - processedItem - }); - this.focusedItemInfo = { - index: -1, - parentKey: processedItem.key - }; - this.onArrowDownKey(event); - } - } else { - var itemIndex = this.focusedItemInfo.index !== -1 ? this.findNextItemIndex(this.focusedItemInfo.index) : this.findFirstFocusedItemIndex(); - this.changeFocusedItemIndex(event, itemIndex); - event.preventDefault(); - } - }, "onArrowRightKey"), - onHomeKey: /* @__PURE__ */ __name(function onHomeKey3(event) { - this.changeFocusedItemIndex(event, this.findFirstItemIndex()); - event.preventDefault(); - }, "onHomeKey"), - onEndKey: /* @__PURE__ */ __name(function onEndKey3(event) { - this.changeFocusedItemIndex(event, this.findLastItemIndex()); - event.preventDefault(); - }, "onEndKey"), - onEnterKey: /* @__PURE__ */ __name(function onEnterKey3(event) { - if (this.focusedItemInfo.index !== -1) { - var element = findSingle(this.menubar, 'li[id="'.concat("".concat(this.focusedItemId), '"]')); - var anchorElement = element && findSingle(element, 'a[data-pc-section="itemlink"]'); - anchorElement ? anchorElement.click() : element && element.click(); - var processedItem = this.visibleItems[this.focusedItemInfo.index]; - var grouped = this.isProccessedItemGroup(processedItem); - !grouped && (this.focusedItemInfo.index = this.findFirstFocusedItemIndex()); - } - event.preventDefault(); - }, "onEnterKey"), - onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey(event) { - this.onEnterKey(event); - }, "onSpaceKey"), - onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey2(event) { - if (this.focusedItemInfo.level !== 0) { - var _focusedItemInfo = this.focusedItemInfo; - this.hide(event, false); - this.focusedItemInfo = { - index: Number(_focusedItemInfo.parentKey.split("_")[0]), - level: 0, - parentKey: "" - }; - } - event.preventDefault(); - }, "onEscapeKey"), - onTabKey: /* @__PURE__ */ __name(function onTabKey2(event) { - if (this.focusedItemInfo.index !== -1) { - var processedItem = this.visibleItems[this.focusedItemInfo.index]; - var grouped = this.isProccessedItemGroup(processedItem); - !grouped && this.onItemChange({ - originalEvent: event, - processedItem - }); - } - this.hide(); - }, "onTabKey"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener2() { - var _this5 = this; - if (!this.outsideClickListener) { - this.outsideClickListener = function(event) { - var isOutsideContainer = _this5.container && !_this5.container.contains(event.target); - var isOutsideTarget = !(_this5.target && (_this5.target === event.target || _this5.target.contains(event.target))); - if (isOutsideContainer && isOutsideTarget) { - _this5.hide(); - } - }; - document.addEventListener("click", this.outsideClickListener); - } - }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener2() { - if (this.outsideClickListener) { - document.removeEventListener("click", this.outsideClickListener); - this.outsideClickListener = null; - } - }, "unbindOutsideClickListener"), - bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener2() { - var _this6 = this; - if (!this.resizeListener) { - this.resizeListener = function(event) { - if (!isTouchDevice()) { - _this6.hide(event, true); - } - _this6.mobileActive = false; - }; - window.addEventListener("resize", this.resizeListener); - } - }, "bindResizeListener"), - unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener2() { - if (this.resizeListener) { - window.removeEventListener("resize", this.resizeListener); - this.resizeListener = null; - } - }, "unbindResizeListener"), - bindMatchMediaListener: /* @__PURE__ */ __name(function bindMatchMediaListener() { - var _this7 = this; - if (!this.matchMediaListener) { - var query = matchMedia("(max-width: ".concat(this.breakpoint, ")")); - this.query = query; - this.queryMatches = query.matches; - this.matchMediaListener = function() { - _this7.queryMatches = query.matches; - _this7.mobileActive = false; - }; - this.query.addEventListener("change", this.matchMediaListener); - } - }, "bindMatchMediaListener"), - unbindMatchMediaListener: /* @__PURE__ */ __name(function unbindMatchMediaListener() { - if (this.matchMediaListener) { - this.query.removeEventListener("change", this.matchMediaListener); - this.matchMediaListener = null; - } - }, "unbindMatchMediaListener"), - isItemMatched: /* @__PURE__ */ __name(function isItemMatched(processedItem) { - var _this$getProccessedIt; - return this.isValidItem(processedItem) && ((_this$getProccessedIt = this.getProccessedItemLabel(processedItem)) === null || _this$getProccessedIt === void 0 ? void 0 : _this$getProccessedIt.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase())); - }, "isItemMatched"), - isValidItem: /* @__PURE__ */ __name(function isValidItem(processedItem) { - return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item) && this.isItemVisible(processedItem.item); - }, "isValidItem"), - isValidSelectedItem: /* @__PURE__ */ __name(function isValidSelectedItem(processedItem) { - return this.isValidItem(processedItem) && this.isSelected(processedItem); - }, "isValidSelectedItem"), - isSelected: /* @__PURE__ */ __name(function isSelected2(processedItem) { - return this.activeItemPath.some(function(p) { - return p.key === processedItem.key; - }); - }, "isSelected"), - findFirstItemIndex: /* @__PURE__ */ __name(function findFirstItemIndex() { - var _this8 = this; - return this.visibleItems.findIndex(function(processedItem) { - return _this8.isValidItem(processedItem); - }); - }, "findFirstItemIndex"), - findLastItemIndex: /* @__PURE__ */ __name(function findLastItemIndex() { - var _this9 = this; - return findLastIndex(this.visibleItems, function(processedItem) { - return _this9.isValidItem(processedItem); - }); - }, "findLastItemIndex"), - findNextItemIndex: /* @__PURE__ */ __name(function findNextItemIndex(index) { - var _this10 = this; - var matchedItemIndex = index < this.visibleItems.length - 1 ? this.visibleItems.slice(index + 1).findIndex(function(processedItem) { - return _this10.isValidItem(processedItem); - }) : -1; - return matchedItemIndex > -1 ? matchedItemIndex + index + 1 : index; - }, "findNextItemIndex"), - findPrevItemIndex: /* @__PURE__ */ __name(function findPrevItemIndex(index) { - var _this11 = this; - var matchedItemIndex = index > 0 ? findLastIndex(this.visibleItems.slice(0, index), function(processedItem) { - return _this11.isValidItem(processedItem); - }) : -1; - return matchedItemIndex > -1 ? matchedItemIndex : index; - }, "findPrevItemIndex"), - findSelectedItemIndex: /* @__PURE__ */ __name(function findSelectedItemIndex() { - var _this12 = this; - return this.visibleItems.findIndex(function(processedItem) { - return _this12.isValidSelectedItem(processedItem); - }); - }, "findSelectedItemIndex"), - findFirstFocusedItemIndex: /* @__PURE__ */ __name(function findFirstFocusedItemIndex() { - var selectedIndex = this.findSelectedItemIndex(); - return selectedIndex < 0 ? this.findFirstItemIndex() : selectedIndex; - }, "findFirstFocusedItemIndex"), - findLastFocusedItemIndex: /* @__PURE__ */ __name(function findLastFocusedItemIndex() { - var selectedIndex = this.findSelectedItemIndex(); - return selectedIndex < 0 ? this.findLastItemIndex() : selectedIndex; - }, "findLastFocusedItemIndex"), - searchItems: /* @__PURE__ */ __name(function searchItems(event, _char) { - var _this13 = this; - this.searchValue = (this.searchValue || "") + _char; - var itemIndex = -1; - var matched = false; - if (this.focusedItemInfo.index !== -1) { - itemIndex = this.visibleItems.slice(this.focusedItemInfo.index).findIndex(function(processedItem) { - return _this13.isItemMatched(processedItem); - }); - itemIndex = itemIndex === -1 ? this.visibleItems.slice(0, this.focusedItemInfo.index).findIndex(function(processedItem) { - return _this13.isItemMatched(processedItem); - }) : itemIndex + this.focusedItemInfo.index; - } else { - itemIndex = this.visibleItems.findIndex(function(processedItem) { - return _this13.isItemMatched(processedItem); - }); - } - if (itemIndex !== -1) { - matched = true; - } - if (itemIndex === -1 && this.focusedItemInfo.index === -1) { - itemIndex = this.findFirstFocusedItemIndex(); - } - if (itemIndex !== -1) { - this.changeFocusedItemIndex(event, itemIndex); - } - if (this.searchTimeout) { - clearTimeout(this.searchTimeout); - } - this.searchTimeout = setTimeout(function() { - _this13.searchValue = ""; - _this13.searchTimeout = null; - }, 500); - return matched; - }, "searchItems"), - changeFocusedItemIndex: /* @__PURE__ */ __name(function changeFocusedItemIndex(event, index) { - if (this.focusedItemInfo.index !== index) { - this.focusedItemInfo.index = index; - this.scrollInView(); - } - }, "changeFocusedItemIndex"), - scrollInView: /* @__PURE__ */ __name(function scrollInView3() { - var index = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : -1; - var id2 = index !== -1 ? "".concat(this.id, "_").concat(index) : this.focusedItemId; - var element = findSingle(this.menubar, 'li[id="'.concat(id2, '"]')); - if (element) { - element.scrollIntoView && element.scrollIntoView({ - block: "nearest", - inline: "start" - }); - } - }, "scrollInView"), - createProcessedItems: /* @__PURE__ */ __name(function createProcessedItems(items) { - var _this14 = this; - var level = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; - var parent = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; - var parentKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ""; - var processedItems3 = []; - items && items.forEach(function(item3, index) { - var key = (parentKey !== "" ? parentKey + "_" : "") + index; - var newItem = { - item: item3, - index, - level, - key, - parent, - parentKey - }; - newItem["items"] = _this14.createProcessedItems(item3.items, level + 1, newItem, key); - processedItems3.push(newItem); - }); - return processedItems3; - }, "createProcessedItems"), - containerRef: /* @__PURE__ */ __name(function containerRef(el) { - this.container = el; - }, "containerRef"), - menubarRef: /* @__PURE__ */ __name(function menubarRef(el) { - this.menubar = el ? el.$el : void 0; - }, "menubarRef") - }, - computed: { - processedItems: /* @__PURE__ */ __name(function processedItems() { - return this.createProcessedItems(this.model || []); - }, "processedItems"), - visibleItems: /* @__PURE__ */ __name(function visibleItems() { - var _this15 = this; - var processedItem = this.activeItemPath.find(function(p) { - return p.key === _this15.focusedItemInfo.parentKey; - }); - return processedItem ? processedItem.items : this.processedItems; - }, "visibleItems"), - focusedItemId: /* @__PURE__ */ __name(function focusedItemId() { - return this.focusedItemInfo.index !== -1 ? "".concat(this.id).concat(isNotEmpty(this.focusedItemInfo.parentKey) ? "_" + this.focusedItemInfo.parentKey : "", "_").concat(this.focusedItemInfo.index) : null; - }, "focusedItemId") - }, - components: { - MenubarSub: script$1$3, - BarsIcon: script$B - } -}; -function _typeof(o) { - "@babel/helpers - typeof"; - return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { - return typeof o2; - } : function(o2) { - return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; - }, _typeof(o); -} -__name(_typeof, "_typeof"); -function ownKeys(e, r) { - var t = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t.push.apply(t, o); - } - return t; -} -__name(ownKeys, "ownKeys"); -function _objectSpread(e) { - for (var r = 1; r < arguments.length; r++) { - var t = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys(Object(t), true).forEach(function(r2) { - _defineProperty(e, r2, t[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); - }); - } - return e; -} -__name(_objectSpread, "_objectSpread"); -function _defineProperty(e, r, t) { - return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; -} -__name(_defineProperty, "_defineProperty"); -function _toPropertyKey(t) { - var i = _toPrimitive(t, "string"); - return "symbol" == _typeof(i) ? i : i + ""; -} -__name(_toPropertyKey, "_toPropertyKey"); -function _toPrimitive(t, r) { - if ("object" != _typeof(t) || !t) return t; - var e = t[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t, r || "default"); - if ("object" != _typeof(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t); -} -__name(_toPrimitive, "_toPrimitive"); -var _hoisted_1$c = ["aria-haspopup", "aria-expanded", "aria-controls", "aria-label"]; -function render$9(_ctx, _cache, $props, $setup, $data, $options) { - var _component_BarsIcon = resolveComponent("BarsIcon"); - var _component_MenubarSub = resolveComponent("MenubarSub"); - return openBlock(), createElementBlock("div", mergeProps({ - ref: $options.containerRef, - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [_ctx.$slots.start ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("start") - }, _ctx.ptm("start")), [renderSlot(_ctx.$slots, "start")], 16)) : createCommentVNode("", true), renderSlot(_ctx.$slots, _ctx.$slots.button ? "button" : "menubutton", { - id: $data.id, - "class": normalizeClass(_ctx.cx("button")), - toggleCallback: /* @__PURE__ */ __name(function toggleCallback(event) { - return $options.menuButtonClick(event); - }, "toggleCallback") - }, function() { - var _ctx$$primevue$config; - return [_ctx.model && _ctx.model.length > 0 ? (openBlock(), createElementBlock("a", mergeProps({ - key: 0, - ref: "menubutton", - role: "button", - tabindex: "0", - "class": _ctx.cx("button"), - "aria-haspopup": _ctx.model.length && _ctx.model.length > 0 ? true : false, - "aria-expanded": $data.mobileActive, - "aria-controls": $data.id, - "aria-label": (_ctx$$primevue$config = _ctx.$primevue.config.locale.aria) === null || _ctx$$primevue$config === void 0 ? void 0 : _ctx$$primevue$config.navigation, - onClick: _cache[0] || (_cache[0] = function($event) { - return $options.menuButtonClick($event); - }), - onKeydown: _cache[1] || (_cache[1] = function($event) { - return $options.menuButtonKeydown($event); - }) - }, _objectSpread(_objectSpread({}, _ctx.buttonProps), _ctx.ptm("button"))), [renderSlot(_ctx.$slots, _ctx.$slots.buttonicon ? "buttonicon" : "menubuttonicon", {}, function() { - return [createVNode(_component_BarsIcon, normalizeProps(guardReactiveProps(_ctx.ptm("buttonicon"))), null, 16)]; - })], 16, _hoisted_1$c)) : createCommentVNode("", true)]; - }), createVNode(_component_MenubarSub, { - ref: $options.menubarRef, - id: $data.id + "_list", - role: "menubar", - items: $options.processedItems, - templates: _ctx.$slots, - root: true, - mobileActive: $data.mobileActive, - tabindex: "0", - "aria-activedescendant": $data.focused ? $options.focusedItemId : void 0, - menuId: $data.id, - focusedItemId: $data.focused ? $options.focusedItemId : void 0, - activeItemPath: $data.activeItemPath, - level: 0, - "aria-labelledby": _ctx.ariaLabelledby, - "aria-label": _ctx.ariaLabel, - pt: _ctx.pt, - unstyled: _ctx.unstyled, - onFocus: $options.onFocus, - onBlur: $options.onBlur, - onKeydown: $options.onKeyDown, - onItemClick: $options.onItemClick, - onItemMouseenter: $options.onItemMouseEnter, - onItemMousemove: $options.onItemMouseMove - }, null, 8, ["id", "items", "templates", "mobileActive", "aria-activedescendant", "menuId", "focusedItemId", "activeItemPath", "aria-labelledby", "aria-label", "pt", "unstyled", "onFocus", "onBlur", "onKeydown", "onItemClick", "onItemMouseenter", "onItemMousemove"]), _ctx.$slots.end ? (openBlock(), createElementBlock("div", mergeProps({ - key: 1, - "class": _ctx.cx("end") - }, _ctx.ptm("end")), [renderSlot(_ctx.$slots, "end")], 16)) : createCommentVNode("", true)], 16); -} -__name(render$9, "render$9"); -script$5.render = render$9; -const _withScopeId$2 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-a2b12676"), n = n(), popScopeId(), n), "_withScopeId$2"); -const _hoisted_1$b = ["href"]; -const _hoisted_2$9 = { class: "p-menubar-item-label" }; -const _hoisted_3$7 = { - key: 1, - class: "ml-auto border border-surface rounded text-muted text-xs p-1 keybinding-tag" -}; -const _sfc_main$6 = /* @__PURE__ */ defineComponent({ - __name: "CommandMenubar", - setup(__props) { - const settingStore = useSettingStore(); - const dropdownDirection = computed( - () => settingStore.get("Comfy.UseNewMenu") === "Top" ? "down" : "up" - ); - const menuItemsStore = useMenuItemStore(); - const { t } = useI18n(); - const translateMenuItem = /* @__PURE__ */ __name((item3) => { - const label = typeof item3.label === "function" ? item3.label() : item3.label; - const translatedLabel = label ? t(`menuLabels.${normalizeI18nKey(label)}`, label) : void 0; - return { - ...item3, - label: translatedLabel, - items: item3.items?.map(translateMenuItem) - }; - }, "translateMenuItem"); - const translatedItems = computed( - () => menuItemsStore.menuItems.map(translateMenuItem) - ); - return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$5), { - model: translatedItems.value, - class: "top-menubar border-none p-0 bg-transparent", - pt: { - rootList: "gap-0 flex-nowrap w-auto", - submenu: `dropdown-direction-${dropdownDirection.value}`, - item: "relative" - } - }, { - item: withCtx(({ item: item3, props }) => [ - createBaseVNode("a", mergeProps({ class: "p-menubar-item-link" }, props.action, { - href: item3.url, - target: "_blank" - }), [ - item3.icon ? (openBlock(), createElementBlock("span", { - key: 0, - class: normalizeClass(["p-menubar-item-icon", item3.icon]) - }, null, 2)) : createCommentVNode("", true), - createBaseVNode("span", _hoisted_2$9, toDisplayString(item3.label), 1), - item3?.comfyCommand?.keybinding ? (openBlock(), createElementBlock("span", _hoisted_3$7, toDisplayString(item3.comfyCommand.keybinding.combo.toString()), 1)) : createCommentVNode("", true) - ], 16, _hoisted_1$b) - ]), - _: 1 - }, 8, ["model", "pt"]); - }; - } -}); -const CommandMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-a2b12676"]]); -var theme$2 = /* @__PURE__ */ __name(function theme7(_ref) { - var dt = _ref.dt; - return "\n.p-panel {\n border: 1px solid ".concat(dt("panel.border.color"), ";\n border-radius: ").concat(dt("panel.border.radius"), ";\n background: ").concat(dt("panel.background"), ";\n color: ").concat(dt("panel.color"), ";\n}\n\n.p-panel-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: ").concat(dt("panel.header.padding"), ";\n background: ").concat(dt("panel.header.background"), ";\n color: ").concat(dt("panel.header.color"), ";\n border-style: solid;\n border-width: ").concat(dt("panel.header.border.width"), ";\n border-color: ").concat(dt("panel.header.border.color"), ";\n border-radius: ").concat(dt("panel.header.border.radius"), ";\n}\n\n.p-panel-toggleable .p-panel-header {\n padding: ").concat(dt("panel.toggleable.header.padding"), ";\n}\n\n.p-panel-title {\n line-height: 1;\n font-weight: ").concat(dt("panel.title.font.weight"), ";\n}\n\n.p-panel-content {\n padding: ").concat(dt("panel.content.padding"), ";\n}\n\n.p-panel-footer {\n padding: ").concat(dt("panel.footer.padding"), ";\n}\n"); -}, "theme"); -var classes$2 = { - root: /* @__PURE__ */ __name(function root9(_ref2) { - var props = _ref2.props; - return ["p-panel p-component", { - "p-panel-toggleable": props.toggleable - }]; - }, "root"), - header: "p-panel-header", - title: "p-panel-title", - headerActions: "p-panel-header-actions", - pcToggleButton: "p-panel-toggle-button", - contentContainer: "p-panel-content-container", - content: "p-panel-content", - footer: "p-panel-footer" -}; -var PanelStyle = BaseStyle.extend({ - name: "panel", - theme: theme$2, - classes: classes$2 -}); -var script$1$2 = { - name: "BasePanel", - "extends": script$g, - props: { - header: String, - toggleable: Boolean, - collapsed: Boolean, - toggleButtonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default() { - return { - severity: "secondary", - text: true, - rounded: true - }; - }, "_default") - } - }, - style: PanelStyle, - provide: /* @__PURE__ */ __name(function provide11() { - return { - $pcPanel: this, - $parentInstance: this - }; - }, "provide") -}; -var script$4 = { - name: "Panel", - "extends": script$1$2, - inheritAttrs: false, - emits: ["update:collapsed", "toggle"], - data: /* @__PURE__ */ __name(function data7() { - return { - id: this.$attrs.id, - d_collapsed: this.collapsed - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId3(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId"), - collapsed: /* @__PURE__ */ __name(function collapsed(newValue) { - this.d_collapsed = newValue; - }, "collapsed") - }, - mounted: /* @__PURE__ */ __name(function mounted7() { - this.id = this.id || UniqueComponentId(); - }, "mounted"), - methods: { - toggle: /* @__PURE__ */ __name(function toggle2(event) { - this.d_collapsed = !this.d_collapsed; - this.$emit("update:collapsed", this.d_collapsed); - this.$emit("toggle", { - originalEvent: event, - value: this.d_collapsed - }); - }, "toggle"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown3(event) { - if (event.code === "Enter" || event.code === "NumpadEnter" || event.code === "Space") { - this.toggle(event); - event.preventDefault(); - } - }, "onKeyDown") - }, - computed: { - buttonAriaLabel: /* @__PURE__ */ __name(function buttonAriaLabel() { - return this.toggleButtonProps && this.toggleButtonProps.ariaLabel ? this.toggleButtonProps.ariaLabel : this.header; - }, "buttonAriaLabel") - }, - components: { - PlusIcon: script$C, - MinusIcon: script$D, - Button: script$f - }, - directives: { - ripple: Ripple - } -}; -var _hoisted_1$a = ["id"]; -var _hoisted_2$8 = ["id", "aria-labelledby"]; -function render$8(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Button = resolveComponent("Button"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("header") - }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header", { - id: $data.id + "_header", - "class": normalizeClass(_ctx.cx("title")) - }, function() { - return [_ctx.header ? (openBlock(), createElementBlock("span", mergeProps({ - key: 0, - id: $data.id + "_header", - "class": _ctx.cx("title") - }, _ctx.ptm("title")), toDisplayString(_ctx.header), 17, _hoisted_1$a)) : createCommentVNode("", true)]; - }), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("headerActions") - }, _ctx.ptm("headerActions")), [renderSlot(_ctx.$slots, "icons"), _ctx.toggleable ? (openBlock(), createBlock(_component_Button, mergeProps({ - key: 0, - id: $data.id + "_header", - "class": _ctx.cx("pcToggleButton"), - "aria-label": $options.buttonAriaLabel, - "aria-controls": $data.id + "_content", - "aria-expanded": !$data.d_collapsed, - unstyled: _ctx.unstyled, - onClick: $options.toggle, - onKeydown: $options.onKeyDown - }, _ctx.toggleButtonProps, { - pt: _ctx.ptm("pcToggleButton") - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, _ctx.$slots.toggleicon ? "toggleicon" : "togglericon", { - collapsed: $data.d_collapsed - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent($data.d_collapsed ? "PlusIcon" : "MinusIcon"), mergeProps({ - "class": slotProps["class"] - }, _ctx.ptm("pcToggleButton")["icon"]), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["id", "class", "aria-label", "aria-controls", "aria-expanded", "unstyled", "onClick", "onKeydown", "pt"])) : createCommentVNode("", true)], 16)], 16), createVNode(Transition, mergeProps({ - name: "p-toggleable-content" - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [withDirectives(createBaseVNode("div", mergeProps({ - id: $data.id + "_content", - "class": _ctx.cx("contentContainer"), - role: "region", - "aria-labelledby": $data.id + "_header" - }, _ctx.ptm("contentContainer")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("content") - }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("footer") - }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true)], 16, _hoisted_2$8), [[vShow, !$data.d_collapsed]])]; - }), - _: 3 - }, 16)], 16); -} -__name(render$8, "render$8"); -script$4.render = render$8; -const _hoisted_1$9 = { +const _hoisted_1$c = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; -const _hoisted_2$7 = /* @__PURE__ */ createBaseVNode("path", { +const _hoisted_2$a = /* @__PURE__ */ createBaseVNode("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", @@ -6253,20 +5497,20 @@ const _hoisted_2$7 = /* @__PURE__ */ createBaseVNode("path", { "stroke-width": "2", d: "M6 4v16m4-16l10 8l-10 8z" }, null, -1); -const _hoisted_3$6 = [ - _hoisted_2$7 +const _hoisted_3$9 = [ + _hoisted_2$a ]; -function render$7(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$9, [..._hoisted_3$6]); +function render$9(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$c, [..._hoisted_3$9]); } -__name(render$7, "render$7"); -const __unplugin_components_3 = markRaw({ name: "lucide-step-forward", render: render$7 }); -const _hoisted_1$8 = { +__name(render$9, "render$9"); +const __unplugin_components_3 = markRaw({ name: "lucide-step-forward", render: render$9 }); +const _hoisted_1$b = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; -const _hoisted_2$6 = /* @__PURE__ */ createBaseVNode("path", { +const _hoisted_2$9 = /* @__PURE__ */ createBaseVNode("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", @@ -6274,20 +5518,20 @@ const _hoisted_2$6 = /* @__PURE__ */ createBaseVNode("path", { "stroke-width": "2", d: "m13 19l9-7l-9-7zM2 19l9-7l-9-7z" }, null, -1); -const _hoisted_3$5 = [ - _hoisted_2$6 +const _hoisted_3$8 = [ + _hoisted_2$9 ]; -function render$6(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$8, [..._hoisted_3$5]); +function render$8(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$b, [..._hoisted_3$8]); } -__name(render$6, "render$6"); -const __unplugin_components_2 = markRaw({ name: "lucide-fast-forward", render: render$6 }); -const _hoisted_1$7 = { +__name(render$8, "render$8"); +const __unplugin_components_2 = markRaw({ name: "lucide-fast-forward", render: render$8 }); +const _hoisted_1$a = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; -const _hoisted_2$5 = /* @__PURE__ */ createBaseVNode("path", { +const _hoisted_2$8 = /* @__PURE__ */ createBaseVNode("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", @@ -6295,20 +5539,20 @@ const _hoisted_2$5 = /* @__PURE__ */ createBaseVNode("path", { "stroke-width": "2", d: "m6 3l14 9l-14 9z" }, null, -1); -const _hoisted_3$4 = [ - _hoisted_2$5 +const _hoisted_3$7 = [ + _hoisted_2$8 ]; -function render$5(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$7, [..._hoisted_3$4]); +function render$7(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$a, [..._hoisted_3$7]); } -__name(render$5, "render$5"); -const __unplugin_components_1$1 = markRaw({ name: "lucide-play", render: render$5 }); -const _hoisted_1$6 = { +__name(render$7, "render$7"); +const __unplugin_components_1$1 = markRaw({ name: "lucide-play", render: render$7 }); +const _hoisted_1$9 = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; -const _hoisted_2$4 = /* @__PURE__ */ createBaseVNode("g", { +const _hoisted_2$7 = /* @__PURE__ */ createBaseVNode("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", @@ -6318,28 +5562,28 @@ const _hoisted_2$4 = /* @__PURE__ */ createBaseVNode("g", { /* @__PURE__ */ createBaseVNode("path", { d: "M16 12H3m13 6H3m7-12H3m18 12V8a2 2 0 0 0-2-2h-5" }), /* @__PURE__ */ createBaseVNode("path", { d: "m16 8l-2-2l2-2" }) ], -1); -const _hoisted_3$3 = [ - _hoisted_2$4 +const _hoisted_3$6 = [ + _hoisted_2$7 ]; -function render$4(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$6, [..._hoisted_3$3]); +function render$6(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$9, [..._hoisted_3$6]); } -__name(render$4, "render$4"); -const __unplugin_components_0$1 = markRaw({ name: "lucide-list-start", render: render$4 }); -var theme$1 = /* @__PURE__ */ __name(function theme8(_ref) { +__name(render$6, "render$6"); +const __unplugin_components_0$1 = markRaw({ name: "lucide-list-start", render: render$6 }); +var theme$2 = /* @__PURE__ */ __name(function theme6(_ref) { var dt = _ref.dt; return "\n.p-tieredmenu {\n background: ".concat(dt("tieredmenu.background"), ";\n color: ").concat(dt("tieredmenu.color"), ";\n border: 1px solid ").concat(dt("tieredmenu.border.color"), ";\n border-radius: ").concat(dt("tieredmenu.border.radius"), ";\n min-width: 12.5rem;\n}\n\n.p-tieredmenu-root-list,\n.p-tieredmenu-submenu {\n margin: 0;\n padding: ").concat(dt("tieredmenu.list.padding"), ";\n list-style: none;\n outline: 0 none;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("tieredmenu.list.gap"), ";\n}\n\n.p-tieredmenu-submenu {\n position: absolute;\n min-width: 100%;\n z-index: 1;\n background: ").concat(dt("tieredmenu.background"), ";\n color: ").concat(dt("tieredmenu.color"), ";\n border: 1px solid ").concat(dt("tieredmenu.border.color"), ";\n border-radius: ").concat(dt("tieredmenu.border.radius"), ";\n box-shadow: ").concat(dt("tieredmenu.shadow"), ";\n}\n\n.p-tieredmenu-item {\n position: relative;\n}\n\n.p-tieredmenu-item-content {\n transition: background ").concat(dt("tieredmenu.transition.duration"), ", color ").concat(dt("tieredmenu.transition.duration"), ";\n border-radius: ").concat(dt("tieredmenu.item.border.radius"), ";\n color: ").concat(dt("tieredmenu.item.color"), ";\n}\n\n.p-tieredmenu-item-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n color: inherit;\n padding: ").concat(dt("tieredmenu.item.padding"), ";\n gap: ").concat(dt("tieredmenu.item.gap"), ";\n user-select: none;\n outline: 0 none;\n}\n\n.p-tieredmenu-item-label {\n line-height: 1;\n}\n\n.p-tieredmenu-item-icon {\n color: ").concat(dt("tieredmenu.item.icon.color"), ";\n}\n\n.p-tieredmenu-submenu-icon {\n color: ").concat(dt("tieredmenu.submenu.icon.color"), ";\n margin-left: auto;\n font-size: ").concat(dt("tieredmenu.submenu.icon.size"), ";\n width: ").concat(dt("tieredmenu.submenu.icon.size"), ";\n height: ").concat(dt("tieredmenu.submenu.icon.size"), ";\n}\n\n.p-tieredmenu-item.p-focus > .p-tieredmenu-item-content {\n color: ").concat(dt("tieredmenu.item.focus.color"), ";\n background: ").concat(dt("tieredmenu.item.focus.background"), ";\n}\n\n.p-tieredmenu-item.p-focus > .p-tieredmenu-item-content .p-tieredmenu-item-icon {\n color: ").concat(dt("tieredmenu.item.icon.focus.color"), ";\n}\n\n.p-tieredmenu-item.p-focus > .p-tieredmenu-item-content .p-tieredmenu-submenu-icon {\n color: ").concat(dt("tieredmenu.submenu.icon.focus.color"), ";\n}\n\n.p-tieredmenu-item:not(.p-disabled) > .p-tieredmenu-item-content:hover {\n color: ").concat(dt("tieredmenu.item.focus.color"), ";\n background: ").concat(dt("tieredmenu.item.focus.background"), ";\n}\n\n.p-tieredmenu-item:not(.p-disabled) > .p-tieredmenu-item-content:hover .p-tieredmenu-item-icon {\n color: ").concat(dt("tieredmenu.item.icon.focus.color"), ";\n}\n\n.p-tieredmenu-item:not(.p-disabled) > .p-tieredmenu-item-content:hover .p-tieredmenu-submenu-icon {\n color: ").concat(dt("tieredmenu.submenu.icon.focus.color"), ";\n}\n\n.p-tieredmenu-item-active > .p-tieredmenu-item-content {\n color: ").concat(dt("tieredmenu.item.active.color"), ";\n background: ").concat(dt("tieredmenu.item.active.background"), ";\n}\n\n.p-tieredmenu-item-active > .p-tieredmenu-item-content .p-tieredmenu-item-icon {\n color: ").concat(dt("tieredmenu.item.icon.active.color"), ";\n}\n\n.p-tieredmenu-item-active > .p-tieredmenu-item-content .p-tieredmenu-submenu-icon {\n color: ").concat(dt("tieredmenu.submenu.icon.active.color"), ";\n}\n\n.p-tieredmenu-separator {\n border-top: 1px solid ").concat(dt("tieredmenu.separator.border.color"), ";\n}\n\n.p-tieredmenu-overlay {\n box-shadow: ").concat(dt("tieredmenu.shadow"), ";\n}\n\n.p-tieredmenu-enter-from,\n.p-tieredmenu-leave-active {\n opacity: 0;\n}\n\n.p-tieredmenu-enter-active {\n transition: opacity 250ms;\n}\n"); }, "theme"); -var inlineStyles = { - submenu: /* @__PURE__ */ __name(function submenu2(_ref2) { +var inlineStyles$1 = { + submenu: /* @__PURE__ */ __name(function submenu(_ref2) { var instance = _ref2.instance, processedItem = _ref2.processedItem; return { display: instance.isItemActive(processedItem) ? "flex" : "none" }; }, "submenu") }; -var classes$1 = { - root: /* @__PURE__ */ __name(function root10(_ref3) { +var classes$2 = { + root: /* @__PURE__ */ __name(function root8(_ref3) { _ref3.instance; var props = _ref3.props; return ["p-tieredmenu p-component", { @@ -6348,7 +5592,7 @@ var classes$1 = { }, "root"), start: "p-tieredmenu-start", rootList: "p-tieredmenu-root-list", - item: /* @__PURE__ */ __name(function item2(_ref4) { + item: /* @__PURE__ */ __name(function item(_ref4) { var instance = _ref4.instance, processedItem = _ref4.processedItem; return ["p-tieredmenu-item", { "p-tieredmenu-item-active": instance.isItemActive(processedItem), @@ -6367,13 +5611,13 @@ var classes$1 = { }; var TieredMenuStyle = BaseStyle.extend({ name: "tieredmenu", - theme: theme$1, - classes: classes$1, - inlineStyles + theme: theme$2, + classes: classes$2, + inlineStyles: inlineStyles$1 }); -var script$2 = { +var script$2$1 = { name: "BaseTieredMenu", - "extends": script$g, + "extends": script$e, props: { popup: { type: Boolean, @@ -6413,17 +5657,17 @@ var script$2 = { } }, style: TieredMenuStyle, - provide: /* @__PURE__ */ __name(function provide12() { + provide: /* @__PURE__ */ __name(function provide10() { return { $pcTieredMenu: this, $parentInstance: this }; }, "provide") }; -var script$1$1 = { +var script$1$2 = { name: "TieredMenuSub", hostName: "TieredMenu", - "extends": script$g, + "extends": script$e, emits: ["item-click", "item-mouseenter", "item-mousemove"], container: null, props: { @@ -6461,22 +5705,22 @@ var script$1$1 = { } }, methods: { - getItemId: /* @__PURE__ */ __name(function getItemId2(processedItem) { + getItemId: /* @__PURE__ */ __name(function getItemId(processedItem) { return "".concat(this.menuId, "_").concat(processedItem.key); }, "getItemId"), - getItemKey: /* @__PURE__ */ __name(function getItemKey2(processedItem) { + getItemKey: /* @__PURE__ */ __name(function getItemKey(processedItem) { return this.getItemId(processedItem); }, "getItemKey"), - getItemProp: /* @__PURE__ */ __name(function getItemProp3(processedItem, name, params) { + getItemProp: /* @__PURE__ */ __name(function getItemProp(processedItem, name, params) { return processedItem && processedItem.item ? resolve(processedItem.item[name], params) : void 0; }, "getItemProp"), - getItemLabel: /* @__PURE__ */ __name(function getItemLabel3(processedItem) { + getItemLabel: /* @__PURE__ */ __name(function getItemLabel(processedItem) { return this.getItemProp(processedItem, "label"); }, "getItemLabel"), - getItemLabelId: /* @__PURE__ */ __name(function getItemLabelId2(processedItem) { + getItemLabelId: /* @__PURE__ */ __name(function getItemLabelId(processedItem) { return "".concat(this.menuId, "_").concat(processedItem.key, "_label"); }, "getItemLabelId"), - getPTOptions: /* @__PURE__ */ __name(function getPTOptions5(processedItem, index, key) { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions4(processedItem, index, key) { return this.ptm(key, { context: { item: processedItem.item, @@ -6487,27 +5731,27 @@ var script$1$1 = { } }); }, "getPTOptions"), - isItemActive: /* @__PURE__ */ __name(function isItemActive2(processedItem) { + isItemActive: /* @__PURE__ */ __name(function isItemActive(processedItem) { return this.activeItemPath.some(function(path) { return path.key === processedItem.key; }); }, "isItemActive"), - isItemVisible: /* @__PURE__ */ __name(function isItemVisible3(processedItem) { + isItemVisible: /* @__PURE__ */ __name(function isItemVisible(processedItem) { return this.getItemProp(processedItem, "visible") !== false; }, "isItemVisible"), - isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled3(processedItem) { + isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled(processedItem) { return this.getItemProp(processedItem, "disabled"); }, "isItemDisabled"), - isItemFocused: /* @__PURE__ */ __name(function isItemFocused2(processedItem) { + isItemFocused: /* @__PURE__ */ __name(function isItemFocused(processedItem) { return this.focusedItemId === this.getItemId(processedItem); }, "isItemFocused"), - isItemGroup: /* @__PURE__ */ __name(function isItemGroup3(processedItem) { + isItemGroup: /* @__PURE__ */ __name(function isItemGroup(processedItem) { return isNotEmpty(processedItem.items); }, "isItemGroup"), onEnter: /* @__PURE__ */ __name(function onEnter2() { nestedPosition(this.container, this.level); }, "onEnter"), - onItemClick: /* @__PURE__ */ __name(function onItemClick3(event, processedItem) { + onItemClick: /* @__PURE__ */ __name(function onItemClick(event, processedItem) { this.getItemProp(processedItem, "command", { originalEvent: event, item: processedItem.item @@ -6518,31 +5762,31 @@ var script$1$1 = { isFocus: true }); }, "onItemClick"), - onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter3(event, processedItem) { + onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter(event, processedItem) { this.$emit("item-mouseenter", { originalEvent: event, processedItem }); }, "onItemMouseEnter"), - onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove3(event, processedItem) { + onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove(event, processedItem) { this.$emit("item-mousemove", { originalEvent: event, processedItem }); }, "onItemMouseMove"), - getAriaSetSize: /* @__PURE__ */ __name(function getAriaSetSize2() { + getAriaSetSize: /* @__PURE__ */ __name(function getAriaSetSize() { var _this = this; return this.items.filter(function(processedItem) { return _this.isItemVisible(processedItem) && !_this.getItemProp(processedItem, "separator"); }).length; }, "getAriaSetSize"), - getAriaPosInset: /* @__PURE__ */ __name(function getAriaPosInset3(index) { + getAriaPosInset: /* @__PURE__ */ __name(function getAriaPosInset2(index) { var _this2 = this; return index - this.items.slice(0, index).filter(function(processedItem) { return _this2.isItemVisible(processedItem) && _this2.getItemProp(processedItem, "separator"); }).length + 1; }, "getAriaPosInset"), - getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps2(processedItem, index) { + getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps(processedItem, index) { return { action: mergeProps({ "class": this.cx("itemLink"), @@ -6560,22 +5804,22 @@ var script$1$1 = { }, this.getPTOptions(processedItem, index, "submenuIcon")) }; }, "getMenuItemProps"), - containerRef: /* @__PURE__ */ __name(function containerRef2(el) { + containerRef: /* @__PURE__ */ __name(function containerRef(el) { this.container = el; }, "containerRef") }, components: { - AngleRightIcon: script$z + AngleRightIcon: script$w }, directives: { ripple: Ripple } }; -var _hoisted_1$1$1 = ["tabindex"]; -var _hoisted_2$3 = ["id", "aria-label", "aria-disabled", "aria-expanded", "aria-haspopup", "aria-level", "aria-setsize", "aria-posinset", "data-p-active", "data-p-focused", "data-p-disabled"]; -var _hoisted_3$2 = ["onClick", "onMouseenter", "onMousemove"]; -var _hoisted_4 = ["href", "target"]; -var _hoisted_5 = ["id"]; +var _hoisted_1$1$2 = ["tabindex"]; +var _hoisted_2$6 = ["id", "aria-label", "aria-disabled", "aria-expanded", "aria-haspopup", "aria-level", "aria-setsize", "aria-posinset", "data-p-active", "data-p-focused", "data-p-disabled"]; +var _hoisted_3$5 = ["onClick", "onMouseenter", "onMousemove"]; +var _hoisted_4$1 = ["href", "target"]; +var _hoisted_5$1 = ["id"]; var _hoisted_6 = ["id"]; function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { var _component_AngleRightIcon = resolveComponent("AngleRightIcon"); @@ -6645,7 +5889,7 @@ function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { id: $options.getItemLabelId(processedItem), "class": _ctx.cx("itemLabel"), ref_for: true - }, $options.getPTOptions(processedItem, index, "itemLabel")), toDisplayString($options.getItemLabel(processedItem)), 17, _hoisted_5), $options.getItemProp(processedItem, "items") ? (openBlock(), createElementBlock(Fragment, { + }, $options.getPTOptions(processedItem, index, "itemLabel")), toDisplayString($options.getItemLabel(processedItem)), 17, _hoisted_5$1), $options.getItemProp(processedItem, "items") ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [$props.templates.submenuicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.submenuicon), mergeProps({ key: 0, @@ -6656,13 +5900,13 @@ function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { key: 1, "class": _ctx.cx("submenuIcon"), ref_for: true - }, $options.getPTOptions(processedItem, index, "submenuIcon")), null, 16, ["class"]))], 64)) : createCommentVNode("", true)], 16, _hoisted_4)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { + }, $options.getPTOptions(processedItem, index, "submenuIcon")), null, 16, ["class"]))], 64)) : createCommentVNode("", true)], 16, _hoisted_4$1)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { key: 1, item: processedItem.item, hasSubmenu: $options.getItemProp(processedItem, "items"), label: $options.getItemLabel(processedItem), props: $options.getMenuItemProps(processedItem, index) - }, null, 8, ["item", "hasSubmenu", "label", "props"]))], 16, _hoisted_3$2), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_TieredMenuSub, { + }, null, 8, ["item", "hasSubmenu", "label", "props"]))], 16, _hoisted_3$5), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_TieredMenuSub, { key: 0, id: $options.getItemId(processedItem) + "_list", style: normalizeStyle(_ctx.sx("submenu", true, { @@ -6688,7 +5932,7 @@ function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { onItemMousemove: _cache[2] || (_cache[2] = function($event) { return _ctx.$emit("item-mousemove", $event); }) - }, null, 8, ["id", "style", "aria-labelledby", "menuId", "focusedItemId", "items", "templates", "activeItemPath", "level", "visible", "pt", "unstyled"])) : createCommentVNode("", true)], 16, _hoisted_2$3)) : createCommentVNode("", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ + }, null, 8, ["id", "style", "aria-labelledby", "menuId", "focusedItemId", "items", "templates", "activeItemPath", "level", "visible", "pt", "unstyled"])) : createCommentVNode("", true)], 16, _hoisted_2$6)) : createCommentVNode("", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ key: 1, id: $options.getItemId(processedItem), style: $options.getItemProp(processedItem, "style"), @@ -6696,16 +5940,16 @@ function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { role: "separator", ref_for: true }, _ctx.ptm("separator")), null, 16, _hoisted_6)) : createCommentVNode("", true)], 64); - }), 128))], 16, _hoisted_1$1$1)) : createCommentVNode("", true)]; + }), 128))], 16, _hoisted_1$1$2)) : createCommentVNode("", true)]; }), _: 1 }, 16, ["onEnter"]); } __name(render$1$1, "render$1$1"); -script$1$1.render = render$1$1; -var script$3 = { +script$1$2.render = render$1$1; +var script$4 = { name: "TieredMenu", - "extends": script$2, + "extends": script$2$1, inheritAttrs: false, emits: ["focus", "blur", "before-show", "before-hide", "hide", "show"], outsideClickListener: null, @@ -6716,7 +5960,7 @@ var script$3 = { menubar: null, searchTimeout: null, searchValue: null, - data: /* @__PURE__ */ __name(function data8() { + data: /* @__PURE__ */ __name(function data6() { return { id: this.$attrs.id, focused: false, @@ -6732,10 +5976,10 @@ var script$3 = { }; }, "data"), watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId4(newValue) { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId2(newValue) { this.id = newValue || UniqueComponentId(); }, "$attrsId"), - activeItemPath: /* @__PURE__ */ __name(function activeItemPath2(newPath) { + activeItemPath: /* @__PURE__ */ __name(function activeItemPath(newPath) { if (!this.popup) { if (isNotEmpty(newPath)) { this.bindOutsideClickListener(); @@ -6747,10 +5991,10 @@ var script$3 = { } }, "activeItemPath") }, - mounted: /* @__PURE__ */ __name(function mounted8() { + mounted: /* @__PURE__ */ __name(function mounted6() { this.id = this.id || UniqueComponentId(); }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount7() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount6() { this.unbindOutsideClickListener(); this.unbindResizeListener(); if (this.scrollHandler) { @@ -6764,34 +6008,34 @@ var script$3 = { this.container = null; }, "beforeUnmount"), methods: { - getItemProp: /* @__PURE__ */ __name(function getItemProp4(item3, name) { + getItemProp: /* @__PURE__ */ __name(function getItemProp2(item3, name) { return item3 ? resolve(item3[name]) : void 0; }, "getItemProp"), - getItemLabel: /* @__PURE__ */ __name(function getItemLabel4(item3) { + getItemLabel: /* @__PURE__ */ __name(function getItemLabel2(item3) { return this.getItemProp(item3, "label"); }, "getItemLabel"), - isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled4(item3) { + isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled2(item3) { return this.getItemProp(item3, "disabled"); }, "isItemDisabled"), - isItemVisible: /* @__PURE__ */ __name(function isItemVisible4(item3) { + isItemVisible: /* @__PURE__ */ __name(function isItemVisible2(item3) { return this.getItemProp(item3, "visible") !== false; }, "isItemVisible"), - isItemGroup: /* @__PURE__ */ __name(function isItemGroup4(item3) { + isItemGroup: /* @__PURE__ */ __name(function isItemGroup2(item3) { return isNotEmpty(this.getItemProp(item3, "items")); }, "isItemGroup"), - isItemSeparator: /* @__PURE__ */ __name(function isItemSeparator2(item3) { + isItemSeparator: /* @__PURE__ */ __name(function isItemSeparator(item3) { return this.getItemProp(item3, "separator"); }, "isItemSeparator"), - getProccessedItemLabel: /* @__PURE__ */ __name(function getProccessedItemLabel2(processedItem) { + getProccessedItemLabel: /* @__PURE__ */ __name(function getProccessedItemLabel(processedItem) { return processedItem ? this.getItemLabel(processedItem.item) : void 0; }, "getProccessedItemLabel"), - isProccessedItemGroup: /* @__PURE__ */ __name(function isProccessedItemGroup2(processedItem) { + isProccessedItemGroup: /* @__PURE__ */ __name(function isProccessedItemGroup(processedItem) { return processedItem && isNotEmpty(processedItem.items); }, "isProccessedItemGroup"), - toggle: /* @__PURE__ */ __name(function toggle3(event) { + toggle: /* @__PURE__ */ __name(function toggle(event) { this.visible ? this.hide(event, true) : this.show(event); }, "toggle"), - show: /* @__PURE__ */ __name(function show3(event, isFocus) { + show: /* @__PURE__ */ __name(function show2(event, isFocus) { if (this.popup) { this.$emit("before-show"); this.visible = true; @@ -6800,7 +6044,7 @@ var script$3 = { } isFocus && focus(this.menubar); }, "show"), - hide: /* @__PURE__ */ __name(function hide3(event, isFocus) { + hide: /* @__PURE__ */ __name(function hide2(event, isFocus) { if (this.popup) { this.$emit("before-hide"); this.visible = false; @@ -6814,7 +6058,7 @@ var script$3 = { isFocus && focus(this.relatedTarget || this.target || this.menubar); this.dirty = false; }, "hide"), - onFocus: /* @__PURE__ */ __name(function onFocus4(event) { + onFocus: /* @__PURE__ */ __name(function onFocus3(event) { this.focused = true; if (!this.popup) { this.focusedItemInfo = this.focusedItemInfo.index !== -1 ? this.focusedItemInfo : { @@ -6825,7 +6069,7 @@ var script$3 = { } this.$emit("focus", event); }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur3(event) { + onBlur: /* @__PURE__ */ __name(function onBlur2(event) { this.focused = false; this.focusedItemInfo = { index: -1, @@ -6836,7 +6080,7 @@ var script$3 = { this.dirty = false; this.$emit("blur", event); }, "onBlur"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown4(event) { + onKeyDown: /* @__PURE__ */ __name(function onKeyDown2(event) { if (this.disabled) { event.preventDefault(); return; @@ -6887,7 +6131,7 @@ var script$3 = { break; } }, "onKeyDown"), - onItemChange: /* @__PURE__ */ __name(function onItemChange2(event) { + onItemChange: /* @__PURE__ */ __name(function onItemChange(event) { var processedItem = event.processedItem, isFocus = event.isFocus; if (isEmpty(processedItem)) return; var index = processedItem.index, key = processedItem.key, level = processedItem.level, parentKey = processedItem.parentKey, items = processedItem.items; @@ -6914,10 +6158,10 @@ var script$3 = { target: this.target }); }, "onOverlayClick"), - onItemClick: /* @__PURE__ */ __name(function onItemClick4(event) { + onItemClick: /* @__PURE__ */ __name(function onItemClick2(event) { var originalEvent = event.originalEvent, processedItem = event.processedItem; var grouped = this.isProccessedItemGroup(processedItem); - var root12 = isEmpty(processedItem.parent); + var root11 = isEmpty(processedItem.parent); var selected = this.isSelected(processedItem); if (selected) { var index = processedItem.index, key = processedItem.key, level = processedItem.level, parentKey = processedItem.parentKey; @@ -6929,13 +6173,13 @@ var script$3 = { level, parentKey }; - this.dirty = !root12; + this.dirty = !root11; focus(this.menubar); } else { if (grouped) { this.onItemChange(event); } else { - var rootProcessedItem = root12 ? processedItem : this.activeItemPath.find(function(p) { + var rootProcessedItem = root11 ? processedItem : this.activeItemPath.find(function(p) { return p.parentKey === ""; }); this.hide(originalEvent); @@ -6944,22 +6188,22 @@ var script$3 = { } } }, "onItemClick"), - onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter4(event) { + onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter2(event) { if (this.dirty) { this.onItemChange(event); } }, "onItemMouseEnter"), - onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove4(event) { + onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove2(event) { if (this.focused) { this.changeFocusedItemIndex(event, event.processedItem.index); } }, "onItemMouseMove"), - onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey3(event) { + onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey2(event) { var itemIndex = this.focusedItemInfo.index !== -1 ? this.findNextItemIndex(this.focusedItemInfo.index) : this.findFirstFocusedItemIndex(); this.changeFocusedItemIndex(event, itemIndex); event.preventDefault(); }, "onArrowDownKey"), - onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey3(event) { + onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey2(event) { if (event.altKey) { if (this.focusedItemInfo.index !== -1) { var processedItem = this.visibleItems[this.focusedItemInfo.index]; @@ -6977,14 +6221,14 @@ var script$3 = { event.preventDefault(); } }, "onArrowUpKey"), - onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey4(event) { + onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey3(event) { var _this = this; var processedItem = this.visibleItems[this.focusedItemInfo.index]; var parentItem = this.activeItemPath.find(function(p) { return p.key === processedItem.parentKey; }); - var root12 = isEmpty(processedItem.parent); - if (!root12) { + var root11 = isEmpty(processedItem.parent); + if (!root11) { this.focusedItemInfo = { index: -1, parentKey: parentItem ? parentItem.parentKey : "" @@ -6997,7 +6241,7 @@ var script$3 = { }); event.preventDefault(); }, "onArrowLeftKey"), - onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey4(event) { + onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey3(event) { var processedItem = this.visibleItems[this.focusedItemInfo.index]; var grouped = this.isProccessedItemGroup(processedItem); if (grouped) { @@ -7014,15 +6258,15 @@ var script$3 = { } event.preventDefault(); }, "onArrowRightKey"), - onHomeKey: /* @__PURE__ */ __name(function onHomeKey4(event) { + onHomeKey: /* @__PURE__ */ __name(function onHomeKey3(event) { this.changeFocusedItemIndex(event, this.findFirstItemIndex()); event.preventDefault(); }, "onHomeKey"), - onEndKey: /* @__PURE__ */ __name(function onEndKey4(event) { + onEndKey: /* @__PURE__ */ __name(function onEndKey3(event) { this.changeFocusedItemIndex(event, this.findLastItemIndex()); event.preventDefault(); }, "onEndKey"), - onEnterKey: /* @__PURE__ */ __name(function onEnterKey4(event) { + onEnterKey: /* @__PURE__ */ __name(function onEnterKey3(event) { if (this.focusedItemInfo.index !== -1) { var element = findSingle(this.menubar, 'li[id="'.concat("".concat(this.focusedItemId), '"]')); var anchorElement = element && findSingle(element, '[data-pc-section="itemlink"]'); @@ -7035,10 +6279,10 @@ var script$3 = { } event.preventDefault(); }, "onEnterKey"), - onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey2(event) { + onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey(event) { this.onEnterKey(event); }, "onSpaceKey"), - onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey3(event) { + onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey2(event) { if (this.popup || this.focusedItemInfo.level !== 0) { var _focusedItemInfo = this.focusedItemInfo; this.hide(event, false); @@ -7051,7 +6295,7 @@ var script$3 = { } event.preventDefault(); }, "onEscapeKey"), - onTabKey: /* @__PURE__ */ __name(function onTabKey3(event) { + onTabKey: /* @__PURE__ */ __name(function onTabKey2(event) { if (this.focusedItemInfo.index !== -1) { var processedItem = this.visibleItems[this.focusedItemInfo.index]; var grouped = this.isProccessedItemGroup(processedItem); @@ -7101,7 +6345,7 @@ var script$3 = { this.container.style.minWidth = getOuterWidth(this.target) + "px"; } }, "alignOverlay"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener3() { + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener2() { var _this2 = this; if (!this.outsideClickListener) { this.outsideClickListener = function(event) { @@ -7114,7 +6358,7 @@ var script$3 = { document.addEventListener("click", this.outsideClickListener); } }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener3() { + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener2() { if (this.outsideClickListener) { document.removeEventListener("click", this.outsideClickListener); this.outsideClickListener = null; @@ -7134,7 +6378,7 @@ var script$3 = { this.scrollHandler.unbindScrollListener(); } }, "unbindScrollListener"), - bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener3() { + bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener2() { var _this4 = this; if (!this.resizeListener) { this.resizeListener = function(event) { @@ -7145,68 +6389,68 @@ var script$3 = { window.addEventListener("resize", this.resizeListener); } }, "bindResizeListener"), - unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener3() { + unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener2() { if (this.resizeListener) { window.removeEventListener("resize", this.resizeListener); this.resizeListener = null; } }, "unbindResizeListener"), - isItemMatched: /* @__PURE__ */ __name(function isItemMatched2(processedItem) { + isItemMatched: /* @__PURE__ */ __name(function isItemMatched(processedItem) { var _this$getProccessedIt; return this.isValidItem(processedItem) && ((_this$getProccessedIt = this.getProccessedItemLabel(processedItem)) === null || _this$getProccessedIt === void 0 ? void 0 : _this$getProccessedIt.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase())); }, "isItemMatched"), - isValidItem: /* @__PURE__ */ __name(function isValidItem2(processedItem) { + isValidItem: /* @__PURE__ */ __name(function isValidItem(processedItem) { return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item) && this.isItemVisible(processedItem.item); }, "isValidItem"), - isValidSelectedItem: /* @__PURE__ */ __name(function isValidSelectedItem2(processedItem) { + isValidSelectedItem: /* @__PURE__ */ __name(function isValidSelectedItem(processedItem) { return this.isValidItem(processedItem) && this.isSelected(processedItem); }, "isValidSelectedItem"), - isSelected: /* @__PURE__ */ __name(function isSelected3(processedItem) { + isSelected: /* @__PURE__ */ __name(function isSelected2(processedItem) { return this.activeItemPath.some(function(p) { return p.key === processedItem.key; }); }, "isSelected"), - findFirstItemIndex: /* @__PURE__ */ __name(function findFirstItemIndex2() { + findFirstItemIndex: /* @__PURE__ */ __name(function findFirstItemIndex() { var _this5 = this; return this.visibleItems.findIndex(function(processedItem) { return _this5.isValidItem(processedItem); }); }, "findFirstItemIndex"), - findLastItemIndex: /* @__PURE__ */ __name(function findLastItemIndex2() { + findLastItemIndex: /* @__PURE__ */ __name(function findLastItemIndex() { var _this6 = this; return findLastIndex(this.visibleItems, function(processedItem) { return _this6.isValidItem(processedItem); }); }, "findLastItemIndex"), - findNextItemIndex: /* @__PURE__ */ __name(function findNextItemIndex2(index) { + findNextItemIndex: /* @__PURE__ */ __name(function findNextItemIndex(index) { var _this7 = this; var matchedItemIndex = index < this.visibleItems.length - 1 ? this.visibleItems.slice(index + 1).findIndex(function(processedItem) { return _this7.isValidItem(processedItem); }) : -1; return matchedItemIndex > -1 ? matchedItemIndex + index + 1 : index; }, "findNextItemIndex"), - findPrevItemIndex: /* @__PURE__ */ __name(function findPrevItemIndex2(index) { + findPrevItemIndex: /* @__PURE__ */ __name(function findPrevItemIndex(index) { var _this8 = this; var matchedItemIndex = index > 0 ? findLastIndex(this.visibleItems.slice(0, index), function(processedItem) { return _this8.isValidItem(processedItem); }) : -1; return matchedItemIndex > -1 ? matchedItemIndex : index; }, "findPrevItemIndex"), - findSelectedItemIndex: /* @__PURE__ */ __name(function findSelectedItemIndex2() { + findSelectedItemIndex: /* @__PURE__ */ __name(function findSelectedItemIndex() { var _this9 = this; return this.visibleItems.findIndex(function(processedItem) { return _this9.isValidSelectedItem(processedItem); }); }, "findSelectedItemIndex"), - findFirstFocusedItemIndex: /* @__PURE__ */ __name(function findFirstFocusedItemIndex2() { + findFirstFocusedItemIndex: /* @__PURE__ */ __name(function findFirstFocusedItemIndex() { var selectedIndex = this.findSelectedItemIndex(); return selectedIndex < 0 ? this.findFirstItemIndex() : selectedIndex; }, "findFirstFocusedItemIndex"), - findLastFocusedItemIndex: /* @__PURE__ */ __name(function findLastFocusedItemIndex2() { + findLastFocusedItemIndex: /* @__PURE__ */ __name(function findLastFocusedItemIndex() { var selectedIndex = this.findSelectedItemIndex(); return selectedIndex < 0 ? this.findLastItemIndex() : selectedIndex; }, "findLastFocusedItemIndex"), - searchItems: /* @__PURE__ */ __name(function searchItems2(event, _char) { + searchItems: /* @__PURE__ */ __name(function searchItems(event, _char) { var _this10 = this; this.searchValue = (this.searchValue || "") + _char; var itemIndex = -1; @@ -7241,13 +6485,13 @@ var script$3 = { }, 500); return matched; }, "searchItems"), - changeFocusedItemIndex: /* @__PURE__ */ __name(function changeFocusedItemIndex2(event, index) { + changeFocusedItemIndex: /* @__PURE__ */ __name(function changeFocusedItemIndex(event, index) { if (this.focusedItemInfo.index !== index) { this.focusedItemInfo.index = index; this.scrollInView(); } }, "changeFocusedItemIndex"), - scrollInView: /* @__PURE__ */ __name(function scrollInView4() { + scrollInView: /* @__PURE__ */ __name(function scrollInView3() { var index = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : -1; var id2 = index !== -1 ? "".concat(this.id, "_").concat(index) : this.focusedItemId; var element = findSingle(this.menubar, 'li[id="'.concat(id2, '"]')); @@ -7258,7 +6502,7 @@ var script$3 = { }); } }, "scrollInView"), - createProcessedItems: /* @__PURE__ */ __name(function createProcessedItems2(items) { + createProcessedItems: /* @__PURE__ */ __name(function createProcessedItems(items) { var _this11 = this; var level = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; var parent = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; @@ -7279,35 +6523,35 @@ var script$3 = { }); return processedItems3; }, "createProcessedItems"), - containerRef: /* @__PURE__ */ __name(function containerRef3(el) { + containerRef: /* @__PURE__ */ __name(function containerRef2(el) { this.container = el; }, "containerRef"), - menubarRef: /* @__PURE__ */ __name(function menubarRef2(el) { + menubarRef: /* @__PURE__ */ __name(function menubarRef(el) { this.menubar = el ? el.$el : void 0; }, "menubarRef") }, computed: { - processedItems: /* @__PURE__ */ __name(function processedItems2() { + processedItems: /* @__PURE__ */ __name(function processedItems() { return this.createProcessedItems(this.model || []); }, "processedItems"), - visibleItems: /* @__PURE__ */ __name(function visibleItems2() { + visibleItems: /* @__PURE__ */ __name(function visibleItems() { var _this12 = this; var processedItem = this.activeItemPath.find(function(p) { return p.key === _this12.focusedItemInfo.parentKey; }); return processedItem ? processedItem.items : this.processedItems; }, "visibleItems"), - focusedItemId: /* @__PURE__ */ __name(function focusedItemId2() { + focusedItemId: /* @__PURE__ */ __name(function focusedItemId() { return this.focusedItemInfo.index !== -1 ? "".concat(this.id).concat(isNotEmpty(this.focusedItemInfo.parentKey) ? "_" + this.focusedItemInfo.parentKey : "", "_").concat(this.focusedItemInfo.index) : null; }, "focusedItemId") }, components: { - TieredMenuSub: script$1$1, - Portal: script$m + TieredMenuSub: script$1$2, + Portal: script$k } }; -var _hoisted_1$5 = ["id"]; -function render$3(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$8 = ["id"]; +function render$5(_ctx, _cache, $props, $setup, $data, $options) { var _component_TieredMenuSub = resolveComponent("TieredMenuSub"); var _component_Portal = resolveComponent("Portal"); return openBlock(), createBlock(_component_Portal, { @@ -7362,7 +6606,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) { }, null, 8, ["id", "tabindex", "aria-label", "aria-labelledby", "aria-disabled", "aria-activedescendant", "menuId", "focusedItemId", "items", "templates", "activeItemPath", "visible", "pt", "unstyled", "onFocus", "onBlur", "onKeydown", "onItemClick", "onItemMouseenter", "onItemMousemove"]), _ctx.$slots.end ? (openBlock(), createElementBlock("div", mergeProps({ key: 1, "class": _ctx.cx("end") - }, _ctx.ptm("end")), [renderSlot(_ctx.$slots, "end")], 16)) : createCommentVNode("", true)], 16, _hoisted_1$5)) : createCommentVNode("", true)]; + }, _ctx.ptm("end")), [renderSlot(_ctx.$slots, "end")], 16)) : createCommentVNode("", true)], 16, _hoisted_1$8)) : createCommentVNode("", true)]; }), _: 3 }, 16, ["onEnter", "onAfterEnter", "onLeave", "onAfterLeave"])]; @@ -7370,14 +6614,14 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) { _: 3 }, 8, ["appendTo", "disabled"]); } -__name(render$3, "render$3"); -script$3.render = render$3; -var theme9 = /* @__PURE__ */ __name(function theme10(_ref) { +__name(render$5, "render$5"); +script$4.render = render$5; +var theme$1 = /* @__PURE__ */ __name(function theme7(_ref) { var dt = _ref.dt; return "\n.p-splitbutton {\n display: inline-flex;\n position: relative;\n border-radius: ".concat(dt("splitbutton.border.radius"), ";\n}\n\n.p-splitbutton-button {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n border-right: 0 none;\n}\n\n.p-splitbutton-button:focus-visible,\n.p-splitbutton-dropdown:focus-visible {\n z-index: 1;\n}\n\n.p-splitbutton-button:not(:disabled):hover,\n.p-splitbutton-button:not(:disabled):active {\n border-right: 0 none;\n}\n\n.p-splitbutton-dropdown {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.p-splitbutton .p-menu {\n min-width: 100%;\n}\n\n.p-splitbutton-fluid {\n display: flex;\n}\n\n.p-splitbutton-rounded .p-splitbutton-dropdown {\n border-top-right-radius: ").concat(dt("splitbutton.rounded.border.radius"), ";\n border-bottom-right-radius: ").concat(dt("splitbutton.rounded.border.radius"), ";\n}\n\n.p-splitbutton-rounded .p-splitbutton-button {\n border-top-left-radius: ").concat(dt("splitbutton.rounded.border.radius"), ";\n border-bottom-left-radius: ").concat(dt("splitbutton.rounded.border.radius"), ";\n}\n\n.p-splitbutton-raised {\n box-shadow: ").concat(dt("splitbutton.raised.shadow"), ";\n}\n"); }, "theme"); -var classes = { - root: /* @__PURE__ */ __name(function root11(_ref2) { +var classes$1 = { + root: /* @__PURE__ */ __name(function root9(_ref2) { var instance = _ref2.instance, props = _ref2.props; return ["p-splitbutton p-component", { "p-splitbutton-raised": props.raised, @@ -7390,12 +6634,12 @@ var classes = { }; var SplitButtonStyle = BaseStyle.extend({ name: "splitbutton", - theme: theme9, - classes + theme: theme$1, + classes: classes$1 }); -var script$1 = { +var script$1$1 = { name: "BaseSplitButton", - "extends": script$g, + "extends": script$e, props: { label: { type: String, @@ -7483,16 +6727,16 @@ var script$1 = { } }, style: SplitButtonStyle, - provide: /* @__PURE__ */ __name(function provide13() { + provide: /* @__PURE__ */ __name(function provide11() { return { $pcSplitButton: this, $parentInstance: this }; }, "provide") }; -var script = { +var script$3 = { name: "SplitButton", - "extends": script$1, + "extends": script$1$1, inheritAttrs: false, emits: ["click"], inject: { @@ -7500,18 +6744,18 @@ var script = { "default": null } }, - data: /* @__PURE__ */ __name(function data9() { + data: /* @__PURE__ */ __name(function data7() { return { id: this.$attrs.id, isExpanded: false }; }, "data"), watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId5(newValue) { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId3(newValue) { this.id = newValue || UniqueComponentId(); }, "$attrsId") }, - mounted: /* @__PURE__ */ __name(function mounted9() { + mounted: /* @__PURE__ */ __name(function mounted7() { var _this = this; this.id = this.id || UniqueComponentId(); this.$watch("$refs.menu.visible", function(newValue) { @@ -7551,13 +6795,13 @@ var script = { }, "hasFluid") }, components: { - PVSButton: script$f, - PVSMenu: script$3, - ChevronDownIcon: script$n + PVSButton: script$d, + PVSMenu: script$4, + ChevronDownIcon: script$l } }; -var _hoisted_1$4 = ["data-p-severity"]; -function render$2(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$7 = ["data-p-severity"]; +function render$4(_ctx, _cache, $props, $setup, $data, $options) { var _component_PVSButton = resolveComponent("PVSButton"); var _component_PVSMenu = resolveComponent("PVSMenu"); return openBlock(), createElementBlock("div", mergeProps({ @@ -7662,12 +6906,12 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) { })]; }), key: "1" - } : void 0]), 1032, ["id", "model", "autoZIndex", "baseZIndex", "appendTo", "unstyled", "pt"])], 16, _hoisted_1$4); + } : void 0]), 1032, ["id", "model", "autoZIndex", "baseZIndex", "appendTo", "unstyled", "pt"])], 16, _hoisted_1$7); } -__name(render$2, "render$2"); -script.render = render$2; +__name(render$4, "render$4"); +script$3.render = render$4; const minQueueCount = 1; -const _sfc_main$5 = /* @__PURE__ */ defineComponent({ +const _sfc_main$8 = /* @__PURE__ */ defineComponent({ __name: "BatchCountEdit", props: { class: { default: "" } @@ -7684,7 +6928,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({ let newCount; if (increment) { const originalCount = batchCount.value - 1; - newCount = originalCount * 2; + newCount = Math.min(originalCount * 2, maxQueueCount.value); } else { const originalCount = batchCount.value + 1; newCount = Math.floor(originalCount / 2); @@ -7696,7 +6940,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({ return withDirectives((openBlock(), createElementBlock("div", { class: normalizeClass(["batch-count", props.class]) }, [ - createVNode(unref(script$E), { + createVNode(unref(script$x), { class: "w-14", modelValue: unref(batchCount), "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(batchCount) ? batchCount.value = $event : null), @@ -7730,10 +6974,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({ }; } }); -const BatchCountEdit = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-713442be"]]); -const _withScopeId$1 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-d3897845"), n = n(), popScopeId(), n), "_withScopeId$1"); -const _hoisted_1$3 = { class: "queue-button-group flex" }; -const _sfc_main$4 = /* @__PURE__ */ defineComponent({ +const BatchCountEdit = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-b9328350"]]); +const _withScopeId$3 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-7f4f551b"), n = n(), popScopeId(), n), "_withScopeId$3"); +const _hoisted_1$6 = { class: "queue-button-group flex" }; +const _sfc_main$7 = /* @__PURE__ */ defineComponent({ __name: "ComfyQueueButton", setup(__props) { const workspaceStore = useWorkspaceStore(); @@ -7785,8 +7029,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ const _component_i_lucide58fast_forward = __unplugin_components_2; const _component_i_lucide58step_forward = __unplugin_components_3; const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock("div", _hoisted_1$3, [ - withDirectives((openBlock(), createBlock(unref(script), { + return openBlock(), createElementBlock("div", _hoisted_1$6, [ + withDirectives((openBlock(), createBlock(unref(script$3), { class: "comfyui-queue-button", label: activeQueueModeMenuItem.value.label, severity: "primary", @@ -7799,7 +7043,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ unref(workspaceStore).shiftDown ? (openBlock(), createBlock(_component_i_lucide58list_start, { key: 0 })) : unref(queueMode) === "disabled" ? (openBlock(), createBlock(_component_i_lucide58play, { key: 1 })) : unref(queueMode) === "instant" ? (openBlock(), createBlock(_component_i_lucide58fast_forward, { key: 2 })) : unref(queueMode) === "change" ? (openBlock(), createBlock(_component_i_lucide58step_forward, { key: 3 })) : createCommentVNode("", true) ]), item: withCtx(({ item: item3 }) => [ - withDirectives(createVNode(unref(script$f), { + withDirectives(createVNode(unref(script$d), { label: item3.label, icon: item3.icon, severity: item3.key === unref(queueMode) ? "primary" : "secondary", @@ -7819,9 +7063,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ ] ]), createVNode(BatchCountEdit), - createVNode(unref(script$7), { class: "execution-actions flex flex-nowrap" }, { + createVNode(unref(script$8), { class: "execution-actions flex flex-nowrap" }, { default: withCtx(() => [ - withDirectives(createVNode(unref(script$f), { + withDirectives(createVNode(unref(script$d), { icon: "pi pi-times", severity: executingPrompt.value ? "danger" : "secondary", disabled: !executingPrompt.value, @@ -7835,7 +7079,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ { bottom: true } ] ]), - withDirectives(createVNode(unref(script$f), { + withDirectives(createVNode(unref(script$d), { icon: "pi pi-stop", severity: hasPendingTasks.value ? "danger" : "secondary", disabled: !hasPendingTasks.value, @@ -7856,9 +7100,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ }; } }); -const ComfyQueueButton = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-d3897845"]]); +const ComfyQueueButton = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-7f4f551b"]]); const overlapThreshold = 20; -const _sfc_main$3 = /* @__PURE__ */ defineComponent({ +const _sfc_main$6 = /* @__PURE__ */ defineComponent({ __name: "ComfyActionbar", setup(__props) { const settingsStore = useSettingStore(); @@ -8007,7 +7251,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({ }); }); return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$4), { + return openBlock(), createBlock(unref(script$y), { class: normalizeClass(["actionbar w-fit", { "is-dragging": unref(isDragging), "is-docked": unref(isDocked) }]), style: normalizeStyle(unref(style)) }, { @@ -8030,42 +7274,42 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({ }; } }); -const Actionbar = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-542a7001"]]); -const _hoisted_1$2 = { +const Actionbar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-915e5456"]]); +const _hoisted_1$5 = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; -const _hoisted_2$2 = /* @__PURE__ */ createBaseVNode("path", { +const _hoisted_2$5 = /* @__PURE__ */ createBaseVNode("path", { fill: "currentColor", d: "M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm0-5v3h14v-3zm0-2h14V5H5zm0 2v3z" }, null, -1); -const _hoisted_3$1 = [ - _hoisted_2$2 +const _hoisted_3$4 = [ + _hoisted_2$5 ]; -function render$1(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$2, [..._hoisted_3$1]); +function render$3(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$5, [..._hoisted_3$4]); } -__name(render$1, "render$1"); -const __unplugin_components_1 = markRaw({ name: "material-symbols-dock-to-bottom-outline", render: render$1 }); -const _hoisted_1$1 = { +__name(render$3, "render$3"); +const __unplugin_components_1 = markRaw({ name: "material-symbols-dock-to-bottom-outline", render: render$3 }); +const _hoisted_1$4 = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; -const _hoisted_2$1 = /* @__PURE__ */ createBaseVNode("path", { +const _hoisted_2$4 = /* @__PURE__ */ createBaseVNode("path", { fill: "currentColor", d: "M5 21q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.587 1.413T19 21zm0-7h14V5H5z" }, null, -1); -const _hoisted_3 = [ - _hoisted_2$1 +const _hoisted_3$3 = [ + _hoisted_2$4 ]; -function render(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$1, [..._hoisted_3]); +function render$2(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$4, [..._hoisted_3$3]); } -__name(render, "render"); -const __unplugin_components_0 = markRaw({ name: "material-symbols-dock-to-bottom", render }); -const _sfc_main$2 = /* @__PURE__ */ defineComponent({ +__name(render$2, "render$2"); +const __unplugin_components_0 = markRaw({ name: "material-symbols-dock-to-bottom", render: render$2 }); +const _sfc_main$5 = /* @__PURE__ */ defineComponent({ __name: "BottomPanelToggleButton", setup(__props) { const bottomPanelStore = useBottomPanelStore(); @@ -8073,7 +7317,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({ const _component_i_material_symbols58dock_to_bottom = __unplugin_components_0; const _component_i_material_symbols58dock_to_bottom_outline = __unplugin_components_1; const _directive_tooltip = resolveDirective("tooltip"); - return withDirectives((openBlock(), createBlock(unref(script$f), { + return withDirectives((openBlock(), createBlock(unref(script$d), { severity: "secondary", text: "", onClick: unref(bottomPanelStore).toggleBottomPanel @@ -8089,7 +7333,1359 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({ }; } }); -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-d792da31"), n = n(), popScopeId(), n), "_withScopeId"); +var theme8 = /* @__PURE__ */ __name(function theme9(_ref) { + var dt = _ref.dt; + return "\n.p-menubar {\n display: flex;\n align-items: center;\n background: ".concat(dt("menubar.background"), ";\n border: 1px solid ").concat(dt("menubar.border.color"), ";\n border-radius: ").concat(dt("menubar.border.radius"), ";\n color: ").concat(dt("menubar.color"), ";\n padding: ").concat(dt("menubar.padding"), ";\n gap: ").concat(dt("menubar.gap"), ";\n}\n\n.p-menubar-start,\n.p-megamenu-end {\n display: flex;\n align-items: center;\n}\n\n.p-menubar-root-list,\n.p-menubar-submenu {\n display: flex;\n margin: 0;\n padding: 0;\n list-style: none;\n outline: 0 none;\n}\n\n.p-menubar-root-list {\n align-items: center;\n flex-wrap: wrap;\n gap: ").concat(dt("menubar.gap"), ";\n}\n\n.p-menubar-root-list > .p-menubar-item > .p-menubar-item-content {\n border-radius: ").concat(dt("menubar.base.item.border.radius"), ";\n}\n\n.p-menubar-root-list > .p-menubar-item > .p-menubar-item-content > .p-menubar-item-link {\n padding: ").concat(dt("menubar.base.item.padding"), ";\n}\n\n.p-menubar-item-content {\n transition: background ").concat(dt("menubar.transition.duration"), ", color ").concat(dt("menubar.transition.duration"), ";\n border-radius: ").concat(dt("menubar.item.border.radius"), ";\n color: ").concat(dt("menubar.item.color"), ";\n}\n\n.p-menubar-item-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n color: inherit;\n padding: ").concat(dt("menubar.item.padding"), ";\n gap: ").concat(dt("menubar.item.gap"), ";\n user-select: none;\n outline: 0 none;\n}\n\n.p-menubar-item-label {\n line-height: 1;\n}\n\n.p-menubar-item-icon {\n color: ").concat(dt("menubar.item.icon.color"), ";\n}\n\n.p-menubar-submenu-icon {\n color: ").concat(dt("menubar.submenu.icon.color"), ";\n margin-left: auto;\n font-size: ").concat(dt("menubar.submenu.icon.size"), ";\n width: ").concat(dt("menubar.submenu.icon.size"), ";\n height: ").concat(dt("menubar.submenu.icon.size"), ";\n}\n\n.p-menubar-item.p-focus > .p-menubar-item-content {\n color: ").concat(dt("menubar.item.focus.color"), ";\n background: ").concat(dt("menubar.item.focus.background"), ";\n}\n\n.p-menubar-item.p-focus > .p-menubar-item-content .p-menubar-item-icon {\n color: ").concat(dt("menubar.item.icon.focus.color"), ";\n}\n\n.p-menubar-item.p-focus > .p-menubar-item-content .p-menubar-submenu-icon {\n color: ").concat(dt("menubar.submenu.icon.focus.color"), ";\n}\n\n.p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover {\n color: ").concat(dt("menubar.item.focus.color"), ";\n background: ").concat(dt("menubar.item.focus.background"), ";\n}\n\n.p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover .p-menubar-item-icon {\n color: ").concat(dt("menubar.item.icon.focus.color"), ";\n}\n\n.p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover .p-menubar-submenu-icon {\n color: ").concat(dt("menubar.submenu.icon.focus.color"), ";\n}\n\n.p-menubar-item-active > .p-menubar-item-content {\n color: ").concat(dt("menubar.item.active.color"), ";\n background: ").concat(dt("menubar.item.active.background"), ";\n}\n\n.p-menubar-item-active > .p-menubar-item-content .p-menubar-item-icon {\n color: ").concat(dt("menubar.item.icon.active.color"), ";\n}\n\n.p-menubar-item-active > .p-menubar-item-content .p-menubar-submenu-icon {\n color: ").concat(dt("menubar.submenu.icon.active.color"), ";\n}\n\n.p-menubar-submenu {\n display: none;\n position: absolute;\n min-width: 12.5rem;\n z-index: 1;\n background: ").concat(dt("menubar.submenu.background"), ";\n border: 1px solid ").concat(dt("menubar.submenu.border.color"), ";\n border-radius: ").concat(dt("menubar.border.radius"), ";\n box-shadow: ").concat(dt("menubar.submenu.shadow"), ";\n color: ").concat(dt("menubar.submenu.color"), ";\n flex-direction: column;\n padding: ").concat(dt("menubar.submenu.padding"), ";\n gap: ").concat(dt("menubar.submenu.gap"), ";\n}\n\n.p-menubar-submenu .p-menubar-separator {\n border-top: 1px solid ").concat(dt("menubar.separator.border.color"), ";\n}\n\n.p-menubar-submenu .p-menubar-item {\n position: relative;\n}\n\n .p-menubar-submenu > .p-menubar-item-active > .p-menubar-submenu {\n display: block;\n left: 100%;\n top: 0;\n}\n\n.p-menubar-end {\n margin-left: auto;\n align-self: center;\n}\n\n.p-menubar-button {\n display: none;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n width: ").concat(dt("menubar.mobile.button.size"), ";\n height: ").concat(dt("menubar.mobile.button.size"), ";\n position: relative;\n color: ").concat(dt("menubar.mobile.button.color"), ";\n border: 0 none;\n background: transparent;\n border-radius: ").concat(dt("menubar.mobile.button.border.radius"), ";\n transition: background ").concat(dt("menubar.transition.duration"), ", color ").concat(dt("menubar.transition.duration"), ", outline-color ").concat(dt("menubar.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-menubar-button:hover {\n color: ").concat(dt("menubar.mobile.button.hover.color"), ";\n background: ").concat(dt("menubar.mobile.button.hover.background"), ";\n}\n\n.p-menubar-button:focus-visible {\n box-shadow: ").concat(dt("menubar.mobile.button.focus.ring.shadow"), ";\n outline: ").concat(dt("menubar.mobile.button.focus.ring.width"), " ").concat(dt("menubar.mobile.button.focus.ring.style"), " ").concat(dt("menubar.mobile.button.focus.ring.color"), ";\n outline-offset: ").concat(dt("menubar.mobile.button.focus.ring.offset"), ";\n}\n\n.p-menubar-mobile {\n position: relative;\n}\n\n.p-menubar-mobile .p-menubar-button {\n display: flex;\n}\n\n.p-menubar-mobile .p-menubar-root-list {\n position: absolute;\n display: none;\n width: 100%;\n padding: ").concat(dt("menubar.submenu.padding"), ";\n background: ").concat(dt("menubar.submenu.background"), ";\n border: 1px solid ").concat(dt("menubar.submenu.border.color"), ";\n box-shadow: ").concat(dt("menubar.submenu.shadow"), ";\n}\n\n.p-menubar-mobile .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content {\n border-radius: ").concat(dt("menubar.item.border.radius"), ";\n}\n\n.p-menubar-mobile .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content > .p-menubar-item-link {\n padding: ").concat(dt("menubar.item.padding"), ";\n}\n\n.p-menubar-mobile-active .p-menubar-root-list {\n display: flex;\n flex-direction: column;\n top: 100%;\n left: 0;\n z-index: 1;\n}\n\n.p-menubar-mobile .p-menubar-root-list .p-menubar-item {\n width: 100%;\n position: static;\n}\n\n.p-menubar-mobile .p-menubar-root-list .p-menubar-separator {\n border-top: 1px solid ").concat(dt("menubar.separator.border.color"), ";\n}\n\n.p-menubar-mobile .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content .p-menubar-submenu-icon {\n margin-left: auto;\n transition: transform 0.2s;\n}\n\n.p-menubar-mobile .p-menubar-root-list > .p-menubar-item-active > .p-menubar-item-content .p-menubar-submenu-icon {\n transform: rotate(-180deg);\n}\n\n.p-menubar-mobile .p-menubar-submenu .p-menubar-submenu-icon {\n transition: transform 0.2s;\n transform: rotate(90deg);\n}\n\n.p-menubar-mobile .p-menubar-item-active > .p-menubar-item-content .p-menubar-submenu-icon {\n transform: rotate(-90deg);\n}\n\n.p-menubar-mobile .p-menubar-submenu {\n width: 100%;\n position: static;\n box-shadow: none;\n border: 0 none;\n padding-left: ").concat(dt("menubar.submenu.mobile.indent"), ";\n}\n"); +}, "theme"); +var inlineStyles = { + submenu: /* @__PURE__ */ __name(function submenu2(_ref2) { + var instance = _ref2.instance, processedItem = _ref2.processedItem; + return { + display: instance.isItemActive(processedItem) ? "flex" : "none" + }; + }, "submenu") +}; +var classes = { + root: /* @__PURE__ */ __name(function root10(_ref3) { + var instance = _ref3.instance; + return ["p-menubar p-component", { + "p-menubar-mobile": instance.queryMatches, + "p-menubar-mobile-active": instance.mobileActive + }]; + }, "root"), + start: "p-menubar-start", + button: "p-menubar-button", + rootList: "p-menubar-root-list", + item: /* @__PURE__ */ __name(function item2(_ref4) { + var instance = _ref4.instance, processedItem = _ref4.processedItem; + return ["p-menubar-item", { + "p-menubar-item-active": instance.isItemActive(processedItem), + "p-focus": instance.isItemFocused(processedItem), + "p-disabled": instance.isItemDisabled(processedItem) + }]; + }, "item"), + itemContent: "p-menubar-item-content", + itemLink: "p-menubar-item-link", + itemIcon: "p-menubar-item-icon", + itemLabel: "p-menubar-item-label", + submenuIcon: "p-menubar-submenu-icon", + submenu: "p-menubar-submenu", + separator: "p-menubar-separator", + end: "p-menubar-end" +}; +var MenubarStyle = BaseStyle.extend({ + name: "menubar", + theme: theme8, + classes, + inlineStyles +}); +var script$2 = { + name: "BaseMenubar", + "extends": script$e, + props: { + model: { + type: Array, + "default": null + }, + buttonProps: { + type: null, + "default": null + }, + breakpoint: { + type: String, + "default": "960px" + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + } + }, + style: MenubarStyle, + provide: /* @__PURE__ */ __name(function provide12() { + return { + $pcMenubar: this, + $parentInstance: this + }; + }, "provide") +}; +var script$1 = { + name: "MenubarSub", + hostName: "Menubar", + "extends": script$e, + emits: ["item-mouseenter", "item-click", "item-mousemove"], + props: { + items: { + type: Array, + "default": null + }, + root: { + type: Boolean, + "default": false + }, + popup: { + type: Boolean, + "default": false + }, + mobileActive: { + type: Boolean, + "default": false + }, + templates: { + type: Object, + "default": null + }, + level: { + type: Number, + "default": 0 + }, + menuId: { + type: String, + "default": null + }, + focusedItemId: { + type: String, + "default": null + }, + activeItemPath: { + type: Object, + "default": null + } + }, + list: null, + methods: { + getItemId: /* @__PURE__ */ __name(function getItemId2(processedItem) { + return "".concat(this.menuId, "_").concat(processedItem.key); + }, "getItemId"), + getItemKey: /* @__PURE__ */ __name(function getItemKey2(processedItem) { + return this.getItemId(processedItem); + }, "getItemKey"), + getItemProp: /* @__PURE__ */ __name(function getItemProp3(processedItem, name, params) { + return processedItem && processedItem.item ? resolve(processedItem.item[name], params) : void 0; + }, "getItemProp"), + getItemLabel: /* @__PURE__ */ __name(function getItemLabel3(processedItem) { + return this.getItemProp(processedItem, "label"); + }, "getItemLabel"), + getItemLabelId: /* @__PURE__ */ __name(function getItemLabelId2(processedItem) { + return "".concat(this.menuId, "_").concat(processedItem.key, "_label"); + }, "getItemLabelId"), + getPTOptions: /* @__PURE__ */ __name(function getPTOptions5(processedItem, index, key) { + return this.ptm(key, { + context: { + item: processedItem.item, + index, + active: this.isItemActive(processedItem), + focused: this.isItemFocused(processedItem), + disabled: this.isItemDisabled(processedItem), + level: this.level + } + }); + }, "getPTOptions"), + isItemActive: /* @__PURE__ */ __name(function isItemActive2(processedItem) { + return this.activeItemPath.some(function(path) { + return path.key === processedItem.key; + }); + }, "isItemActive"), + isItemVisible: /* @__PURE__ */ __name(function isItemVisible3(processedItem) { + return this.getItemProp(processedItem, "visible") !== false; + }, "isItemVisible"), + isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled3(processedItem) { + return this.getItemProp(processedItem, "disabled"); + }, "isItemDisabled"), + isItemFocused: /* @__PURE__ */ __name(function isItemFocused2(processedItem) { + return this.focusedItemId === this.getItemId(processedItem); + }, "isItemFocused"), + isItemGroup: /* @__PURE__ */ __name(function isItemGroup3(processedItem) { + return isNotEmpty(processedItem.items); + }, "isItemGroup"), + onItemClick: /* @__PURE__ */ __name(function onItemClick3(event, processedItem) { + this.getItemProp(processedItem, "command", { + originalEvent: event, + item: processedItem.item + }); + this.$emit("item-click", { + originalEvent: event, + processedItem, + isFocus: true + }); + }, "onItemClick"), + onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter3(event, processedItem) { + this.$emit("item-mouseenter", { + originalEvent: event, + processedItem + }); + }, "onItemMouseEnter"), + onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove3(event, processedItem) { + this.$emit("item-mousemove", { + originalEvent: event, + processedItem + }); + }, "onItemMouseMove"), + getAriaPosInset: /* @__PURE__ */ __name(function getAriaPosInset3(index) { + return index - this.calculateAriaSetSize.slice(0, index).length + 1; + }, "getAriaPosInset"), + getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps2(processedItem, index) { + return { + action: mergeProps({ + "class": this.cx("itemLink"), + tabindex: -1, + "aria-hidden": true + }, this.getPTOptions(processedItem, index, "itemLink")), + icon: mergeProps({ + "class": [this.cx("itemIcon"), this.getItemProp(processedItem, "icon")] + }, this.getPTOptions(processedItem, index, "itemIcon")), + label: mergeProps({ + "class": this.cx("itemLabel") + }, this.getPTOptions(processedItem, index, "itemLabel")), + submenuicon: mergeProps({ + "class": this.cx("submenuIcon") + }, this.getPTOptions(processedItem, index, "submenuIcon")) + }; + }, "getMenuItemProps") + }, + computed: { + calculateAriaSetSize: /* @__PURE__ */ __name(function calculateAriaSetSize() { + var _this = this; + return this.items.filter(function(processedItem) { + return _this.isItemVisible(processedItem) && _this.getItemProp(processedItem, "separator"); + }); + }, "calculateAriaSetSize"), + getAriaSetSize: /* @__PURE__ */ __name(function getAriaSetSize2() { + var _this2 = this; + return this.items.filter(function(processedItem) { + return _this2.isItemVisible(processedItem) && !_this2.getItemProp(processedItem, "separator"); + }).length; + }, "getAriaSetSize") + }, + components: { + AngleRightIcon: script$w, + AngleDownIcon: script$z + }, + directives: { + ripple: Ripple + } +}; +var _hoisted_1$1$1 = ["id", "aria-label", "aria-disabled", "aria-expanded", "aria-haspopup", "aria-level", "aria-setsize", "aria-posinset", "data-p-active", "data-p-focused", "data-p-disabled"]; +var _hoisted_2$3 = ["onClick", "onMouseenter", "onMousemove"]; +var _hoisted_3$2 = ["href", "target"]; +var _hoisted_4 = ["id"]; +var _hoisted_5 = ["id"]; +function render$1(_ctx, _cache, $props, $setup, $data, $options) { + var _component_MenubarSub = resolveComponent("MenubarSub", true); + var _directive_ripple = resolveDirective("ripple"); + return openBlock(), createElementBlock("ul", mergeProps({ + "class": $props.level === 0 ? _ctx.cx("rootList") : _ctx.cx("submenu") + }, $props.level === 0 ? _ctx.ptm("rootList") : _ctx.ptm("submenu")), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.items, function(processedItem, index) { + return openBlock(), createElementBlock(Fragment, { + key: $options.getItemKey(processedItem) + }, [$options.isItemVisible(processedItem) && !$options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ + key: 0, + id: $options.getItemId(processedItem), + style: $options.getItemProp(processedItem, "style"), + "class": [_ctx.cx("item", { + processedItem + }), $options.getItemProp(processedItem, "class")], + role: "menuitem", + "aria-label": $options.getItemLabel(processedItem), + "aria-disabled": $options.isItemDisabled(processedItem) || void 0, + "aria-expanded": $options.isItemGroup(processedItem) ? $options.isItemActive(processedItem) : void 0, + "aria-haspopup": $options.isItemGroup(processedItem) && !$options.getItemProp(processedItem, "to") ? "menu" : void 0, + "aria-level": $props.level + 1, + "aria-setsize": $options.getAriaSetSize, + "aria-posinset": $options.getAriaPosInset(index), + ref_for: true + }, $options.getPTOptions(processedItem, index, "item"), { + "data-p-active": $options.isItemActive(processedItem), + "data-p-focused": $options.isItemFocused(processedItem), + "data-p-disabled": $options.isItemDisabled(processedItem) + }), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("itemContent"), + onClick: /* @__PURE__ */ __name(function onClick2($event) { + return $options.onItemClick($event, processedItem); + }, "onClick"), + onMouseenter: /* @__PURE__ */ __name(function onMouseenter($event) { + return $options.onItemMouseEnter($event, processedItem); + }, "onMouseenter"), + onMousemove: /* @__PURE__ */ __name(function onMousemove($event) { + return $options.onItemMouseMove($event, processedItem); + }, "onMousemove"), + ref_for: true + }, $options.getPTOptions(processedItem, index, "itemContent")), [!$props.templates.item ? withDirectives((openBlock(), createElementBlock("a", mergeProps({ + key: 0, + href: $options.getItemProp(processedItem, "url"), + "class": _ctx.cx("itemLink"), + target: $options.getItemProp(processedItem, "target"), + tabindex: "-1", + ref_for: true + }, $options.getPTOptions(processedItem, index, "itemLink")), [$props.templates.itemicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.itemicon), { + key: 0, + item: processedItem.item, + "class": normalizeClass(_ctx.cx("itemIcon")) + }, null, 8, ["item", "class"])) : $options.getItemProp(processedItem, "icon") ? (openBlock(), createElementBlock("span", mergeProps({ + key: 1, + "class": [_ctx.cx("itemIcon"), $options.getItemProp(processedItem, "icon")], + ref_for: true + }, $options.getPTOptions(processedItem, index, "itemIcon")), null, 16)) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ + id: $options.getItemLabelId(processedItem), + "class": _ctx.cx("itemLabel"), + ref_for: true + }, $options.getPTOptions(processedItem, index, "itemLabel")), toDisplayString($options.getItemLabel(processedItem)), 17, _hoisted_4), $options.getItemProp(processedItem, "items") ? (openBlock(), createElementBlock(Fragment, { + key: 2 + }, [$props.templates.submenuicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.submenuicon), { + key: 0, + root: $props.root, + active: $options.isItemActive(processedItem), + "class": normalizeClass(_ctx.cx("submenuIcon")) + }, null, 8, ["root", "active", "class"])) : (openBlock(), createBlock(resolveDynamicComponent($props.root ? "AngleDownIcon" : "AngleRightIcon"), mergeProps({ + key: 1, + "class": _ctx.cx("submenuIcon"), + ref_for: true + }, $options.getPTOptions(processedItem, index, "submenuIcon")), null, 16, ["class"]))], 64)) : createCommentVNode("", true)], 16, _hoisted_3$2)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { + key: 1, + item: processedItem.item, + root: $props.root, + hasSubmenu: $options.getItemProp(processedItem, "items"), + label: $options.getItemLabel(processedItem), + props: $options.getMenuItemProps(processedItem, index) + }, null, 8, ["item", "root", "hasSubmenu", "label", "props"]))], 16, _hoisted_2$3), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_MenubarSub, { + key: 0, + id: $options.getItemId(processedItem) + "_list", + menuId: $props.menuId, + role: "menu", + style: normalizeStyle(_ctx.sx("submenu", true, { + processedItem + })), + focusedItemId: $props.focusedItemId, + items: processedItem.items, + mobileActive: $props.mobileActive, + activeItemPath: $props.activeItemPath, + templates: $props.templates, + level: $props.level + 1, + "aria-labelledby": $options.getItemLabelId(processedItem), + pt: _ctx.pt, + unstyled: _ctx.unstyled, + onItemClick: _cache[0] || (_cache[0] = function($event) { + return _ctx.$emit("item-click", $event); + }), + onItemMouseenter: _cache[1] || (_cache[1] = function($event) { + return _ctx.$emit("item-mouseenter", $event); + }), + onItemMousemove: _cache[2] || (_cache[2] = function($event) { + return _ctx.$emit("item-mousemove", $event); + }) + }, null, 8, ["id", "menuId", "style", "focusedItemId", "items", "mobileActive", "activeItemPath", "templates", "level", "aria-labelledby", "pt", "unstyled"])) : createCommentVNode("", true)], 16, _hoisted_1$1$1)) : createCommentVNode("", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ + key: 1, + id: $options.getItemId(processedItem), + "class": [_ctx.cx("separator"), $options.getItemProp(processedItem, "class")], + style: $options.getItemProp(processedItem, "style"), + role: "separator", + ref_for: true + }, _ctx.ptm("separator")), null, 16, _hoisted_5)) : createCommentVNode("", true)], 64); + }), 128))], 16); +} +__name(render$1, "render$1"); +script$1.render = render$1; +var script = { + name: "Menubar", + "extends": script$2, + inheritAttrs: false, + emits: ["focus", "blur"], + matchMediaListener: null, + data: /* @__PURE__ */ __name(function data8() { + return { + id: this.$attrs.id, + mobileActive: false, + focused: false, + focusedItemInfo: { + index: -1, + level: 0, + parentKey: "" + }, + activeItemPath: [], + dirty: false, + query: null, + queryMatches: false + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId4(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId"), + activeItemPath: /* @__PURE__ */ __name(function activeItemPath2(newPath) { + if (isNotEmpty(newPath)) { + this.bindOutsideClickListener(); + this.bindResizeListener(); + } else { + this.unbindOutsideClickListener(); + this.unbindResizeListener(); + } + }, "activeItemPath") + }, + outsideClickListener: null, + container: null, + menubar: null, + mounted: /* @__PURE__ */ __name(function mounted8() { + this.id = this.id || UniqueComponentId(); + this.bindMatchMediaListener(); + }, "mounted"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount7() { + this.mobileActive = false; + this.unbindOutsideClickListener(); + this.unbindResizeListener(); + this.unbindMatchMediaListener(); + if (this.container) { + ZIndex.clear(this.container); + } + this.container = null; + }, "beforeUnmount"), + methods: { + getItemProp: /* @__PURE__ */ __name(function getItemProp4(item3, name) { + return item3 ? resolve(item3[name]) : void 0; + }, "getItemProp"), + getItemLabel: /* @__PURE__ */ __name(function getItemLabel4(item3) { + return this.getItemProp(item3, "label"); + }, "getItemLabel"), + isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled4(item3) { + return this.getItemProp(item3, "disabled"); + }, "isItemDisabled"), + isItemVisible: /* @__PURE__ */ __name(function isItemVisible4(item3) { + return this.getItemProp(item3, "visible") !== false; + }, "isItemVisible"), + isItemGroup: /* @__PURE__ */ __name(function isItemGroup4(item3) { + return isNotEmpty(this.getItemProp(item3, "items")); + }, "isItemGroup"), + isItemSeparator: /* @__PURE__ */ __name(function isItemSeparator2(item3) { + return this.getItemProp(item3, "separator"); + }, "isItemSeparator"), + getProccessedItemLabel: /* @__PURE__ */ __name(function getProccessedItemLabel2(processedItem) { + return processedItem ? this.getItemLabel(processedItem.item) : void 0; + }, "getProccessedItemLabel"), + isProccessedItemGroup: /* @__PURE__ */ __name(function isProccessedItemGroup2(processedItem) { + return processedItem && isNotEmpty(processedItem.items); + }, "isProccessedItemGroup"), + toggle: /* @__PURE__ */ __name(function toggle2(event) { + var _this = this; + if (this.mobileActive) { + this.mobileActive = false; + ZIndex.clear(this.menubar); + this.hide(); + } else { + this.mobileActive = true; + ZIndex.set("menu", this.menubar, this.$primevue.config.zIndex.menu); + setTimeout(function() { + _this.show(); + }, 1); + } + this.bindOutsideClickListener(); + event.preventDefault(); + }, "toggle"), + show: /* @__PURE__ */ __name(function show3() { + focus(this.menubar); + }, "show"), + hide: /* @__PURE__ */ __name(function hide3(event, isFocus) { + var _this2 = this; + if (this.mobileActive) { + this.mobileActive = false; + setTimeout(function() { + focus(_this2.$refs.menubutton); + }, 0); + } + this.activeItemPath = []; + this.focusedItemInfo = { + index: -1, + level: 0, + parentKey: "" + }; + isFocus && focus(this.menubar); + this.dirty = false; + }, "hide"), + onFocus: /* @__PURE__ */ __name(function onFocus4(event) { + this.focused = true; + this.focusedItemInfo = this.focusedItemInfo.index !== -1 ? this.focusedItemInfo : { + index: this.findFirstFocusedItemIndex(), + level: 0, + parentKey: "" + }; + this.$emit("focus", event); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur3(event) { + this.focused = false; + this.focusedItemInfo = { + index: -1, + level: 0, + parentKey: "" + }; + this.searchValue = ""; + this.dirty = false; + this.$emit("blur", event); + }, "onBlur"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown3(event) { + var metaKey = event.metaKey || event.ctrlKey; + switch (event.code) { + case "ArrowDown": + this.onArrowDownKey(event); + break; + case "ArrowUp": + this.onArrowUpKey(event); + break; + case "ArrowLeft": + this.onArrowLeftKey(event); + break; + case "ArrowRight": + this.onArrowRightKey(event); + break; + case "Home": + this.onHomeKey(event); + break; + case "End": + this.onEndKey(event); + break; + case "Space": + this.onSpaceKey(event); + break; + case "Enter": + case "NumpadEnter": + this.onEnterKey(event); + break; + case "Escape": + this.onEscapeKey(event); + break; + case "Tab": + this.onTabKey(event); + break; + case "PageDown": + case "PageUp": + case "Backspace": + case "ShiftLeft": + case "ShiftRight": + break; + default: + if (!metaKey && isPrintableCharacter(event.key)) { + this.searchItems(event, event.key); + } + break; + } + }, "onKeyDown"), + onItemChange: /* @__PURE__ */ __name(function onItemChange2(event) { + var processedItem = event.processedItem, isFocus = event.isFocus; + if (isEmpty(processedItem)) return; + var index = processedItem.index, key = processedItem.key, level = processedItem.level, parentKey = processedItem.parentKey, items = processedItem.items; + var grouped = isNotEmpty(items); + var activeItemPath3 = this.activeItemPath.filter(function(p) { + return p.parentKey !== parentKey && p.parentKey !== key; + }); + grouped && activeItemPath3.push(processedItem); + this.focusedItemInfo = { + index, + level, + parentKey + }; + this.activeItemPath = activeItemPath3; + grouped && (this.dirty = true); + isFocus && focus(this.menubar); + }, "onItemChange"), + onItemClick: /* @__PURE__ */ __name(function onItemClick4(event) { + var originalEvent = event.originalEvent, processedItem = event.processedItem; + var grouped = this.isProccessedItemGroup(processedItem); + var root11 = isEmpty(processedItem.parent); + var selected = this.isSelected(processedItem); + if (selected) { + var index = processedItem.index, key = processedItem.key, level = processedItem.level, parentKey = processedItem.parentKey; + this.activeItemPath = this.activeItemPath.filter(function(p) { + return key !== p.key && key.startsWith(p.key); + }); + this.focusedItemInfo = { + index, + level, + parentKey + }; + this.dirty = !root11; + focus(this.menubar); + } else { + if (grouped) { + this.onItemChange(event); + } else { + var rootProcessedItem = root11 ? processedItem : this.activeItemPath.find(function(p) { + return p.parentKey === ""; + }); + this.hide(originalEvent); + this.changeFocusedItemIndex(originalEvent, rootProcessedItem ? rootProcessedItem.index : -1); + this.mobileActive = false; + focus(this.menubar); + } + } + }, "onItemClick"), + onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter4(event) { + if (this.dirty) { + this.onItemChange(event); + } + }, "onItemMouseEnter"), + onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove4(event) { + if (this.focused) { + this.changeFocusedItemIndex(event, event.processedItem.index); + } + }, "onItemMouseMove"), + menuButtonClick: /* @__PURE__ */ __name(function menuButtonClick(event) { + this.toggle(event); + }, "menuButtonClick"), + menuButtonKeydown: /* @__PURE__ */ __name(function menuButtonKeydown(event) { + (event.code === "Enter" || event.code === "NumpadEnter" || event.code === "Space") && this.menuButtonClick(event); + }, "menuButtonKeydown"), + onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey3(event) { + var processedItem = this.visibleItems[this.focusedItemInfo.index]; + var root11 = processedItem ? isEmpty(processedItem.parent) : null; + if (root11) { + var grouped = this.isProccessedItemGroup(processedItem); + if (grouped) { + this.onItemChange({ + originalEvent: event, + processedItem + }); + this.focusedItemInfo = { + index: -1, + parentKey: processedItem.key + }; + this.onArrowRightKey(event); + } + } else { + var itemIndex = this.focusedItemInfo.index !== -1 ? this.findNextItemIndex(this.focusedItemInfo.index) : this.findFirstFocusedItemIndex(); + this.changeFocusedItemIndex(event, itemIndex); + } + event.preventDefault(); + }, "onArrowDownKey"), + onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey3(event) { + var _this3 = this; + var processedItem = this.visibleItems[this.focusedItemInfo.index]; + var root11 = isEmpty(processedItem.parent); + if (root11) { + var grouped = this.isProccessedItemGroup(processedItem); + if (grouped) { + this.onItemChange({ + originalEvent: event, + processedItem + }); + this.focusedItemInfo = { + index: -1, + parentKey: processedItem.key + }; + var itemIndex = this.findLastItemIndex(); + this.changeFocusedItemIndex(event, itemIndex); + } + } else { + var parentItem = this.activeItemPath.find(function(p) { + return p.key === processedItem.parentKey; + }); + if (this.focusedItemInfo.index === 0) { + this.focusedItemInfo = { + index: -1, + parentKey: parentItem ? parentItem.parentKey : "" + }; + this.searchValue = ""; + this.onArrowLeftKey(event); + this.activeItemPath = this.activeItemPath.filter(function(p) { + return p.parentKey !== _this3.focusedItemInfo.parentKey; + }); + } else { + var _itemIndex = this.focusedItemInfo.index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo.index) : this.findLastFocusedItemIndex(); + this.changeFocusedItemIndex(event, _itemIndex); + } + } + event.preventDefault(); + }, "onArrowUpKey"), + onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey4(event) { + var _this4 = this; + var processedItem = this.visibleItems[this.focusedItemInfo.index]; + var parentItem = processedItem ? this.activeItemPath.find(function(p) { + return p.key === processedItem.parentKey; + }) : null; + if (parentItem) { + this.onItemChange({ + originalEvent: event, + processedItem: parentItem + }); + this.activeItemPath = this.activeItemPath.filter(function(p) { + return p.parentKey !== _this4.focusedItemInfo.parentKey; + }); + event.preventDefault(); + } else { + var itemIndex = this.focusedItemInfo.index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo.index) : this.findLastFocusedItemIndex(); + this.changeFocusedItemIndex(event, itemIndex); + event.preventDefault(); + } + }, "onArrowLeftKey"), + onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey4(event) { + var processedItem = this.visibleItems[this.focusedItemInfo.index]; + var parentItem = processedItem ? this.activeItemPath.find(function(p) { + return p.key === processedItem.parentKey; + }) : null; + if (parentItem) { + var grouped = this.isProccessedItemGroup(processedItem); + if (grouped) { + this.onItemChange({ + originalEvent: event, + processedItem + }); + this.focusedItemInfo = { + index: -1, + parentKey: processedItem.key + }; + this.onArrowDownKey(event); + } + } else { + var itemIndex = this.focusedItemInfo.index !== -1 ? this.findNextItemIndex(this.focusedItemInfo.index) : this.findFirstFocusedItemIndex(); + this.changeFocusedItemIndex(event, itemIndex); + event.preventDefault(); + } + }, "onArrowRightKey"), + onHomeKey: /* @__PURE__ */ __name(function onHomeKey4(event) { + this.changeFocusedItemIndex(event, this.findFirstItemIndex()); + event.preventDefault(); + }, "onHomeKey"), + onEndKey: /* @__PURE__ */ __name(function onEndKey4(event) { + this.changeFocusedItemIndex(event, this.findLastItemIndex()); + event.preventDefault(); + }, "onEndKey"), + onEnterKey: /* @__PURE__ */ __name(function onEnterKey4(event) { + if (this.focusedItemInfo.index !== -1) { + var element = findSingle(this.menubar, 'li[id="'.concat("".concat(this.focusedItemId), '"]')); + var anchorElement = element && findSingle(element, 'a[data-pc-section="itemlink"]'); + anchorElement ? anchorElement.click() : element && element.click(); + var processedItem = this.visibleItems[this.focusedItemInfo.index]; + var grouped = this.isProccessedItemGroup(processedItem); + !grouped && (this.focusedItemInfo.index = this.findFirstFocusedItemIndex()); + } + event.preventDefault(); + }, "onEnterKey"), + onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey2(event) { + this.onEnterKey(event); + }, "onSpaceKey"), + onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey3(event) { + if (this.focusedItemInfo.level !== 0) { + var _focusedItemInfo = this.focusedItemInfo; + this.hide(event, false); + this.focusedItemInfo = { + index: Number(_focusedItemInfo.parentKey.split("_")[0]), + level: 0, + parentKey: "" + }; + } + event.preventDefault(); + }, "onEscapeKey"), + onTabKey: /* @__PURE__ */ __name(function onTabKey3(event) { + if (this.focusedItemInfo.index !== -1) { + var processedItem = this.visibleItems[this.focusedItemInfo.index]; + var grouped = this.isProccessedItemGroup(processedItem); + !grouped && this.onItemChange({ + originalEvent: event, + processedItem + }); + } + this.hide(); + }, "onTabKey"), + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener3() { + var _this5 = this; + if (!this.outsideClickListener) { + this.outsideClickListener = function(event) { + var isOutsideContainer = _this5.container && !_this5.container.contains(event.target); + var isOutsideTarget = !(_this5.target && (_this5.target === event.target || _this5.target.contains(event.target))); + if (isOutsideContainer && isOutsideTarget) { + _this5.hide(); + } + }; + document.addEventListener("click", this.outsideClickListener); + } + }, "bindOutsideClickListener"), + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener3() { + if (this.outsideClickListener) { + document.removeEventListener("click", this.outsideClickListener); + this.outsideClickListener = null; + } + }, "unbindOutsideClickListener"), + bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener3() { + var _this6 = this; + if (!this.resizeListener) { + this.resizeListener = function(event) { + if (!isTouchDevice()) { + _this6.hide(event, true); + } + _this6.mobileActive = false; + }; + window.addEventListener("resize", this.resizeListener); + } + }, "bindResizeListener"), + unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener3() { + if (this.resizeListener) { + window.removeEventListener("resize", this.resizeListener); + this.resizeListener = null; + } + }, "unbindResizeListener"), + bindMatchMediaListener: /* @__PURE__ */ __name(function bindMatchMediaListener() { + var _this7 = this; + if (!this.matchMediaListener) { + var query = matchMedia("(max-width: ".concat(this.breakpoint, ")")); + this.query = query; + this.queryMatches = query.matches; + this.matchMediaListener = function() { + _this7.queryMatches = query.matches; + _this7.mobileActive = false; + }; + this.query.addEventListener("change", this.matchMediaListener); + } + }, "bindMatchMediaListener"), + unbindMatchMediaListener: /* @__PURE__ */ __name(function unbindMatchMediaListener() { + if (this.matchMediaListener) { + this.query.removeEventListener("change", this.matchMediaListener); + this.matchMediaListener = null; + } + }, "unbindMatchMediaListener"), + isItemMatched: /* @__PURE__ */ __name(function isItemMatched2(processedItem) { + var _this$getProccessedIt; + return this.isValidItem(processedItem) && ((_this$getProccessedIt = this.getProccessedItemLabel(processedItem)) === null || _this$getProccessedIt === void 0 ? void 0 : _this$getProccessedIt.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase())); + }, "isItemMatched"), + isValidItem: /* @__PURE__ */ __name(function isValidItem2(processedItem) { + return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item) && this.isItemVisible(processedItem.item); + }, "isValidItem"), + isValidSelectedItem: /* @__PURE__ */ __name(function isValidSelectedItem2(processedItem) { + return this.isValidItem(processedItem) && this.isSelected(processedItem); + }, "isValidSelectedItem"), + isSelected: /* @__PURE__ */ __name(function isSelected3(processedItem) { + return this.activeItemPath.some(function(p) { + return p.key === processedItem.key; + }); + }, "isSelected"), + findFirstItemIndex: /* @__PURE__ */ __name(function findFirstItemIndex2() { + var _this8 = this; + return this.visibleItems.findIndex(function(processedItem) { + return _this8.isValidItem(processedItem); + }); + }, "findFirstItemIndex"), + findLastItemIndex: /* @__PURE__ */ __name(function findLastItemIndex2() { + var _this9 = this; + return findLastIndex(this.visibleItems, function(processedItem) { + return _this9.isValidItem(processedItem); + }); + }, "findLastItemIndex"), + findNextItemIndex: /* @__PURE__ */ __name(function findNextItemIndex2(index) { + var _this10 = this; + var matchedItemIndex = index < this.visibleItems.length - 1 ? this.visibleItems.slice(index + 1).findIndex(function(processedItem) { + return _this10.isValidItem(processedItem); + }) : -1; + return matchedItemIndex > -1 ? matchedItemIndex + index + 1 : index; + }, "findNextItemIndex"), + findPrevItemIndex: /* @__PURE__ */ __name(function findPrevItemIndex2(index) { + var _this11 = this; + var matchedItemIndex = index > 0 ? findLastIndex(this.visibleItems.slice(0, index), function(processedItem) { + return _this11.isValidItem(processedItem); + }) : -1; + return matchedItemIndex > -1 ? matchedItemIndex : index; + }, "findPrevItemIndex"), + findSelectedItemIndex: /* @__PURE__ */ __name(function findSelectedItemIndex2() { + var _this12 = this; + return this.visibleItems.findIndex(function(processedItem) { + return _this12.isValidSelectedItem(processedItem); + }); + }, "findSelectedItemIndex"), + findFirstFocusedItemIndex: /* @__PURE__ */ __name(function findFirstFocusedItemIndex2() { + var selectedIndex = this.findSelectedItemIndex(); + return selectedIndex < 0 ? this.findFirstItemIndex() : selectedIndex; + }, "findFirstFocusedItemIndex"), + findLastFocusedItemIndex: /* @__PURE__ */ __name(function findLastFocusedItemIndex2() { + var selectedIndex = this.findSelectedItemIndex(); + return selectedIndex < 0 ? this.findLastItemIndex() : selectedIndex; + }, "findLastFocusedItemIndex"), + searchItems: /* @__PURE__ */ __name(function searchItems2(event, _char) { + var _this13 = this; + this.searchValue = (this.searchValue || "") + _char; + var itemIndex = -1; + var matched = false; + if (this.focusedItemInfo.index !== -1) { + itemIndex = this.visibleItems.slice(this.focusedItemInfo.index).findIndex(function(processedItem) { + return _this13.isItemMatched(processedItem); + }); + itemIndex = itemIndex === -1 ? this.visibleItems.slice(0, this.focusedItemInfo.index).findIndex(function(processedItem) { + return _this13.isItemMatched(processedItem); + }) : itemIndex + this.focusedItemInfo.index; + } else { + itemIndex = this.visibleItems.findIndex(function(processedItem) { + return _this13.isItemMatched(processedItem); + }); + } + if (itemIndex !== -1) { + matched = true; + } + if (itemIndex === -1 && this.focusedItemInfo.index === -1) { + itemIndex = this.findFirstFocusedItemIndex(); + } + if (itemIndex !== -1) { + this.changeFocusedItemIndex(event, itemIndex); + } + if (this.searchTimeout) { + clearTimeout(this.searchTimeout); + } + this.searchTimeout = setTimeout(function() { + _this13.searchValue = ""; + _this13.searchTimeout = null; + }, 500); + return matched; + }, "searchItems"), + changeFocusedItemIndex: /* @__PURE__ */ __name(function changeFocusedItemIndex2(event, index) { + if (this.focusedItemInfo.index !== index) { + this.focusedItemInfo.index = index; + this.scrollInView(); + } + }, "changeFocusedItemIndex"), + scrollInView: /* @__PURE__ */ __name(function scrollInView4() { + var index = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : -1; + var id2 = index !== -1 ? "".concat(this.id, "_").concat(index) : this.focusedItemId; + var element = findSingle(this.menubar, 'li[id="'.concat(id2, '"]')); + if (element) { + element.scrollIntoView && element.scrollIntoView({ + block: "nearest", + inline: "start" + }); + } + }, "scrollInView"), + createProcessedItems: /* @__PURE__ */ __name(function createProcessedItems2(items) { + var _this14 = this; + var level = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; + var parent = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; + var parentKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ""; + var processedItems3 = []; + items && items.forEach(function(item3, index) { + var key = (parentKey !== "" ? parentKey + "_" : "") + index; + var newItem = { + item: item3, + index, + level, + key, + parent, + parentKey + }; + newItem["items"] = _this14.createProcessedItems(item3.items, level + 1, newItem, key); + processedItems3.push(newItem); + }); + return processedItems3; + }, "createProcessedItems"), + containerRef: /* @__PURE__ */ __name(function containerRef3(el) { + this.container = el; + }, "containerRef"), + menubarRef: /* @__PURE__ */ __name(function menubarRef2(el) { + this.menubar = el ? el.$el : void 0; + }, "menubarRef") + }, + computed: { + processedItems: /* @__PURE__ */ __name(function processedItems2() { + return this.createProcessedItems(this.model || []); + }, "processedItems"), + visibleItems: /* @__PURE__ */ __name(function visibleItems2() { + var _this15 = this; + var processedItem = this.activeItemPath.find(function(p) { + return p.key === _this15.focusedItemInfo.parentKey; + }); + return processedItem ? processedItem.items : this.processedItems; + }, "visibleItems"), + focusedItemId: /* @__PURE__ */ __name(function focusedItemId2() { + return this.focusedItemInfo.index !== -1 ? "".concat(this.id).concat(isNotEmpty(this.focusedItemInfo.parentKey) ? "_" + this.focusedItemInfo.parentKey : "", "_").concat(this.focusedItemInfo.index) : null; + }, "focusedItemId") + }, + components: { + MenubarSub: script$1, + BarsIcon: script$A + } +}; +function _typeof(o) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { + return typeof o2; + } : function(o2) { + return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; + }, _typeof(o); +} +__name(_typeof, "_typeof"); +function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t.push.apply(t, o); + } + return t; +} +__name(ownKeys, "ownKeys"); +function _objectSpread(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), true).forEach(function(r2) { + _defineProperty(e, r2, t[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); + }); + } + return e; +} +__name(_objectSpread, "_objectSpread"); +function _defineProperty(e, r, t) { + return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; +} +__name(_defineProperty, "_defineProperty"); +function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; +} +__name(_toPropertyKey, "_toPropertyKey"); +function _toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} +__name(_toPrimitive, "_toPrimitive"); +var _hoisted_1$3 = ["aria-haspopup", "aria-expanded", "aria-controls", "aria-label"]; +function render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_BarsIcon = resolveComponent("BarsIcon"); + var _component_MenubarSub = resolveComponent("MenubarSub"); + return openBlock(), createElementBlock("div", mergeProps({ + ref: $options.containerRef, + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [_ctx.$slots.start ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("start") + }, _ctx.ptm("start")), [renderSlot(_ctx.$slots, "start")], 16)) : createCommentVNode("", true), renderSlot(_ctx.$slots, _ctx.$slots.button ? "button" : "menubutton", { + id: $data.id, + "class": normalizeClass(_ctx.cx("button")), + toggleCallback: /* @__PURE__ */ __name(function toggleCallback(event) { + return $options.menuButtonClick(event); + }, "toggleCallback") + }, function() { + var _ctx$$primevue$config; + return [_ctx.model && _ctx.model.length > 0 ? (openBlock(), createElementBlock("a", mergeProps({ + key: 0, + ref: "menubutton", + role: "button", + tabindex: "0", + "class": _ctx.cx("button"), + "aria-haspopup": _ctx.model.length && _ctx.model.length > 0 ? true : false, + "aria-expanded": $data.mobileActive, + "aria-controls": $data.id, + "aria-label": (_ctx$$primevue$config = _ctx.$primevue.config.locale.aria) === null || _ctx$$primevue$config === void 0 ? void 0 : _ctx$$primevue$config.navigation, + onClick: _cache[0] || (_cache[0] = function($event) { + return $options.menuButtonClick($event); + }), + onKeydown: _cache[1] || (_cache[1] = function($event) { + return $options.menuButtonKeydown($event); + }) + }, _objectSpread(_objectSpread({}, _ctx.buttonProps), _ctx.ptm("button"))), [renderSlot(_ctx.$slots, _ctx.$slots.buttonicon ? "buttonicon" : "menubuttonicon", {}, function() { + return [createVNode(_component_BarsIcon, normalizeProps(guardReactiveProps(_ctx.ptm("buttonicon"))), null, 16)]; + })], 16, _hoisted_1$3)) : createCommentVNode("", true)]; + }), createVNode(_component_MenubarSub, { + ref: $options.menubarRef, + id: $data.id + "_list", + role: "menubar", + items: $options.processedItems, + templates: _ctx.$slots, + root: true, + mobileActive: $data.mobileActive, + tabindex: "0", + "aria-activedescendant": $data.focused ? $options.focusedItemId : void 0, + menuId: $data.id, + focusedItemId: $data.focused ? $options.focusedItemId : void 0, + activeItemPath: $data.activeItemPath, + level: 0, + "aria-labelledby": _ctx.ariaLabelledby, + "aria-label": _ctx.ariaLabel, + pt: _ctx.pt, + unstyled: _ctx.unstyled, + onFocus: $options.onFocus, + onBlur: $options.onBlur, + onKeydown: $options.onKeyDown, + onItemClick: $options.onItemClick, + onItemMouseenter: $options.onItemMouseEnter, + onItemMousemove: $options.onItemMouseMove + }, null, 8, ["id", "items", "templates", "mobileActive", "aria-activedescendant", "menuId", "focusedItemId", "activeItemPath", "aria-labelledby", "aria-label", "pt", "unstyled", "onFocus", "onBlur", "onKeydown", "onItemClick", "onItemMouseenter", "onItemMousemove"]), _ctx.$slots.end ? (openBlock(), createElementBlock("div", mergeProps({ + key: 1, + "class": _ctx.cx("end") + }, _ctx.ptm("end")), [renderSlot(_ctx.$slots, "end")], 16)) : createCommentVNode("", true)], 16); +} +__name(render, "render"); +script.render = render; +const _withScopeId$2 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-6fecd137"), n = n(), popScopeId(), n), "_withScopeId$2"); +const _hoisted_1$2 = ["href"]; +const _hoisted_2$2 = { class: "p-menubar-item-label" }; +const _hoisted_3$1 = { + key: 1, + class: "ml-auto border border-surface rounded text-muted text-xs p-1 keybinding-tag" +}; +const _sfc_main$4 = /* @__PURE__ */ defineComponent({ + __name: "CommandMenubar", + setup(__props) { + const settingStore = useSettingStore(); + const dropdownDirection = computed( + () => settingStore.get("Comfy.UseNewMenu") === "Top" ? "down" : "up" + ); + const menuItemsStore = useMenuItemStore(); + const { t } = useI18n(); + const translateMenuItem = /* @__PURE__ */ __name((item3) => { + const label = typeof item3.label === "function" ? item3.label() : item3.label; + const translatedLabel = label ? t(`menuLabels.${normalizeI18nKey(label)}`, label) : void 0; + return { + ...item3, + label: translatedLabel, + items: item3.items?.map(translateMenuItem) + }; + }, "translateMenuItem"); + const translatedItems = computed( + () => menuItemsStore.menuItems.map(translateMenuItem) + ); + return (_ctx, _cache) => { + return openBlock(), createBlock(unref(script), { + model: translatedItems.value, + class: "top-menubar border-none p-0 bg-transparent", + pt: { + rootList: "gap-0 flex-nowrap w-auto", + submenu: `dropdown-direction-${dropdownDirection.value}`, + item: "relative" + } + }, { + item: withCtx(({ item: item3, props }) => [ + createBaseVNode("a", mergeProps({ class: "p-menubar-item-link" }, props.action, { + href: item3.url, + target: "_blank" + }), [ + item3.icon ? (openBlock(), createElementBlock("span", { + key: 0, + class: normalizeClass(["p-menubar-item-icon", item3.icon]) + }, null, 2)) : createCommentVNode("", true), + createBaseVNode("span", _hoisted_2$2, toDisplayString(item3.label), 1), + item3?.comfyCommand?.keybinding ? (openBlock(), createElementBlock("span", _hoisted_3$1, toDisplayString(item3.comfyCommand.keybinding.combo.toString()), 1)) : createCommentVNode("", true) + ], 16, _hoisted_1$2) + ]), + _: 1 + }, 8, ["model", "pt"]); + }; + } +}); +const CommandMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-6fecd137"]]); +const _withScopeId$1 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-8d011a31"), n = n(), popScopeId(), n), "_withScopeId$1"); +const _hoisted_1$1 = { class: "workflow-label text-sm max-w-[150px] truncate inline-block" }; +const _hoisted_2$1 = { class: "relative" }; +const _hoisted_3 = { + key: 0, + class: "status-indicator" +}; +const _sfc_main$3 = /* @__PURE__ */ defineComponent({ + __name: "WorkflowTab", + props: { + class: {}, + workflowOption: {} + }, + setup(__props) { + const props = __props; + const workspaceStore = useWorkspaceStore(); + const workflowStore = useWorkflowStore(); + const workflowTabRef = ref(null); + const closeWorkflows = /* @__PURE__ */ __name(async (options) => { + for (const opt of options) { + if (!await useWorkflowService().closeWorkflow(opt.workflow, { + warnIfUnsaved: !workspaceStore.shiftDown + })) { + break; + } + } + }, "closeWorkflows"); + const onCloseWorkflow = /* @__PURE__ */ __name((option2) => { + closeWorkflows([option2]); + }, "onCloseWorkflow"); + const tabGetter = /* @__PURE__ */ __name(() => workflowTabRef.value, "tabGetter"); + usePragmaticDraggable(tabGetter, { + getInitialData: /* @__PURE__ */ __name(() => { + return { + workflowKey: props.workflowOption.workflow.key + }; + }, "getInitialData") + }); + usePragmaticDroppable(tabGetter, { + getData: /* @__PURE__ */ __name(() => { + return { + workflowKey: props.workflowOption.workflow.key + }; + }, "getData"), + onDrop: /* @__PURE__ */ __name((e) => { + const fromIndex = workflowStore.openWorkflows.findIndex( + (wf) => wf.key === e.source.data.workflowKey + ); + const toIndex = workflowStore.openWorkflows.findIndex( + (wf) => wf.key === e.location.current.dropTargets[0]?.data.workflowKey + ); + if (fromIndex !== toIndex) { + workflowStore.reorderWorkflows(fromIndex, toIndex); + } + }, "onDrop") + }); + return (_ctx, _cache) => { + const _directive_tooltip = resolveDirective("tooltip"); + return openBlock(), createElementBlock("div", mergeProps({ + class: "flex p-2 gap-2 workflow-tab", + ref_key: "workflowTabRef", + ref: workflowTabRef + }, _ctx.$attrs), [ + withDirectives((openBlock(), createElementBlock("span", _hoisted_1$1, [ + createTextVNode(toDisplayString(_ctx.workflowOption.workflow.filename), 1) + ])), [ + [ + _directive_tooltip, + _ctx.workflowOption.workflow.key, + void 0, + { bottom: true } + ] + ]), + createBaseVNode("div", _hoisted_2$1, [ + !unref(workspaceStore).shiftDown && (_ctx.workflowOption.workflow.isModified || !_ctx.workflowOption.workflow.isPersisted) ? (openBlock(), createElementBlock("span", _hoisted_3, "•")) : createCommentVNode("", true), + createVNode(unref(script$d), { + class: "close-button p-0 w-auto", + icon: "pi pi-times", + text: "", + severity: "secondary", + size: "small", + onClick: _cache[0] || (_cache[0] = withModifiers(($event) => onCloseWorkflow(_ctx.workflowOption), ["stop"])) + }) + ]) + ], 16); + }; + } +}); +const WorkflowTab = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-8d011a31"]]); +const _sfc_main$2 = /* @__PURE__ */ defineComponent({ + __name: "WorkflowTabs", + props: { + class: {} + }, + setup(__props) { + const props = __props; + const { t } = useI18n(); + const workspaceStore = useWorkspaceStore(); + const workflowStore = useWorkflowStore(); + const workflowService = useWorkflowService(); + const rightClickedTab = ref(null); + const menu = ref(); + const workflowToOption = /* @__PURE__ */ __name((workflow) => ({ + value: workflow.path, + workflow + }), "workflowToOption"); + const options = computed( + () => workflowStore.openWorkflows.map(workflowToOption) + ); + const selectedWorkflow = computed( + () => workflowStore.activeWorkflow ? workflowToOption(workflowStore.activeWorkflow) : null + ); + const onWorkflowChange = /* @__PURE__ */ __name((option2) => { + if (!option2) { + return; + } + if (selectedWorkflow.value?.value === option2.value) { + return; + } + workflowService.openWorkflow(option2.workflow); + }, "onWorkflowChange"); + const closeWorkflows = /* @__PURE__ */ __name(async (options2) => { + for (const opt of options2) { + if (!await workflowService.closeWorkflow(opt.workflow, { + warnIfUnsaved: !workspaceStore.shiftDown + })) { + break; + } + } + }, "closeWorkflows"); + const onCloseWorkflow = /* @__PURE__ */ __name((option2) => { + closeWorkflows([option2]); + }, "onCloseWorkflow"); + const showContextMenu = /* @__PURE__ */ __name((event, option2) => { + rightClickedTab.value = option2; + menu.value.show(event); + }, "showContextMenu"); + const contextMenuItems = computed(() => { + const tab = rightClickedTab.value; + if (!tab) return []; + const index = options.value.findIndex((v) => v.workflow === tab.workflow); + return [ + { + label: t("tabMenu.duplicateTab"), + command: /* @__PURE__ */ __name(() => { + workflowService.duplicateWorkflow(tab.workflow); + }, "command") + }, + { + separator: true + }, + { + label: t("tabMenu.closeTab"), + command: /* @__PURE__ */ __name(() => onCloseWorkflow(tab), "command") + }, + { + label: t("tabMenu.closeTabsToLeft"), + command: /* @__PURE__ */ __name(() => closeWorkflows(options.value.slice(0, index)), "command"), + disabled: index <= 0 + }, + { + label: t("tabMenu.closeTabsToRight"), + command: /* @__PURE__ */ __name(() => closeWorkflows(options.value.slice(index + 1)), "command"), + disabled: index === options.value.length - 1 + }, + { + label: t("tabMenu.closeOtherTabs"), + command: /* @__PURE__ */ __name(() => closeWorkflows([ + ...options.value.slice(index + 1), + ...options.value.slice(0, index) + ]), "command"), + disabled: options.value.length <= 1 + } + ]; + }); + const commandStore = useCommandStore(); + return (_ctx, _cache) => { + return openBlock(), createElementBlock(Fragment, null, [ + createVNode(unref(script$B), { + class: normalizeClass(["workflow-tabs bg-transparent inline", props.class]), + modelValue: selectedWorkflow.value, + "onUpdate:modelValue": onWorkflowChange, + options: options.value, + optionLabel: "label", + dataKey: "value" + }, { + option: withCtx(({ option: option2 }) => [ + createVNode(WorkflowTab, { + onContextmenu: /* @__PURE__ */ __name(($event) => showContextMenu($event, option2), "onContextmenu"), + onMouseup: withModifiers(($event) => onCloseWorkflow(option2), ["middle"]), + "workflow-option": option2 + }, null, 8, ["onContextmenu", "onMouseup", "workflow-option"]) + ]), + _: 1 + }, 8, ["class", "modelValue", "options"]), + createVNode(unref(script$d), { + class: "new-blank-workflow-button", + icon: "pi pi-plus", + text: "", + severity: "secondary", + onClick: _cache[0] || (_cache[0] = () => unref(commandStore).execute("Comfy.NewBlankWorkflow")) + }), + createVNode(unref(script$C), { + ref_key: "menu", + ref: menu, + model: contextMenuItems.value + }, null, 8, ["model"]) + ], 64); + }; + } +}); +const WorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-d485c044"]]); +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-878b63b8"), n = n(), popScopeId(), n), "_withScopeId"); const _hoisted_1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createBaseVNode("h1", { class: "comfyui-logo mx-2" }, "ComfyUI", -1)); const _hoisted_2 = { class: "flex-grow" }; const _sfc_main$1 = /* @__PURE__ */ defineComponent({ @@ -8133,7 +8729,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ }, [ _hoisted_1, createVNode(CommandMenubar), - createVNode(unref(script$F), { + createVNode(unref(script$D), { layout: "vertical", class: "mx-2" }), @@ -8146,8 +8742,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ ref: menuRight }, null, 512), createVNode(Actionbar), - createVNode(_sfc_main$2), - withDirectives(createVNode(unref(script$f), { + createVNode(_sfc_main$5), + withDirectives(createVNode(unref(script$d), { icon: "pi pi-bars", severity: "secondary", text: "", @@ -8163,37 +8759,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ }; } }); -const TopMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-d792da31"]]); -function setupAutoQueueHandler() { - const queueCountStore = useQueuePendingTaskCountStore(); - const queueSettingsStore = useQueueSettingsStore(); - let graphHasChanged = false; - let internalCount = 0; - api.addEventListener("graphChanged", () => { - if (queueSettingsStore.mode === "change") { - if (internalCount) { - graphHasChanged = true; - } else { - graphHasChanged = false; - app.queuePrompt(0, queueSettingsStore.batchCount); - internalCount++; - } - } - }); - queueCountStore.$subscribe( - () => { - internalCount = queueCountStore.count; - if (!internalCount && !app.lastExecutionError) { - if (queueSettingsStore.mode === "instant" || queueSettingsStore.mode === "change" && graphHasChanged) { - graphHasChanged = false; - app.queuePrompt(0, queueSettingsStore.batchCount); - } - } - }, - { detached: true } - ); -} -__name(setupAutoQueueHandler, "setupAutoQueueHandler"); +const TopMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-878b63b8"]]); var LatentPreviewMethod = /* @__PURE__ */ ((LatentPreviewMethod2) => { LatentPreviewMethod2["NoPreviews"] = "none"; LatentPreviewMethod2["Auto"] = "auto"; @@ -8672,7 +9238,10 @@ const SERVER_CONFIG_ITEMS = [ } ]; function useCoreCommands() { - const getTracker = /* @__PURE__ */ __name(() => useWorkflowStore()?.activeWorkflow?.changeTracker, "getTracker"); + const workflowService = useWorkflowService(); + const workflowStore = useWorkflowStore(); + const dialogService = useDialogService(); + const getTracker = /* @__PURE__ */ __name(() => workflowStore.activeWorkflow?.changeTracker, "getTracker"); const getSelectedNodes = /* @__PURE__ */ __name(() => { const selectedNodes = app.canvas.selected_nodes; const result = []; @@ -8841,7 +9410,9 @@ function useCoreCommands() { id: "Comfy.BrowseTemplates", icon: "pi pi-folder-open", label: "Browse Templates", - function: showTemplateWorkflowsDialog + function: /* @__PURE__ */ __name(() => { + dialogService.showTemplateWorkflowsDialog(); + }, "function") }, { id: "Comfy.Canvas.ZoomIn", @@ -8938,7 +9509,7 @@ function useCoreCommands() { label: "Show Settings Dialog", versionAdded: "1.3.7", function: /* @__PURE__ */ __name(() => { - showSettingsDialog(); + dialogService.showSettingsDialog(); }, "function") }, { @@ -9134,10 +9705,59 @@ function useCoreCommands() { function: /* @__PURE__ */ __name(() => { useSearchBoxStore().toggleVisible(); }, "function") + }, + { + id: "Comfy.Help.AboutComfyUI", + icon: "pi pi-info-circle", + label: "Open About ComfyUI", + menubarLabel: "About ComfyUI", + versionAdded: "1.6.4", + function: /* @__PURE__ */ __name(() => { + dialogService.showSettingsDialog("about"); + }, "function") + }, + { + id: "Comfy.DuplicateWorkflow", + icon: "pi pi-clone", + label: "Duplicate Current Workflow", + versionAdded: "1.6.15", + function: /* @__PURE__ */ __name(() => { + workflowService.duplicateWorkflow(workflowStore.activeWorkflow); + }, "function") } ]; } __name(useCoreCommands, "useCoreCommands"); +function setupAutoQueueHandler() { + const queueCountStore = useQueuePendingTaskCountStore(); + const queueSettingsStore = useQueueSettingsStore(); + let graphHasChanged = false; + let internalCount = 0; + api.addEventListener("graphChanged", () => { + if (queueSettingsStore.mode === "change") { + if (internalCount) { + graphHasChanged = true; + } else { + graphHasChanged = false; + app.queuePrompt(0, queueSettingsStore.batchCount); + internalCount++; + } + } + }); + queueCountStore.$subscribe( + () => { + internalCount = queueCountStore.count; + if (!internalCount && !app.lastExecutionError) { + if (queueSettingsStore.mode === "instant" || queueSettingsStore.mode === "change" && graphHasChanged) { + graphHasChanged = false; + app.queuePrompt(0, queueSettingsStore.batchCount); + } + } + }, + { detached: true } + ); +} +__name(setupAutoQueueHandler, "setupAutoQueueHandler"); const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "GraphView", setup(__props) { @@ -9146,9 +9766,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ const toast = useToast(); const settingStore = useSettingStore(); const executionStore = useExecutionStore(); - const theme11 = computed(() => settingStore.get("Comfy.ColorPalette")); + const theme10 = computed(() => settingStore.get("Comfy.ColorPalette")); watch( - theme11, + theme10, (newTheme) => { const DARK_THEME_CLASS = "dark-theme"; const isDarkTheme = newTheme !== "light"; @@ -9183,7 +9803,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ watchEffect(() => { const useNewMenu = settingStore.get("Comfy.UseNewMenu"); if (useNewMenu === "Disabled") { - app.ui.menuContainer.style.removeProperty("display"); + app.ui.menuContainer.style.setProperty("display", "block"); app.ui.restoreMenuPosition(); } else { app.ui.menuContainer.style.setProperty("display", "none"); @@ -9195,11 +9815,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ ); }); const init = /* @__PURE__ */ __name(() => { - settingStore.addSettings(app.ui.settings); const coreCommands = useCoreCommands(); useCommandStore().registerCommands(coreCommands); useMenuItemStore().registerCoreMenuCommands(); - useKeybindingStore().loadCoreKeybindings(); + useKeybindingService().registerCoreKeybindings(); useSidebarTabStore().registerCoreSidebarTabs(); useBottomPanelStore().registerCoreBottomPanelTabs(); app.extensionManager = useWorkspaceStore(); @@ -9241,10 +9860,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ api.removeEventListener("reconnected", onReconnected); executionStore.unbindExecutionEvents(); }); + useEventListener(window, "keydown", useKeybindingService().keybindHandler); const onGraphReady = /* @__PURE__ */ __name(() => { requestIdleCallback( () => { - useKeybindingStore().loadUserKeybindings(); + useKeybindingService().registerUserKeybindings(); useServerConfigStore().loadServerConfig( SERVER_CONFIG_ITEMS, settingStore.get("Comfy.Server.ServerConfigValues") @@ -9259,10 +9879,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ return (_ctx, _cache) => { return openBlock(), createElementBlock(Fragment, null, [ createVNode(TopMenubar), - createVNode(_sfc_main$c, { onReady: onGraphReady }), - createVNode(_sfc_main$a), + createVNode(_sfc_main$a, { onReady: onGraphReady }), createVNode(_sfc_main$9), - createVNode(_sfc_main$8), + createVNode(_sfc_main$r), + createVNode(_sfc_main$t), createVNode(MenuHamburger) ], 64); }; @@ -9271,4 +9891,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=GraphView-BWxgNrh6.js.map +//# sourceMappingURL=GraphView-DswvqURL.js.map diff --git a/web/assets/InstallView-8N2LdZUx.css b/web/assets/InstallView-8N2LdZUx.css deleted file mode 100644 index 5ce7563a..00000000 --- a/web/assets/InstallView-8N2LdZUx.css +++ /dev/null @@ -1,4 +0,0 @@ - -[data-v-7ef01cf2] .p-steppanel { - background-color: transparent -} diff --git a/web/assets/InstallView-DbHtR5YG.js b/web/assets/InstallView-AV2llYNm.js similarity index 60% rename from web/assets/InstallView-DbHtR5YG.js rename to web/assets/InstallView-AV2llYNm.js index 72a57638..0b455d93 100644 --- a/web/assets/InstallView-DbHtR5YG.js +++ b/web/assets/InstallView-AV2llYNm.js @@ -1,156 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -import { B as BaseStyle, V as script$7, af as UniqueComponentId, f as openBlock, g as createElementBlock, m as mergeProps, p as renderSlot, i as createCommentVNode, b_ as findIndexInList, b$ as find, l as resolveComponent, x as createBlock, M as resolveDynamicComponent, y as withCtx, A as createBaseVNode, a8 as toDisplayString, C as normalizeClass, X as findSingle, P as Fragment, aw as Transition, v as withDirectives, ad as vShow, a as defineComponent, I as useI18n, c0 as useModel, r as ref, o as onMounted, t as resolveDirective, h as createVNode, z as unref, aq as script$8, c1 as script$9, c2 as script$a, D as script$b, ay as createTextVNode, bW as script$c, bZ as electronAPI, c3 as MigrationItems, q as computed, aL as watchEffect, Q as renderList, br as withModifiers, c4 as script$d, aC as script$e, c5 as script$f, bN as script$g, aI as script$h, bU as useRouter, R as pushScopeId, U as popScopeId, aO as toRaw, _ as _export_sfc } from "./index-DIU5yZe9.js"; -var theme = /* @__PURE__ */ __name(function theme2(_ref) { - var dt = _ref.dt; - return "\n.p-steplist {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin: 0;\n padding: 0;\n list-style-type: none;\n overflow-x: auto;\n}\n\n.p-step {\n position: relative;\n display: flex;\n flex: 1 1 auto;\n align-items: center;\n gap: ".concat(dt("stepper.step.gap"), ";\n padding: ").concat(dt("stepper.step.padding"), ";\n}\n\n.p-step:last-of-type {\n flex: initial;\n}\n\n.p-step-header {\n border: 0 none;\n display: inline-flex;\n align-items: center;\n text-decoration: none;\n cursor: pointer;\n transition: background ").concat(dt("stepper.transition.duration"), ", color ").concat(dt("stepper.transition.duration"), ", border-color ").concat(dt("stepper.transition.duration"), ", outline-color ").concat(dt("stepper.transition.duration"), ", box-shadow ").concat(dt("stepper.transition.duration"), ";\n border-radius: ").concat(dt("stepper.step.header.border.radius"), ";\n outline-color: transparent;\n background: transparent;\n padding: ").concat(dt("stepper.step.header.padding"), ";\n gap: ").concat(dt("stepper.step.header.gap"), ";\n}\n\n.p-step-header:focus-visible {\n box-shadow: ").concat(dt("stepper.step.header.focus.ring.shadow"), ";\n outline: ").concat(dt("stepper.step.header.focus.ring.width"), " ").concat(dt("stepper.step.header.focus.ring.style"), " ").concat(dt("stepper.step.header.focus.ring.color"), ";\n outline-offset: ").concat(dt("stepper.step.header.focus.ring.offset"), ";\n}\n\n.p-stepper.p-stepper-readonly .p-step {\n cursor: auto;\n}\n\n.p-step-title {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n color: ").concat(dt("stepper.step.title.color"), ";\n font-weight: ").concat(dt("stepper.step.title.font.weight"), ";\n transition: background ").concat(dt("stepper.transition.duration"), ", color ").concat(dt("stepper.transition.duration"), ", border-color ").concat(dt("stepper.transition.duration"), ", box-shadow ").concat(dt("stepper.transition.duration"), ", outline-color ").concat(dt("stepper.transition.duration"), ";\n}\n\n.p-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n color: ").concat(dt("stepper.step.number.color"), ";\n border: 2px solid ").concat(dt("stepper.step.number.border.color"), ";\n background: ").concat(dt("stepper.step.number.background"), ";\n min-width: ").concat(dt("stepper.step.number.size"), ";\n height: ").concat(dt("stepper.step.number.size"), ";\n line-height: ").concat(dt("stepper.step.number.size"), ";\n font-size: ").concat(dt("stepper.step.number.font.size"), ";\n z-index: 1;\n border-radius: ").concat(dt("stepper.step.number.border.radius"), ";\n position: relative;\n font-weight: ").concat(dt("stepper.step.number.font.weight"), ';\n}\n\n.p-step-number::after {\n content: " ";\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: ').concat(dt("stepper.step.number.border.radius"), ";\n box-shadow: ").concat(dt("stepper.step.number.shadow"), ";\n}\n\n.p-step-active .p-step-header {\n cursor: default;\n}\n\n.p-step-active .p-step-number {\n background: ").concat(dt("stepper.step.number.active.background"), ";\n border-color: ").concat(dt("stepper.step.number.active.border.color"), ";\n color: ").concat(dt("stepper.step.number.active.color"), ";\n}\n\n.p-step-active .p-step-title {\n color: ").concat(dt("stepper.step.title.active.color"), ";\n}\n\n.p-step:not(.p-disabled):focus-visible {\n outline: ").concat(dt("focus.ring.width"), " ").concat(dt("focus.ring.style"), " ").concat(dt("focus.ring.color"), ";\n outline-offset: ").concat(dt("focus.ring.offset"), ";\n}\n\n.p-step:has(~ .p-step-active) .p-stepper-separator {\n background: ").concat(dt("stepper.separator.active.background"), ";\n}\n\n.p-stepper-separator {\n flex: 1 1 0;\n background: ").concat(dt("stepper.separator.background"), ";\n width: 100%;\n height: ").concat(dt("stepper.separator.size"), ";\n transition: background ").concat(dt("stepper.transition.duration"), ", color ").concat(dt("stepper.transition.duration"), ", border-color ").concat(dt("stepper.transition.duration"), ", box-shadow ").concat(dt("stepper.transition.duration"), ", outline-color ").concat(dt("stepper.transition.duration"), ";\n}\n\n.p-steppanels {\n padding: ").concat(dt("stepper.steppanels.padding"), ";\n}\n\n.p-steppanel {\n background: ").concat(dt("stepper.steppanel.background"), ";\n color: ").concat(dt("stepper.steppanel.color"), ";\n}\n\n.p-stepper:has(.p-stepitem) {\n display: flex;\n flex-direction: column;\n}\n\n.p-stepitem {\n display: flex;\n flex-direction: column;\n flex: initial;\n}\n\n.p-stepitem.p-stepitem-active {\n flex: 1 1 auto;\n}\n\n.p-stepitem .p-step {\n flex: initial;\n}\n\n.p-stepitem .p-steppanel-content {\n width: 100%;\n padding: ").concat(dt("stepper.steppanel.padding"), ";\n}\n\n.p-stepitem .p-steppanel {\n display: flex;\n flex: 1 1 auto;\n}\n\n.p-stepitem .p-stepper-separator {\n flex: 0 0 auto;\n width: ").concat(dt("stepper.separator.size"), ";\n height: auto;\n margin: ").concat(dt("stepper.separator.margin"), ";\n position: relative;\n left: calc(-1 * ").concat(dt("stepper.separator.size"), ");\n}\n\n.p-stepitem:has(~ .p-stepitem-active) .p-stepper-separator {\n background: ").concat(dt("stepper.separator.active.background"), ";\n}\n\n.p-stepitem:last-of-type .p-steppanel {\n padding-inline-start: ").concat(dt("stepper.step.number.size"), ";\n}\n"); -}, "theme"); +import { B as BaseStyle, q as script$6, o as openBlock, f as createElementBlock, D as mergeProps, c1 as findIndexInList, c2 as find, aB as resolveComponent, k as createBlock, G as resolveDynamicComponent, M as withCtx, H as createBaseVNode, X as toDisplayString, J as renderSlot, I as createCommentVNode, T as normalizeClass, P as findSingle, F as Fragment, aC as Transition, i as withDirectives, v as vShow, ak as UniqueComponentId, d as defineComponent, ab as ref, c3 as useModel, N as createVNode, j as unref, c4 as script$7, bQ as script$8, bM as withModifiers, aP as script$9, a1 as useI18n, c as computed, aI as script$a, aE as createTextVNode, c0 as electronAPI, m as onMounted, r as resolveDirective, av as script$b, c5 as script$c, c6 as script$d, l as script$e, bZ as script$f, c7 as MigrationItems, w as watchEffect, E as renderList, c8 as script$g, bW as useRouter, aL as pushScopeId, aM as popScopeId, aU as toRaw, _ as _export_sfc } from "./index-C4Fk50Nx.js"; +import { _ as _sfc_main$5 } from "./BaseViewTemplate-CsEJhGbv.js"; var classes$4 = { - root: /* @__PURE__ */ __name(function root(_ref2) { - var props = _ref2.props; - return ["p-stepper p-component", { - "p-readonly": props.linear - }]; - }, "root"), - separator: "p-stepper-separator" -}; -var StepperStyle = BaseStyle.extend({ - name: "stepper", - theme, - classes: classes$4 -}); -var script$1$4 = { - name: "BaseStepper", - "extends": script$7, - props: { - value: { - type: [String, Number], - "default": void 0 - }, - linear: { - type: Boolean, - "default": false - } - }, - style: StepperStyle, - provide: /* @__PURE__ */ __name(function provide() { - return { - $pcStepper: this, - $parentInstance: this - }; - }, "provide") -}; -var script$6 = { - name: "Stepper", - "extends": script$1$4, - inheritAttrs: false, - emits: ["update:value"], - data: /* @__PURE__ */ __name(function data() { - return { - id: this.$attrs.id, - d_value: this.value - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId"), - value: /* @__PURE__ */ __name(function value(newValue) { - this.d_value = newValue; - }, "value") - }, - mounted: /* @__PURE__ */ __name(function mounted() { - this.id = this.id || UniqueComponentId(); - }, "mounted"), - methods: { - updateValue: /* @__PURE__ */ __name(function updateValue(newValue) { - if (this.d_value !== newValue) { - this.d_value = newValue; - this.$emit("update:value", newValue); - } - }, "updateValue"), - isStepActive: /* @__PURE__ */ __name(function isStepActive(value2) { - return this.d_value === value2; - }, "isStepActive"), - isStepDisabled: /* @__PURE__ */ __name(function isStepDisabled() { - return this.linear; - }, "isStepDisabled") - } -}; -function render$5(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root"), - role: "tablist" - }, _ctx.ptmi("root")), [_ctx.$slots.start ? renderSlot(_ctx.$slots, "start", { - key: 0 - }) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default"), _ctx.$slots.end ? renderSlot(_ctx.$slots, "end", { - key: 1 - }) : createCommentVNode("", true)], 16); -} -__name(render$5, "render$5"); -script$6.render = render$5; -var classes$3 = { - root: "p-steplist" -}; -var StepListStyle = BaseStyle.extend({ - name: "steplist", - classes: classes$3 -}); -var script$1$3 = { - name: "BaseStepList", - "extends": script$7, - style: StepListStyle, - provide: /* @__PURE__ */ __name(function provide2() { - return { - $pcStepList: this, - $parentInstance: this - }; - }, "provide") -}; -var script$5 = { - name: "StepList", - "extends": script$1$3, - inheritAttrs: false -}; -function render$4(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16); -} -__name(render$4, "render$4"); -script$5.render = render$4; -var classes$2 = { - root: "p-steppanels" -}; -var StepPanelsStyle = BaseStyle.extend({ - name: "steppanels", - classes: classes$2 -}); -var script$1$2 = { - name: "BaseStepPanels", - "extends": script$7, - style: StepPanelsStyle, - provide: /* @__PURE__ */ __name(function provide3() { - return { - $pcStepPanels: this, - $parentInstance: this - }; - }, "provide") -}; -var script$4 = { - name: "StepPanels", - "extends": script$1$2, - inheritAttrs: false -}; -function render$3(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16); -} -__name(render$3, "render$3"); -script$4.render = render$3; -var classes$1 = { - root: /* @__PURE__ */ __name(function root2(_ref) { + root: /* @__PURE__ */ __name(function root(_ref) { var instance = _ref.instance; return ["p-step", { "p-step-active": instance.active, @@ -163,23 +16,23 @@ var classes$1 = { }; var StepStyle = BaseStyle.extend({ name: "step", - classes: classes$1 + classes: classes$4 }); -var script$2$1 = { +var script$2$2 = { name: "StepperSeparator", hostName: "Stepper", - "extends": script$7 + "extends": script$6 }; -function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { +function render$1$2(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("span", mergeProps({ "class": _ctx.cx("separator") }, _ctx.ptm("separator")), null, 16); } -__name(render$1$1, "render$1$1"); -script$2$1.render = render$1$1; -var script$1$1 = { +__name(render$1$2, "render$1$2"); +script$2$2.render = render$1$2; +var script$1$4 = { name: "BaseStep", - "extends": script$7, + "extends": script$6, props: { value: { type: [String, Number], @@ -199,16 +52,16 @@ var script$1$1 = { } }, style: StepStyle, - provide: /* @__PURE__ */ __name(function provide4() { + provide: /* @__PURE__ */ __name(function provide() { return { $pcStep: this, $parentInstance: this }; }, "provide") }; -var script$3 = { +var script$5 = { name: "Step", - "extends": script$1$1, + "extends": script$1$4, inheritAttrs: false, inject: { $pcStepper: { @@ -221,12 +74,12 @@ var script$3 = { "default": null } }, - data: /* @__PURE__ */ __name(function data2() { + data: /* @__PURE__ */ __name(function data() { return { isSeparatorVisible: false }; }, "data"), - mounted: /* @__PURE__ */ __name(function mounted2() { + mounted: /* @__PURE__ */ __name(function mounted() { if (this.$el && this.$pcStepList) { var index = findIndexInList(this.$el, find(this.$pcStepper.$el, '[data-pc-name="step"]')); var stepLen = find(this.$pcStepper.$el, '[data-pc-name="step"]').length; @@ -255,7 +108,7 @@ var script$3 = { var _this$$pcStepItem; return !!this.$pcStepItem ? (_this$$pcStepItem = this.$pcStepItem) === null || _this$$pcStepItem === void 0 ? void 0 : _this$$pcStepItem.value : this.value; }, "activeValue"), - isStepDisabled: /* @__PURE__ */ __name(function isStepDisabled2() { + isStepDisabled: /* @__PURE__ */ __name(function isStepDisabled() { return !this.active && (this.$pcStepper.isStepDisabled() || this.disabled); }, "isStepDisabled"), id: /* @__PURE__ */ __name(function id() { @@ -289,11 +142,11 @@ var script$3 = { }, "a11yAttrs") }, components: { - StepperSeparator: script$2$1 + StepperSeparator: script$2$2 } }; -var _hoisted_1$4 = ["id", "tabindex", "aria-controls", "disabled"]; -function render$2(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$5 = ["id", "tabindex", "aria-controls", "disabled"]; +function render$4(_ctx, _cache, $props, $setup, $data, $options) { var _component_StepperSeparator = resolveComponent("StepperSeparator"); return !_ctx.asChild ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ key: 0, @@ -319,7 +172,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) { "class": _ctx.cx("number") }, $options.getPTOptions("number")), toDisplayString($options.activeValue), 17), createBaseVNode("span", mergeProps({ "class": _ctx.cx("title") - }, $options.getPTOptions("title")), [renderSlot(_ctx.$slots, "default")], 16)], 16, _hoisted_1$4), $data.isSeparatorVisible ? (openBlock(), createBlock(_component_StepperSeparator, { + }, $options.getPTOptions("title")), [renderSlot(_ctx.$slots, "default")], 16)], 16, _hoisted_1$5), $data.isSeparatorVisible ? (openBlock(), createBlock(_component_StepperSeparator, { key: 0 })) : createCommentVNode("", true)]; }), @@ -333,10 +186,40 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) { activateCallback: $options.onStepClick }); } -__name(render$2, "render$2"); -script$3.render = render$2; -var classes = { - root: /* @__PURE__ */ __name(function root3(_ref) { +__name(render$4, "render$4"); +script$5.render = render$4; +var classes$3 = { + root: "p-steplist" +}; +var StepListStyle = BaseStyle.extend({ + name: "steplist", + classes: classes$3 +}); +var script$1$3 = { + name: "BaseStepList", + "extends": script$6, + style: StepListStyle, + provide: /* @__PURE__ */ __name(function provide2() { + return { + $pcStepList: this, + $parentInstance: this + }; + }, "provide") +}; +var script$4 = { + name: "StepList", + "extends": script$1$3, + inheritAttrs: false +}; +function render$3(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16); +} +__name(render$3, "render$3"); +script$4.render = render$3; +var classes$2 = { + root: /* @__PURE__ */ __name(function root2(_ref) { var instance = _ref.instance; return ["p-steppanel", { "p-steppanel-active": instance.isVertical && instance.active @@ -346,23 +229,23 @@ var classes = { }; var StepPanelStyle = BaseStyle.extend({ name: "steppanel", - classes + classes: classes$2 }); -var script$2 = { +var script$2$1 = { name: "StepperSeparator", hostName: "Stepper", - "extends": script$7 + "extends": script$6 }; -function render$1(_ctx, _cache, $props, $setup, $data, $options) { +function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("span", mergeProps({ "class": _ctx.cx("separator") }, _ctx.ptm("separator")), null, 16); } -__name(render$1, "render$1"); -script$2.render = render$1; -var script$1 = { +__name(render$1$1, "render$1$1"); +script$2$1.render = render$1$1; +var script$1$2 = { name: "BaseStepPanel", - "extends": script$7, + "extends": script$6, props: { value: { type: [String, Number], @@ -378,16 +261,16 @@ var script$1 = { } }, style: StepPanelStyle, - provide: /* @__PURE__ */ __name(function provide5() { + provide: /* @__PURE__ */ __name(function provide3() { return { $pcStepPanel: this, $parentInstance: this }; }, "provide") }; -var script = { +var script$3 = { name: "StepPanel", - "extends": script$1, + "extends": script$1$2, inheritAttrs: false, inject: { $pcStepper: { @@ -400,12 +283,12 @@ var script = { "default": null } }, - data: /* @__PURE__ */ __name(function data3() { + data: /* @__PURE__ */ __name(function data2() { return { isSeparatorVisible: false }; }, "data"), - mounted: /* @__PURE__ */ __name(function mounted3() { + mounted: /* @__PURE__ */ __name(function mounted2() { if (this.$el) { var _this$$pcStepItem, _this$$pcStepList; var stepElements = find(this.$pcStepper.$el, '[data-pc-name="step"]'); @@ -423,7 +306,7 @@ var script = { } }); }, "getPTOptions"), - updateValue: /* @__PURE__ */ __name(function updateValue2(val) { + updateValue: /* @__PURE__ */ __name(function updateValue(val) { this.$pcStepper.updateValue(val); }, "updateValue") }, @@ -459,10 +342,10 @@ var script = { }, "a11yAttrs") }, components: { - StepperSeparator: script$2 + StepperSeparator: script$2$1 } }; -function render(_ctx, _cache, $props, $setup, $data, $options) { +function render$2(_ctx, _cache, $props, $setup, $data, $options) { var _component_StepperSeparator = resolveComponent("StepperSeparator"); return $options.isVertical ? (openBlock(), createElementBlock(Fragment, { key: 0 @@ -527,27 +410,412 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { }, "activateCallback") }) : createCommentVNode("", true)], 64)); } +__name(render$2, "render$2"); +script$3.render = render$2; +var classes$1 = { + root: "p-steppanels" +}; +var StepPanelsStyle = BaseStyle.extend({ + name: "steppanels", + classes: classes$1 +}); +var script$1$1 = { + name: "BaseStepPanels", + "extends": script$6, + style: StepPanelsStyle, + provide: /* @__PURE__ */ __name(function provide4() { + return { + $pcStepPanels: this, + $parentInstance: this + }; + }, "provide") +}; +var script$2 = { + name: "StepPanels", + "extends": script$1$1, + inheritAttrs: false +}; +function render$1(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16); +} +__name(render$1, "render$1"); +script$2.render = render$1; +var theme = /* @__PURE__ */ __name(function theme2(_ref) { + var dt = _ref.dt; + return "\n.p-steplist {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin: 0;\n padding: 0;\n list-style-type: none;\n overflow-x: auto;\n}\n\n.p-step {\n position: relative;\n display: flex;\n flex: 1 1 auto;\n align-items: center;\n gap: ".concat(dt("stepper.step.gap"), ";\n padding: ").concat(dt("stepper.step.padding"), ";\n}\n\n.p-step:last-of-type {\n flex: initial;\n}\n\n.p-step-header {\n border: 0 none;\n display: inline-flex;\n align-items: center;\n text-decoration: none;\n cursor: pointer;\n transition: background ").concat(dt("stepper.transition.duration"), ", color ").concat(dt("stepper.transition.duration"), ", border-color ").concat(dt("stepper.transition.duration"), ", outline-color ").concat(dt("stepper.transition.duration"), ", box-shadow ").concat(dt("stepper.transition.duration"), ";\n border-radius: ").concat(dt("stepper.step.header.border.radius"), ";\n outline-color: transparent;\n background: transparent;\n padding: ").concat(dt("stepper.step.header.padding"), ";\n gap: ").concat(dt("stepper.step.header.gap"), ";\n}\n\n.p-step-header:focus-visible {\n box-shadow: ").concat(dt("stepper.step.header.focus.ring.shadow"), ";\n outline: ").concat(dt("stepper.step.header.focus.ring.width"), " ").concat(dt("stepper.step.header.focus.ring.style"), " ").concat(dt("stepper.step.header.focus.ring.color"), ";\n outline-offset: ").concat(dt("stepper.step.header.focus.ring.offset"), ";\n}\n\n.p-stepper.p-stepper-readonly .p-step {\n cursor: auto;\n}\n\n.p-step-title {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n color: ").concat(dt("stepper.step.title.color"), ";\n font-weight: ").concat(dt("stepper.step.title.font.weight"), ";\n transition: background ").concat(dt("stepper.transition.duration"), ", color ").concat(dt("stepper.transition.duration"), ", border-color ").concat(dt("stepper.transition.duration"), ", box-shadow ").concat(dt("stepper.transition.duration"), ", outline-color ").concat(dt("stepper.transition.duration"), ";\n}\n\n.p-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n color: ").concat(dt("stepper.step.number.color"), ";\n border: 2px solid ").concat(dt("stepper.step.number.border.color"), ";\n background: ").concat(dt("stepper.step.number.background"), ";\n min-width: ").concat(dt("stepper.step.number.size"), ";\n height: ").concat(dt("stepper.step.number.size"), ";\n line-height: ").concat(dt("stepper.step.number.size"), ";\n font-size: ").concat(dt("stepper.step.number.font.size"), ";\n z-index: 1;\n border-radius: ").concat(dt("stepper.step.number.border.radius"), ";\n position: relative;\n font-weight: ").concat(dt("stepper.step.number.font.weight"), ';\n}\n\n.p-step-number::after {\n content: " ";\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: ').concat(dt("stepper.step.number.border.radius"), ";\n box-shadow: ").concat(dt("stepper.step.number.shadow"), ";\n}\n\n.p-step-active .p-step-header {\n cursor: default;\n}\n\n.p-step-active .p-step-number {\n background: ").concat(dt("stepper.step.number.active.background"), ";\n border-color: ").concat(dt("stepper.step.number.active.border.color"), ";\n color: ").concat(dt("stepper.step.number.active.color"), ";\n}\n\n.p-step-active .p-step-title {\n color: ").concat(dt("stepper.step.title.active.color"), ";\n}\n\n.p-step:not(.p-disabled):focus-visible {\n outline: ").concat(dt("focus.ring.width"), " ").concat(dt("focus.ring.style"), " ").concat(dt("focus.ring.color"), ";\n outline-offset: ").concat(dt("focus.ring.offset"), ";\n}\n\n.p-step:has(~ .p-step-active) .p-stepper-separator {\n background: ").concat(dt("stepper.separator.active.background"), ";\n}\n\n.p-stepper-separator {\n flex: 1 1 0;\n background: ").concat(dt("stepper.separator.background"), ";\n width: 100%;\n height: ").concat(dt("stepper.separator.size"), ";\n transition: background ").concat(dt("stepper.transition.duration"), ", color ").concat(dt("stepper.transition.duration"), ", border-color ").concat(dt("stepper.transition.duration"), ", box-shadow ").concat(dt("stepper.transition.duration"), ", outline-color ").concat(dt("stepper.transition.duration"), ";\n}\n\n.p-steppanels {\n padding: ").concat(dt("stepper.steppanels.padding"), ";\n}\n\n.p-steppanel {\n background: ").concat(dt("stepper.steppanel.background"), ";\n color: ").concat(dt("stepper.steppanel.color"), ";\n}\n\n.p-stepper:has(.p-stepitem) {\n display: flex;\n flex-direction: column;\n}\n\n.p-stepitem {\n display: flex;\n flex-direction: column;\n flex: initial;\n}\n\n.p-stepitem.p-stepitem-active {\n flex: 1 1 auto;\n}\n\n.p-stepitem .p-step {\n flex: initial;\n}\n\n.p-stepitem .p-steppanel-content {\n width: 100%;\n padding: ").concat(dt("stepper.steppanel.padding"), ";\n}\n\n.p-stepitem .p-steppanel {\n display: flex;\n flex: 1 1 auto;\n}\n\n.p-stepitem .p-stepper-separator {\n flex: 0 0 auto;\n width: ").concat(dt("stepper.separator.size"), ";\n height: auto;\n margin: ").concat(dt("stepper.separator.margin"), ";\n position: relative;\n left: calc(-1 * ").concat(dt("stepper.separator.size"), ");\n}\n\n.p-stepitem:has(~ .p-stepitem-active) .p-stepper-separator {\n background: ").concat(dt("stepper.separator.active.background"), ";\n}\n\n.p-stepitem:last-of-type .p-steppanel {\n padding-inline-start: ").concat(dt("stepper.step.number.size"), ";\n}\n"); +}, "theme"); +var classes = { + root: /* @__PURE__ */ __name(function root3(_ref2) { + var props = _ref2.props; + return ["p-stepper p-component", { + "p-readonly": props.linear + }]; + }, "root"), + separator: "p-stepper-separator" +}; +var StepperStyle = BaseStyle.extend({ + name: "stepper", + theme, + classes +}); +var script$1 = { + name: "BaseStepper", + "extends": script$6, + props: { + value: { + type: [String, Number], + "default": void 0 + }, + linear: { + type: Boolean, + "default": false + } + }, + style: StepperStyle, + provide: /* @__PURE__ */ __name(function provide5() { + return { + $pcStepper: this, + $parentInstance: this + }; + }, "provide") +}; +var script = { + name: "Stepper", + "extends": script$1, + inheritAttrs: false, + emits: ["update:value"], + data: /* @__PURE__ */ __name(function data3() { + return { + id: this.$attrs.id, + d_value: this.value + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId"), + value: /* @__PURE__ */ __name(function value(newValue) { + this.d_value = newValue; + }, "value") + }, + mounted: /* @__PURE__ */ __name(function mounted3() { + this.id = this.id || UniqueComponentId(); + }, "mounted"), + methods: { + updateValue: /* @__PURE__ */ __name(function updateValue2(newValue) { + if (this.d_value !== newValue) { + this.d_value = newValue; + this.$emit("update:value", newValue); + } + }, "updateValue"), + isStepActive: /* @__PURE__ */ __name(function isStepActive(value2) { + return this.d_value === value2; + }, "isStepActive"), + isStepDisabled: /* @__PURE__ */ __name(function isStepDisabled2() { + return this.linear; + }, "isStepDisabled") + } +}; +function render(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root"), + role: "tablist" + }, _ctx.ptmi("root")), [_ctx.$slots.start ? renderSlot(_ctx.$slots, "start", { + key: 0 + }) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default"), _ctx.$slots.end ? renderSlot(_ctx.$slots, "end", { + key: 1 + }) : createCommentVNode("", true)], 16); +} __name(render, "render"); script.render = render; -const _hoisted_1$3 = { class: "flex flex-col gap-6 w-[600px]" }; -const _hoisted_2$3 = { class: "flex flex-col gap-4" }; +const _hoisted_1$4 = { class: "flex flex-col gap-6 w-[600px]" }; +const _hoisted_2$4 = { class: "flex flex-col gap-4" }; +const _hoisted_3$4 = { class: "text-2xl font-semibold text-neutral-100" }; +const _hoisted_4$4 = { class: "text-neutral-400 my-0" }; +const _hoisted_5$3 = { class: "flex flex-col bg-neutral-800 p-4 rounded-lg" }; +const _hoisted_6$3 = { class: "flex items-center gap-4" }; +const _hoisted_7$3 = { class: "flex-1" }; +const _hoisted_8$3 = { class: "text-lg font-medium text-neutral-100" }; +const _hoisted_9$3 = { class: "text-sm text-neutral-400 mt-1" }; +const _hoisted_10$3 = { class: "flex items-center gap-4" }; +const _hoisted_11$3 = { class: "flex-1" }; +const _hoisted_12$3 = { class: "text-lg font-medium text-neutral-100" }; +const _hoisted_13$2 = { class: "text-sm text-neutral-400 mt-1" }; +const _hoisted_14$2 = { class: "text-neutral-300" }; +const _hoisted_15$2 = { class: "font-medium mb-2" }; +const _hoisted_16$2 = { class: "list-disc pl-6 space-y-1" }; +const _hoisted_17$2 = { class: "font-medium mt-4 mb-2" }; +const _hoisted_18$2 = { class: "list-disc pl-6 space-y-1" }; +const _sfc_main$4 = /* @__PURE__ */ defineComponent({ + __name: "DesktopSettingsConfiguration", + props: { + "autoUpdate": { required: true }, + "autoUpdateModifiers": {}, + "allowMetrics": { required: true }, + "allowMetricsModifiers": {} + }, + emits: ["update:autoUpdate", "update:allowMetrics"], + setup(__props) { + const showDialog = ref(false); + const autoUpdate = useModel(__props, "autoUpdate"); + const allowMetrics = useModel(__props, "allowMetrics"); + const showMetricsInfo = /* @__PURE__ */ __name(() => { + showDialog.value = true; + }, "showMetricsInfo"); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", _hoisted_1$4, [ + createBaseVNode("div", _hoisted_2$4, [ + createBaseVNode("h2", _hoisted_3$4, toDisplayString(_ctx.$t("install.desktopAppSettings")), 1), + createBaseVNode("p", _hoisted_4$4, toDisplayString(_ctx.$t("install.desktopAppSettingsDescription")), 1) + ]), + createBaseVNode("div", _hoisted_5$3, [ + createBaseVNode("div", _hoisted_6$3, [ + createBaseVNode("div", _hoisted_7$3, [ + createBaseVNode("h3", _hoisted_8$3, toDisplayString(_ctx.$t("install.settings.autoUpdate")), 1), + createBaseVNode("p", _hoisted_9$3, toDisplayString(_ctx.$t("install.settings.autoUpdateDescription")), 1) + ]), + createVNode(unref(script$7), { + modelValue: autoUpdate.value, + "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => autoUpdate.value = $event) + }, null, 8, ["modelValue"]) + ]), + createVNode(unref(script$8)), + createBaseVNode("div", _hoisted_10$3, [ + createBaseVNode("div", _hoisted_11$3, [ + createBaseVNode("h3", _hoisted_12$3, toDisplayString(_ctx.$t("install.settings.allowMetrics")), 1), + createBaseVNode("p", _hoisted_13$2, toDisplayString(_ctx.$t("install.settings.allowMetricsDescription")), 1), + createBaseVNode("a", { + href: "#", + class: "text-sm text-blue-400 hover:text-blue-300 mt-1 inline-block", + onClick: withModifiers(showMetricsInfo, ["prevent"]) + }, toDisplayString(_ctx.$t("install.settings.learnMoreAboutData")), 1) + ]), + createVNode(unref(script$7), { + modelValue: allowMetrics.value, + "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => allowMetrics.value = $event) + }, null, 8, ["modelValue"]) + ]) + ]), + createVNode(unref(script$9), { + visible: showDialog.value, + "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => showDialog.value = $event), + modal: "", + header: _ctx.$t("install.settings.dataCollectionDialog.title") + }, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_14$2, [ + createBaseVNode("h4", _hoisted_15$2, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.whatWeCollect")), 1), + createBaseVNode("ul", _hoisted_16$2, [ + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.errorReports")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.systemInfo")), 1) + ]), + createBaseVNode("h4", _hoisted_17$2, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.whatWeDoNotCollect")), 1), + createBaseVNode("ul", _hoisted_18$2, [ + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.personalInformation")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.workflowContents")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.fileSystemInformation")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t( + "install.settings.dataCollectionDialog.customNodeConfigurations" + )), 1) + ]) + ]) + ]), + _: 1 + }, 8, ["visible", "header"]) + ]); + }; + } +}); +const _imports_0 = "" + new URL("images/nvidia-logo.svg", import.meta.url).href; +const _imports_1 = "" + new URL("images/apple-mps-logo.png", import.meta.url).href; +const _imports_2 = "" + new URL("images/manual-configuration.svg", import.meta.url).href; +const _hoisted_1$3 = { class: "flex flex-col gap-6 w-[600px] h-[30rem] select-none" }; +const _hoisted_2$3 = { class: "grow flex flex-col gap-4 text-neutral-300" }; const _hoisted_3$3 = { class: "text-2xl font-semibold text-neutral-100" }; -const _hoisted_4$3 = { class: "text-neutral-400 my-0" }; -const _hoisted_5$2 = { class: "flex gap-2" }; -const _hoisted_6$2 = { class: "bg-neutral-800 p-4 rounded-lg" }; -const _hoisted_7$2 = { class: "text-lg font-medium mt-0 mb-3 text-neutral-100" }; -const _hoisted_8$2 = { class: "flex flex-col gap-2" }; -const _hoisted_9$2 = { class: "flex items-center gap-2" }; -const _hoisted_10$2 = /* @__PURE__ */ createBaseVNode("i", { class: "pi pi-folder text-neutral-400" }, null, -1); -const _hoisted_11$2 = /* @__PURE__ */ createBaseVNode("span", { class: "text-neutral-400" }, "App Data:", -1); -const _hoisted_12$2 = { class: "text-neutral-200" }; -const _hoisted_13$2 = { class: "pi pi-info-circle" }; -const _hoisted_14$2 = { class: "flex items-center gap-2" }; -const _hoisted_15$2 = /* @__PURE__ */ createBaseVNode("i", { class: "pi pi-desktop text-neutral-400" }, null, -1); -const _hoisted_16$1 = /* @__PURE__ */ createBaseVNode("span", { class: "text-neutral-400" }, "App Path:", -1); -const _hoisted_17$1 = { class: "text-neutral-200" }; -const _hoisted_18$1 = { class: "pi pi-info-circle" }; +const _hoisted_4$3 = { class: "m-1 text-neutral-400" }; +const _hoisted_5$2 = /* @__PURE__ */ createBaseVNode("img", { + class: "m-12", + alt: "NVIDIA logo", + width: "196", + height: "32", + src: _imports_0 +}, null, -1); +const _hoisted_6$2 = [ + _hoisted_5$2 +]; +const _hoisted_7$2 = /* @__PURE__ */ createBaseVNode("img", { + class: "rounded-lg hover-brighten", + alt: "Apple Metal Performance Shaders Logo", + width: "292", + ratio: "", + src: _imports_1 +}, null, -1); +const _hoisted_8$2 = [ + _hoisted_7$2 +]; +const _hoisted_9$2 = /* @__PURE__ */ createBaseVNode("img", { + class: "m-12", + alt: "Manual configuration", + width: "196", + src: _imports_2 +}, null, -1); +const _hoisted_10$2 = [ + _hoisted_9$2 +]; +const _hoisted_11$2 = { + key: 0, + class: "m-1" +}; +const _hoisted_12$2 = { + key: 1, + class: "m-1" +}; +const _hoisted_13$1 = { + key: 2, + class: "text-neutral-300" +}; +const _hoisted_14$1 = { class: "m-1" }; +const _hoisted_15$1 = { key: 3 }; +const _hoisted_16$1 = { class: "m-1" }; +const _hoisted_17$1 = { class: "m-1" }; +const _hoisted_18$1 = { + for: "cpu-mode", + class: "select-none" +}; const _sfc_main$3 = /* @__PURE__ */ defineComponent({ + __name: "GpuPicker", + props: { + "device": { + required: true + }, + "deviceModifiers": {} + }, + emits: ["update:device"], + setup(__props) { + const { t } = useI18n(); + const cpuMode = computed({ + get: /* @__PURE__ */ __name(() => selected.value === "cpu", "get"), + set: /* @__PURE__ */ __name((value2) => { + selected.value = value2 ? "cpu" : null; + }, "set") + }); + const selected = useModel(__props, "device"); + const electron = electronAPI(); + const platform = electron.getPlatform(); + const pickGpu = /* @__PURE__ */ __name((value2) => { + const newValue = selected.value === value2 ? null : value2; + selected.value = newValue; + }, "pickGpu"); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", _hoisted_1$3, [ + createBaseVNode("div", _hoisted_2$3, [ + createBaseVNode("h2", _hoisted_3$3, toDisplayString(_ctx.$t("install.gpuSelection.selectGpu")), 1), + createBaseVNode("p", _hoisted_4$3, toDisplayString(_ctx.$t("install.gpuSelection.selectGpuDescription")) + ": ", 1), + createBaseVNode("div", { + class: normalizeClass(["flex gap-2 text-center transition-opacity", { selected: selected.value }]) + }, [ + unref(platform) !== "darwin" ? (openBlock(), createElementBlock("div", { + key: 0, + class: normalizeClass(["gpu-button", { selected: selected.value === "nvidia" }]), + role: "button", + onClick: _cache[0] || (_cache[0] = ($event) => pickGpu("nvidia")) + }, _hoisted_6$2, 2)) : createCommentVNode("", true), + unref(platform) === "darwin" ? (openBlock(), createElementBlock("div", { + key: 1, + class: normalizeClass(["gpu-button", { selected: selected.value === "mps" }]), + role: "button", + onClick: _cache[1] || (_cache[1] = ($event) => pickGpu("mps")) + }, _hoisted_8$2, 2)) : createCommentVNode("", true), + createBaseVNode("div", { + class: normalizeClass(["gpu-button", { selected: selected.value === "unsupported" }]), + role: "button", + onClick: _cache[2] || (_cache[2] = ($event) => pickGpu("unsupported")) + }, _hoisted_10$2, 2) + ], 2), + selected.value === "nvidia" ? (openBlock(), createElementBlock("p", _hoisted_11$2, [ + createVNode(unref(script$a), { + icon: "pi pi-check", + severity: "success", + value: "CUDA" + }), + createTextVNode(" " + toDisplayString(_ctx.$t("install.gpuSelection.nvidiaDescription")), 1) + ])) : createCommentVNode("", true), + selected.value === "mps" ? (openBlock(), createElementBlock("p", _hoisted_12$2, [ + createVNode(unref(script$a), { + icon: "pi pi-check", + severity: "success", + value: "MPS" + }), + createTextVNode(" " + toDisplayString(_ctx.$t("install.gpuSelection.mpsDescription")), 1) + ])) : createCommentVNode("", true), + selected.value === "unsupported" ? (openBlock(), createElementBlock("div", _hoisted_13$1, [ + createBaseVNode("p", _hoisted_14$1, [ + createVNode(unref(script$a), { + icon: "pi pi-exclamation-triangle", + severity: "warn", + value: unref(t)("icon.exclamation-triangle") + }, null, 8, ["value"]), + createTextVNode(" " + toDisplayString(_ctx.$t("install.gpuSelection.customSkipsPython")), 1) + ]), + createBaseVNode("ul", null, [ + createBaseVNode("li", null, [ + createBaseVNode("strong", null, toDisplayString(_ctx.$t("install.gpuSelection.customComfyNeedsPython")), 1) + ]), + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.gpuSelection.customManualVenv")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.gpuSelection.customInstallRequirements")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.gpuSelection.customMayNotWork")), 1) + ]) + ])) : createCommentVNode("", true), + selected.value === "cpu" ? (openBlock(), createElementBlock("div", _hoisted_15$1, [ + createBaseVNode("p", _hoisted_16$1, [ + createVNode(unref(script$a), { + icon: "pi pi-exclamation-triangle", + severity: "warn", + value: unref(t)("icon.exclamation-triangle") + }, null, 8, ["value"]), + createTextVNode(" " + toDisplayString(_ctx.$t("install.gpuSelection.cpuModeDescription")), 1) + ]), + createBaseVNode("p", _hoisted_17$1, toDisplayString(_ctx.$t("install.gpuSelection.cpuModeDescription2")), 1) + ])) : createCommentVNode("", true) + ]), + createBaseVNode("div", { + class: normalizeClass(["transition-opacity flex gap-3 h-0", { + "opacity-40": selected.value && selected.value !== "cpu" + }]) + }, [ + createVNode(unref(script$7), { + modelValue: cpuMode.value, + "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => cpuMode.value = $event), + inputId: "cpu-mode", + class: "-translate-y-40" + }, null, 8, ["modelValue"]), + createBaseVNode("label", _hoisted_18$1, toDisplayString(_ctx.$t("install.gpuSelection.enableCpuMode")), 1) + ], 2) + ]); + }; + } +}); +const _hoisted_1$2 = { class: "flex flex-col gap-6 w-[600px]" }; +const _hoisted_2$2 = { class: "flex flex-col gap-4" }; +const _hoisted_3$2 = { class: "text-2xl font-semibold text-neutral-100" }; +const _hoisted_4$2 = { class: "text-neutral-400 my-0" }; +const _hoisted_5$1 = { class: "flex gap-2" }; +const _hoisted_6$1 = { class: "bg-neutral-800 p-4 rounded-lg" }; +const _hoisted_7$1 = { class: "text-lg font-medium mt-0 mb-3 text-neutral-100" }; +const _hoisted_8$1 = { class: "flex flex-col gap-2" }; +const _hoisted_9$1 = { class: "flex items-center gap-2" }; +const _hoisted_10$1 = /* @__PURE__ */ createBaseVNode("i", { class: "pi pi-folder text-neutral-400" }, null, -1); +const _hoisted_11$1 = /* @__PURE__ */ createBaseVNode("span", { class: "text-neutral-400" }, "App Data:", -1); +const _hoisted_12$1 = { class: "text-neutral-200" }; +const _hoisted_13 = { class: "pi pi-info-circle" }; +const _hoisted_14 = { class: "flex items-center gap-2" }; +const _hoisted_15 = /* @__PURE__ */ createBaseVNode("i", { class: "pi pi-desktop text-neutral-400" }, null, -1); +const _hoisted_16 = /* @__PURE__ */ createBaseVNode("span", { class: "text-neutral-400" }, "App Path:", -1); +const _hoisted_17 = { class: "text-neutral-200" }; +const _hoisted_18 = { class: "pi pi-info-circle" }; +const _sfc_main$2 = /* @__PURE__ */ defineComponent({ __name: "InstallLocationPicker", props: { "installPath": { required: true }, @@ -560,6 +828,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({ const { t } = useI18n(); const installPath = useModel(__props, "installPath"); const pathError = useModel(__props, "pathError"); + const pathExists = ref(false); const appData = ref(""); const appPath = ref(""); const electron = electronAPI(); @@ -573,10 +842,21 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({ const validatePath = /* @__PURE__ */ __name(async (path) => { try { pathError.value = ""; + pathExists.value = false; const validation = await electron.validateInstallPath(path); if (!validation.isValid) { - pathError.value = validation.error; + const errors = []; + if (validation.cannotWrite) errors.push(t("install.cannotWrite")); + if (validation.freeSpace < validation.requiredSpace) { + const requiredGB = validation.requiredSpace / 1024 / 1024 / 1024; + errors.push(`${t("install.insufficientFreeSpace")}: ${requiredGB} GB`); + } + if (validation.parentMissing) errors.push(t("install.parentMissing")); + if (validation.error) + errors.push(`${t("install.unhandledError")}: ${validation.error}`); + pathError.value = errors.join("\n"); } + if (validation.exists) pathExists.value = true; } catch (error) { pathError.value = t("install.pathValidationFailed"); } @@ -594,14 +874,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({ }, "browsePath"); return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock("div", _hoisted_1$3, [ - createBaseVNode("div", _hoisted_2$3, [ - createBaseVNode("h2", _hoisted_3$3, toDisplayString(_ctx.$t("install.chooseInstallationLocation")), 1), - createBaseVNode("p", _hoisted_4$3, toDisplayString(_ctx.$t("install.installLocationDescription")), 1), - createBaseVNode("div", _hoisted_5$2, [ - createVNode(unref(script$a), { class: "flex-1" }, { + return openBlock(), createElementBlock("div", _hoisted_1$2, [ + createBaseVNode("div", _hoisted_2$2, [ + createBaseVNode("h2", _hoisted_3$2, toDisplayString(_ctx.$t("install.chooseInstallationLocation")), 1), + createBaseVNode("p", _hoisted_4$2, toDisplayString(_ctx.$t("install.installLocationDescription")), 1), + createBaseVNode("div", _hoisted_5$1, [ + createVNode(unref(script$d), { class: "flex-1" }, { default: withCtx(() => [ - createVNode(unref(script$8), { + createVNode(unref(script$b), { modelValue: installPath.value, "onUpdate:modelValue": [ _cache[0] || (_cache[0] = ($event) => installPath.value = $event), @@ -609,44 +889,54 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({ ], class: normalizeClass(["w-full", { "p-invalid": pathError.value }]) }, null, 8, ["modelValue", "class"]), - withDirectives(createVNode(unref(script$9), { class: "pi pi-info-circle" }, null, 512), [ + withDirectives(createVNode(unref(script$c), { class: "pi pi-info-circle" }, null, 512), [ [_directive_tooltip, _ctx.$t("install.installLocationTooltip")] ]) ]), _: 1 }), - createVNode(unref(script$b), { + createVNode(unref(script$e), { icon: "pi pi-folder", onClick: browsePath, class: "w-12" }) ]), - pathError.value ? (openBlock(), createBlock(unref(script$c), { + pathError.value ? (openBlock(), createBlock(unref(script$f), { key: 0, - severity: "error" + severity: "error", + class: "whitespace-pre-line" }, { default: withCtx(() => [ createTextVNode(toDisplayString(pathError.value), 1) ]), _: 1 + })) : createCommentVNode("", true), + pathExists.value ? (openBlock(), createBlock(unref(script$f), { + key: 1, + severity: "warn" + }, { + default: withCtx(() => [ + createTextVNode(toDisplayString(_ctx.$t("install.pathExists")), 1) + ]), + _: 1 })) : createCommentVNode("", true) ]), - createBaseVNode("div", _hoisted_6$2, [ - createBaseVNode("h3", _hoisted_7$2, toDisplayString(_ctx.$t("install.systemLocations")), 1), - createBaseVNode("div", _hoisted_8$2, [ - createBaseVNode("div", _hoisted_9$2, [ - _hoisted_10$2, - _hoisted_11$2, - createBaseVNode("span", _hoisted_12$2, toDisplayString(appData.value), 1), - withDirectives(createBaseVNode("span", _hoisted_13$2, null, 512), [ + createBaseVNode("div", _hoisted_6$1, [ + createBaseVNode("h3", _hoisted_7$1, toDisplayString(_ctx.$t("install.systemLocations")), 1), + createBaseVNode("div", _hoisted_8$1, [ + createBaseVNode("div", _hoisted_9$1, [ + _hoisted_10$1, + _hoisted_11$1, + createBaseVNode("span", _hoisted_12$1, toDisplayString(appData.value), 1), + withDirectives(createBaseVNode("span", _hoisted_13, null, 512), [ [_directive_tooltip, _ctx.$t("install.appDataLocationTooltip")] ]) ]), - createBaseVNode("div", _hoisted_14$2, [ - _hoisted_15$2, - _hoisted_16$1, - createBaseVNode("span", _hoisted_17$1, toDisplayString(appPath.value), 1), - withDirectives(createBaseVNode("span", _hoisted_18$1, null, 512), [ + createBaseVNode("div", _hoisted_14, [ + _hoisted_15, + _hoisted_16, + createBaseVNode("span", _hoisted_17, toDisplayString(appPath.value), 1), + withDirectives(createBaseVNode("span", _hoisted_18, null, 512), [ [_directive_tooltip, _ctx.$t("install.appPathLocationTooltip")] ]) ]) @@ -656,28 +946,25 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$2 = { class: "flex flex-col gap-6 w-[600px]" }; -const _hoisted_2$2 = { class: "flex flex-col gap-4" }; -const _hoisted_3$2 = { class: "text-2xl font-semibold text-neutral-100" }; -const _hoisted_4$2 = { class: "text-neutral-400 my-0" }; -const _hoisted_5$1 = { class: "flex gap-2" }; -const _hoisted_6$1 = { +const _hoisted_1$1 = { class: "flex flex-col gap-6 w-[600px]" }; +const _hoisted_2$1 = { class: "flex flex-col gap-4" }; +const _hoisted_3$1 = { class: "text-2xl font-semibold text-neutral-100" }; +const _hoisted_4$1 = { class: "text-neutral-400 my-0" }; +const _hoisted_5 = { class: "flex gap-2" }; +const _hoisted_6 = { key: 0, class: "flex flex-col gap-4 bg-neutral-800 p-4 rounded-lg" }; -const _hoisted_7$1 = { class: "text-lg mt-0 font-medium text-neutral-100" }; -const _hoisted_8$1 = { class: "flex flex-col gap-3" }; -const _hoisted_9$1 = ["onClick"]; -const _hoisted_10$1 = ["for"]; -const _hoisted_11$1 = { class: "text-sm text-neutral-400 my-1" }; -const _hoisted_12$1 = { class: "flex items-center gap-3 p-2 rounded cursor-not-allowed" }; -const _hoisted_13$1 = { class: "text-neutral-200 font-medium" }; -const _hoisted_14$1 = { class: "text-sm text-neutral-400 my-1" }; -const _hoisted_15$1 = { +const _hoisted_7 = { class: "text-lg mt-0 font-medium text-neutral-100" }; +const _hoisted_8 = { class: "flex flex-col gap-3" }; +const _hoisted_9 = ["onClick"]; +const _hoisted_10 = ["for"]; +const _hoisted_11 = { class: "text-sm text-neutral-400 my-1" }; +const _hoisted_12 = { key: 1, class: "text-neutral-400 italic" }; -const _sfc_main$2 = /* @__PURE__ */ defineComponent({ +const _sfc_main$1 = /* @__PURE__ */ defineComponent({ __name: "MigrationPicker", props: { "sourcePath": { required: false }, @@ -733,12 +1020,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({ migrationItemIds.value = migrationItems.value.filter((item) => item.selected).map((item) => item.id); }); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$2, [ - createBaseVNode("div", _hoisted_2$2, [ - createBaseVNode("h2", _hoisted_3$2, toDisplayString(_ctx.$t("install.migrateFromExistingInstallation")), 1), - createBaseVNode("p", _hoisted_4$2, toDisplayString(_ctx.$t("install.migrationSourcePathDescription")), 1), - createBaseVNode("div", _hoisted_5$1, [ - createVNode(unref(script$8), { + return openBlock(), createElementBlock("div", _hoisted_1$1, [ + createBaseVNode("div", _hoisted_2$1, [ + createBaseVNode("h2", _hoisted_3$1, toDisplayString(_ctx.$t("install.migrateFromExistingInstallation")), 1), + createBaseVNode("p", _hoisted_4$1, toDisplayString(_ctx.$t("install.migrationSourcePathDescription")), 1), + createBaseVNode("div", _hoisted_5, [ + createVNode(unref(script$b), { modelValue: sourcePath.value, "onUpdate:modelValue": [ _cache[0] || (_cache[0] = ($event) => sourcePath.value = $event), @@ -747,13 +1034,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({ placeholder: "Select existing ComfyUI installation (optional)", class: normalizeClass(["flex-1", { "p-invalid": pathError.value }]) }, null, 8, ["modelValue", "class"]), - createVNode(unref(script$b), { + createVNode(unref(script$e), { icon: "pi pi-folder", onClick: browsePath, class: "w-12" }) ]), - pathError.value ? (openBlock(), createBlock(unref(script$c), { + pathError.value ? (openBlock(), createBlock(unref(script$f), { key: 0, severity: "error" }, { @@ -763,16 +1050,16 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({ _: 1 })) : createCommentVNode("", true) ]), - isValidSource.value ? (openBlock(), createElementBlock("div", _hoisted_6$1, [ - createBaseVNode("h3", _hoisted_7$1, toDisplayString(_ctx.$t("install.selectItemsToMigrate")), 1), - createBaseVNode("div", _hoisted_8$1, [ + isValidSource.value ? (openBlock(), createElementBlock("div", _hoisted_6, [ + createBaseVNode("h3", _hoisted_7, toDisplayString(_ctx.$t("install.selectItemsToMigrate")), 1), + createBaseVNode("div", _hoisted_8, [ (openBlock(true), createElementBlock(Fragment, null, renderList(migrationItems.value, (item) => { return openBlock(), createElementBlock("div", { key: item.id, class: "flex items-center gap-3 p-2 hover:bg-neutral-700 rounded", onClick: /* @__PURE__ */ __name(($event) => item.selected = !item.selected, "onClick") }, [ - createVNode(unref(script$d), { + createVNode(unref(script$g), { modelValue: item.selected, "onUpdate:modelValue": /* @__PURE__ */ __name(($event) => item.selected = $event, "onUpdate:modelValue"), inputId: item.id, @@ -784,284 +1071,218 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({ createBaseVNode("label", { for: item.id, class: "text-neutral-200 font-medium" - }, toDisplayString(item.label), 9, _hoisted_10$1), - createBaseVNode("p", _hoisted_11$1, toDisplayString(item.description), 1) + }, toDisplayString(item.label), 9, _hoisted_10), + createBaseVNode("p", _hoisted_11, toDisplayString(item.description), 1) ]) - ], 8, _hoisted_9$1); - }), 128)), - createBaseVNode("div", _hoisted_12$1, [ - createVNode(unref(script$d), { - disabled: "", - binary: true - }), - createBaseVNode("div", null, [ - createBaseVNode("label", _hoisted_13$1, [ - createTextVNode(toDisplayString(_ctx.$t("install.customNodes")) + " ", 1), - createVNode(unref(script$e), { severity: "secondary" }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(_ctx.$t("g.comingSoon")) + "... ", 1) - ]), - _: 1 - }) - ]), - createBaseVNode("p", _hoisted_14$1, toDisplayString(_ctx.$t("install.customNodesDescription")), 1) - ]) - ]) + ], 8, _hoisted_9); + }), 128)) ]) - ])) : (openBlock(), createElementBlock("div", _hoisted_15$1, toDisplayString(_ctx.$t("install.migrationOptional")), 1)) + ])) : (openBlock(), createElementBlock("div", _hoisted_12, toDisplayString(_ctx.$t("install.migrationOptional")), 1)) ]); }; } }); -const _hoisted_1$1 = { class: "flex flex-col gap-6 w-[600px]" }; -const _hoisted_2$1 = { class: "flex flex-col gap-4" }; -const _hoisted_3$1 = { class: "text-2xl font-semibold text-neutral-100" }; -const _hoisted_4$1 = { class: "text-neutral-400 my-0" }; -const _hoisted_5 = { class: "flex flex-col bg-neutral-800 p-4 rounded-lg" }; -const _hoisted_6 = { class: "flex items-center gap-4" }; -const _hoisted_7 = { class: "flex-1" }; -const _hoisted_8 = { class: "text-lg font-medium text-neutral-100" }; -const _hoisted_9 = { class: "text-sm text-neutral-400 mt-1" }; -const _hoisted_10 = { class: "flex items-center gap-4" }; -const _hoisted_11 = { class: "flex-1" }; -const _hoisted_12 = { class: "text-lg font-medium text-neutral-100" }; -const _hoisted_13 = { class: "text-sm text-neutral-400 mt-1" }; -const _hoisted_14 = { class: "text-neutral-300" }; -const _hoisted_15 = { class: "font-medium mb-2" }; -const _hoisted_16 = { class: "list-disc pl-6 space-y-1" }; -const _hoisted_17 = { class: "font-medium mt-4 mb-2" }; -const _hoisted_18 = { class: "list-disc pl-6 space-y-1" }; -const _sfc_main$1 = /* @__PURE__ */ defineComponent({ - __name: "DesktopSettingsConfiguration", - props: { - "autoUpdate": { required: true }, - "autoUpdateModifiers": {}, - "allowMetrics": { required: true }, - "allowMetricsModifiers": {} - }, - emits: ["update:autoUpdate", "update:allowMetrics"], - setup(__props) { - const showDialog = ref(false); - const autoUpdate = useModel(__props, "autoUpdate"); - const allowMetrics = useModel(__props, "allowMetrics"); - const showMetricsInfo = /* @__PURE__ */ __name(() => { - showDialog.value = true; - }, "showMetricsInfo"); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$1, [ - createBaseVNode("div", _hoisted_2$1, [ - createBaseVNode("h2", _hoisted_3$1, toDisplayString(_ctx.$t("install.desktopAppSettings")), 1), - createBaseVNode("p", _hoisted_4$1, toDisplayString(_ctx.$t("install.desktopAppSettingsDescription")), 1) - ]), - createBaseVNode("div", _hoisted_5, [ - createBaseVNode("div", _hoisted_6, [ - createBaseVNode("div", _hoisted_7, [ - createBaseVNode("h3", _hoisted_8, toDisplayString(_ctx.$t("install.settings.autoUpdate")), 1), - createBaseVNode("p", _hoisted_9, toDisplayString(_ctx.$t("install.settings.autoUpdateDescription")), 1) - ]), - createVNode(unref(script$f), { - modelValue: autoUpdate.value, - "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => autoUpdate.value = $event) - }, null, 8, ["modelValue"]) - ]), - createVNode(unref(script$g)), - createBaseVNode("div", _hoisted_10, [ - createBaseVNode("div", _hoisted_11, [ - createBaseVNode("h3", _hoisted_12, toDisplayString(_ctx.$t("install.settings.allowMetrics")), 1), - createBaseVNode("p", _hoisted_13, toDisplayString(_ctx.$t("install.settings.allowMetricsDescription")), 1), - createBaseVNode("a", { - href: "#", - class: "text-sm text-blue-400 hover:text-blue-300 mt-1 inline-block", - onClick: withModifiers(showMetricsInfo, ["prevent"]) - }, toDisplayString(_ctx.$t("install.settings.learnMoreAboutData")), 1) - ]), - createVNode(unref(script$f), { - modelValue: allowMetrics.value, - "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => allowMetrics.value = $event) - }, null, 8, ["modelValue"]) - ]) - ]), - createVNode(unref(script$h), { - visible: showDialog.value, - "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => showDialog.value = $event), - modal: "", - header: _ctx.$t("install.settings.dataCollectionDialog.title") - }, { - default: withCtx(() => [ - createBaseVNode("div", _hoisted_14, [ - createBaseVNode("h4", _hoisted_15, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.whatWeCollect")), 1), - createBaseVNode("ul", _hoisted_16, [ - createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.errorReports")), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.systemInfo")), 1) - ]), - createBaseVNode("h4", _hoisted_17, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.whatWeDoNotCollect")), 1), - createBaseVNode("ul", _hoisted_18, [ - createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.personalInformation")), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.workflowContents")), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.fileSystemInformation")), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t( - "install.settings.dataCollectionDialog.customNodeConfigurations" - )), 1) - ]) - ]) - ]), - _: 1 - }, 8, ["visible", "header"]) - ]); - }; - } -}); -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-7ef01cf2"), n = n(), popScopeId(), n), "_withScopeId"); -const _hoisted_1 = { class: "font-sans flex flex-col items-center h-screen m-0 text-neutral-300 bg-neutral-900 dark-theme pointer-events-auto" }; -const _hoisted_2 = { class: "flex pt-6 justify-end" }; +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-de33872d"), n = n(), popScopeId(), n), "_withScopeId"); +const _hoisted_1 = { class: "flex pt-6 justify-end" }; +const _hoisted_2 = { class: "flex pt-6 justify-between" }; const _hoisted_3 = { class: "flex pt-6 justify-between" }; const _hoisted_4 = { class: "flex pt-6 justify-between" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "InstallView", setup(__props) { + const device = ref(null); const installPath = ref(""); const pathError = ref(""); const migrationSourcePath = ref(""); const migrationItemIds = ref([]); const autoUpdate = ref(true); const allowMetrics = ref(true); + const highestStep = ref(0); + const setHighestStep = /* @__PURE__ */ __name((value2) => { + const int = typeof value2 === "number" ? value2 : parseInt(value2, 10); + if (!isNaN(int) && int > highestStep.value) highestStep.value = int; + }, "setHighestStep"); const hasError = computed(() => pathError.value !== ""); + const noGpu = computed(() => typeof device.value !== "string"); + const electron = electronAPI(); const router = useRouter(); const install = /* @__PURE__ */ __name(() => { - const options = toRaw({ + const options = { installPath: installPath.value, autoUpdate: autoUpdate.value, allowMetrics: allowMetrics.value, migrationSourcePath: migrationSourcePath.value, - migrationItemIds: toRaw(migrationItemIds.value) - }); - electronAPI().installComfyUI(options); - router.push("/server-start"); + migrationItemIds: toRaw(migrationItemIds.value), + device: device.value + }; + electron.installComfyUI(options); + const nextPage = options.device === "unsupported" ? "/manual-configuration" : "/server-start"; + router.push(nextPage); }, "install"); + onMounted(async () => { + if (!electron) return; + const detectedGpu = await electron.Config.getDetectedGpu(); + if (detectedGpu === "mps" || detectedGpu === "nvidia") + device.value = detectedGpu; + }); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1, [ - createVNode(unref(script$6), { - class: "mt-[5vh] 2xl:mt-[20vh]", - value: "1" - }, { - default: withCtx(() => [ - createVNode(unref(script$5), null, { - default: withCtx(() => [ - createVNode(unref(script$3), { - value: "1", - disabled: hasError.value - }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(_ctx.$t("install.installLocation")), 1) - ]), - _: 1 - }, 8, ["disabled"]), - createVNode(unref(script$3), { - value: "2", - disabled: hasError.value - }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(_ctx.$t("install.migration")), 1) - ]), - _: 1 - }, 8, ["disabled"]), - createVNode(unref(script$3), { - value: "3", - disabled: hasError.value - }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(_ctx.$t("install.desktopSettings")), 1) - ]), - _: 1 - }, 8, ["disabled"]) - ]), - _: 1 - }), - createVNode(unref(script$4), null, { - default: withCtx(() => [ - createVNode(unref(script), { value: "1" }, { - default: withCtx(({ activateCallback }) => [ - createVNode(_sfc_main$3, { - installPath: installPath.value, - "onUpdate:installPath": _cache[0] || (_cache[0] = ($event) => installPath.value = $event), - pathError: pathError.value, - "onUpdate:pathError": _cache[1] || (_cache[1] = ($event) => pathError.value = $event) - }, null, 8, ["installPath", "pathError"]), - createBaseVNode("div", _hoisted_2, [ - createVNode(unref(script$b), { - label: "Next", - icon: "pi pi-arrow-right", - iconPos: "right", - onClick: /* @__PURE__ */ __name(($event) => activateCallback("2"), "onClick"), - disabled: pathError.value !== "" - }, null, 8, ["onClick", "disabled"]) - ]) - ]), - _: 1 - }), - createVNode(unref(script), { value: "2" }, { - default: withCtx(({ activateCallback }) => [ - createVNode(_sfc_main$2, { - sourcePath: migrationSourcePath.value, - "onUpdate:sourcePath": _cache[2] || (_cache[2] = ($event) => migrationSourcePath.value = $event), - migrationItemIds: migrationItemIds.value, - "onUpdate:migrationItemIds": _cache[3] || (_cache[3] = ($event) => migrationItemIds.value = $event) - }, null, 8, ["sourcePath", "migrationItemIds"]), - createBaseVNode("div", _hoisted_3, [ - createVNode(unref(script$b), { - label: "Back", - severity: "secondary", - icon: "pi pi-arrow-left", - onClick: /* @__PURE__ */ __name(($event) => activateCallback("1"), "onClick") - }, null, 8, ["onClick"]), - createVNode(unref(script$b), { - label: "Next", - icon: "pi pi-arrow-right", - iconPos: "right", - onClick: /* @__PURE__ */ __name(($event) => activateCallback("3"), "onClick") - }, null, 8, ["onClick"]) - ]) - ]), - _: 1 - }), - createVNode(unref(script), { value: "3" }, { - default: withCtx(({ activateCallback }) => [ - createVNode(_sfc_main$1, { - autoUpdate: autoUpdate.value, - "onUpdate:autoUpdate": _cache[4] || (_cache[4] = ($event) => autoUpdate.value = $event), - allowMetrics: allowMetrics.value, - "onUpdate:allowMetrics": _cache[5] || (_cache[5] = ($event) => allowMetrics.value = $event) - }, null, 8, ["autoUpdate", "allowMetrics"]), - createBaseVNode("div", _hoisted_4, [ - createVNode(unref(script$b), { - label: "Back", - severity: "secondary", - icon: "pi pi-arrow-left", - onClick: /* @__PURE__ */ __name(($event) => activateCallback("2"), "onClick") - }, null, 8, ["onClick"]), - createVNode(unref(script$b), { - label: "Install", - icon: "pi pi-check", - iconPos: "right", - disabled: hasError.value, - onClick: _cache[6] || (_cache[6] = ($event) => install()) - }, null, 8, ["disabled"]) - ]) - ]), - _: 1 - }) - ]), - _: 1 - }) - ]), - _: 1 - }) - ]); + return openBlock(), createBlock(_sfc_main$5, { dark: "" }, { + default: withCtx(() => [ + createVNode(unref(script), { + class: "h-full p-8 2xl:p-16", + value: "0", + "onUpdate:value": setHighestStep + }, { + default: withCtx(() => [ + createVNode(unref(script$4), { class: "select-none" }, { + default: withCtx(() => [ + createVNode(unref(script$5), { value: "0" }, { + default: withCtx(() => [ + createTextVNode(toDisplayString(_ctx.$t("install.gpu")), 1) + ]), + _: 1 + }), + createVNode(unref(script$5), { + value: "1", + disabled: noGpu.value + }, { + default: withCtx(() => [ + createTextVNode(toDisplayString(_ctx.$t("install.installLocation")), 1) + ]), + _: 1 + }, 8, ["disabled"]), + createVNode(unref(script$5), { + value: "2", + disabled: noGpu.value || hasError.value || highestStep.value < 1 + }, { + default: withCtx(() => [ + createTextVNode(toDisplayString(_ctx.$t("install.migration")), 1) + ]), + _: 1 + }, 8, ["disabled"]), + createVNode(unref(script$5), { + value: "3", + disabled: noGpu.value || hasError.value || highestStep.value < 2 + }, { + default: withCtx(() => [ + createTextVNode(toDisplayString(_ctx.$t("install.desktopSettings")), 1) + ]), + _: 1 + }, 8, ["disabled"]) + ]), + _: 1 + }), + createVNode(unref(script$2), null, { + default: withCtx(() => [ + createVNode(unref(script$3), { value: "0" }, { + default: withCtx(({ activateCallback }) => [ + createVNode(_sfc_main$3, { + device: device.value, + "onUpdate:device": _cache[0] || (_cache[0] = ($event) => device.value = $event) + }, null, 8, ["device"]), + createBaseVNode("div", _hoisted_1, [ + createVNode(unref(script$e), { + label: _ctx.$t("g.next"), + icon: "pi pi-arrow-right", + iconPos: "right", + onClick: /* @__PURE__ */ __name(($event) => activateCallback("1"), "onClick"), + disabled: typeof device.value !== "string" + }, null, 8, ["label", "onClick", "disabled"]) + ]) + ]), + _: 1 + }), + createVNode(unref(script$3), { value: "1" }, { + default: withCtx(({ activateCallback }) => [ + createVNode(_sfc_main$2, { + installPath: installPath.value, + "onUpdate:installPath": _cache[1] || (_cache[1] = ($event) => installPath.value = $event), + pathError: pathError.value, + "onUpdate:pathError": _cache[2] || (_cache[2] = ($event) => pathError.value = $event) + }, null, 8, ["installPath", "pathError"]), + createBaseVNode("div", _hoisted_2, [ + createVNode(unref(script$e), { + label: _ctx.$t("g.back"), + severity: "secondary", + icon: "pi pi-arrow-left", + onClick: /* @__PURE__ */ __name(($event) => activateCallback("0"), "onClick") + }, null, 8, ["label", "onClick"]), + createVNode(unref(script$e), { + label: _ctx.$t("g.next"), + icon: "pi pi-arrow-right", + iconPos: "right", + onClick: /* @__PURE__ */ __name(($event) => activateCallback("2"), "onClick"), + disabled: pathError.value !== "" + }, null, 8, ["label", "onClick", "disabled"]) + ]) + ]), + _: 1 + }), + createVNode(unref(script$3), { value: "2" }, { + default: withCtx(({ activateCallback }) => [ + createVNode(_sfc_main$1, { + sourcePath: migrationSourcePath.value, + "onUpdate:sourcePath": _cache[3] || (_cache[3] = ($event) => migrationSourcePath.value = $event), + migrationItemIds: migrationItemIds.value, + "onUpdate:migrationItemIds": _cache[4] || (_cache[4] = ($event) => migrationItemIds.value = $event) + }, null, 8, ["sourcePath", "migrationItemIds"]), + createBaseVNode("div", _hoisted_3, [ + createVNode(unref(script$e), { + label: _ctx.$t("g.back"), + severity: "secondary", + icon: "pi pi-arrow-left", + onClick: /* @__PURE__ */ __name(($event) => activateCallback("1"), "onClick") + }, null, 8, ["label", "onClick"]), + createVNode(unref(script$e), { + label: _ctx.$t("g.next"), + icon: "pi pi-arrow-right", + iconPos: "right", + onClick: /* @__PURE__ */ __name(($event) => activateCallback("3"), "onClick") + }, null, 8, ["label", "onClick"]) + ]) + ]), + _: 1 + }), + createVNode(unref(script$3), { value: "3" }, { + default: withCtx(({ activateCallback }) => [ + createVNode(_sfc_main$4, { + autoUpdate: autoUpdate.value, + "onUpdate:autoUpdate": _cache[5] || (_cache[5] = ($event) => autoUpdate.value = $event), + allowMetrics: allowMetrics.value, + "onUpdate:allowMetrics": _cache[6] || (_cache[6] = ($event) => allowMetrics.value = $event) + }, null, 8, ["autoUpdate", "allowMetrics"]), + createBaseVNode("div", _hoisted_4, [ + createVNode(unref(script$e), { + label: _ctx.$t("g.back"), + severity: "secondary", + icon: "pi pi-arrow-left", + onClick: /* @__PURE__ */ __name(($event) => activateCallback("2"), "onClick") + }, null, 8, ["label", "onClick"]), + createVNode(unref(script$e), { + label: _ctx.$t("g.install"), + icon: "pi pi-check", + iconPos: "right", + disabled: hasError.value, + onClick: _cache[7] || (_cache[7] = ($event) => install()) + }, null, 8, ["label", "disabled"]) + ]) + ]), + _: 1 + }) + ]), + _: 1 + }) + ]), + _: 1 + }) + ]), + _: 1 + }); }; } }); -const InstallView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7ef01cf2"]]); +const InstallView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-de33872d"]]); export { InstallView as default }; -//# sourceMappingURL=InstallView-DbHtR5YG.js.map +//# sourceMappingURL=InstallView-AV2llYNm.js.map diff --git a/web/assets/InstallView-CwQdoH-C.css b/web/assets/InstallView-CwQdoH-C.css new file mode 100644 index 00000000..df578778 --- /dev/null +++ b/web/assets/InstallView-CwQdoH-C.css @@ -0,0 +1,79 @@ + +:root { + --p-tag-gap: 0.5rem; +} +.hover-brighten { + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; + transition-property: filter, box-shadow; +&:hover { + filter: brightness(107%) contrast(105%); + box-shadow: 0 0 0.25rem #ffffff79; +} +} +.p-accordioncontent-content { + border-radius: 0.5rem; + --tw-bg-opacity: 1; + background-color: rgb(23 23 23 / var(--tw-bg-opacity)); + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; +} +div.selected { +.gpu-button:not(.selected) { + opacity: 0.5; +} +.gpu-button:not(.selected):hover { + opacity: 1; +} +} +.gpu-button { + margin: 0px; + display: flex; + width: 50%; + cursor: pointer; + flex-direction: column; + align-items: center; + justify-content: space-around; + border-radius: 0.5rem; + background-color: rgb(38 38 38 / var(--tw-bg-opacity)); + --tw-bg-opacity: 0.5; + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; +} +.gpu-button:hover { + --tw-bg-opacity: 0.75; +} +.gpu-button { +&.selected { + --tw-bg-opacity: 1; + background-color: rgb(64 64 64 / var(--tw-bg-opacity)); +} +&.selected { + --tw-bg-opacity: 0.5; +} +&.selected { + opacity: 1; +} +&.selected:hover { + --tw-bg-opacity: 0.6; +} +} +.disabled { + pointer-events: none; + opacity: 0.4; +} +.p-card-header { + flex-grow: 1; + text-align: center; +} +.p-card-body { + padding-top: 0px; + text-align: center; +} + +[data-v-de33872d] .p-steppanel { + background-color: transparent +} diff --git a/web/assets/InstallView-DbHtR5YG.js.map b/web/assets/InstallView-DbHtR5YG.js.map deleted file mode 100644 index 346c244f..00000000 --- a/web/assets/InstallView-DbHtR5YG.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"InstallView-DbHtR5YG.js","sources":["../../node_modules/primevue/stepper/style/index.mjs","../../node_modules/primevue/stepper/index.mjs","../../node_modules/primevue/steplist/style/index.mjs","../../node_modules/primevue/steplist/index.mjs","../../node_modules/primevue/steppanels/style/index.mjs","../../node_modules/primevue/steppanels/index.mjs","../../node_modules/primevue/step/style/index.mjs","../../node_modules/primevue/step/index.mjs","../../node_modules/primevue/steppanel/style/index.mjs","../../node_modules/primevue/steppanel/index.mjs","../../src/components/install/InstallLocationPicker.vue","../../src/components/install/MigrationPicker.vue","../../src/components/install/DesktopSettingsConfiguration.vue","../../src/views/InstallView.vue"],"sourcesContent":["import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-steplist {\\n position: relative;\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n margin: 0;\\n padding: 0;\\n list-style-type: none;\\n overflow-x: auto;\\n}\\n\\n.p-step {\\n position: relative;\\n display: flex;\\n flex: 1 1 auto;\\n align-items: center;\\n gap: \".concat(dt('stepper.step.gap'), \";\\n padding: \").concat(dt('stepper.step.padding'), \";\\n}\\n\\n.p-step:last-of-type {\\n flex: initial;\\n}\\n\\n.p-step-header {\\n border: 0 none;\\n display: inline-flex;\\n align-items: center;\\n text-decoration: none;\\n cursor: pointer;\\n transition: background \").concat(dt('stepper.transition.duration'), \", color \").concat(dt('stepper.transition.duration'), \", border-color \").concat(dt('stepper.transition.duration'), \", outline-color \").concat(dt('stepper.transition.duration'), \", box-shadow \").concat(dt('stepper.transition.duration'), \";\\n border-radius: \").concat(dt('stepper.step.header.border.radius'), \";\\n outline-color: transparent;\\n background: transparent;\\n padding: \").concat(dt('stepper.step.header.padding'), \";\\n gap: \").concat(dt('stepper.step.header.gap'), \";\\n}\\n\\n.p-step-header:focus-visible {\\n box-shadow: \").concat(dt('stepper.step.header.focus.ring.shadow'), \";\\n outline: \").concat(dt('stepper.step.header.focus.ring.width'), \" \").concat(dt('stepper.step.header.focus.ring.style'), \" \").concat(dt('stepper.step.header.focus.ring.color'), \";\\n outline-offset: \").concat(dt('stepper.step.header.focus.ring.offset'), \";\\n}\\n\\n.p-stepper.p-stepper-readonly .p-step {\\n cursor: auto;\\n}\\n\\n.p-step-title {\\n display: block;\\n white-space: nowrap;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n max-width: 100%;\\n color: \").concat(dt('stepper.step.title.color'), \";\\n font-weight: \").concat(dt('stepper.step.title.font.weight'), \";\\n transition: background \").concat(dt('stepper.transition.duration'), \", color \").concat(dt('stepper.transition.duration'), \", border-color \").concat(dt('stepper.transition.duration'), \", box-shadow \").concat(dt('stepper.transition.duration'), \", outline-color \").concat(dt('stepper.transition.duration'), \";\\n}\\n\\n.p-step-number {\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n color: \").concat(dt('stepper.step.number.color'), \";\\n border: 2px solid \").concat(dt('stepper.step.number.border.color'), \";\\n background: \").concat(dt('stepper.step.number.background'), \";\\n min-width: \").concat(dt('stepper.step.number.size'), \";\\n height: \").concat(dt('stepper.step.number.size'), \";\\n line-height: \").concat(dt('stepper.step.number.size'), \";\\n font-size: \").concat(dt('stepper.step.number.font.size'), \";\\n z-index: 1;\\n border-radius: \").concat(dt('stepper.step.number.border.radius'), \";\\n position: relative;\\n font-weight: \").concat(dt('stepper.step.number.font.weight'), \";\\n}\\n\\n.p-step-number::after {\\n content: \\\" \\\";\\n position: absolute;\\n width: 100%;\\n height: 100%;\\n border-radius: \").concat(dt('stepper.step.number.border.radius'), \";\\n box-shadow: \").concat(dt('stepper.step.number.shadow'), \";\\n}\\n\\n.p-step-active .p-step-header {\\n cursor: default;\\n}\\n\\n.p-step-active .p-step-number {\\n background: \").concat(dt('stepper.step.number.active.background'), \";\\n border-color: \").concat(dt('stepper.step.number.active.border.color'), \";\\n color: \").concat(dt('stepper.step.number.active.color'), \";\\n}\\n\\n.p-step-active .p-step-title {\\n color: \").concat(dt('stepper.step.title.active.color'), \";\\n}\\n\\n.p-step:not(.p-disabled):focus-visible {\\n outline: \").concat(dt('focus.ring.width'), \" \").concat(dt('focus.ring.style'), \" \").concat(dt('focus.ring.color'), \";\\n outline-offset: \").concat(dt('focus.ring.offset'), \";\\n}\\n\\n.p-step:has(~ .p-step-active) .p-stepper-separator {\\n background: \").concat(dt('stepper.separator.active.background'), \";\\n}\\n\\n.p-stepper-separator {\\n flex: 1 1 0;\\n background: \").concat(dt('stepper.separator.background'), \";\\n width: 100%;\\n height: \").concat(dt('stepper.separator.size'), \";\\n transition: background \").concat(dt('stepper.transition.duration'), \", color \").concat(dt('stepper.transition.duration'), \", border-color \").concat(dt('stepper.transition.duration'), \", box-shadow \").concat(dt('stepper.transition.duration'), \", outline-color \").concat(dt('stepper.transition.duration'), \";\\n}\\n\\n.p-steppanels {\\n padding: \").concat(dt('stepper.steppanels.padding'), \";\\n}\\n\\n.p-steppanel {\\n background: \").concat(dt('stepper.steppanel.background'), \";\\n color: \").concat(dt('stepper.steppanel.color'), \";\\n}\\n\\n.p-stepper:has(.p-stepitem) {\\n display: flex;\\n flex-direction: column;\\n}\\n\\n.p-stepitem {\\n display: flex;\\n flex-direction: column;\\n flex: initial;\\n}\\n\\n.p-stepitem.p-stepitem-active {\\n flex: 1 1 auto;\\n}\\n\\n.p-stepitem .p-step {\\n flex: initial;\\n}\\n\\n.p-stepitem .p-steppanel-content {\\n width: 100%;\\n padding: \").concat(dt('stepper.steppanel.padding'), \";\\n}\\n\\n.p-stepitem .p-steppanel {\\n display: flex;\\n flex: 1 1 auto;\\n}\\n\\n.p-stepitem .p-stepper-separator {\\n flex: 0 0 auto;\\n width: \").concat(dt('stepper.separator.size'), \";\\n height: auto;\\n margin: \").concat(dt('stepper.separator.margin'), \";\\n position: relative;\\n left: calc(-1 * \").concat(dt('stepper.separator.size'), \");\\n}\\n\\n.p-stepitem:has(~ .p-stepitem-active) .p-stepper-separator {\\n background: \").concat(dt('stepper.separator.active.background'), \";\\n}\\n\\n.p-stepitem:last-of-type .p-steppanel {\\n padding-inline-start: \").concat(dt('stepper.step.number.size'), \";\\n}\\n\");\n};\nvar classes = {\n root: function root(_ref2) {\n var props = _ref2.props;\n return ['p-stepper p-component', {\n 'p-readonly': props.linear\n }];\n },\n separator: 'p-stepper-separator'\n};\nvar StepperStyle = BaseStyle.extend({\n name: 'stepper',\n theme: theme,\n classes: classes\n});\n\nexport { StepperStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { UniqueComponentId } from '@primevue/core/utils';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport StepperStyle from 'primevue/stepper/style';\nimport { openBlock, createElementBlock, mergeProps, renderSlot, createCommentVNode } from 'vue';\n\nvar script$1 = {\n name: 'BaseStepper',\n \"extends\": BaseComponent,\n props: {\n value: {\n type: [String, Number],\n \"default\": undefined\n },\n linear: {\n type: Boolean,\n \"default\": false\n }\n },\n style: StepperStyle,\n provide: function provide() {\n return {\n $pcStepper: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'Stepper',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['update:value'],\n data: function data() {\n return {\n id: this.$attrs.id,\n d_value: this.value\n };\n },\n watch: {\n '$attrs.id': function $attrsId(newValue) {\n this.id = newValue || UniqueComponentId();\n },\n value: function value(newValue) {\n this.d_value = newValue;\n }\n },\n mounted: function mounted() {\n this.id = this.id || UniqueComponentId();\n },\n methods: {\n updateValue: function updateValue(newValue) {\n if (this.d_value !== newValue) {\n this.d_value = newValue;\n this.$emit('update:value', newValue);\n }\n },\n isStepActive: function isStepActive(value) {\n return this.d_value === value;\n },\n isStepDisabled: function isStepDisabled() {\n return this.linear;\n }\n }\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root'),\n role: \"tablist\"\n }, _ctx.ptmi('root')), [_ctx.$slots.start ? renderSlot(_ctx.$slots, \"start\", {\n key: 0\n }) : createCommentVNode(\"\", true), renderSlot(_ctx.$slots, \"default\"), _ctx.$slots.end ? renderSlot(_ctx.$slots, \"end\", {\n key: 1\n }) : createCommentVNode(\"\", true)], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar classes = {\n root: 'p-steplist'\n};\nvar StepListStyle = BaseStyle.extend({\n name: 'steplist',\n classes: classes\n});\n\nexport { StepListStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseComponent from '@primevue/core/basecomponent';\nimport StepListStyle from 'primevue/steplist/style';\nimport { openBlock, createElementBlock, mergeProps, renderSlot } from 'vue';\n\nvar script$1 = {\n name: 'BaseStepList',\n \"extends\": BaseComponent,\n style: StepListStyle,\n provide: function provide() {\n return {\n $pcStepList: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'StepList',\n \"extends\": script$1,\n inheritAttrs: false\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root')), [renderSlot(_ctx.$slots, \"default\")], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar classes = {\n root: 'p-steppanels'\n};\nvar StepPanelsStyle = BaseStyle.extend({\n name: 'steppanels',\n classes: classes\n});\n\nexport { StepPanelsStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseComponent from '@primevue/core/basecomponent';\nimport StepPanelsStyle from 'primevue/steppanels/style';\nimport { openBlock, createElementBlock, mergeProps, renderSlot } from 'vue';\n\nvar script$1 = {\n name: 'BaseStepPanels',\n \"extends\": BaseComponent,\n style: StepPanelsStyle,\n provide: function provide() {\n return {\n $pcStepPanels: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'StepPanels',\n \"extends\": script$1,\n inheritAttrs: false\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root')), [renderSlot(_ctx.$slots, \"default\")], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar classes = {\n root: function root(_ref) {\n var instance = _ref.instance;\n return ['p-step', {\n 'p-step-active': instance.active,\n 'p-disabled': instance.isStepDisabled\n }];\n },\n header: 'p-step-header',\n number: 'p-step-number',\n title: 'p-step-title'\n};\nvar StepStyle = BaseStyle.extend({\n name: 'step',\n classes: classes\n});\n\nexport { StepStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { find } from '@primeuix/utils/dom';\nimport { findIndexInList } from '@primeuix/utils/object';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport { openBlock, createElementBlock, mergeProps, resolveComponent, createBlock, resolveDynamicComponent, withCtx, createElementVNode, toDisplayString, renderSlot, createCommentVNode, normalizeClass } from 'vue';\nimport StepStyle from 'primevue/step/style';\n\nvar script$2 = {\n name: 'StepperSeparator',\n hostName: 'Stepper',\n \"extends\": BaseComponent\n};\n\nfunction render$1(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps({\n \"class\": _ctx.cx('separator')\n }, _ctx.ptm('separator')), null, 16);\n}\n\nscript$2.render = render$1;\n\nvar script$1 = {\n name: 'BaseStep',\n \"extends\": BaseComponent,\n props: {\n value: {\n type: [String, Number],\n \"default\": undefined\n },\n disabled: {\n type: Boolean,\n \"default\": false\n },\n asChild: {\n type: Boolean,\n \"default\": false\n },\n as: {\n type: [String, Object],\n \"default\": 'DIV'\n }\n },\n style: StepStyle,\n provide: function provide() {\n return {\n $pcStep: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'Step',\n \"extends\": script$1,\n inheritAttrs: false,\n inject: {\n $pcStepper: {\n \"default\": null\n },\n $pcStepList: {\n \"default\": null\n },\n $pcStepItem: {\n \"default\": null\n }\n },\n data: function data() {\n return {\n isSeparatorVisible: false\n };\n },\n mounted: function mounted() {\n if (this.$el && this.$pcStepList) {\n var index = findIndexInList(this.$el, find(this.$pcStepper.$el, '[data-pc-name=\"step\"]'));\n var stepLen = find(this.$pcStepper.$el, '[data-pc-name=\"step\"]').length;\n this.isSeparatorVisible = index !== stepLen - 1;\n }\n },\n methods: {\n getPTOptions: function getPTOptions(key) {\n var _ptm = key === 'root' ? this.ptmi : this.ptm;\n return _ptm(key, {\n context: {\n active: this.active,\n disabled: this.isStepDisabled\n }\n });\n },\n onStepClick: function onStepClick() {\n this.$pcStepper.updateValue(this.activeValue);\n }\n },\n computed: {\n active: function active() {\n return this.$pcStepper.isStepActive(this.activeValue);\n },\n activeValue: function activeValue() {\n var _this$$pcStepItem;\n return !!this.$pcStepItem ? (_this$$pcStepItem = this.$pcStepItem) === null || _this$$pcStepItem === void 0 ? void 0 : _this$$pcStepItem.value : this.value;\n },\n isStepDisabled: function isStepDisabled() {\n return !this.active && (this.$pcStepper.isStepDisabled() || this.disabled);\n },\n id: function id() {\n var _this$$pcStepper;\n return \"\".concat((_this$$pcStepper = this.$pcStepper) === null || _this$$pcStepper === void 0 ? void 0 : _this$$pcStepper.id, \"_step_\").concat(this.activeValue);\n },\n ariaControls: function ariaControls() {\n var _this$$pcStepper2;\n return \"\".concat((_this$$pcStepper2 = this.$pcStepper) === null || _this$$pcStepper2 === void 0 ? void 0 : _this$$pcStepper2.id, \"_steppanel_\").concat(this.activeValue);\n },\n a11yAttrs: function a11yAttrs() {\n return {\n root: {\n role: 'presentation',\n 'aria-current': this.active ? 'step' : undefined,\n 'data-pc-name': 'step',\n 'data-pc-section': 'root',\n 'data-p-disabled': this.disabled,\n 'data-p-active': this.active\n },\n header: {\n id: this.id,\n role: 'tab',\n taindex: this.disabled ? -1 : undefined,\n 'aria-controls': this.ariaControls,\n 'data-pc-section': 'header',\n disabled: this.disabled,\n onClick: this.onStepClick\n }\n };\n }\n },\n components: {\n StepperSeparator: script$2\n }\n};\n\nvar _hoisted_1 = [\"id\", \"tabindex\", \"aria-controls\", \"disabled\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_StepperSeparator = resolveComponent(\"StepperSeparator\");\n return !_ctx.asChild ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({\n key: 0,\n \"class\": _ctx.cx('root'),\n \"aria-current\": $options.active ? 'step' : undefined,\n role: \"presentation\",\n \"data-p-active\": $options.active,\n \"data-p-disabled\": $options.isStepDisabled\n }, $options.getPTOptions('root')), {\n \"default\": withCtx(function () {\n return [createElementVNode(\"button\", mergeProps({\n id: $options.id,\n \"class\": _ctx.cx('header'),\n role: \"tab\",\n type: \"button\",\n tabindex: $options.isStepDisabled ? -1 : undefined,\n \"aria-controls\": $options.ariaControls,\n disabled: $options.isStepDisabled,\n onClick: _cache[0] || (_cache[0] = function () {\n return $options.onStepClick && $options.onStepClick.apply($options, arguments);\n })\n }, $options.getPTOptions('header')), [createElementVNode(\"span\", mergeProps({\n \"class\": _ctx.cx('number')\n }, $options.getPTOptions('number')), toDisplayString($options.activeValue), 17), createElementVNode(\"span\", mergeProps({\n \"class\": _ctx.cx('title')\n }, $options.getPTOptions('title')), [renderSlot(_ctx.$slots, \"default\")], 16)], 16, _hoisted_1), $data.isSeparatorVisible ? (openBlock(), createBlock(_component_StepperSeparator, {\n key: 0\n })) : createCommentVNode(\"\", true)];\n }),\n _: 3\n }, 16, [\"class\", \"aria-current\", \"data-p-active\", \"data-p-disabled\"])) : renderSlot(_ctx.$slots, \"default\", {\n key: 1,\n \"class\": normalizeClass(_ctx.cx('root')),\n active: $options.active,\n value: _ctx.value,\n a11yAttrs: $options.a11yAttrs,\n activateCallback: $options.onStepClick\n });\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar classes = {\n root: function root(_ref) {\n var instance = _ref.instance;\n return ['p-steppanel', {\n 'p-steppanel-active': instance.isVertical && instance.active\n }];\n },\n content: 'p-steppanel-content'\n};\nvar StepPanelStyle = BaseStyle.extend({\n name: 'steppanel',\n classes: classes\n});\n\nexport { StepPanelStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { find, findSingle } from '@primeuix/utils/dom';\nimport { findIndexInList } from '@primeuix/utils/object';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport { openBlock, createElementBlock, mergeProps, resolveComponent, Fragment, createBlock, Transition, withCtx, withDirectives, resolveDynamicComponent, createCommentVNode, createElementVNode, renderSlot, vShow } from 'vue';\nimport StepPanelStyle from 'primevue/steppanel/style';\n\nvar script$2 = {\n name: 'StepperSeparator',\n hostName: 'Stepper',\n \"extends\": BaseComponent\n};\n\nfunction render$1(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps({\n \"class\": _ctx.cx('separator')\n }, _ctx.ptm('separator')), null, 16);\n}\n\nscript$2.render = render$1;\n\nvar script$1 = {\n name: 'BaseStepPanel',\n \"extends\": BaseComponent,\n props: {\n value: {\n type: [String, Number],\n \"default\": undefined\n },\n asChild: {\n type: Boolean,\n \"default\": false\n },\n as: {\n type: [String, Object],\n \"default\": 'DIV'\n }\n },\n style: StepPanelStyle,\n provide: function provide() {\n return {\n $pcStepPanel: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'StepPanel',\n \"extends\": script$1,\n inheritAttrs: false,\n inject: {\n $pcStepper: {\n \"default\": null\n },\n $pcStepItem: {\n \"default\": null\n },\n $pcStepList: {\n \"default\": null\n }\n },\n data: function data() {\n return {\n isSeparatorVisible: false\n };\n },\n mounted: function mounted() {\n if (this.$el) {\n var _this$$pcStepItem, _this$$pcStepList;\n var stepElements = find(this.$pcStepper.$el, '[data-pc-name=\"step\"]');\n var stepPanelEl = findSingle(this.isVertical ? (_this$$pcStepItem = this.$pcStepItem) === null || _this$$pcStepItem === void 0 ? void 0 : _this$$pcStepItem.$el : (_this$$pcStepList = this.$pcStepList) === null || _this$$pcStepList === void 0 ? void 0 : _this$$pcStepList.$el, '[data-pc-name=\"step\"]');\n var stepPanelIndex = findIndexInList(stepPanelEl, stepElements);\n this.isSeparatorVisible = this.isVertical && stepPanelIndex !== stepElements.length - 1;\n }\n },\n methods: {\n getPTOptions: function getPTOptions(key) {\n var _ptm = key === 'root' ? this.ptmi : this.ptm;\n return _ptm(key, {\n context: {\n active: this.active\n }\n });\n },\n updateValue: function updateValue(val) {\n this.$pcStepper.updateValue(val);\n }\n },\n computed: {\n active: function active() {\n var _this$$pcStepItem2, _this$$pcStepper;\n var activeValue = !!this.$pcStepItem ? (_this$$pcStepItem2 = this.$pcStepItem) === null || _this$$pcStepItem2 === void 0 ? void 0 : _this$$pcStepItem2.value : this.value;\n return activeValue === ((_this$$pcStepper = this.$pcStepper) === null || _this$$pcStepper === void 0 ? void 0 : _this$$pcStepper.d_value);\n },\n isVertical: function isVertical() {\n return !!this.$pcStepItem;\n },\n activeValue: function activeValue() {\n var _this$$pcStepItem3;\n return this.isVertical ? (_this$$pcStepItem3 = this.$pcStepItem) === null || _this$$pcStepItem3 === void 0 ? void 0 : _this$$pcStepItem3.value : this.value;\n },\n id: function id() {\n var _this$$pcStepper2;\n return \"\".concat((_this$$pcStepper2 = this.$pcStepper) === null || _this$$pcStepper2 === void 0 ? void 0 : _this$$pcStepper2.id, \"_steppanel_\").concat(this.activeValue);\n },\n ariaControls: function ariaControls() {\n var _this$$pcStepper3;\n return \"\".concat((_this$$pcStepper3 = this.$pcStepper) === null || _this$$pcStepper3 === void 0 ? void 0 : _this$$pcStepper3.id, \"_step_\").concat(this.activeValue);\n },\n a11yAttrs: function a11yAttrs() {\n return {\n id: this.id,\n role: 'tabpanel',\n 'aria-controls': this.ariaControls,\n 'data-pc-name': 'steppanel',\n 'data-p-active': this.active\n };\n }\n },\n components: {\n StepperSeparator: script$2\n }\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_StepperSeparator = resolveComponent(\"StepperSeparator\");\n return $options.isVertical ? (openBlock(), createElementBlock(Fragment, {\n key: 0\n }, [!_ctx.asChild ? (openBlock(), createBlock(Transition, mergeProps({\n key: 0,\n name: \"p-toggleable-content\"\n }, _ctx.ptm('transition')), {\n \"default\": withCtx(function () {\n return [withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({\n id: $options.id,\n \"class\": _ctx.cx('root'),\n role: \"tabpanel\",\n \"aria-controls\": $options.ariaControls\n }, $options.getPTOptions('root')), {\n \"default\": withCtx(function () {\n return [$data.isSeparatorVisible ? (openBlock(), createBlock(_component_StepperSeparator, {\n key: 0\n })) : createCommentVNode(\"\", true), createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('content')\n }, $options.getPTOptions('content')), [renderSlot(_ctx.$slots, \"default\", {\n active: $options.active,\n activateCallback: function activateCallback(val) {\n return $options.updateValue(val);\n }\n })], 16)];\n }),\n _: 3\n }, 16, [\"id\", \"class\", \"aria-controls\"])), [[vShow, $options.active]])];\n }),\n _: 3\n }, 16)) : renderSlot(_ctx.$slots, \"default\", {\n key: 1,\n active: $options.active,\n a11yAttrs: $options.a11yAttrs,\n activateCallback: function activateCallback(val) {\n return $options.updateValue(val);\n }\n })], 64)) : (openBlock(), createElementBlock(Fragment, {\n key: 1\n }, [!_ctx.asChild ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({\n key: 0,\n id: $options.id,\n \"class\": _ctx.cx('root'),\n role: \"tabpanel\",\n \"aria-controls\": $options.ariaControls\n }, $options.getPTOptions('root')), {\n \"default\": withCtx(function () {\n return [renderSlot(_ctx.$slots, \"default\", {\n active: $options.active,\n activateCallback: function activateCallback(val) {\n return $options.updateValue(val);\n }\n })];\n }),\n _: 3\n }, 16, [\"id\", \"class\", \"aria-controls\"])), [[vShow, $options.active]]) : _ctx.asChild && $options.active ? renderSlot(_ctx.$slots, \"default\", {\n key: 1,\n active: $options.active,\n a11yAttrs: $options.a11yAttrs,\n activateCallback: function activateCallback(val) {\n return $options.updateValue(val);\n }\n }) : createCommentVNode(\"\", true)], 64));\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n","\n\n\n","\n\n\n","\n\n\n\n\n"],"names":["theme","classes","script$1","BaseComponent","script","value","render","provide","root","script$2","render$1","data","mounted","isStepDisabled","_hoisted_1","createElementVNode","getPTOptions","updateValue","active","activeValue","id","ariaControls","a11yAttrs","_useModel","sourcePath"],"mappings":";;;AAEA,IAAI,QAAQ,gCAASA,OAAM,MAAM;AAC/B,MAAI,KAAK,KAAK;AACd,SAAO,yUAAyU,OAAO,GAAG,kBAAkB,GAAG,kBAAkB,EAAE,OAAO,GAAG,sBAAsB,GAAG,oOAAoO,EAAE,OAAO,GAAG,6BAA6B,GAAG,UAAU,EAAE,OAAO,GAAG,6BAA6B,GAAG,iBAAiB,EAAE,OAAO,GAAG,6BAA6B,GAAG,kBAAkB,EAAE,OAAO,GAAG,6BAA6B,GAAG,eAAe,EAAE,OAAO,GAAG,6BAA6B,GAAG,wBAAwB,EAAE,OAAO,GAAG,mCAAmC,GAAG,iFAAiF,EAAE,OAAO,GAAG,6BAA6B,GAAG,cAAc,EAAE,OAAO,GAAG,yBAAyB,GAAG,0DAA0D,EAAE,OAAO,GAAG,uCAAuC,GAAG,k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EAAE;AAC5B,UAAA,mBAAmB,IAAc,CAAA,CAAE;AAEnC,UAAA,aAAa,IAAI,IAAI;AACrB,UAAA,eAAe,IAAI,IAAI;AAE7B,UAAM,WAAW,SAAS,MAAM,UAAU,UAAU,EAAE;AAEtD,UAAM,SAAS;AACf,UAAM,UAAU,6BAAM;AACpB,YAAM,UAAU,MAAM;AAAA,QACpB,aAAa,YAAY;AAAA,QACzB,YAAY,WAAW;AAAA,QACvB,cAAc,aAAa;AAAA,QAC3B,qBAAqB,oBAAoB;AAAA,QACzC,kBAAkB,MAAM,iBAAiB,KAAK;AAAA,MAAA,CAC/C;AACW,kBAAA,EAAE,eAAe,OAAO;AACpC,aAAO,KAAK,eAAe;AAAA,IAAA,GATb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9]} \ No newline at end of file diff --git a/web/assets/KeybindingPanel-C3wT8hYZ.css b/web/assets/KeybindingPanel-C3wT8hYZ.css deleted file mode 100644 index 2a6bf233..00000000 --- a/web/assets/KeybindingPanel-C3wT8hYZ.css +++ /dev/null @@ -1,8 +0,0 @@ - -[data-v-c20ad403] .p-datatable-tbody > tr > td { - padding: 0.25rem; - min-height: 2rem -} -[data-v-c20ad403] .p-datatable-row-selected .actions,[data-v-c20ad403] .p-datatable-selectable-row:hover .actions { - visibility: visible -} diff --git a/web/assets/KeybindingPanel-DC2AxNNa.js b/web/assets/KeybindingPanel-CxaJ1IiJ.js similarity index 87% rename from web/assets/KeybindingPanel-DC2AxNNa.js rename to web/assets/KeybindingPanel-CxaJ1IiJ.js index 757103de..f165f9a5 100644 --- a/web/assets/KeybindingPanel-DC2AxNNa.js +++ b/web/assets/KeybindingPanel-CxaJ1IiJ.js @@ -1,8 +1,10 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { a as defineComponent, q as computed, f as openBlock, g as createElementBlock, P as Fragment, Q as renderList, h as createVNode, y as withCtx, ay as createTextVNode, a8 as toDisplayString, z as unref, aC as script, i as createCommentVNode, r as ref, ck as FilterMatchMode, O as useKeybindingStore, F as useCommandStore, I as useI18n, aS as normalizeI18nKey, aL as watchEffect, bn as useToast, t as resolveDirective, x as createBlock, cl as SearchBox, A as createBaseVNode, D as script$2, aq as script$4, br as withModifiers, bW as script$5, aI as script$6, v as withDirectives, cm as _sfc_main$2, R as pushScopeId, U as popScopeId, ce as KeyComboImpl, cn as KeybindingImpl, _ as _export_sfc } from "./index-DIU5yZe9.js"; -import { s as script$1, a as script$3 } from "./index-D3u7l7ha.js"; -import "./index-d698Brhb.js"; +import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, E as renderList, N as createVNode, M as withCtx, aE as createTextVNode, X as toDisplayString, j as unref, aI as script, I as createCommentVNode, ab as ref, cn as FilterMatchMode, a$ as useKeybindingStore, a2 as useCommandStore, a1 as useI18n, af as normalizeI18nKey, w as watchEffect, bs as useToast, r as resolveDirective, k as createBlock, co as SearchBox, H as createBaseVNode, l as script$2, av as script$4, bM as withModifiers, bZ as script$5, aP as script$6, i as withDirectives, cp as _sfc_main$2, aL as pushScopeId, aM as popScopeId, cq as KeyComboImpl, cr as KeybindingImpl, _ as _export_sfc } from "./index-C4Fk50Nx.js"; +import { s as script$1, a as script$3 } from "./index-CK0rrCYF.js"; +import { u as useKeybindingService } from "./keybindingService-D48fkLBy.js"; +import "./index-lMQBwSDj.js"; +import "./index-B7ycxfFq.js"; const _hoisted_1$1 = { key: 0, class: "px-2" @@ -35,7 +37,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ }; } }); -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-c20ad403"), n = n(), popScopeId(), n), "_withScopeId"); +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-2554ab36"), n = n(), popScopeId(), n), "_withScopeId"); const _hoisted_1 = { class: "actions invisible flex flex-row" }; const _hoisted_2 = ["title"]; const _hoisted_3 = { key: 1 }; @@ -46,6 +48,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ global: { value: "", matchMode: FilterMatchMode.CONTAINS } }); const keybindingStore = useKeybindingStore(); + const keybindingService = useKeybindingService(); const commandStore = useCommandStore(); const { t } = useI18n(); const commandsData = computed(() => { @@ -90,7 +93,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ function removeKeybinding(commandData) { if (commandData.keybinding) { keybindingStore.unsetKeybinding(commandData.keybinding); - keybindingStore.persistUserKeybindings(); + keybindingService.persistUserKeybindings(); } } __name(removeKeybinding, "removeKeybinding"); @@ -114,7 +117,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }) ); if (updated) { - keybindingStore.persistUserKeybindings(); + keybindingService.persistUserKeybindings(); } } cancelEdit(); @@ -123,7 +126,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ const toast = useToast(); async function resetKeybindings() { keybindingStore.resetKeybindings(); - await keybindingStore.persistUserKeybindings(); + await keybindingService.persistUserKeybindings(); toast.add({ severity: "info", summary: "Info", @@ -182,7 +185,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }), createVNode(unref(script$1), { field: "id", - header: "Command ID", + header: _ctx.$t("g.command"), sortable: "", class: "max-w-64 2xl:max-w-full" }, { @@ -193,10 +196,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }, toDisplayString(slotProps.data.label), 9, _hoisted_2) ]), _: 1 - }), + }, 8, ["header"]), createVNode(unref(script$1), { field: "keybinding", - header: "Keybinding" + header: _ctx.$t("g.keybinding") }, { body: withCtx((slotProps) => [ slotProps.data.keybinding ? (openBlock(), createBlock(_sfc_main$1, { @@ -206,7 +209,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }, null, 8, ["keyCombo", "isModified"])) : (openBlock(), createElementBlock("span", _hoisted_3, "-")) ]), _: 1 - }) + }, 8, ["header"]) ]), _: 1 }, 8, ["value", "selection", "filters"]), @@ -274,8 +277,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }; } }); -const KeybindingPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c20ad403"]]); +const KeybindingPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2554ab36"]]); export { KeybindingPanel as default }; -//# sourceMappingURL=KeybindingPanel-DC2AxNNa.js.map +//# sourceMappingURL=KeybindingPanel-CxaJ1IiJ.js.map diff --git a/web/assets/KeybindingPanel-DC2AxNNa.js.map b/web/assets/KeybindingPanel-DC2AxNNa.js.map deleted file mode 100644 index 3b87df93..00000000 --- a/web/assets/KeybindingPanel-DC2AxNNa.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"KeybindingPanel-DC2AxNNa.js","sources":["../../src/components/dialog/content/setting/keybinding/KeyComboDisplay.vue","../../src/components/dialog/content/setting/KeybindingPanel.vue"],"sourcesContent":["\n\n\n","\n\n\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgBA,UAAM,QAAQ;AAUd,UAAM,eAAe,SAAS,MAAM,MAAM,SAAS,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;ACgHpE,UAAM,UAAU,IAAI;AAAA,MAClB,QAAQ,EAAE,OAAO,IAAI,WAAW,gBAAgB,SAAS;AAAA,IAAA,CAC1D;AAED,UAAM,kBAAkB;AACxB,UAAM,eAAe;AACf,UAAA,EAAE,MAAM;AAOR,UAAA,eAAe,SAAyB,MAAM;AAClD,aAAO,OAAO,OAAO,aAAa,QAAQ,EAAE,IAAI,CAAC,aAAa;AAAA,QAC5D,IAAI,QAAQ;AAAA,QACZ,OAAO,EAAE,YAAY,iBAAiB,QAAQ,EAAE,CAAC,UAAU,QAAQ,KAAK;AAAA,QACxE,YAAY,gBAAgB,yBAAyB,QAAQ,EAAE;AAAA,MAC/D,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jB,WAAW,sBAAsB,MAAM;AAAA,YACvC,OAAO,mBAAmB;AAAA,UAAA,CAC3B;AAAA,QAAA;AAEH,YAAI,SAAS;AACX,0BAAgB,uBAAuB;AAAA,QACzC;AAAA,MACF;AACW;IACb;AAbS;AAeT,UAAM,QAAQ;AACd,mBAAe,mBAAmB;AAChC,sBAAgB,iBAAiB;AACjC,YAAM,gBAAgB;AACtB,YAAM,IAAI;AAAA,QACR,UAAU;AAAA,QACV,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,MAAM;AAAA,MAAA,CACP;AAAA,IACH;AATe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/web/assets/KeybindingPanel-DvrUYZ4S.css b/web/assets/KeybindingPanel-DvrUYZ4S.css new file mode 100644 index 00000000..8f714bcd --- /dev/null +++ b/web/assets/KeybindingPanel-DvrUYZ4S.css @@ -0,0 +1,8 @@ + +[data-v-2554ab36] .p-datatable-tbody > tr > td { + padding: 0.25rem; + min-height: 2rem +} +[data-v-2554ab36] .p-datatable-row-selected .actions,[data-v-2554ab36] .p-datatable-selectable-row:hover .actions { + visibility: visible +} diff --git a/web/assets/ManualConfigurationView-B6ecEClB.css b/web/assets/ManualConfigurationView-B6ecEClB.css new file mode 100644 index 00000000..06a5cc3e --- /dev/null +++ b/web/assets/ManualConfigurationView-B6ecEClB.css @@ -0,0 +1,7 @@ + +:root { + --p-tag-gap: 0.5rem; +} +.comfy-installer { + margin-top: max(1rem, max(0px, calc((100vh - 42rem) * 0.5))); +} diff --git a/web/assets/ManualConfigurationView-BA4Vtud8.js b/web/assets/ManualConfigurationView-BA4Vtud8.js new file mode 100644 index 00000000..122da4e9 --- /dev/null +++ b/web/assets/ManualConfigurationView-BA4Vtud8.js @@ -0,0 +1,75 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { d as defineComponent, a1 as useI18n, ab as ref, m as onMounted, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, aI as script, l as script$2, c0 as electronAPI } from "./index-C4Fk50Nx.js"; +import { s as script$1 } from "./index-hdfnBvYs.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-CsEJhGbv.js"; +import "./index-B7ycxfFq.js"; +const _hoisted_1 = { class: "comfy-installer grow flex flex-col gap-4 text-neutral-300 max-w-110" }; +const _hoisted_2 = { class: "text-2xl font-semibold text-neutral-100" }; +const _hoisted_3 = { class: "m-1 text-neutral-300" }; +const _hoisted_4 = { class: "ml-2" }; +const _hoisted_5 = { class: "m-1 mb-4" }; +const _hoisted_6 = { class: "m-0" }; +const _hoisted_7 = { class: "m-1" }; +const _hoisted_8 = { class: "font-mono" }; +const _hoisted_9 = { class: "m-1" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "ManualConfigurationView", + setup(__props) { + const { t } = useI18n(); + const electron = electronAPI(); + const basePath = ref(null); + const sep = ref("/"); + const restartApp = /* @__PURE__ */ __name((message) => electron.restartApp(message), "restartApp"); + onMounted(async () => { + basePath.value = await electron.getBasePath(); + if (basePath.value.indexOf("/") === -1) sep.value = "\\"; + }); + return (_ctx, _cache) => { + return openBlock(), createBlock(_sfc_main$1, { dark: "" }, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_1, [ + createBaseVNode("h2", _hoisted_2, toDisplayString(_ctx.$t("install.manualConfiguration.title")), 1), + createBaseVNode("p", _hoisted_3, [ + createVNode(unref(script), { + icon: "pi pi-exclamation-triangle", + severity: "warn", + value: unref(t)("icon.exclamation-triangle") + }, null, 8, ["value"]), + createBaseVNode("strong", _hoisted_4, toDisplayString(_ctx.$t("install.gpuSelection.customComfyNeedsPython")), 1) + ]), + createBaseVNode("div", null, [ + createBaseVNode("p", _hoisted_5, toDisplayString(_ctx.$t("install.manualConfiguration.requirements")) + ": ", 1), + createBaseVNode("ul", _hoisted_6, [ + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.gpuSelection.customManualVenv")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.gpuSelection.customInstallRequirements")), 1) + ]) + ]), + createBaseVNode("p", _hoisted_7, toDisplayString(_ctx.$t("install.manualConfiguration.createVenv")) + ":", 1), + createVNode(unref(script$1), { + header: unref(t)("install.manualConfiguration.virtualEnvironmentPath") + }, { + default: withCtx(() => [ + createBaseVNode("span", _hoisted_8, toDisplayString(`${basePath.value}${sep.value}.venv${sep.value}`), 1) + ]), + _: 1 + }, 8, ["header"]), + createBaseVNode("p", _hoisted_9, toDisplayString(_ctx.$t("install.manualConfiguration.restartWhenFinished")), 1), + createVNode(unref(script$2), { + class: "place-self-end", + label: unref(t)("menuLabels.Restart"), + severity: "warn", + icon: "pi pi-refresh", + onClick: _cache[0] || (_cache[0] = ($event) => restartApp("Manual configuration complete")) + }, null, 8, ["label"]) + ]) + ]), + _: 1 + }); + }; + } +}); +export { + _sfc_main as default +}; +//# sourceMappingURL=ManualConfigurationView-BA4Vtud8.js.map diff --git a/web/assets/NotSupportedView-C8O1Ed5c.js b/web/assets/NotSupportedView-C8O1Ed5c.js deleted file mode 100644 index 906fc9b8..00000000 --- a/web/assets/NotSupportedView-C8O1Ed5c.js +++ /dev/null @@ -1,82 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { a as defineComponent, bU as useRouter, t as resolveDirective, f as openBlock, g as createElementBlock, A as createBaseVNode, a8 as toDisplayString, h as createVNode, z as unref, D as script, v as withDirectives } from "./index-DIU5yZe9.js"; -const _imports_0 = "" + new URL("images/sad_girl.png", import.meta.url).href; -const _hoisted_1 = { class: "font-sans w-screen h-screen flex items-center m-0 text-neutral-900 bg-neutral-300 pointer-events-auto" }; -const _hoisted_2 = { class: "flex-grow flex items-center justify-center" }; -const _hoisted_3 = { class: "flex flex-col gap-8 p-8" }; -const _hoisted_4 = { class: "text-4xl font-bold text-red-500" }; -const _hoisted_5 = { class: "space-y-4" }; -const _hoisted_6 = { class: "text-xl" }; -const _hoisted_7 = { class: "list-disc list-inside space-y-1 text-neutral-800" }; -const _hoisted_8 = { class: "flex gap-4" }; -const _hoisted_9 = /* @__PURE__ */ createBaseVNode("div", { class: "h-screen flex-grow-0" }, [ - /* @__PURE__ */ createBaseVNode("img", { - src: _imports_0, - alt: "Sad girl illustration", - class: "h-full object-cover" - }) -], -1); -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "NotSupportedView", - setup(__props) { - const openDocs = /* @__PURE__ */ __name(() => { - window.open( - "https://github.com/Comfy-Org/desktop#currently-supported-platforms", - "_blank" - ); - }, "openDocs"); - const reportIssue = /* @__PURE__ */ __name(() => { - window.open("https://forum.comfy.org/c/v1-feedback/", "_blank"); - }, "reportIssue"); - const router = useRouter(); - const continueToInstall = /* @__PURE__ */ __name(() => { - router.push("/install"); - }, "continueToInstall"); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock("div", _hoisted_1, [ - createBaseVNode("div", _hoisted_2, [ - createBaseVNode("div", _hoisted_3, [ - createBaseVNode("h1", _hoisted_4, toDisplayString(_ctx.$t("notSupported.title")), 1), - createBaseVNode("div", _hoisted_5, [ - createBaseVNode("p", _hoisted_6, toDisplayString(_ctx.$t("notSupported.message")), 1), - createBaseVNode("ul", _hoisted_7, [ - createBaseVNode("li", null, toDisplayString(_ctx.$t("notSupported.supportedDevices.macos")), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t("notSupported.supportedDevices.windows")), 1) - ]) - ]), - createBaseVNode("div", _hoisted_8, [ - createVNode(unref(script), { - label: _ctx.$t("notSupported.learnMore"), - icon: "pi pi-github", - onClick: openDocs, - severity: "secondary" - }, null, 8, ["label"]), - createVNode(unref(script), { - label: _ctx.$t("notSupported.reportIssue"), - icon: "pi pi-flag", - onClick: reportIssue, - severity: "secondary" - }, null, 8, ["label"]), - withDirectives(createVNode(unref(script), { - label: _ctx.$t("notSupported.continue"), - icon: "pi pi-arrow-right", - iconPos: "right", - onClick: continueToInstall, - severity: "danger" - }, null, 8, ["label"]), [ - [_directive_tooltip, _ctx.$t("notSupported.continueTooltip")] - ]) - ]) - ]) - ]), - _hoisted_9 - ]); - }; - } -}); -export { - _sfc_main as default -}; -//# sourceMappingURL=NotSupportedView-C8O1Ed5c.js.map diff --git a/web/assets/NotSupportedView-C8O1Ed5c.js.map b/web/assets/NotSupportedView-C8O1Ed5c.js.map deleted file mode 100644 index b6d2fffa..00000000 --- a/web/assets/NotSupportedView-C8O1Ed5c.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NotSupportedView-C8O1Ed5c.js","sources":["../../../../../../../assets/images/sad_girl.png","../../src/views/NotSupportedView.vue"],"sourcesContent":["export default \"__VITE_PUBLIC_ASSET__b82952e7__\"","\n\n\n"],"names":[],"mappings":";;;AAAA,MAAe,aAAA,KAAA,IAAA,IAAA,uBAAA,YAAA,GAAA,EAAA;;;;;;;;;;;;;;;;;;;AC+Df,UAAM,WAAW,6BAAM;AACd,aAAA;AAAA,QACL;AAAA,QACA;AAAA,MAAA;AAAA,IACF,GAJe;AAOjB,UAAM,cAAc,6BAAM;AACjB,aAAA,KAAK,0CAA0C,QAAQ;AAAA,IAAA,GAD5C;AAIpB,UAAM,SAAS;AACf,UAAM,oBAAoB,6BAAM;AAC9B,aAAO,KAAK,UAAU;AAAA,IAAA,GADE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/web/assets/NotSupportedView-CRaD8u74.js b/web/assets/NotSupportedView-CRaD8u74.js new file mode 100644 index 00000000..07e3eca6 --- /dev/null +++ b/web/assets/NotSupportedView-CRaD8u74.js @@ -0,0 +1,86 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { d as defineComponent, bW as useRouter, r as resolveDirective, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, l as script, i as withDirectives } from "./index-C4Fk50Nx.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-CsEJhGbv.js"; +const _imports_0 = "" + new URL("images/sad_girl.png", import.meta.url).href; +const _hoisted_1 = { class: "sad-container" }; +const _hoisted_2 = /* @__PURE__ */ createBaseVNode("img", { + class: "sad-girl", + src: _imports_0, + alt: "Sad girl illustration" +}, null, -1); +const _hoisted_3 = { class: "no-drag sad-text flex items-center" }; +const _hoisted_4 = { class: "flex flex-col gap-8 p-8 min-w-110" }; +const _hoisted_5 = { class: "text-4xl font-bold text-red-500" }; +const _hoisted_6 = { class: "space-y-4" }; +const _hoisted_7 = { class: "text-xl" }; +const _hoisted_8 = { class: "list-disc list-inside space-y-1 text-neutral-800" }; +const _hoisted_9 = { class: "flex gap-4" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "NotSupportedView", + setup(__props) { + const openDocs = /* @__PURE__ */ __name(() => { + window.open( + "https://github.com/Comfy-Org/desktop#currently-supported-platforms", + "_blank" + ); + }, "openDocs"); + const reportIssue = /* @__PURE__ */ __name(() => { + window.open("https://forum.comfy.org/c/v1-feedback/", "_blank"); + }, "reportIssue"); + const router = useRouter(); + const continueToInstall = /* @__PURE__ */ __name(() => { + router.push("/install"); + }, "continueToInstall"); + return (_ctx, _cache) => { + const _directive_tooltip = resolveDirective("tooltip"); + return openBlock(), createBlock(_sfc_main$1, null, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_1, [ + _hoisted_2, + createBaseVNode("div", _hoisted_3, [ + createBaseVNode("div", _hoisted_4, [ + createBaseVNode("h1", _hoisted_5, toDisplayString(_ctx.$t("notSupported.title")), 1), + createBaseVNode("div", _hoisted_6, [ + createBaseVNode("p", _hoisted_7, toDisplayString(_ctx.$t("notSupported.message")), 1), + createBaseVNode("ul", _hoisted_8, [ + createBaseVNode("li", null, toDisplayString(_ctx.$t("notSupported.supportedDevices.macos")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t("notSupported.supportedDevices.windows")), 1) + ]) + ]), + createBaseVNode("div", _hoisted_9, [ + createVNode(unref(script), { + label: _ctx.$t("notSupported.learnMore"), + icon: "pi pi-github", + onClick: openDocs, + severity: "secondary" + }, null, 8, ["label"]), + createVNode(unref(script), { + label: _ctx.$t("notSupported.reportIssue"), + icon: "pi pi-flag", + onClick: reportIssue, + severity: "secondary" + }, null, 8, ["label"]), + withDirectives(createVNode(unref(script), { + label: _ctx.$t("notSupported.continue"), + icon: "pi pi-arrow-right", + iconPos: "right", + onClick: continueToInstall, + severity: "danger" + }, null, 8, ["label"]), [ + [_directive_tooltip, _ctx.$t("notSupported.continueTooltip")] + ]) + ]) + ]) + ]) + ]) + ]), + _: 1 + }); + }; + } +}); +export { + _sfc_main as default +}; +//# sourceMappingURL=NotSupportedView-CRaD8u74.js.map diff --git a/web/assets/NotSupportedView-bFzHmqNj.css b/web/assets/NotSupportedView-bFzHmqNj.css new file mode 100644 index 00000000..80ac3298 --- /dev/null +++ b/web/assets/NotSupportedView-bFzHmqNj.css @@ -0,0 +1,17 @@ + +.sad-container { + display: grid; + align-items: center; + justify-content: space-evenly; + grid-template-columns: 25rem 1fr; +& > * { + grid-row: 1; +} +} +.sad-text { + grid-column: 1/3; +} +.sad-girl { + grid-column: 2/3; + width: min(75vw, 100vh); +} diff --git a/web/assets/ServerConfigPanel-CvXC1Xmx.js.map b/web/assets/ServerConfigPanel-CvXC1Xmx.js.map deleted file mode 100644 index 868d3fb1..00000000 --- a/web/assets/ServerConfigPanel-CvXC1Xmx.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ServerConfigPanel-CvXC1Xmx.js","sources":["../../src/components/dialog/content/setting/ServerConfigPanel.vue"],"sourcesContent":["\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFA,UAAM,eAAe;AACrB,UAAM,oBAAoB;AACpB,UAAA;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,IACE,YAAY,iBAAiB;AAEjC,UAAM,gBAAgB,6BAAM;AAC1B,wBAAkB,cAAc;AAAA,IAAA,GADZ;AAItB,UAAM,aAAa,6BAAM;AACvB,kBAAA,EAAc;IAAW,GADR;AAIb,UAAA,YAAY,CAAC,WAAW;AACf,mBAAA,IAAI,2BAA2B,MAAM;AAAA,IAAA,CACnD;AAEK,UAAA,oBAAoB,CAAC,WAAW;AACvB,mBAAA,IAAI,mCAAmC,MAAM;AAAA,IAAA,CAC3D;AAEK,UAAA,EAAE,oBAAoB;AAC5B,UAAM,sBAAsB,mCAAY;AAChC,YAAA,gBAAgB,gBAAgB,KAAK;AAAA,IAAA,GADjB;AAItB,UAAA,EAAE,MAAM;AACR,UAAA,gBAAgB,wBAAC,SAA0C;AACxD,aAAA;AAAA,QACL,GAAG;AAAA,QACH,MAAM,EAAE,qBAAqB,KAAK,EAAE,SAAS,KAAK,IAAI;AAAA,QACtD,SAAS,KAAK,UACV,EAAE,qBAAqB,KAAK,EAAE,YAAY,KAAK,OAAO,IACtD;AAAA,MAAA;AAAA,IACN,GAPoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/web/assets/ServerConfigPanel-CvXC1Xmx.js b/web/assets/ServerConfigPanel-TLv4HMGK.js similarity index 90% rename from web/assets/ServerConfigPanel-CvXC1Xmx.js rename to web/assets/ServerConfigPanel-TLv4HMGK.js index 6443c8df..6489eb66 100644 --- a/web/assets/ServerConfigPanel-CvXC1Xmx.js +++ b/web/assets/ServerConfigPanel-TLv4HMGK.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { A as createBaseVNode, f as openBlock, g as createElementBlock, aZ as markRaw, a as defineComponent, u as useSettingStore, aK as storeToRefs, w as watch, cL as useCopyToClipboard, I as useI18n, x as createBlock, y as withCtx, z as unref, bW as script, a8 as toDisplayString, Q as renderList, P as Fragment, h as createVNode, D as script$1, i as createCommentVNode, bN as script$2, cM as FormItem, cm as _sfc_main$1, bZ as electronAPI } from "./index-DIU5yZe9.js"; -import { u as useServerConfigStore } from "./serverConfigStore-DYv7_Nld.js"; +import { H as createBaseVNode, o as openBlock, f as createElementBlock, Z as markRaw, d as defineComponent, a as useSettingStore, aS as storeToRefs, a5 as watch, cO as useCopyToClipboard, a1 as useI18n, k as createBlock, M as withCtx, j as unref, bZ as script, X as toDisplayString, E as renderList, F as Fragment, N as createVNode, l as script$1, I as createCommentVNode, bQ as script$2, cP as FormItem, cp as _sfc_main$1, c0 as electronAPI } from "./index-C4Fk50Nx.js"; +import { u as useServerConfigStore } from "./serverConfigStore-BawYAb1j.js"; const _hoisted_1$1 = { viewBox: "0 0 24 24", width: "1.2em", @@ -131,7 +131,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ (openBlock(true), createElementBlock(Fragment, null, renderList(items, (item) => { return openBlock(), createElementBlock("div", { key: item.name, - class: "flex items-center mb-4" + class: "mb-4" }, [ createVNode(FormItem, { item: translateItem(item), @@ -155,4 +155,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ServerConfigPanel-CvXC1Xmx.js.map +//# sourceMappingURL=ServerConfigPanel-TLv4HMGK.js.map diff --git a/web/assets/ServerStartView-BvuHEhuL.js b/web/assets/ServerStartView-BvuHEhuL.js deleted file mode 100644 index af172de1..00000000 --- a/web/assets/ServerStartView-BvuHEhuL.js +++ /dev/null @@ -1,92 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { a as defineComponent, I as useI18n, r as ref, bX as ProgressStatus, o as onMounted, f as openBlock, g as createElementBlock, A as createBaseVNode, ay as createTextVNode, a8 as toDisplayString, z as unref, i as createCommentVNode, h as createVNode, D as script, x as createBlock, v as withDirectives, ad as vShow, bY as BaseTerminal, R as pushScopeId, U as popScopeId, bZ as electronAPI, _ as _export_sfc } from "./index-DIU5yZe9.js"; -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-c0d3157e"), n = n(), popScopeId(), n), "_withScopeId"); -const _hoisted_1 = { class: "font-sans flex flex-col justify-center items-center h-screen m-0 text-neutral-300 bg-neutral-900 dark-theme pointer-events-auto" }; -const _hoisted_2 = { class: "text-2xl font-bold" }; -const _hoisted_3 = { key: 0 }; -const _hoisted_4 = { - key: 0, - class: "flex flex-col items-center gap-4" -}; -const _hoisted_5 = { class: "flex items-center my-4 gap-2" }; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "ServerStartView", - setup(__props) { - const electron = electronAPI(); - const { t } = useI18n(); - const status = ref(ProgressStatus.INITIAL_STATE); - const electronVersion = ref(""); - let xterm; - const terminalVisible = ref(true); - const updateProgress = /* @__PURE__ */ __name(({ status: newStatus }) => { - status.value = newStatus; - if (newStatus === ProgressStatus.ERROR) terminalVisible.value = false; - else xterm?.clear(); - }, "updateProgress"); - const terminalCreated = /* @__PURE__ */ __name(({ terminal, useAutoSize }, root) => { - xterm = terminal; - useAutoSize(root, true, true); - electron.onLogMessage((message) => { - terminal.write(message); - }); - terminal.options.cursorBlink = false; - terminal.options.disableStdin = true; - terminal.options.cursorInactiveStyle = "block"; - }, "terminalCreated"); - const reinstall = /* @__PURE__ */ __name(() => electron.reinstall(), "reinstall"); - const reportIssue = /* @__PURE__ */ __name(() => { - window.open("https://forum.comfy.org/c/v1-feedback/", "_blank"); - }, "reportIssue"); - const openLogs = /* @__PURE__ */ __name(() => electron.openLogsFolder(), "openLogs"); - onMounted(async () => { - electron.sendReady(); - electron.onProgressUpdate(updateProgress); - electronVersion.value = await electron.getElectronVersion(); - }); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1, [ - createBaseVNode("h2", _hoisted_2, [ - createTextVNode(toDisplayString(unref(t)(`serverStart.process.${status.value}`)) + " ", 1), - status.value === unref(ProgressStatus).ERROR ? (openBlock(), createElementBlock("span", _hoisted_3, " v" + toDisplayString(electronVersion.value), 1)) : createCommentVNode("", true) - ]), - status.value === unref(ProgressStatus).ERROR ? (openBlock(), createElementBlock("div", _hoisted_4, [ - createBaseVNode("div", _hoisted_5, [ - createVNode(unref(script), { - icon: "pi pi-flag", - severity: "secondary", - label: unref(t)("serverStart.reportIssue"), - onClick: reportIssue - }, null, 8, ["label"]), - createVNode(unref(script), { - icon: "pi pi-file", - severity: "secondary", - label: unref(t)("serverStart.openLogs"), - onClick: openLogs - }, null, 8, ["label"]), - createVNode(unref(script), { - icon: "pi pi-refresh", - label: unref(t)("serverStart.reinstall"), - onClick: reinstall - }, null, 8, ["label"]) - ]), - !terminalVisible.value ? (openBlock(), createBlock(unref(script), { - key: 0, - icon: "pi pi-search", - severity: "secondary", - label: unref(t)("serverStart.showTerminal"), - onClick: _cache[0] || (_cache[0] = ($event) => terminalVisible.value = true) - }, null, 8, ["label"])) : createCommentVNode("", true) - ])) : createCommentVNode("", true), - withDirectives(createVNode(BaseTerminal, { onCreated: terminalCreated }, null, 512), [ - [vShow, terminalVisible.value] - ]) - ]); - }; - } -}); -const ServerStartView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c0d3157e"]]); -export { - ServerStartView as default -}; -//# sourceMappingURL=ServerStartView-BvuHEhuL.js.map diff --git a/web/assets/ServerStartView-BvuHEhuL.js.map b/web/assets/ServerStartView-BvuHEhuL.js.map deleted file mode 100644 index 047e682a..00000000 --- a/web/assets/ServerStartView-BvuHEhuL.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ServerStartView-BvuHEhuL.js","sources":["../../src/views/ServerStartView.vue"],"sourcesContent":["\n\n\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAuDA,UAAM,WAAW;AACX,UAAA,EAAE,MAAM;AAER,UAAA,SAAS,IAAoB,eAAe,aAAa;AACzD,UAAA,kBAAkB,IAAY,EAAE;AAClC,QAAA;AAEE,UAAA,kBAAkB,IAAI,IAAI;AAEhC,UAAM,iBAAiB,wBAAC,EAAE,QAAQ,gBAA4C;AAC5E,aAAO,QAAQ;AAGf,UAAI,cAAc,eAAe,MAAO,iBAAgB,QAAQ;AAAA,kBACpD,MAAM;AAAA,IAAA,GALG;AAQvB,UAAM,kBAAkB,wBACtB,EAAE,UAAU,YAAA,GACZ,SACG;AACK,cAAA;AAEI,kBAAA,MAAM,MAAM,IAAI;AACnB,eAAA,aAAa,CAAC,YAAoB;AACzC,iBAAS,MAAM,OAAO;AAAA,MAAA,CACvB;AAED,eAAS,QAAQ,cAAc;AAC/B,eAAS,QAAQ,eAAe;AAChC,eAAS,QAAQ,sBAAsB;AAAA,IAAA,GAbjB;AAgBlB,UAAA,YAAY,6BAAM,SAAS,aAAf;AAClB,UAAM,cAAc,6BAAM;AACjB,aAAA,KAAK,0CAA0C,QAAQ;AAAA,IAAA,GAD5C;AAGd,UAAA,WAAW,6BAAM,SAAS,kBAAf;AAEjB,cAAU,YAAY;AACpB,eAAS,UAAU;AACnB,eAAS,iBAAiB,cAAc;AACxB,sBAAA,QAAQ,MAAM,SAAS,mBAAmB;AAAA,IAAA,CAC3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/web/assets/ServerStartView-CiO_acWT.js b/web/assets/ServerStartView-CiO_acWT.js new file mode 100644 index 00000000..1abcb36a --- /dev/null +++ b/web/assets/ServerStartView-CiO_acWT.js @@ -0,0 +1,98 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { d as defineComponent, a1 as useI18n, ab as ref, b_ as ProgressStatus, m as onMounted, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, aE as createTextVNode, X as toDisplayString, j as unref, f as createElementBlock, I as createCommentVNode, N as createVNode, l as script, i as withDirectives, v as vShow, b$ as BaseTerminal, aL as pushScopeId, aM as popScopeId, c0 as electronAPI, _ as _export_sfc } from "./index-C4Fk50Nx.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-CsEJhGbv.js"; +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-42c1131d"), n = n(), popScopeId(), n), "_withScopeId"); +const _hoisted_1 = { class: "text-2xl font-bold" }; +const _hoisted_2 = { key: 0 }; +const _hoisted_3 = { + key: 0, + class: "flex flex-col items-center gap-4" +}; +const _hoisted_4 = { class: "flex items-center my-4 gap-2" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "ServerStartView", + setup(__props) { + const electron = electronAPI(); + const { t } = useI18n(); + const status = ref(ProgressStatus.INITIAL_STATE); + const electronVersion = ref(""); + let xterm; + const terminalVisible = ref(true); + const updateProgress = /* @__PURE__ */ __name(({ status: newStatus }) => { + status.value = newStatus; + if (newStatus === ProgressStatus.ERROR) terminalVisible.value = false; + else xterm?.clear(); + }, "updateProgress"); + const terminalCreated = /* @__PURE__ */ __name(({ terminal, useAutoSize }, root) => { + xterm = terminal; + useAutoSize(root, true, true); + electron.onLogMessage((message) => { + terminal.write(message); + }); + terminal.options.cursorBlink = false; + terminal.options.disableStdin = true; + terminal.options.cursorInactiveStyle = "block"; + }, "terminalCreated"); + const reinstall = /* @__PURE__ */ __name(() => electron.reinstall(), "reinstall"); + const reportIssue = /* @__PURE__ */ __name(() => { + window.open("https://forum.comfy.org/c/v1-feedback/", "_blank"); + }, "reportIssue"); + const openLogs = /* @__PURE__ */ __name(() => electron.openLogsFolder(), "openLogs"); + onMounted(async () => { + electron.sendReady(); + electron.onProgressUpdate(updateProgress); + electronVersion.value = await electron.getElectronVersion(); + }); + return (_ctx, _cache) => { + return openBlock(), createBlock(_sfc_main$1, { + dark: "", + class: "flex-col" + }, { + default: withCtx(() => [ + createBaseVNode("h2", _hoisted_1, [ + createTextVNode(toDisplayString(unref(t)(`serverStart.process.${status.value}`)) + " ", 1), + status.value === unref(ProgressStatus).ERROR ? (openBlock(), createElementBlock("span", _hoisted_2, " v" + toDisplayString(electronVersion.value), 1)) : createCommentVNode("", true) + ]), + status.value === unref(ProgressStatus).ERROR ? (openBlock(), createElementBlock("div", _hoisted_3, [ + createBaseVNode("div", _hoisted_4, [ + createVNode(unref(script), { + icon: "pi pi-flag", + severity: "secondary", + label: unref(t)("serverStart.reportIssue"), + onClick: reportIssue + }, null, 8, ["label"]), + createVNode(unref(script), { + icon: "pi pi-file", + severity: "secondary", + label: unref(t)("serverStart.openLogs"), + onClick: openLogs + }, null, 8, ["label"]), + createVNode(unref(script), { + icon: "pi pi-refresh", + label: unref(t)("serverStart.reinstall"), + onClick: reinstall + }, null, 8, ["label"]) + ]), + !terminalVisible.value ? (openBlock(), createBlock(unref(script), { + key: 0, + icon: "pi pi-search", + severity: "secondary", + label: unref(t)("serverStart.showTerminal"), + onClick: _cache[0] || (_cache[0] = ($event) => terminalVisible.value = true) + }, null, 8, ["label"])) : createCommentVNode("", true) + ])) : createCommentVNode("", true), + withDirectives(createVNode(BaseTerminal, { onCreated: terminalCreated }, null, 512), [ + [vShow, terminalVisible.value] + ]) + ]), + _: 1 + }); + }; + } +}); +const ServerStartView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-42c1131d"]]); +export { + ServerStartView as default +}; +//# sourceMappingURL=ServerStartView-CiO_acWT.js.map diff --git a/web/assets/ServerStartView-BHqjjHcl.css b/web/assets/ServerStartView-CnyN4Ib6.css similarity index 64% rename from web/assets/ServerStartView-BHqjjHcl.css rename to web/assets/ServerStartView-CnyN4Ib6.css index 50d444d7..60a63414 100644 --- a/web/assets/ServerStartView-BHqjjHcl.css +++ b/web/assets/ServerStartView-CnyN4Ib6.css @@ -1,5 +1,5 @@ -[data-v-c0d3157e] .xterm-helper-textarea { +[data-v-42c1131d] .xterm-helper-textarea { /* Hide this as it moves all over when uv is running */ display: none; } diff --git a/web/assets/UserSelectView-2l9Kbchu.js b/web/assets/UserSelectView-2l9Kbchu.js new file mode 100644 index 00000000..554218e5 --- /dev/null +++ b/web/assets/UserSelectView-2l9Kbchu.js @@ -0,0 +1,102 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { d as defineComponent, aX as useUserStore, bW as useRouter, ab as ref, c as computed, m as onMounted, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, bX as withKeys, j as unref, av as script, bQ as script$1, bY as script$2, bZ as script$3, aE as createTextVNode, I as createCommentVNode, l as script$4 } from "./index-C4Fk50Nx.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-CsEJhGbv.js"; +const _hoisted_1 = { + id: "comfy-user-selection", + class: "min-w-84 relative rounded-lg bg-[var(--comfy-menu-bg)] p-5 px-10 shadow-lg" +}; +const _hoisted_2 = /* @__PURE__ */ createBaseVNode("h1", { class: "my-2.5 mb-7 font-normal" }, "ComfyUI", -1); +const _hoisted_3 = { class: "flex w-full flex-col items-center" }; +const _hoisted_4 = { class: "flex w-full flex-col gap-2" }; +const _hoisted_5 = { for: "new-user-input" }; +const _hoisted_6 = { class: "flex w-full flex-col gap-2" }; +const _hoisted_7 = { for: "existing-user-select" }; +const _hoisted_8 = { class: "mt-5" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "UserSelectView", + setup(__props) { + const userStore = useUserStore(); + const router = useRouter(); + const selectedUser = ref(null); + const newUsername = ref(""); + const loginError = ref(""); + const createNewUser = computed(() => newUsername.value.trim() !== ""); + const newUserExistsError = computed(() => { + return userStore.users.find((user) => user.username === newUsername.value) ? `User "${newUsername.value}" already exists` : ""; + }); + const error = computed(() => newUserExistsError.value || loginError.value); + const login = /* @__PURE__ */ __name(async () => { + try { + const user = createNewUser.value ? await userStore.createUser(newUsername.value) : selectedUser.value; + if (!user) { + throw new Error("No user selected"); + } + userStore.login(user); + router.push("/"); + } catch (err) { + loginError.value = err.message ?? JSON.stringify(err); + } + }, "login"); + onMounted(async () => { + if (!userStore.initialized) { + await userStore.initialize(); + } + }); + return (_ctx, _cache) => { + return openBlock(), createBlock(_sfc_main$1, { dark: "" }, { + default: withCtx(() => [ + createBaseVNode("main", _hoisted_1, [ + _hoisted_2, + createBaseVNode("div", _hoisted_3, [ + createBaseVNode("div", _hoisted_4, [ + createBaseVNode("label", _hoisted_5, toDisplayString(_ctx.$t("userSelect.newUser")) + ":", 1), + createVNode(unref(script), { + id: "new-user-input", + modelValue: newUsername.value, + "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => newUsername.value = $event), + placeholder: _ctx.$t("userSelect.enterUsername"), + onKeyup: withKeys(login, ["enter"]) + }, null, 8, ["modelValue", "placeholder"]) + ]), + createVNode(unref(script$1)), + createBaseVNode("div", _hoisted_6, [ + createBaseVNode("label", _hoisted_7, toDisplayString(_ctx.$t("userSelect.existingUser")) + ":", 1), + createVNode(unref(script$2), { + modelValue: selectedUser.value, + "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedUser.value = $event), + class: "w-full", + inputId: "existing-user-select", + options: unref(userStore).users, + "option-label": "username", + placeholder: _ctx.$t("userSelect.selectUser"), + disabled: createNewUser.value + }, null, 8, ["modelValue", "options", "placeholder", "disabled"]), + error.value ? (openBlock(), createBlock(unref(script$3), { + key: 0, + severity: "error" + }, { + default: withCtx(() => [ + createTextVNode(toDisplayString(error.value), 1) + ]), + _: 1 + })) : createCommentVNode("", true) + ]), + createBaseVNode("footer", _hoisted_8, [ + createVNode(unref(script$4), { + label: _ctx.$t("userSelect.next"), + onClick: login + }, null, 8, ["label"]) + ]) + ]) + ]) + ]), + _: 1 + }); + }; + } +}); +export { + _sfc_main as default +}; +//# sourceMappingURL=UserSelectView-2l9Kbchu.js.map diff --git a/web/assets/UserSelectView-C_4L-Yqf.js b/web/assets/UserSelectView-C_4L-Yqf.js deleted file mode 100644 index 09d6f844..00000000 --- a/web/assets/UserSelectView-C_4L-Yqf.js +++ /dev/null @@ -1,98 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { a as defineComponent, J as useUserStore, bU as useRouter, r as ref, q as computed, o as onMounted, f as openBlock, g as createElementBlock, A as createBaseVNode, a8 as toDisplayString, h as createVNode, z as unref, aq as script, bN as script$1, bV as script$2, x as createBlock, y as withCtx, ay as createTextVNode, bW as script$3, i as createCommentVNode, D as script$4 } from "./index-DIU5yZe9.js"; -const _hoisted_1 = { - id: "comfy-user-selection", - class: "font-sans flex flex-col items-center h-screen m-0 text-neutral-300 bg-neutral-900 dark-theme pointer-events-auto" -}; -const _hoisted_2 = { class: "mt-[5vh] 2xl:mt-[20vh] min-w-84 relative rounded-lg bg-[var(--comfy-menu-bg)] p-5 px-10 shadow-lg" }; -const _hoisted_3 = /* @__PURE__ */ createBaseVNode("h1", { class: "my-2.5 mb-7 font-normal" }, "ComfyUI", -1); -const _hoisted_4 = { class: "flex w-full flex-col items-center" }; -const _hoisted_5 = { class: "flex w-full flex-col gap-2" }; -const _hoisted_6 = { for: "new-user-input" }; -const _hoisted_7 = { class: "flex w-full flex-col gap-2" }; -const _hoisted_8 = { for: "existing-user-select" }; -const _hoisted_9 = { class: "mt-5" }; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "UserSelectView", - setup(__props) { - const userStore = useUserStore(); - const router = useRouter(); - const selectedUser = ref(null); - const newUsername = ref(""); - const loginError = ref(""); - const createNewUser = computed(() => newUsername.value.trim() !== ""); - const newUserExistsError = computed(() => { - return userStore.users.find((user) => user.username === newUsername.value) ? `User "${newUsername.value}" already exists` : ""; - }); - const error = computed(() => newUserExistsError.value || loginError.value); - const login = /* @__PURE__ */ __name(async () => { - try { - const user = createNewUser.value ? await userStore.createUser(newUsername.value) : selectedUser.value; - if (!user) { - throw new Error("No user selected"); - } - userStore.login(user); - router.push("/"); - } catch (err) { - loginError.value = err.message ?? JSON.stringify(err); - } - }, "login"); - onMounted(async () => { - if (!userStore.initialized) { - await userStore.initialize(); - } - }); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1, [ - createBaseVNode("main", _hoisted_2, [ - _hoisted_3, - createBaseVNode("form", _hoisted_4, [ - createBaseVNode("div", _hoisted_5, [ - createBaseVNode("label", _hoisted_6, toDisplayString(_ctx.$t("userSelect.newUser")) + ":", 1), - createVNode(unref(script), { - id: "new-user-input", - modelValue: newUsername.value, - "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => newUsername.value = $event), - placeholder: _ctx.$t("userSelect.enterUsername") - }, null, 8, ["modelValue", "placeholder"]) - ]), - createVNode(unref(script$1)), - createBaseVNode("div", _hoisted_7, [ - createBaseVNode("label", _hoisted_8, toDisplayString(_ctx.$t("userSelect.existingUser")) + ":", 1), - createVNode(unref(script$2), { - modelValue: selectedUser.value, - "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedUser.value = $event), - class: "w-full", - inputId: "existing-user-select", - options: unref(userStore).users, - "option-label": "username", - placeholder: _ctx.$t("userSelect.selectUser"), - disabled: createNewUser.value - }, null, 8, ["modelValue", "options", "placeholder", "disabled"]), - error.value ? (openBlock(), createBlock(unref(script$3), { - key: 0, - severity: "error" - }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(error.value), 1) - ]), - _: 1 - })) : createCommentVNode("", true) - ]), - createBaseVNode("footer", _hoisted_9, [ - createVNode(unref(script$4), { - label: _ctx.$t("userSelect.next"), - onClick: login - }, null, 8, ["label"]) - ]) - ]) - ]) - ]); - }; - } -}); -export { - _sfc_main as default -}; -//# sourceMappingURL=UserSelectView-C_4L-Yqf.js.map diff --git a/web/assets/UserSelectView-C_4L-Yqf.js.map b/web/assets/UserSelectView-C_4L-Yqf.js.map deleted file mode 100644 index 895075fc..00000000 --- a/web/assets/UserSelectView-C_4L-Yqf.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"UserSelectView-C_4L-Yqf.js","sources":["../../src/views/UserSelectView.vue"],"sourcesContent":["\n\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAoDA,UAAM,YAAY;AAClB,UAAM,SAAS;AAET,UAAA,eAAe,IAAiB,IAAI;AACpC,UAAA,cAAc,IAAI,EAAE;AACpB,UAAA,aAAa,IAAI,EAAE;AAEzB,UAAM,gBAAgB,SAAS,MAAM,YAAY,MAAM,KAAA,MAAW,EAAE;AAC9D,UAAA,qBAAqB,SAAS,MAAM;AACxC,aAAO,UAAU,MAAM,KAAK,CAAC,SAAS,KAAK,aAAa,YAAY,KAAK,IACrE,SAAS,YAAY,KAAK,qBAC1B;AAAA,IAAA,CACL;AACD,UAAM,QAAQ,SAAS,MAAM,mBAAmB,SAAS,WAAW,KAAK;AAEzE,UAAM,QAAQ,mCAAY;AACpB,UAAA;AACI,cAAA,OAAO,cAAc,QACvB,MAAM,UAAU,WAAW,YAAY,KAAK,IAC5C,aAAa;AAEjB,YAAI,CAAC,MAAM;AACH,gBAAA,IAAI,MAAM,kBAAkB;AAAA,QACpC;AAEA,kBAAU,MAAM,IAAI;AACpB,eAAO,KAAK,GAAG;AAAA,eACR,KAAK;AACZ,mBAAW,QAAQ,IAAI,WAAW,KAAK,UAAU,GAAG;AAAA,MACtD;AAAA,IAAA,GAdY;AAiBd,cAAU,YAAY;AAChB,UAAA,CAAC,UAAU,aAAa;AAC1B,cAAM,UAAU;MAClB;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/web/assets/WelcomeView-BD34JMsC.css b/web/assets/WelcomeView-Brz3-luE.css similarity index 68% rename from web/assets/WelcomeView-BD34JMsC.css rename to web/assets/WelcomeView-Brz3-luE.css index 43c9f933..522f3438 100644 --- a/web/assets/WelcomeView-BD34JMsC.css +++ b/web/assets/WelcomeView-Brz3-luE.css @@ -1,5 +1,5 @@ -.animated-gradient-text[data-v-c4d014c5] { +.animated-gradient-text[data-v-7dfaf74c] { font-weight: 700; font-size: clamp(2rem, 8vw, 4rem); background: linear-gradient(to right, #12c2e9, #c471ed, #f64f59, #12c2e9); @@ -7,12 +7,12 @@ background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; - animation: gradient-c4d014c5 8s linear infinite; + animation: gradient-7dfaf74c 8s linear infinite; } -.text-glow[data-v-c4d014c5] { +.text-glow[data-v-7dfaf74c] { filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3)); } -@keyframes gradient-c4d014c5 { +@keyframes gradient-7dfaf74c { 0% { background-position: 0% center; } @@ -20,11 +20,11 @@ background-position: 300% center; } } -.fade-in-up[data-v-c4d014c5] { - animation: fadeInUp-c4d014c5 1.5s ease-out; +.fade-in-up[data-v-7dfaf74c] { + animation: fadeInUp-7dfaf74c 1.5s ease-out; animation-fill-mode: both; } -@keyframes fadeInUp-c4d014c5 { +@keyframes fadeInUp-7dfaf74c { 0% { opacity: 0; transform: translateY(20px); diff --git a/web/assets/WelcomeView-CB7Th_kO.js b/web/assets/WelcomeView-CB7Th_kO.js new file mode 100644 index 00000000..d5adbd55 --- /dev/null +++ b/web/assets/WelcomeView-CB7Th_kO.js @@ -0,0 +1,40 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { d as defineComponent, bW as useRouter, o as openBlock, k as createBlock, M as withCtx, H as createBaseVNode, X as toDisplayString, N as createVNode, j as unref, l as script, aL as pushScopeId, aM as popScopeId, _ as _export_sfc } from "./index-C4Fk50Nx.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-CsEJhGbv.js"; +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-7dfaf74c"), n = n(), popScopeId(), n), "_withScopeId"); +const _hoisted_1 = { class: "flex flex-col items-center justify-center gap-8 p-8" }; +const _hoisted_2 = { class: "animated-gradient-text text-glow select-none" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "WelcomeView", + setup(__props) { + const router = useRouter(); + const navigateTo = /* @__PURE__ */ __name((path) => { + router.push(path); + }, "navigateTo"); + return (_ctx, _cache) => { + return openBlock(), createBlock(_sfc_main$1, { dark: "" }, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_1, [ + createBaseVNode("h1", _hoisted_2, toDisplayString(_ctx.$t("welcome.title")), 1), + createVNode(unref(script), { + label: _ctx.$t("welcome.getStarted"), + icon: "pi pi-arrow-right", + iconPos: "right", + size: "large", + rounded: "", + onClick: _cache[0] || (_cache[0] = ($event) => navigateTo("/install")), + class: "p-4 text-lg fade-in-up" + }, null, 8, ["label"]) + ]) + ]), + _: 1 + }); + }; + } +}); +const WelcomeView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7dfaf74c"]]); +export { + WelcomeView as default +}; +//# sourceMappingURL=WelcomeView-CB7Th_kO.js.map diff --git a/web/assets/WelcomeView-Db7ZDfZo.js b/web/assets/WelcomeView-Db7ZDfZo.js deleted file mode 100644 index e6dc150e..00000000 --- a/web/assets/WelcomeView-Db7ZDfZo.js +++ /dev/null @@ -1,37 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { a as defineComponent, bU as useRouter, f as openBlock, g as createElementBlock, A as createBaseVNode, a8 as toDisplayString, h as createVNode, z as unref, D as script, R as pushScopeId, U as popScopeId, _ as _export_sfc } from "./index-DIU5yZe9.js"; -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-c4d014c5"), n = n(), popScopeId(), n), "_withScopeId"); -const _hoisted_1 = { class: "font-sans flex flex-col justify-center items-center h-screen m-0 text-neutral-300 bg-neutral-900 dark-theme pointer-events-auto" }; -const _hoisted_2 = { class: "flex flex-col items-center justify-center gap-8 p-8" }; -const _hoisted_3 = { class: "animated-gradient-text text-glow select-none" }; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "WelcomeView", - setup(__props) { - const router = useRouter(); - const navigateTo = /* @__PURE__ */ __name((path) => { - router.push(path); - }, "navigateTo"); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1, [ - createBaseVNode("div", _hoisted_2, [ - createBaseVNode("h1", _hoisted_3, toDisplayString(_ctx.$t("welcome.title")), 1), - createVNode(unref(script), { - label: _ctx.$t("welcome.getStarted"), - icon: "pi pi-arrow-right", - iconPos: "right", - size: "large", - rounded: "", - onClick: _cache[0] || (_cache[0] = ($event) => navigateTo("/install")), - class: "p-4 text-lg fade-in-up" - }, null, 8, ["label"]) - ]) - ]); - }; - } -}); -const WelcomeView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c4d014c5"]]); -export { - WelcomeView as default -}; -//# sourceMappingURL=WelcomeView-Db7ZDfZo.js.map diff --git a/web/assets/WelcomeView-Db7ZDfZo.js.map b/web/assets/WelcomeView-Db7ZDfZo.js.map deleted file mode 100644 index 65e38de4..00000000 --- a/web/assets/WelcomeView-Db7ZDfZo.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"WelcomeView-Db7ZDfZo.js","sources":["../../src/views/WelcomeView.vue"],"sourcesContent":["\n\n\n\n\n"],"names":[],"mappings":";;;;;;;;;;AA4BA,UAAM,SAAS;AACT,UAAA,aAAa,wBAAC,SAAiB;AACnC,aAAO,KAAK,IAAI;AAAA,IAAA,GADC;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/web/assets/images/apple-mps-logo.png b/web/assets/images/apple-mps-logo.png new file mode 100644 index 00000000..261edbfd Binary files /dev/null and b/web/assets/images/apple-mps-logo.png differ diff --git a/web/assets/images/manual-configuration.svg b/web/assets/images/manual-configuration.svg new file mode 100644 index 00000000..bc90c647 --- /dev/null +++ b/web/assets/images/manual-configuration.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/web/assets/images/nvidia-logo.svg b/web/assets/images/nvidia-logo.svg new file mode 100644 index 00000000..71f15b53 --- /dev/null +++ b/web/assets/images/nvidia-logo.svg @@ -0,0 +1,6 @@ + Artificial Intelligence Computing Leadership from NVIDIA + + + + + \ No newline at end of file diff --git a/web/assets/index-p6KSJ2Zq.js b/web/assets/index-5Sv744Dr.js similarity index 98% rename from web/assets/index-p6KSJ2Zq.js rename to web/assets/index-5Sv744Dr.js index 591fc998..5ec1cf8e 100644 --- a/web/assets/index-p6KSJ2Zq.js +++ b/web/assets/index-5Sv744Dr.js @@ -1,7 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { c6 as ComfyDialog, c7 as $el, c8 as ComfyApp, b as app, j as LiteGraph, b9 as LGraphCanvas, c9 as DraggableList, bo as useToastStore, ca as showPromptDialog, cb as t, cc as serialise, aF as useNodeDefStore, cd as deserialiseAndCreate, b2 as api, u as useSettingStore, L as LGraphGroup, ce as KeyComboImpl, O as useKeybindingStore, F as useCommandStore, c as LGraphNode, cf as ComfyWidgets, cg as applyTextReplacements, ch as isElectron, bZ as electronAPI, ci as showConfirmationDialog, aQ as nextTick } from "./index-DIU5yZe9.js"; -import { mergeIfValid, getWidgetConfig, setWidgetConfig } from "./widgetInputs-Bvm3AgOa.js"; +import { ca as ComfyDialog, cb as $el, cc as ComfyApp, h as app, a3 as LiteGraph, bd as LGraphCanvas, cd as useExtensionService, ce as processDynamicPrompt, cf as isElectron, c0 as electronAPI, bR as useDialogService, cg as t, ch as DraggableList, bt as useToastStore, ah as LGraphNode, ci as applyTextReplacements, cj as ComfyWidgets, ck as addValueControlWidgets, a6 as useNodeDefStore, cl as serialise, cm as deserialiseAndCreate, b8 as api, a as useSettingStore, ag as LGraphGroup, ad as nextTick } from "./index-C4Fk50Nx.js"; class ClipspaceDialog extends ComfyDialog { static { __name(this, "ClipspaceDialog"); @@ -285,27 +284,15 @@ const ext$1 = { } }; app.registerExtension(ext$1); -function stripComments(str) { - return str.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, ""); -} -__name(stripComments, "stripComments"); -app.registerExtension({ +useExtensionService().registerExtension({ name: "Comfy.DynamicPrompts", nodeCreated(node) { if (node.widgets) { const widgets = node.widgets.filter((n) => n.dynamicPrompts); for (const widget of widgets) { widget.serializeValue = (workflowNode, widgetIndex) => { - let prompt = stripComments(widget.value); - while (prompt.replace("\\{", "").includes("{") && prompt.replace("\\}", "").includes("}")) { - const startIndex = prompt.replace("\\{", "00").indexOf("{"); - const endIndex = prompt.replace("\\}", "00").indexOf("}"); - const optionsString = prompt.substring(startIndex + 1, endIndex); - const options = optionsString.split("|"); - const randomIndex = Math.floor(Math.random() * options.length); - const randomOption = options[randomIndex]; - prompt = prompt.substring(0, startIndex) + randomOption + prompt.substring(endIndex + 1); - } + if (typeof widget.value !== "string") return widget.value; + const prompt = processDynamicPrompt(widget.value); if (workflowNode?.widgets_values) workflowNode.widgets_values[widgetIndex] = prompt; return prompt; @@ -431,6 +418,167 @@ app.registerExtension({ window.addEventListener("keydown", editAttention); } }); +(async () => { + if (!isElectron()) return; + const electronAPI$1 = electronAPI(); + const desktopAppVersion = await electronAPI$1.getElectronVersion(); + const onChangeRestartApp = /* @__PURE__ */ __name((newValue, oldValue) => { + if (oldValue !== void 0 && newValue !== oldValue) { + electronAPI$1.restartApp("Restart ComfyUI to apply changes.", 1500); + } + }, "onChangeRestartApp"); + app.registerExtension({ + name: "Comfy.ElectronAdapter", + settings: [ + { + id: "Comfy-Desktop.AutoUpdate", + category: ["Comfy-Desktop", "General", "AutoUpdate"], + name: "Automatically check for updates", + type: "boolean", + defaultValue: true, + onChange: onChangeRestartApp + }, + { + id: "Comfy-Desktop.SendStatistics", + category: ["Comfy-Desktop", "General", "Send Statistics"], + name: "Send anonymous crash reports", + type: "boolean", + defaultValue: true, + onChange: onChangeRestartApp + } + ], + commands: [ + { + id: "Comfy-Desktop.Folders.OpenLogsFolder", + label: "Open Logs Folder", + icon: "pi pi-folder-open", + function() { + electronAPI$1.openLogsFolder(); + } + }, + { + id: "Comfy-Desktop.Folders.OpenModelsFolder", + label: "Open Models Folder", + icon: "pi pi-folder-open", + function() { + electronAPI$1.openModelsFolder(); + } + }, + { + id: "Comfy-Desktop.Folders.OpenOutputsFolder", + label: "Open Outputs Folder", + icon: "pi pi-folder-open", + function() { + electronAPI$1.openOutputsFolder(); + } + }, + { + id: "Comfy-Desktop.Folders.OpenInputsFolder", + label: "Open Inputs Folder", + icon: "pi pi-folder-open", + function() { + electronAPI$1.openInputsFolder(); + } + }, + { + id: "Comfy-Desktop.Folders.OpenCustomNodesFolder", + label: "Open Custom Nodes Folder", + icon: "pi pi-folder-open", + function() { + electronAPI$1.openCustomNodesFolder(); + } + }, + { + id: "Comfy-Desktop.Folders.OpenModelConfig", + label: "Open extra_model_paths.yaml", + icon: "pi pi-file", + function() { + electronAPI$1.openModelConfig(); + } + }, + { + id: "Comfy-Desktop.OpenDevTools", + label: "Open DevTools", + icon: "pi pi-code", + function() { + electronAPI$1.openDevTools(); + } + }, + { + id: "Comfy-Desktop.OpenFeedbackPage", + label: "Feedback", + icon: "pi pi-envelope", + function() { + window.open("https://forum.comfy.org/c/v1-feedback/", "_blank"); + } + }, + { + id: "Comfy-Desktop.OpenUserGuide", + label: "Desktop User Guide", + icon: "pi pi-book", + function() { + window.open("https://comfyorg.notion.site/", "_blank"); + } + }, + { + id: "Comfy-Desktop.Reinstall", + label: "Reinstall", + icon: "pi pi-refresh", + async function() { + const proceed = await useDialogService().confirm({ + message: t("desktopMenu.confirmReinstall"), + title: t("desktopMenu.reinstall"), + type: "reinstall" + }); + if (proceed) electronAPI$1.reinstall(); + } + }, + { + id: "Comfy-Desktop.Restart", + label: "Restart", + icon: "pi pi-refresh", + function() { + electronAPI$1.restartApp(); + } + } + ], + menuCommands: [ + { + path: ["Help"], + commands: [ + "Comfy-Desktop.OpenUserGuide", + "Comfy-Desktop.OpenFeedbackPage" + ] + }, + { + path: ["Help"], + commands: ["Comfy-Desktop.OpenDevTools"] + }, + { + path: ["Help", "Open Folder"], + commands: [ + "Comfy-Desktop.Folders.OpenLogsFolder", + "Comfy-Desktop.Folders.OpenModelsFolder", + "Comfy-Desktop.Folders.OpenOutputsFolder", + "Comfy-Desktop.Folders.OpenInputsFolder", + "Comfy-Desktop.Folders.OpenCustomNodesFolder", + "Comfy-Desktop.Folders.OpenModelConfig" + ] + }, + { + path: ["Help"], + commands: ["Comfy-Desktop.Reinstall"] + } + ], + aboutPageBadges: [ + { + label: "ComfyUI_desktop v" + desktopAppVersion, + url: "https://github.com/Comfy-Org/electron", + icon: "pi pi-github" + } + ] + }); +})(); const ORDER = Symbol(); const PREFIX$1 = "workflow"; const SEPARATOR$1 = ">"; @@ -866,6 +1014,791 @@ class ManageGroupDialog extends ComfyDialog { window.comfyAPI = window.comfyAPI || {}; window.comfyAPI.groupNodeManage = window.comfyAPI.groupNodeManage || {}; window.comfyAPI.groupNodeManage.ManageGroupDialog = ManageGroupDialog; +const CONVERTED_TYPE = "converted-widget"; +const VALID_TYPES = [ + "STRING", + "combo", + "number", + "toggle", + "BOOLEAN", + "text", + "string" +]; +const CONFIG = Symbol(); +const GET_CONFIG = Symbol(); +const TARGET = Symbol(); +const replacePropertyName = "Run widget replace on values"; +class PrimitiveNode extends LGraphNode { + static { + __name(this, "PrimitiveNode"); + } + controlValues; + lastType; + static category; + constructor(title) { + super(title); + this.addOutput("connect to widget input", "*"); + this.serialize_widgets = true; + this.isVirtualNode = true; + if (!this.properties || !(replacePropertyName in this.properties)) { + this.addProperty(replacePropertyName, false, "boolean"); + } + } + applyToGraph(extraLinks = []) { + if (!this.outputs[0].links?.length) return; + function get_links(node) { + let links2 = []; + for (const l of node.outputs[0].links) { + const linkInfo = app.graph.links[l]; + const n = node.graph.getNodeById(linkInfo.target_id); + if (n.type == "Reroute") { + links2 = links2.concat(get_links(n)); + } else { + links2.push(l); + } + } + return links2; + } + __name(get_links, "get_links"); + let links = [ + ...get_links(this).map((l) => app.graph.links[l]), + ...extraLinks + ]; + let v = this.widgets?.[0].value; + if (v && this.properties[replacePropertyName]) { + v = applyTextReplacements(app, v); + } + for (const linkInfo of links) { + const node = this.graph.getNodeById(linkInfo.target_id); + const input = node.inputs[linkInfo.target_slot]; + let widget; + if (input.widget[TARGET]) { + widget = input.widget[TARGET]; + } else { + const widgetName = input.widget.name; + if (widgetName) { + widget = node.widgets.find((w) => w.name === widgetName); + } + } + if (widget) { + widget.value = v; + if (widget.callback) { + widget.callback( + widget.value, + app.canvas, + node, + app.canvas.graph_mouse, + {} + ); + } + } + } + } + refreshComboInNode() { + const widget = this.widgets?.[0]; + if (widget?.type === "combo") { + widget.options.values = this.outputs[0].widget[GET_CONFIG]()[0]; + if (!widget.options.values.includes(widget.value)) { + widget.value = widget.options.values[0]; + widget.callback(widget.value); + } + } + } + onAfterGraphConfigured() { + if (this.outputs[0].links?.length && !this.widgets?.length) { + if (!this.#onFirstConnection()) return; + if (this.widgets) { + for (let i = 0; i < this.widgets_values.length; i++) { + const w = this.widgets[i]; + if (w) { + w.value = this.widgets_values[i]; + } + } + } + this.#mergeWidgetConfig(); + } + } + onConnectionsChange(_, index, connected) { + if (app.configuringGraph) { + return; + } + const links = this.outputs[0].links; + if (connected) { + if (links?.length && !this.widgets?.length) { + this.#onFirstConnection(); + } + } else { + this.#mergeWidgetConfig(); + if (!links?.length) { + this.onLastDisconnect(); + } + } + } + onConnectOutput(slot, type, input, target_node, target_slot) { + if (!input.widget) { + if (!(input.type in ComfyWidgets)) return false; + } + if (this.outputs[slot].links?.length) { + const valid = this.#isValidConnection(input); + if (valid) { + this.applyToGraph([{ target_id: target_node.id, target_slot }]); + } + return valid; + } + } + #onFirstConnection(recreating) { + if (!this.outputs[0].links) { + this.onLastDisconnect(); + return; + } + const linkId = this.outputs[0].links[0]; + const link = this.graph.links[linkId]; + if (!link) return; + const theirNode = this.graph.getNodeById(link.target_id); + if (!theirNode || !theirNode.inputs) return; + const input = theirNode.inputs[link.target_slot]; + if (!input) return; + let widget; + if (!input.widget) { + if (!(input.type in ComfyWidgets)) return; + widget = { name: input.name, [GET_CONFIG]: () => [input.type, {}] }; + } else { + widget = input.widget; + } + const config = widget[GET_CONFIG]?.(); + if (!config) return; + const { type } = getWidgetType(config); + this.outputs[0].type = type; + this.outputs[0].name = type; + this.outputs[0].widget = widget; + this.#createWidget( + widget[CONFIG] ?? config, + theirNode, + widget.name, + recreating, + widget[TARGET] + ); + } + #createWidget(inputData, node, widgetName, recreating, targetWidget) { + let type = inputData[0]; + if (type instanceof Array) { + type = "COMBO"; + } + const [oldWidth, oldHeight] = this.size; + let widget; + if (type in ComfyWidgets) { + widget = (ComfyWidgets[type](this, "value", inputData, app) || {}).widget; + } else { + widget = this.addWidget(type, "value", null, () => { + }, {}); + } + if (targetWidget) { + widget.value = targetWidget.value; + } else if (node?.widgets && widget) { + const theirWidget = node.widgets.find((w) => w.name === widgetName); + if (theirWidget) { + widget.value = theirWidget.value; + } + } + if (!inputData?.[1]?.control_after_generate && (widget.type === "number" || widget.type === "combo")) { + let control_value = this.widgets_values?.[1]; + if (!control_value) { + control_value = "fixed"; + } + addValueControlWidgets( + this, + widget, + control_value, + void 0, + inputData + ); + let filter = this.widgets_values?.[2]; + if (filter && this.widgets.length === 3) { + this.widgets[2].value = filter; + } + } + const controlValues = this.controlValues; + if (this.lastType === this.widgets[0].type && controlValues?.length === this.widgets.length - 1) { + for (let i = 0; i < controlValues.length; i++) { + this.widgets[i + 1].value = controlValues[i]; + } + } + const callback = widget.callback; + const self2 = this; + widget.callback = function() { + const r = callback ? callback.apply(this, arguments) : void 0; + self2.applyToGraph(); + return r; + }; + this.size = [ + Math.max(this.size[0], oldWidth), + Math.max(this.size[1], oldHeight) + ]; + if (!recreating) { + const sz = this.computeSize(); + if (this.size[0] < sz[0]) { + this.size[0] = sz[0]; + } + if (this.size[1] < sz[1]) { + this.size[1] = sz[1]; + } + requestAnimationFrame(() => { + if (this.onResize) { + this.onResize(this.size); + } + }); + } + } + recreateWidget() { + const values = this.widgets?.map((w) => w.value); + this.#removeWidgets(); + this.#onFirstConnection(true); + if (values?.length) { + for (let i = 0; i < this.widgets?.length; i++) + this.widgets[i].value = values[i]; + } + return this.widgets?.[0]; + } + #mergeWidgetConfig() { + const output = this.outputs[0]; + const links = output.links; + const hasConfig = !!output.widget[CONFIG]; + if (hasConfig) { + delete output.widget[CONFIG]; + } + if (links?.length < 2 && hasConfig) { + if (links.length) { + this.recreateWidget(); + } + return; + } + const config1 = output.widget[GET_CONFIG](); + const isNumber = config1[0] === "INT" || config1[0] === "FLOAT"; + if (!isNumber) return; + for (const linkId of links) { + const link = app.graph.links[linkId]; + if (!link) continue; + const theirNode = app.graph.getNodeById(link.target_id); + const theirInput = theirNode.inputs[link.target_slot]; + this.#isValidConnection(theirInput, hasConfig); + } + } + isValidWidgetLink(originSlot, targetNode, targetWidget) { + const config2 = getConfig.call(targetNode, targetWidget.name) ?? [ + targetWidget.type, + targetWidget.options || {} + ]; + if (!isConvertibleWidget(targetWidget, config2)) return false; + const output = this.outputs[originSlot]; + if (!(output.widget?.[CONFIG] ?? output.widget?.[GET_CONFIG]())) { + return true; + } + return !!mergeIfValid.call(this, output, config2); + } + #isValidConnection(input, forceUpdate) { + const output = this.outputs[0]; + const config2 = input.widget[GET_CONFIG](); + return !!mergeIfValid.call( + this, + output, + config2, + forceUpdate, + this.recreateWidget + ); + } + #removeWidgets() { + if (this.widgets) { + for (const w of this.widgets) { + if (w.onRemove) { + w.onRemove(); + } + } + this.controlValues = []; + this.lastType = this.widgets[0]?.type; + for (let i = 1; i < this.widgets.length; i++) { + this.controlValues.push(this.widgets[i].value); + } + setTimeout(() => { + delete this.lastType; + delete this.controlValues; + }, 15); + this.widgets.length = 0; + } + } + onLastDisconnect() { + this.outputs[0].type = "*"; + this.outputs[0].name = "connect to widget input"; + delete this.outputs[0].widget; + this.#removeWidgets(); + } +} +function getWidgetConfig(slot) { + return slot.widget[CONFIG] ?? slot.widget[GET_CONFIG]?.() ?? ["*", {}]; +} +__name(getWidgetConfig, "getWidgetConfig"); +function getConfig(widgetName) { + const { nodeData } = this.constructor; + return nodeData?.input?.required?.[widgetName] ?? nodeData?.input?.optional?.[widgetName]; +} +__name(getConfig, "getConfig"); +function isConvertibleWidget(widget, config) { + return (VALID_TYPES.includes(widget.type) || VALID_TYPES.includes(config[0])) && !widget.options?.forceInput; +} +__name(isConvertibleWidget, "isConvertibleWidget"); +function hideWidget(node, widget, suffix = "") { + if (widget.type?.startsWith(CONVERTED_TYPE)) return; + widget.origType = widget.type; + widget.origComputeSize = widget.computeSize; + widget.origSerializeValue = widget.serializeValue; + widget.computeSize = () => [0, -4]; + widget.type = CONVERTED_TYPE + suffix; + widget.serializeValue = () => { + if (!node.inputs) { + return void 0; + } + let node_input = node.inputs.find((i) => i.widget?.name === widget.name); + if (!node_input || !node_input.link) { + return void 0; + } + return widget.origSerializeValue ? widget.origSerializeValue() : widget.value; + }; + if (widget.linkedWidgets) { + for (const w of widget.linkedWidgets) { + hideWidget(node, w, ":" + widget.name); + } + } +} +__name(hideWidget, "hideWidget"); +function showWidget(widget) { + widget.type = widget.origType; + widget.computeSize = widget.origComputeSize; + widget.serializeValue = widget.origSerializeValue; + delete widget.origType; + delete widget.origComputeSize; + delete widget.origSerializeValue; + if (widget.linkedWidgets) { + for (const w of widget.linkedWidgets) { + showWidget(w); + } + } +} +__name(showWidget, "showWidget"); +function convertToInput(node, widget, config) { + hideWidget(node, widget); + const { type } = getWidgetType(config); + const [oldWidth, oldHeight] = node.size; + const inputIsOptional = !!widget.options?.inputIsOptional; + const input = node.addInput(widget.name, type, { + widget: { name: widget.name, [GET_CONFIG]: () => config }, + ...inputIsOptional ? { shape: LiteGraph.SlotShape.HollowCircle } : {} + }); + for (const widget2 of node.widgets) { + widget2.last_y += LiteGraph.NODE_SLOT_HEIGHT; + } + node.setSize([ + Math.max(oldWidth, node.size[0]), + Math.max(oldHeight, node.size[1]) + ]); + return input; +} +__name(convertToInput, "convertToInput"); +function convertToWidget(node, widget) { + showWidget(widget); + const [oldWidth, oldHeight] = node.size; + node.removeInput(node.inputs.findIndex((i) => i.widget?.name === widget.name)); + for (const widget2 of node.widgets) { + widget2.last_y -= LiteGraph.NODE_SLOT_HEIGHT; + } + node.setSize([ + Math.max(oldWidth, node.size[0]), + Math.max(oldHeight, node.size[1]) + ]); +} +__name(convertToWidget, "convertToWidget"); +function getWidgetType(config) { + let type = config[0]; + if (type instanceof Array) { + type = "COMBO"; + } + return { type }; +} +__name(getWidgetType, "getWidgetType"); +function isValidCombo(combo, obj) { + if (!(obj instanceof Array)) { + console.log(`connection rejected: tried to connect combo to ${obj}`); + return false; + } + if (combo.length !== obj.length) { + console.log(`connection rejected: combo lists dont match`); + return false; + } + if (combo.find((v, i) => obj[i] !== v)) { + console.log(`connection rejected: combo lists dont match`); + return false; + } + return true; +} +__name(isValidCombo, "isValidCombo"); +function isPrimitiveNode(node) { + return node.type === "PrimitiveNode"; +} +__name(isPrimitiveNode, "isPrimitiveNode"); +function setWidgetConfig(slot, config, target) { + if (!slot.widget) return; + if (config) { + slot.widget[GET_CONFIG] = () => config; + slot.widget[TARGET] = target; + } else { + delete slot.widget; + } + if (slot.link) { + const link = app.graph.links[slot.link]; + if (link) { + const originNode = app.graph.getNodeById(link.origin_id); + if (isPrimitiveNode(originNode)) { + if (config) { + originNode.recreateWidget(); + } else if (!app.configuringGraph) { + originNode.disconnectOutput(0); + originNode.onLastDisconnect(); + } + } + } + } +} +__name(setWidgetConfig, "setWidgetConfig"); +function mergeIfValid(output, config2, forceUpdate, recreateWidget, config1) { + if (!config1) { + config1 = getWidgetConfig(output); + } + if (config1[0] instanceof Array) { + if (!isValidCombo(config1[0], config2[0])) return; + } else if (config1[0] !== config2[0]) { + console.log(`connection rejected: types dont match`, config1[0], config2[0]); + return; + } + const keys = /* @__PURE__ */ new Set([ + ...Object.keys(config1[1] ?? {}), + ...Object.keys(config2[1] ?? {}) + ]); + let customConfig; + const getCustomConfig = /* @__PURE__ */ __name(() => { + if (!customConfig) { + if (typeof structuredClone === "undefined") { + customConfig = JSON.parse(JSON.stringify(config1[1] ?? {})); + } else { + customConfig = structuredClone(config1[1] ?? {}); + } + } + return customConfig; + }, "getCustomConfig"); + const isNumber = config1[0] === "INT" || config1[0] === "FLOAT"; + for (const k of keys.values()) { + if (k !== "default" && k !== "forceInput" && k !== "defaultInput" && k !== "control_after_generate" && k !== "multiline" && k !== "tooltip" && k !== "dynamicPrompts") { + let v1 = config1[1][k]; + let v2 = config2[1]?.[k]; + if (v1 === v2 || !v1 && !v2) continue; + if (isNumber) { + if (k === "min") { + const theirMax = config2[1]?.["max"]; + if (theirMax != null && v1 > theirMax) { + console.log("connection rejected: min > max", v1, theirMax); + return; + } + getCustomConfig()[k] = v1 == null ? v2 : v2 == null ? v1 : Math.max(v1, v2); + continue; + } else if (k === "max") { + const theirMin = config2[1]?.["min"]; + if (theirMin != null && v1 < theirMin) { + console.log("connection rejected: max < min", v1, theirMin); + return; + } + getCustomConfig()[k] = v1 == null ? v2 : v2 == null ? v1 : Math.min(v1, v2); + continue; + } else if (k === "step") { + let step; + if (v1 == null) { + step = v2; + } else if (v2 == null) { + step = v1; + } else { + if (v1 < v2) { + const a = v2; + v2 = v1; + v1 = a; + } + if (v1 % v2) { + console.log( + "connection rejected: steps not divisible", + "current:", + v1, + "new:", + v2 + ); + return; + } + step = v1; + } + getCustomConfig()[k] = step; + continue; + } + } + console.log(`connection rejected: config ${k} values dont match`, v1, v2); + return; + } + } + if (customConfig || forceUpdate) { + if (customConfig) { + output.widget[CONFIG] = [config1[0], customConfig]; + } + const widget = recreateWidget?.call(this); + if (widget) { + const min = widget.options.min; + const max2 = widget.options.max; + if (min != null && widget.value < min) widget.value = min; + if (max2 != null && widget.value > max2) widget.value = max2; + widget.callback(widget.value); + } + } + return { customConfig }; +} +__name(mergeIfValid, "mergeIfValid"); +let useConversionSubmenusSetting; +app.registerExtension({ + name: "Comfy.WidgetInputs", + init() { + useConversionSubmenusSetting = app.ui.settings.addSetting({ + id: "Comfy.NodeInputConversionSubmenus", + name: "In the node context menu, place the entries that convert between input/widget in sub-menus.", + type: "boolean", + defaultValue: true + }); + }, + setup() { + app.canvas.getWidgetLinkType = function(widget, node) { + const nodeDefStore = useNodeDefStore(); + const nodeDef = nodeDefStore.nodeDefsByName[node.type]; + const input = nodeDef.inputs.getInput(widget.name); + return input?.type; + }; + document.addEventListener( + "litegraph:canvas", + async (e) => { + if (e.detail.subType === "connectingWidgetLink") { + const { node, link, widget } = e.detail; + if (!node || !link || !widget) return; + const nodeData = node.constructor.nodeData; + if (!nodeData) return; + const all = { + ...nodeData?.input?.required, + ...nodeData?.input?.optional + }; + const inputSpec = all[widget.name]; + if (!inputSpec) return; + const input = convertToInput(node, widget, inputSpec); + if (!input) return; + const originNode = link.node; + originNode.connect(link.slot, node, node.inputs.lastIndexOf(input)); + } + } + ); + }, + async beforeRegisterNodeDef(nodeType, nodeData, app2) { + const origGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions; + nodeType.prototype.convertWidgetToInput = function(widget) { + const config = getConfig.call(this, widget.name) ?? [ + widget.type, + widget.options || {} + ]; + if (!isConvertibleWidget(widget, config)) return false; + if (widget.type?.startsWith(CONVERTED_TYPE)) return false; + convertToInput(this, widget, config); + return true; + }; + nodeType.prototype.getExtraMenuOptions = function(_, options) { + const r = origGetExtraMenuOptions ? origGetExtraMenuOptions.apply(this, arguments) : void 0; + if (this.widgets) { + let toInput = []; + let toWidget = []; + for (const w of this.widgets) { + if (w.options?.forceInput) { + continue; + } + if (w.type === CONVERTED_TYPE) { + toWidget.push({ + // @ts-expect-error never + content: `Convert ${w.name} to widget`, + callback: /* @__PURE__ */ __name(() => convertToWidget(this, w), "callback") + }); + } else { + const config = getConfig.call(this, w.name) ?? [ + w.type, + w.options || {} + ]; + if (isConvertibleWidget(w, config)) { + toInput.push({ + content: `Convert ${w.name} to input`, + callback: /* @__PURE__ */ __name(() => convertToInput(this, w, config), "callback") + }); + } + } + } + if (toInput.length) { + if (useConversionSubmenusSetting.value) { + options.push({ + content: "Convert Widget to Input", + submenu: { + options: toInput + } + }); + } else { + options.push(...toInput, null); + } + } + if (toWidget.length) { + if (useConversionSubmenusSetting.value) { + options.push({ + content: "Convert Input to Widget", + submenu: { + options: toWidget + } + }); + } else { + options.push(...toWidget, null); + } + } + } + return r; + }; + nodeType.prototype.onGraphConfigured = function() { + if (!this.inputs) return; + this.widgets ??= []; + for (const input of this.inputs) { + if (input.widget) { + if (!input.widget[GET_CONFIG]) { + input.widget[GET_CONFIG] = () => getConfig.call(this, input.widget.name); + } + if (input.widget.config) { + if (input.widget.config[0] instanceof Array) { + input.type = "COMBO"; + const link = app2.graph.links[input.link]; + if (link) { + link.type = input.type; + } + } + delete input.widget.config; + } + const w = this.widgets.find((w2) => w2.name === input.widget.name); + if (w) { + hideWidget(this, w); + } else { + convertToWidget(this, input); + } + } + } + }; + const origOnNodeCreated = nodeType.prototype.onNodeCreated; + nodeType.prototype.onNodeCreated = function() { + const r = origOnNodeCreated ? origOnNodeCreated.apply(this) : void 0; + if (!app2.configuringGraph && this.widgets) { + for (const w of this.widgets) { + if (w?.options?.forceInput || w?.options?.defaultInput) { + const config = getConfig.call(this, w.name) ?? [ + w.type, + w.options || {} + ]; + convertToInput(this, w, config); + } + } + } + return r; + }; + const origOnConfigure = nodeType.prototype.onConfigure; + nodeType.prototype.onConfigure = function() { + const r = origOnConfigure ? origOnConfigure.apply(this, arguments) : void 0; + if (!app2.configuringGraph && this.inputs) { + for (const input of this.inputs) { + if (input.widget && !input.widget[GET_CONFIG]) { + input.widget[GET_CONFIG] = () => ( + // @ts-expect-error input.widget has unknown type + getConfig.call(this, input.widget.name) + ); + const w = this.widgets.find((w2) => w2.name === input.widget.name); + if (w) { + hideWidget(this, w); + } + } + } + } + return r; + }; + function isNodeAtPos(pos) { + for (const n of app2.graph.nodes) { + if (n.pos[0] === pos[0] && n.pos[1] === pos[1]) { + return true; + } + } + return false; + } + __name(isNodeAtPos, "isNodeAtPos"); + const origOnInputDblClick = nodeType.prototype.onInputDblClick; + const ignoreDblClick = Symbol(); + nodeType.prototype.onInputDblClick = function(slot) { + const r = origOnInputDblClick ? origOnInputDblClick.apply(this, arguments) : void 0; + const input = this.inputs[slot]; + if (!input.widget || !input[ignoreDblClick]) { + if (!(input.type in ComfyWidgets) && !(input.widget?.[GET_CONFIG]?.()?.[0] instanceof Array)) { + return r; + } + } + const node = LiteGraph.createNode("PrimitiveNode"); + app2.graph.add(node); + const pos = [ + this.pos[0] - node.size[0] - 30, + this.pos[1] + ]; + while (isNodeAtPos(pos)) { + pos[1] += LiteGraph.NODE_TITLE_HEIGHT; + } + node.pos = pos; + node.connect(0, this, slot); + node.title = input.name; + input[ignoreDblClick] = true; + setTimeout(() => { + delete input[ignoreDblClick]; + }, 300); + return r; + }; + const onConnectInput = nodeType.prototype.onConnectInput; + nodeType.prototype.onConnectInput = function(targetSlot, type, output, originNode, originSlot) { + const v = onConnectInput?.(this, arguments); + if (type !== "COMBO") return v; + if (originNode.outputs[originSlot].widget) return v; + const targetCombo = this.inputs[targetSlot].widget?.[GET_CONFIG]?.()?.[0]; + if (!targetCombo || !(targetCombo instanceof Array)) return v; + const originConfig = originNode.constructor?.nodeData?.output?.[originSlot]; + if (!originConfig || !isValidCombo(targetCombo, originConfig)) { + return false; + } + return v; + }; + }, + registerCustomNodes() { + LiteGraph.registerNodeType( + "PrimitiveNode", + Object.assign(PrimitiveNode, { + title: "Primitive" + }) + ); + PrimitiveNode.category = "utils"; + } +}); +window.comfyAPI = window.comfyAPI || {}; +window.comfyAPI.widgetInputs = window.comfyAPI.widgetInputs || {}; +window.comfyAPI.widgetInputs.getWidgetConfig = getWidgetConfig; +window.comfyAPI.widgetInputs.convertToInput = convertToInput; +window.comfyAPI.widgetInputs.setWidgetConfig = setWidgetConfig; +window.comfyAPI.widgetInputs.mergeIfValid = mergeIfValid; const GROUP = Symbol(); const PREFIX = "workflow"; const SEPARATOR = ">"; @@ -912,7 +1845,7 @@ class GroupNodeBuilder { return { name, nodeData: this.nodeData }; } async getName() { - const name = await showPromptDialog({ + const name = await useDialogService().prompt({ title: t("groupNode.create"), message: t("groupNode.enterName"), defaultValue: "" @@ -2334,6270 +3267,6 @@ app.registerExtension({ }); } }); -app.registerExtension({ - name: "Comfy.Keybinds", - init() { - const keybindListener = /* @__PURE__ */ __name(async function(event) { - if (!app.vueAppReady) return; - const keyCombo = KeyComboImpl.fromEvent(event); - if (keyCombo.isModifier) { - return; - } - const target = event.composedPath()[0]; - if (!keyCombo.hasModifier && (target.tagName === "TEXTAREA" || target.tagName === "INPUT" || target.tagName === "SPAN" && target.classList.contains("property_value"))) { - return; - } - const keybindingStore = useKeybindingStore(); - const commandStore = useCommandStore(); - const keybinding = keybindingStore.getKeybinding(keyCombo); - if (keybinding && keybinding.targetSelector !== "#graph-canvas") { - event.preventDefault(); - await commandStore.execute(keybinding.commandId); - return; - } - if (event.ctrlKey || event.altKey || event.metaKey) { - return; - } - if (event.key === "Escape") { - const modals = document.querySelectorAll(".comfy-modal"); - for (const modal of modals) { - const modalDisplay = window.getComputedStyle(modal).getPropertyValue("display"); - if (modalDisplay !== "none") { - modal.style.display = "none"; - break; - } - } - for (const d of document.querySelectorAll("dialog")) d.close(); - } - }, "keybindListener"); - window.addEventListener("keydown", keybindListener); - } -}); -function dataURLToBlob(dataURL) { - const parts = dataURL.split(";base64,"); - const contentType = parts[0].split(":")[1]; - const byteString = atob(parts[1]); - const arrayBuffer = new ArrayBuffer(byteString.length); - const uint8Array = new Uint8Array(arrayBuffer); - for (let i = 0; i < byteString.length; i++) { - uint8Array[i] = byteString.charCodeAt(i); - } - return new Blob([arrayBuffer], { type: contentType }); -} -__name(dataURLToBlob, "dataURLToBlob"); -function loadedImageToBlob(image) { - const canvas = document.createElement("canvas"); - canvas.width = image.width; - canvas.height = image.height; - const ctx = canvas.getContext("2d"); - ctx.drawImage(image, 0, 0); - const dataURL = canvas.toDataURL("image/png", 1); - const blob = dataURLToBlob(dataURL); - return blob; -} -__name(loadedImageToBlob, "loadedImageToBlob"); -function loadImage(imagePath) { - return new Promise((resolve, reject) => { - const image = new Image(); - image.onload = function() { - resolve(image); - }; - image.src = imagePath; - }); -} -__name(loadImage, "loadImage"); -async function uploadMask(filepath, formData) { - await api.fetchApi("/upload/mask", { - method: "POST", - body: formData - }).then((response) => { - }).catch((error) => { - console.error("Error:", error); - }); - ComfyApp.clipspace.imgs[ComfyApp.clipspace["selectedIndex"]] = new Image(); - ComfyApp.clipspace.imgs[ComfyApp.clipspace["selectedIndex"]].src = api.apiURL( - "/view?" + new URLSearchParams(filepath).toString() + app.getPreviewFormatParam() + app.getRandParam() - ); - if (ComfyApp.clipspace.images) - ComfyApp.clipspace.images[ComfyApp.clipspace["selectedIndex"]] = filepath; - ClipspaceDialog.invalidatePreview(); -} -__name(uploadMask, "uploadMask"); -function prepare_mask(image, maskCanvas, maskCtx, maskColor) { - maskCtx.drawImage(image, 0, 0, maskCanvas.width, maskCanvas.height); - const maskData = maskCtx.getImageData( - 0, - 0, - maskCanvas.width, - maskCanvas.height - ); - for (let i = 0; i < maskData.data.length; i += 4) { - if (maskData.data[i + 3] == 255) maskData.data[i + 3] = 0; - else maskData.data[i + 3] = 255; - maskData.data[i] = maskColor.r; - maskData.data[i + 1] = maskColor.g; - maskData.data[i + 2] = maskColor.b; - } - maskCtx.globalCompositeOperation = "source-over"; - maskCtx.putImageData(maskData, 0, 0); -} -__name(prepare_mask, "prepare_mask"); -var PointerType = /* @__PURE__ */ ((PointerType2) => { - PointerType2["Arc"] = "arc"; - PointerType2["Rect"] = "rect"; - return PointerType2; -})(PointerType || {}); -var CompositionOperation$1 = /* @__PURE__ */ ((CompositionOperation2) => { - CompositionOperation2["SourceOver"] = "source-over"; - CompositionOperation2["DestinationOut"] = "destination-out"; - return CompositionOperation2; -})(CompositionOperation$1 || {}); -class MaskEditorDialogOld extends ComfyDialog { - static { - __name(this, "MaskEditorDialogOld"); - } - static instance = null; - static mousedown_x = null; - static mousedown_y = null; - brush; - maskCtx; - maskCanvas; - brush_size_slider; - brush_opacity_slider; - colorButton; - saveButton; - zoom_ratio; - pan_x; - pan_y; - imgCanvas; - last_display_style; - is_visible; - image; - handler_registered; - brush_slider_input; - cursorX; - cursorY; - mousedown_pan_x; - mousedown_pan_y; - last_pressure; - pointer_type; - brush_pointer_type_select; - static getInstance() { - if (!MaskEditorDialogOld.instance) { - MaskEditorDialogOld.instance = new MaskEditorDialogOld(); - } - return MaskEditorDialogOld.instance; - } - is_layout_created = false; - constructor() { - super(); - this.element = $el("div.comfy-modal", { parent: document.body }, [ - $el("div.comfy-modal-content", [...this.createButtons()]) - ]); - } - createButtons() { - return []; - } - createButton(name, callback) { - var button = document.createElement("button"); - button.style.pointerEvents = "auto"; - button.innerText = name; - button.addEventListener("click", callback); - return button; - } - createLeftButton(name, callback) { - var button = this.createButton(name, callback); - button.style.cssFloat = "left"; - button.style.marginRight = "4px"; - return button; - } - createRightButton(name, callback) { - var button = this.createButton(name, callback); - button.style.cssFloat = "right"; - button.style.marginLeft = "4px"; - return button; - } - createLeftSlider(self2, name, callback) { - const divElement = document.createElement("div"); - divElement.id = "maskeditor-slider"; - divElement.style.cssFloat = "left"; - divElement.style.fontFamily = "sans-serif"; - divElement.style.marginRight = "4px"; - divElement.style.color = "var(--input-text)"; - divElement.style.backgroundColor = "var(--comfy-input-bg)"; - divElement.style.borderRadius = "8px"; - divElement.style.borderColor = "var(--border-color)"; - divElement.style.borderStyle = "solid"; - divElement.style.fontSize = "15px"; - divElement.style.height = "25px"; - divElement.style.padding = "1px 6px"; - divElement.style.display = "flex"; - divElement.style.position = "relative"; - divElement.style.top = "2px"; - divElement.style.pointerEvents = "auto"; - self2.brush_slider_input = document.createElement("input"); - self2.brush_slider_input.setAttribute("type", "range"); - self2.brush_slider_input.setAttribute("min", "1"); - self2.brush_slider_input.setAttribute("max", "100"); - self2.brush_slider_input.setAttribute("value", "10"); - const labelElement = document.createElement("label"); - labelElement.textContent = name; - divElement.appendChild(labelElement); - divElement.appendChild(self2.brush_slider_input); - self2.brush_slider_input.addEventListener("change", callback); - return divElement; - } - createOpacitySlider(self2, name, callback) { - const divElement = document.createElement("div"); - divElement.id = "maskeditor-opacity-slider"; - divElement.style.cssFloat = "left"; - divElement.style.fontFamily = "sans-serif"; - divElement.style.marginRight = "4px"; - divElement.style.color = "var(--input-text)"; - divElement.style.backgroundColor = "var(--comfy-input-bg)"; - divElement.style.borderRadius = "8px"; - divElement.style.borderColor = "var(--border-color)"; - divElement.style.borderStyle = "solid"; - divElement.style.fontSize = "15px"; - divElement.style.height = "25px"; - divElement.style.padding = "1px 6px"; - divElement.style.display = "flex"; - divElement.style.position = "relative"; - divElement.style.top = "2px"; - divElement.style.pointerEvents = "auto"; - self2.opacity_slider_input = document.createElement("input"); - self2.opacity_slider_input.setAttribute("type", "range"); - self2.opacity_slider_input.setAttribute("min", "0.1"); - self2.opacity_slider_input.setAttribute("max", "1.0"); - self2.opacity_slider_input.setAttribute("step", "0.01"); - self2.opacity_slider_input.setAttribute("value", "0.7"); - const labelElement = document.createElement("label"); - labelElement.textContent = name; - divElement.appendChild(labelElement); - divElement.appendChild(self2.opacity_slider_input); - self2.opacity_slider_input.addEventListener("input", callback); - return divElement; - } - createPointerTypeSelect(self2) { - const divElement = document.createElement("div"); - divElement.id = "maskeditor-pointer-type"; - divElement.style.cssFloat = "left"; - divElement.style.fontFamily = "sans-serif"; - divElement.style.marginRight = "4px"; - divElement.style.color = "var(--input-text)"; - divElement.style.backgroundColor = "var(--comfy-input-bg)"; - divElement.style.borderRadius = "8px"; - divElement.style.borderColor = "var(--border-color)"; - divElement.style.borderStyle = "solid"; - divElement.style.fontSize = "15px"; - divElement.style.height = "25px"; - divElement.style.padding = "1px 6px"; - divElement.style.display = "flex"; - divElement.style.position = "relative"; - divElement.style.top = "2px"; - divElement.style.pointerEvents = "auto"; - const labelElement = document.createElement("label"); - labelElement.textContent = "Pointer Type:"; - const selectElement = document.createElement("select"); - selectElement.style.borderRadius = "0"; - selectElement.style.borderColor = "transparent"; - selectElement.style.borderStyle = "unset"; - selectElement.style.fontSize = "0.9em"; - const optionArc = document.createElement("option"); - optionArc.value = "arc"; - optionArc.text = "Circle"; - optionArc.selected = true; - const optionRect = document.createElement("option"); - optionRect.value = "rect"; - optionRect.text = "Square"; - selectElement.appendChild(optionArc); - selectElement.appendChild(optionRect); - selectElement.addEventListener("change", (event) => { - const target = event.target; - self2.pointer_type = target.value; - this.setBrushBorderRadius(self2); - }); - divElement.appendChild(labelElement); - divElement.appendChild(selectElement); - return divElement; - } - setBrushBorderRadius(self2) { - if (self2.pointer_type === "rect") { - this.brush.style.borderRadius = "0%"; - this.brush.style.MozBorderRadius = "0%"; - this.brush.style.WebkitBorderRadius = "0%"; - } else { - this.brush.style.borderRadius = "50%"; - this.brush.style.MozBorderRadius = "50%"; - this.brush.style.WebkitBorderRadius = "50%"; - } - } - setlayout(imgCanvas, maskCanvas) { - const self2 = this; - self2.pointer_type = "arc"; - var bottom_panel = document.createElement("div"); - bottom_panel.style.position = "absolute"; - bottom_panel.style.bottom = "0px"; - bottom_panel.style.left = "20px"; - bottom_panel.style.right = "20px"; - bottom_panel.style.height = "50px"; - bottom_panel.style.pointerEvents = "none"; - var brush = document.createElement("div"); - brush.id = "brush"; - brush.style.backgroundColor = "transparent"; - brush.style.outline = "1px dashed black"; - brush.style.boxShadow = "0 0 0 1px white"; - brush.style.position = "absolute"; - brush.style.zIndex = "8889"; - brush.style.pointerEvents = "none"; - this.brush = brush; - this.setBrushBorderRadius(self2); - this.element.appendChild(imgCanvas); - this.element.appendChild(maskCanvas); - this.element.appendChild(bottom_panel); - document.body.appendChild(brush); - var clearButton = this.createLeftButton("Clear", () => { - self2.maskCtx.clearRect( - 0, - 0, - self2.maskCanvas.width, - self2.maskCanvas.height - ); - }); - this.brush_size_slider = this.createLeftSlider( - self2, - "Thickness", - (event) => { - self2.brush_size = event.target.value; - self2.updateBrushPreview(self2); - } - ); - this.brush_opacity_slider = this.createOpacitySlider( - self2, - "Opacity", - (event) => { - self2.brush_opacity = event.target.value; - if (self2.brush_color_mode !== "negative") { - self2.maskCanvas.style.opacity = self2.brush_opacity.toString(); - } - } - ); - this.brush_pointer_type_select = this.createPointerTypeSelect(self2); - this.colorButton = this.createLeftButton(this.getColorButtonText(), () => { - if (self2.brush_color_mode === "black") { - self2.brush_color_mode = "white"; - } else if (self2.brush_color_mode === "white") { - self2.brush_color_mode = "negative"; - } else { - self2.brush_color_mode = "black"; - } - self2.updateWhenBrushColorModeChanged(); - }); - var cancelButton = this.createRightButton("Cancel", () => { - document.removeEventListener("keydown", MaskEditorDialogOld.handleKeyDown); - self2.close(); - }); - this.saveButton = this.createRightButton("Save", () => { - document.removeEventListener("keydown", MaskEditorDialogOld.handleKeyDown); - self2.save(); - }); - this.element.appendChild(imgCanvas); - this.element.appendChild(maskCanvas); - this.element.appendChild(bottom_panel); - bottom_panel.appendChild(clearButton); - bottom_panel.appendChild(this.saveButton); - bottom_panel.appendChild(cancelButton); - bottom_panel.appendChild(this.brush_size_slider); - bottom_panel.appendChild(this.brush_opacity_slider); - bottom_panel.appendChild(this.brush_pointer_type_select); - bottom_panel.appendChild(this.colorButton); - imgCanvas.style.position = "absolute"; - maskCanvas.style.position = "absolute"; - imgCanvas.style.top = "200"; - imgCanvas.style.left = "0"; - maskCanvas.style.top = imgCanvas.style.top; - maskCanvas.style.left = imgCanvas.style.left; - const maskCanvasStyle = this.getMaskCanvasStyle(); - maskCanvas.style.mixBlendMode = maskCanvasStyle.mixBlendMode; - maskCanvas.style.opacity = maskCanvasStyle.opacity.toString(); - } - async show() { - this.zoom_ratio = 1; - this.pan_x = 0; - this.pan_y = 0; - if (!this.is_layout_created) { - const imgCanvas = document.createElement("canvas"); - const maskCanvas = document.createElement("canvas"); - imgCanvas.id = "imageCanvas"; - maskCanvas.id = "maskCanvas"; - this.setlayout(imgCanvas, maskCanvas); - this.imgCanvas = imgCanvas; - this.maskCanvas = maskCanvas; - this.maskCtx = maskCanvas.getContext("2d", { willReadFrequently: true }); - this.setEventHandler(maskCanvas); - this.is_layout_created = true; - const self2 = this; - const observer = new MutationObserver(function(mutations) { - mutations.forEach(function(mutation) { - if (mutation.type === "attributes" && mutation.attributeName === "style") { - if (self2.last_display_style && self2.last_display_style != "none" && self2.element.style.display == "none") { - self2.brush.style.display = "none"; - ComfyApp.onClipspaceEditorClosed(); - } - self2.last_display_style = self2.element.style.display; - } - }); - }); - const config = { attributes: true }; - observer.observe(this.element, config); - } - document.addEventListener("keydown", MaskEditorDialogOld.handleKeyDown); - if (ComfyApp.clipspace_return_node) { - this.saveButton.innerText = "Save to node"; - } else { - this.saveButton.innerText = "Save"; - } - this.saveButton.disabled = false; - this.element.style.display = "block"; - this.element.style.width = "85%"; - this.element.style.margin = "0 7.5%"; - this.element.style.height = "100vh"; - this.element.style.top = "50%"; - this.element.style.left = "42%"; - this.element.style.zIndex = "8888"; - await this.setImages(this.imgCanvas); - this.is_visible = true; - } - isOpened() { - return this.element.style.display == "block"; - } - invalidateCanvas(orig_image, mask_image) { - this.imgCanvas.width = orig_image.width; - this.imgCanvas.height = orig_image.height; - this.maskCanvas.width = orig_image.width; - this.maskCanvas.height = orig_image.height; - let imgCtx = this.imgCanvas.getContext("2d", { willReadFrequently: true }); - let maskCtx = this.maskCanvas.getContext("2d", { - willReadFrequently: true - }); - imgCtx.drawImage(orig_image, 0, 0, orig_image.width, orig_image.height); - prepare_mask(mask_image, this.maskCanvas, maskCtx, this.getMaskColor()); - } - async setImages(imgCanvas) { - let self2 = this; - const imgCtx = imgCanvas.getContext("2d", { willReadFrequently: true }); - const maskCtx = this.maskCtx; - const maskCanvas = this.maskCanvas; - imgCtx.clearRect(0, 0, this.imgCanvas.width, this.imgCanvas.height); - maskCtx.clearRect(0, 0, this.maskCanvas.width, this.maskCanvas.height); - const filepath = ComfyApp.clipspace.images; - const alpha_url = new URL( - ComfyApp.clipspace.imgs[ComfyApp.clipspace["selectedIndex"]].src - ); - alpha_url.searchParams.delete("channel"); - alpha_url.searchParams.delete("preview"); - alpha_url.searchParams.set("channel", "a"); - let mask_image = await loadImage(alpha_url); - const rgb_url = new URL( - ComfyApp.clipspace.imgs[ComfyApp.clipspace["selectedIndex"]].src - ); - rgb_url.searchParams.delete("channel"); - rgb_url.searchParams.set("channel", "rgb"); - this.image = new Image(); - this.image.onload = function() { - maskCanvas.width = self2.image.width; - maskCanvas.height = self2.image.height; - self2.invalidateCanvas(self2.image, mask_image); - self2.initializeCanvasPanZoom(); - }; - this.image.src = rgb_url.toString(); - } - initializeCanvasPanZoom() { - let drawWidth = this.image.width; - let drawHeight = this.image.height; - let width = this.element.clientWidth; - let height = this.element.clientHeight; - if (this.image.width > width) { - drawWidth = width; - drawHeight = drawWidth / this.image.width * this.image.height; - } - if (drawHeight > height) { - drawHeight = height; - drawWidth = drawHeight / this.image.height * this.image.width; - } - this.zoom_ratio = drawWidth / this.image.width; - const canvasX = (width - drawWidth) / 2; - const canvasY = (height - drawHeight) / 2; - this.pan_x = canvasX; - this.pan_y = canvasY; - this.invalidatePanZoom(); - } - invalidatePanZoom() { - let raw_width = this.image.width * this.zoom_ratio; - let raw_height = this.image.height * this.zoom_ratio; - if (this.pan_x + raw_width < 10) { - this.pan_x = 10 - raw_width; - } - if (this.pan_y + raw_height < 10) { - this.pan_y = 10 - raw_height; - } - let width = `${raw_width}px`; - let height = `${raw_height}px`; - let left = `${this.pan_x}px`; - let top = `${this.pan_y}px`; - this.maskCanvas.style.width = width; - this.maskCanvas.style.height = height; - this.maskCanvas.style.left = left; - this.maskCanvas.style.top = top; - this.imgCanvas.style.width = width; - this.imgCanvas.style.height = height; - this.imgCanvas.style.left = left; - this.imgCanvas.style.top = top; - } - setEventHandler(maskCanvas) { - const self2 = this; - if (!this.handler_registered) { - maskCanvas.addEventListener("contextmenu", (event) => { - event.preventDefault(); - }); - this.element.addEventListener( - "wheel", - (event) => this.handleWheelEvent(self2, event) - ); - this.element.addEventListener( - "pointermove", - (event) => this.pointMoveEvent(self2, event) - ); - this.element.addEventListener( - "touchmove", - (event) => this.pointMoveEvent(self2, event) - ); - this.element.addEventListener("dragstart", (event) => { - if (event.ctrlKey) { - event.preventDefault(); - } - }); - maskCanvas.addEventListener( - "pointerdown", - (event) => this.handlePointerDown(self2, event) - ); - maskCanvas.addEventListener( - "pointermove", - (event) => this.draw_move(self2, event) - ); - maskCanvas.addEventListener( - "touchmove", - (event) => this.draw_move(self2, event) - ); - maskCanvas.addEventListener("pointerover", (event) => { - this.brush.style.display = "block"; - }); - maskCanvas.addEventListener("pointerleave", (event) => { - this.brush.style.display = "none"; - }); - document.addEventListener( - "pointerup", - MaskEditorDialogOld.handlePointerUp - ); - this.handler_registered = true; - } - } - getMaskCanvasStyle() { - if (this.brush_color_mode === "negative") { - return { - mixBlendMode: "difference", - opacity: "1" - }; - } else { - return { - mixBlendMode: "initial", - opacity: this.brush_opacity - }; - } - } - getMaskColor() { - if (this.brush_color_mode === "black") { - return { r: 0, g: 0, b: 0 }; - } - if (this.brush_color_mode === "white") { - return { r: 255, g: 255, b: 255 }; - } - if (this.brush_color_mode === "negative") { - return { r: 255, g: 255, b: 255 }; - } - return { r: 0, g: 0, b: 0 }; - } - getMaskFillStyle() { - const maskColor = this.getMaskColor(); - return "rgb(" + maskColor.r + "," + maskColor.g + "," + maskColor.b + ")"; - } - getColorButtonText() { - let colorCaption = "unknown"; - if (this.brush_color_mode === "black") { - colorCaption = "black"; - } else if (this.brush_color_mode === "white") { - colorCaption = "white"; - } else if (this.brush_color_mode === "negative") { - colorCaption = "negative"; - } - return "Color: " + colorCaption; - } - updateWhenBrushColorModeChanged() { - this.colorButton.innerText = this.getColorButtonText(); - const maskCanvasStyle = this.getMaskCanvasStyle(); - this.maskCanvas.style.mixBlendMode = maskCanvasStyle.mixBlendMode; - this.maskCanvas.style.opacity = maskCanvasStyle.opacity.toString(); - const maskColor = this.getMaskColor(); - const maskData = this.maskCtx.getImageData( - 0, - 0, - this.maskCanvas.width, - this.maskCanvas.height - ); - for (let i = 0; i < maskData.data.length; i += 4) { - maskData.data[i] = maskColor.r; - maskData.data[i + 1] = maskColor.g; - maskData.data[i + 2] = maskColor.b; - } - this.maskCtx.putImageData(maskData, 0, 0); - } - brush_opacity = 0.7; - brush_size = 10; - brush_color_mode = "black"; - drawing_mode = false; - lastx = -1; - lasty = -1; - lasttime = 0; - static handleKeyDown(event) { - const self2 = MaskEditorDialogOld.instance; - if (event.key === "]") { - self2.brush_size = Math.min(self2.brush_size + 2, 100); - self2.brush_slider_input.value = self2.brush_size; - } else if (event.key === "[") { - self2.brush_size = Math.max(self2.brush_size - 2, 1); - self2.brush_slider_input.value = self2.brush_size; - } else if (event.key === "Enter") { - self2.save(); - } - self2.updateBrushPreview(self2); - } - static handlePointerUp(event) { - event.preventDefault(); - this.mousedown_x = null; - this.mousedown_y = null; - MaskEditorDialogOld.instance.drawing_mode = false; - } - updateBrushPreview(self2) { - const brush = self2.brush; - var centerX = self2.cursorX; - var centerY = self2.cursorY; - brush.style.width = self2.brush_size * 2 * this.zoom_ratio + "px"; - brush.style.height = self2.brush_size * 2 * this.zoom_ratio + "px"; - brush.style.left = centerX - self2.brush_size * this.zoom_ratio + "px"; - brush.style.top = centerY - self2.brush_size * this.zoom_ratio + "px"; - } - handleWheelEvent(self2, event) { - event.preventDefault(); - if (event.ctrlKey) { - if (event.deltaY < 0) { - this.zoom_ratio = Math.min(10, this.zoom_ratio + 0.2); - } else { - this.zoom_ratio = Math.max(0.2, this.zoom_ratio - 0.2); - } - this.invalidatePanZoom(); - } else { - if (event.deltaY < 0) this.brush_size = Math.min(this.brush_size + 2, 100); - else this.brush_size = Math.max(this.brush_size - 2, 1); - this.brush_slider_input.value = this.brush_size.toString(); - this.updateBrushPreview(this); - } - } - pointMoveEvent(self2, event) { - this.cursorX = event.pageX; - this.cursorY = event.pageY; - self2.updateBrushPreview(self2); - if (event.ctrlKey) { - event.preventDefault(); - self2.pan_move(self2, event); - } - let left_button_down = window.TouchEvent && event instanceof TouchEvent || event.buttons == 1; - if (event.shiftKey && left_button_down) { - self2.drawing_mode = false; - const y = event.clientY; - let delta = (self2.zoom_lasty - y) * 5e-3; - self2.zoom_ratio = Math.max( - Math.min(10, self2.last_zoom_ratio - delta), - 0.2 - ); - this.invalidatePanZoom(); - return; - } - } - pan_move(self2, event) { - if (event.buttons == 1) { - if (MaskEditorDialogOld.mousedown_x) { - let deltaX = MaskEditorDialogOld.mousedown_x - event.clientX; - let deltaY = MaskEditorDialogOld.mousedown_y - event.clientY; - self2.pan_x = this.mousedown_pan_x - deltaX; - self2.pan_y = this.mousedown_pan_y - deltaY; - self2.invalidatePanZoom(); - } - } - } - draw_move(self2, event) { - if (event.ctrlKey || event.shiftKey) { - return; - } - event.preventDefault(); - this.cursorX = event.pageX; - this.cursorY = event.pageY; - self2.updateBrushPreview(self2); - let left_button_down = window.TouchEvent && event instanceof TouchEvent || event.buttons == 1; - let right_button_down = [2, 5, 32].includes(event.buttons); - if (!event.altKey && left_button_down) { - var diff = performance.now() - self2.lasttime; - const maskRect = self2.maskCanvas.getBoundingClientRect(); - var x = event.offsetX; - var y = event.offsetY; - if (event.offsetX == null) { - x = event.targetTouches[0].clientX - maskRect.left; - } - if (event.offsetY == null) { - y = event.targetTouches[0].clientY - maskRect.top; - } - x /= self2.zoom_ratio; - y /= self2.zoom_ratio; - var brush_size = this.brush_size; - if (event instanceof PointerEvent && event.pointerType == "pen") { - brush_size *= event.pressure; - this.last_pressure = event.pressure; - } else if (window.TouchEvent && event instanceof TouchEvent && diff < 20) { - brush_size *= this.last_pressure; - } else { - brush_size = this.brush_size; - } - if (diff > 20 && !this.drawing_mode) - requestAnimationFrame(() => { - self2.init_shape( - self2, - "source-over" - /* SourceOver */ - ); - self2.draw_shape(self2, x, y, brush_size); - self2.lastx = x; - self2.lasty = y; - }); - else - requestAnimationFrame(() => { - self2.init_shape( - self2, - "source-over" - /* SourceOver */ - ); - var dx = x - self2.lastx; - var dy = y - self2.lasty; - var distance = Math.sqrt(dx * dx + dy * dy); - var directionX = dx / distance; - var directionY = dy / distance; - for (var i = 0; i < distance; i += 5) { - var px2 = self2.lastx + directionX * i; - var py2 = self2.lasty + directionY * i; - self2.draw_shape(self2, px2, py2, brush_size); - } - self2.lastx = x; - self2.lasty = y; - }); - self2.lasttime = performance.now(); - } else if (event.altKey && left_button_down || right_button_down) { - const maskRect = self2.maskCanvas.getBoundingClientRect(); - const x2 = (event.offsetX || event.targetTouches[0].clientX - maskRect.left) / self2.zoom_ratio; - const y2 = (event.offsetY || event.targetTouches[0].clientY - maskRect.top) / self2.zoom_ratio; - var brush_size = this.brush_size; - if (event instanceof PointerEvent && event.pointerType == "pen") { - brush_size *= event.pressure; - this.last_pressure = event.pressure; - } else if (window.TouchEvent && event instanceof TouchEvent && diff < 20) { - brush_size *= this.last_pressure; - } else { - brush_size = this.brush_size; - } - if (diff > 20 && !this.drawing_mode) - requestAnimationFrame(() => { - self2.init_shape( - self2, - "destination-out" - /* DestinationOut */ - ); - self2.draw_shape(self2, x2, y2, brush_size); - self2.lastx = x2; - self2.lasty = y2; - }); - else - requestAnimationFrame(() => { - self2.init_shape( - self2, - "destination-out" - /* DestinationOut */ - ); - var dx = x2 - self2.lastx; - var dy = y2 - self2.lasty; - var distance = Math.sqrt(dx * dx + dy * dy); - var directionX = dx / distance; - var directionY = dy / distance; - for (var i = 0; i < distance; i += 5) { - var px2 = self2.lastx + directionX * i; - var py2 = self2.lasty + directionY * i; - self2.draw_shape(self2, px2, py2, brush_size); - } - self2.lastx = x2; - self2.lasty = y2; - }); - self2.lasttime = performance.now(); - } - } - handlePointerDown(self2, event) { - if (event.ctrlKey) { - if (event.buttons == 1) { - MaskEditorDialogOld.mousedown_x = event.clientX; - MaskEditorDialogOld.mousedown_y = event.clientY; - this.mousedown_pan_x = this.pan_x; - this.mousedown_pan_y = this.pan_y; - } - return; - } - var brush_size = this.brush_size; - if (event instanceof PointerEvent && event.pointerType == "pen") { - brush_size *= event.pressure; - this.last_pressure = event.pressure; - } - if ([0, 2, 5].includes(event.button)) { - self2.drawing_mode = true; - event.preventDefault(); - if (event.shiftKey) { - self2.zoom_lasty = event.clientY; - self2.last_zoom_ratio = self2.zoom_ratio; - return; - } - const maskRect = self2.maskCanvas.getBoundingClientRect(); - const x = (event.offsetX || event.targetTouches[0].clientX - maskRect.left) / self2.zoom_ratio; - const y = (event.offsetY || event.targetTouches[0].clientY - maskRect.top) / self2.zoom_ratio; - if (!event.altKey && event.button == 0) { - self2.init_shape( - self2, - "source-over" - /* SourceOver */ - ); - } else { - self2.init_shape( - self2, - "destination-out" - /* DestinationOut */ - ); - } - self2.draw_shape(self2, x, y, brush_size); - self2.lastx = x; - self2.lasty = y; - self2.lasttime = performance.now(); - } - } - init_shape(self2, compositionOperation) { - self2.maskCtx.beginPath(); - if (compositionOperation == "source-over") { - self2.maskCtx.fillStyle = this.getMaskFillStyle(); - self2.maskCtx.globalCompositeOperation = "source-over"; - } else if (compositionOperation == "destination-out") { - self2.maskCtx.globalCompositeOperation = "destination-out"; - } - } - draw_shape(self2, x, y, brush_size) { - if (self2.pointer_type === "rect") { - self2.maskCtx.rect( - x - brush_size, - y - brush_size, - brush_size * 2, - brush_size * 2 - ); - } else { - self2.maskCtx.arc(x, y, brush_size, 0, Math.PI * 2, false); - } - self2.maskCtx.fill(); - } - async save() { - const backupCanvas = document.createElement("canvas"); - const backupCtx = backupCanvas.getContext("2d", { - willReadFrequently: true - }); - backupCanvas.width = this.image.width; - backupCanvas.height = this.image.height; - backupCtx.clearRect(0, 0, backupCanvas.width, backupCanvas.height); - backupCtx.drawImage( - this.maskCanvas, - 0, - 0, - this.maskCanvas.width, - this.maskCanvas.height, - 0, - 0, - backupCanvas.width, - backupCanvas.height - ); - const backupData = backupCtx.getImageData( - 0, - 0, - backupCanvas.width, - backupCanvas.height - ); - for (let i = 0; i < backupData.data.length; i += 4) { - if (backupData.data[i + 3] == 255) backupData.data[i + 3] = 0; - else backupData.data[i + 3] = 255; - backupData.data[i] = 0; - backupData.data[i + 1] = 0; - backupData.data[i + 2] = 0; - } - backupCtx.globalCompositeOperation = "source-over"; - backupCtx.putImageData(backupData, 0, 0); - const formData = new FormData(); - const filename = "clipspace-mask-" + performance.now() + ".png"; - const item = { - filename, - subfolder: "clipspace", - type: "input" - }; - if (ComfyApp.clipspace.images) ComfyApp.clipspace.images[0] = item; - if (ComfyApp.clipspace.widgets) { - const index = ComfyApp.clipspace.widgets.findIndex( - (obj) => obj.name === "image" - ); - if (index >= 0) ComfyApp.clipspace.widgets[index].value = item; - } - const dataURL = backupCanvas.toDataURL(); - const blob = dataURLToBlob(dataURL); - let original_url = new URL(this.image.src); - const original_ref = { - filename: original_url.searchParams.get("filename") - }; - let original_subfolder = original_url.searchParams.get("subfolder"); - if (original_subfolder) original_ref.subfolder = original_subfolder; - let original_type = original_url.searchParams.get("type"); - if (original_type) original_ref.type = original_type; - formData.append("image", blob, filename); - formData.append("original_ref", JSON.stringify(original_ref)); - formData.append("type", "input"); - formData.append("subfolder", "clipspace"); - this.saveButton.innerText = "Saving..."; - this.saveButton.disabled = true; - await uploadMask(item, formData); - ComfyApp.onClipspaceEditorSave(); - this.close(); - } -} -window.comfyAPI = window.comfyAPI || {}; -window.comfyAPI.maskEditorOld = window.comfyAPI.maskEditorOld || {}; -window.comfyAPI.maskEditorOld.MaskEditorDialogOld = MaskEditorDialogOld; -var styles = ` - #maskEditorContainer { - display: fixed; - } - #maskEditor_brush { - position: absolute; - backgroundColor: transparent; - z-index: 8889; - pointer-events: none; - border-radius: 50%; - overflow: visible; - outline: 1px dashed black; - box-shadow: 0 0 0 1px white; - } - #maskEditor_brushPreviewGradient { - position: absolute; - width: 100%; - height: 100%; - border-radius: 50%; - display: none; - } - #maskEditor { - display: block; - width: 100%; - height: 100vh; - left: 0; - z-index: 8888; - position: fixed; - background: rgba(50,50,50,0.75); - backdrop-filter: blur(10px); - overflow: hidden; - user-select: none; - } - #maskEditor_sidePanelContainer { - height: 100%; - width: 220px; - z-index: 8888; - display: flex; - flex-direction: column; - } - #maskEditor_sidePanel { - background: var(--comfy-menu-bg); - height: 100%; - display: flex; - align-items: center; - overflow-y: hidden; - width: 220px; - } - #maskEditor_sidePanelShortcuts { - display: flex; - flex-direction: row; - width: 200px; - margin-top: 10px; - gap: 10px; - justify-content: center; - } - .maskEditor_sidePanelIconButton { - width: 40px; - height: 40px; - pointer-events: auto; - display: flex; - justify-content: center; - align-items: center; - transition: background-color 0.1s; - } - .maskEditor_sidePanelIconButton:hover { - background-color: rgba(0, 0, 0, 0.2); - } - #maskEditor_sidePanelBrushSettings { - display: flex; - flex-direction: column; - gap: 10px; - width: 200px; - padding: 10px; - } - .maskEditor_sidePanelTitle { - text-align: center; - font-size: 15px; - font-family: sans-serif; - color: var(--descrip-text); - margin-top: 10px; - } - #maskEditor_sidePanelBrushShapeContainer { - display: flex; - width: 180px; - height: 50px; - border: 1px solid var(--border-color); - pointer-events: auto; - background: rgba(0, 0, 0, 0.2); - } - #maskEditor_sidePanelBrushShapeCircle { - width: 35px; - height: 35px; - border-radius: 50%; - border: 1px solid var(--border-color); - pointer-events: auto; - transition: background 0.1s; - margin-left: 7.5px; - } - .maskEditor_sidePanelBrushRange { - width: 180px; - -webkit-appearance: none; - appearance: none; - background: transparent; - cursor: pointer; - } - .maskEditor_sidePanelBrushRange::-webkit-slider-thumb { - height: 20px; - width: 20px; - border-radius: 50%; - cursor: grab; - margin-top: -8px; - background: var(--p-surface-700); - border: 1px solid var(--border-color); - } - .maskEditor_sidePanelBrushRange::-moz-range-thumb { - height: 20px; - width: 20px; - border-radius: 50%; - cursor: grab; - background: var(--p-surface-800); - border: 1px solid var(--border-color); - } - .maskEditor_sidePanelBrushRange::-webkit-slider-runnable-track { - background: var(--p-surface-700); - height: 3px; - } - .maskEditor_sidePanelBrushRange::-moz-range-track { - background: var(--p-surface-700); - height: 3px; - } - - #maskEditor_sidePanelBrushShapeSquare { - width: 35px; - height: 35px; - margin: 5px; - border: 1px solid var(--border-color); - pointer-events: auto; - transition: background 0.1s; - } - - .maskEditor_brushShape_dark { - background: transparent; - } - - .maskEditor_brushShape_dark:hover { - background: var(--p-surface-900); - } - - .maskEditor_brushShape_light { - background: transparent; - } - - .maskEditor_brushShape_light:hover { - background: var(--comfy-menu-bg); - } - - #maskEditor_sidePanelImageLayerSettings { - display: flex; - flex-direction: column; - gap: 10px; - width: 200px; - align-items: center; - } - .maskEditor_sidePanelLayer { - display: flex; - width: 200px; - height: 50px; - } - .maskEditor_sidePanelLayerVisibilityContainer { - width: 50px; - height: 50px; - border-radius: 8px; - display: flex; - justify-content: center; - align-items: center; - } - .maskEditor_sidePanelVisibilityToggle { - width: 12px; - height: 12px; - border-radius: 50%; - pointer-events: auto; - } - .maskEditor_sidePanelLayerIconContainer { - width: 60px; - height: 50px; - border-radius: 8px; - display: flex; - justify-content: center; - align-items: center; - fill: var(--input-text); - } - .maskEditor_sidePanelLayerIconContainer svg { - width: 30px; - height: 30px; - } - #maskEditor_sidePanelMaskLayerBlendingContainer { - width: 80px; - height: 50px; - border-radius: 8px; - display: flex; - justify-content: center; - align-items: center; - } - #maskEditor_sidePanelMaskLayerBlendingSelect { - width: 80px; - height: 30px; - border: 1px solid var(--border-color); - background-color: rgba(0, 0, 0, 0.2); - color: var(--input-text); - font-family: sans-serif; - font-size: 15px; - pointer-events: auto; - transition: background-color border 0.1s; - } - #maskEditor_sidePanelClearCanvasButton:hover { - background-color: var(--p-overlaybadge-outline-color); - border: none; - } - #maskEditor_sidePanelClearCanvasButton { - width: 180px; - height: 30px; - border: none; - background: rgba(0, 0, 0, 0.2); - border: 1px solid var(--border-color); - color: var(--input-text); - font-family: sans-serif; - font-size: 15px; - pointer-events: auto; - transition: background-color 0.1s; - } - #maskEditor_sidePanelClearCanvasButton:hover { - background-color: var(--p-overlaybadge-outline-color); - } - #maskEditor_sidePanelHorizontalButtonContainer { - display: flex; - gap: 10px; - height: 40px; - } - .maskEditor_sidePanelBigButton { - width: 85px; - height: 30px; - border: none; - background: rgba(0, 0, 0, 0.2); - border: 1px solid var(--border-color); - color: var(--input-text); - font-family: sans-serif; - font-size: 15px; - pointer-events: auto; - transition: background-color border 0.1s; - } - .maskEditor_sidePanelBigButton:hover { - background-color: var(--p-overlaybadge-outline-color); - border: none; - } - #maskEditor_toolPanel { - height: 100%; - width: var(--sidebar-width); - z-index: 8888; - background: var(--comfy-menu-bg); - display: flex; - flex-direction: column; - } - .maskEditor_toolPanelContainer { - width: var(--sidebar-width); - height: var(--sidebar-width); - display: flex; - justify-content: center; - align-items: center; - position: relative; - transition: background-color 0.2s; - } - .maskEditor_toolPanelContainerSelected svg { - fill: var(--p-button-text-primary-color) !important; - } - .maskEditor_toolPanelContainerSelected .maskEditor_toolPanelIndicator { - display: block; - } - .maskEditor_toolPanelContainer svg { - width: 75%; - aspect-ratio: 1/1; - fill: var(--p-button-text-secondary-color); - } - - .maskEditor_toolPanelContainerDark:hover { - background-color: var(--p-surface-800); - } - - .maskEditor_toolPanelContainerLight:hover { - background-color: var(--p-surface-300); - } - - .maskEditor_toolPanelIndicator { - display: none; - height: 100%; - width: 4px; - position: absolute; - left: 0; - background: var(--p-button-text-primary-color); - } - #maskEditor_sidePanelPaintBucketSettings { - display: flex; - flex-direction: column; - gap: 10px; - width: 200px; - padding: 10px; - } - #canvasBackground { - background: white; - width: 100%; - height: 100%; - } - #maskEditor_sidePanelButtonsContainer { - display: flex; - flex-direction: column; - gap: 10px; - margin-top: 10px; - } - .maskEditor_sidePanelSeparator { - width: 200px; - height: 2px; - background: var(--border-color); - margin-top: 5px; - margin-bottom: 5px; - } - #maskEditor_pointerZone { - width: calc(100% - var(--sidebar-width) - 220px); - height: 100%; - } - #maskEditor_uiContainer { - width: 100%; - height: 100%; - position: absolute; - z-index: 8888; - display: flex; - flex-direction: column; - } - #maskEditorCanvasContainer { - position: absolute; - width: 1000px; - height: 667px; - left: 359px; - top: 280px; - } - #imageCanvas { - width: 100%; - height: 100%; - } - #maskCanvas { - width: 100%; - height: 100%; - } - #maskEditor_uiHorizontalContainer { - width: 100%; - height: 100%; - display: flex; - } - #maskEditor_topBar { - display: flex; - height: 44px; - align-items: center; - background: var(--comfy-menu-bg); - } - #maskEditor_topBarTitle { - margin: 0; - margin-left: 0.5rem; - margin-right: 0.5rem; - font-size: 1.2em; - } - #maskEditor_topBarButtonContainer { - display: flex; - gap: 10px; - margin-right: 0.5rem; - position: absolute; - right: 0; - width: 200px; - } - #maskEditor_topBarShortcutsContainer { - display: flex; - gap: 10px; - margin-left: 5px; - } - - .maskEditor_topPanelIconButton_dark { - width: 50px; - height: 30px; - pointer-events: auto; - display: flex; - justify-content: center; - align-items: center; - transition: background-color 0.1s; - background: var(--p-surface-800); - border: 1px solid var(--p-form-field-border-color); - border-radius: 10px; - } - - .maskEditor_topPanelIconButton_dark:hover { - background-color: var(--p-surface-900); - } - - .maskEditor_topPanelIconButton_dark svg { - width: 25px; - height: 25px; - pointer-events: none; - fill: var(--input-text); - } - - .maskEditor_topPanelIconButton_light { - width: 50px; - height: 30px; - pointer-events: auto; - display: flex; - justify-content: center; - align-items: center; - transition: background-color 0.1s; - background: var(--comfy-menu-bg); - border: 1px solid var(--p-form-field-border-color); - border-radius: 10px; - } - - .maskEditor_topPanelIconButton_light:hover { - background-color: var(--p-surface-300); - } - - .maskEditor_topPanelIconButton_light svg { - width: 25px; - height: 25px; - pointer-events: none; - fill: var(--input-text); - } - - .maskEditor_topPanelButton_dark { - height: 30px; - background: var(--p-surface-800); - border: 1px solid var(--p-form-field-border-color); - border-radius: 10px; - color: var(--input-text); - font-family: sans-serif; - pointer-events: auto; - transition: 0.1s; - width: 60px; - } - - .maskEditor_topPanelButton_dark:hover { - background-color: var(--p-surface-900); - } - - .maskEditor_topPanelButton_light { - height: 30px; - background: var(--comfy-menu-bg); - border: 1px solid var(--p-form-field-border-color); - border-radius: 10px; - color: var(--input-text); - font-family: sans-serif; - pointer-events: auto; - transition: 0.1s; - width: 60px; - } - - .maskEditor_topPanelButton_light:hover { - background-color: var(--p-surface-300); - } - - - #maskEditor_sidePanelColorSelectSettings { - flex-direction: column; - } - - .maskEditor_sidePanel_paintBucket_Container { - width: 180px; - display: flex; - flex-direction: column; - position: relative; - } - - .maskEditor_sidePanel_colorSelect_Container { - display: flex; - width: 180px; - align-items: center; - gap: 5px; - height: 30px; - } - - #maskEditor_sidePanelVisibilityToggle { - position: absolute; - right: 0; - } - - #maskEditor_sidePanelColorSelectMethodSelect { - position: absolute; - right: 0; - height: 30px; - border-radius: 0; - border: 1px solid var(--border-color); - background: rgba(0,0,0,0.2); - } - - #maskEditor_sidePanelVisibilityToggle { - position: absolute; - right: 0; - } - - .maskEditor_sidePanel_colorSelect_tolerance_container { - display: flex; - flex-direction: column; - gap: 10px; - margin-bottom: 10px; - } - - .maskEditor_sidePanelContainerColumn { - display: flex; - flex-direction: column; - gap: 12px; - } - - .maskEditor_sidePanelContainerRow { - display: flex; - flex-direction: row; - gap: 10px; - align-items: center; - min-height: 24px; - position: relative; - } - - .maskEditor_accent_bg_dark { - background: var(--p-surface-800); - } - - .maskEditor_accent_bg_very_dark { - background: var(--p-surface-900); - } - - .maskEditor_accent_bg_light { - background: var(--p-surface-300); - } - - .maskEditor_accent_bg_very_light { - background: var(--comfy-menu-bg); - } - - #maskEditor_paintBucketSettings { - display: none; - } - - #maskEditor_colorSelectSettings { - display: none; - } - - .maskEditor_sidePanelToggleContainer { - cursor: pointer; - display: inline-block; - position: absolute; - right: 0; - } - - .maskEditor_toggle_bg_dark { - background: var(--p-surface-700); - } - - .maskEditor_toggle_bg_light { - background: var(--p-surface-300); - } - - .maskEditor_sidePanelToggleSwitch { - display: inline-block; - border-radius: 16px; - width: 40px; - height: 24px; - position: relative; - vertical-align: middle; - transition: background 0.25s; - } - .maskEditor_sidePanelToggleSwitch:before, .maskEditor_sidePanelToggleSwitch:after { - content: ""; - } - .maskEditor_sidePanelToggleSwitch:before { - display: block; - background: linear-gradient(to bottom, #fff 0%, #eee 100%); - border-radius: 50%; - width: 16px; - height: 16px; - position: absolute; - top: 4px; - left: 4px; - transition: ease 0.2s; - } - .maskEditor_sidePanelToggleContainer:hover .maskEditor_sidePanelToggleSwitch:before { - background: linear-gradient(to bottom, #fff 0%, #fff 100%); - } - .maskEditor_sidePanelToggleCheckbox:checked + .maskEditor_sidePanelToggleSwitch { - background: var(--p-button-text-primary-color); - } - .maskEditor_sidePanelToggleCheckbox:checked + .maskEditor_toggle_bg_dark:before { - background: var(--p-surface-900); - } - .maskEditor_sidePanelToggleCheckbox:checked + .maskEditor_toggle_bg_light:before { - background: var(--comfy-menu-bg); - } - .maskEditor_sidePanelToggleCheckbox:checked + .maskEditor_sidePanelToggleSwitch:before { - left: 20px; - } - - .maskEditor_sidePanelToggleCheckbox { - position: absolute; - visibility: hidden; - } - - .maskEditor_sidePanelDropdown_dark { - border: 1px solid var(--p-form-field-border-color); - background: var(--p-surface-900); - height: 24px; - padding-left: 5px; - padding-right: 5px; - border-radius: 6px; - transition: background 0.1s; - } - - .maskEditor_sidePanelDropdown_dark option { - background: var(--p-surface-900); - } - - .maskEditor_sidePanelDropdown_dark:focus { - outline: 1px solid var(--p-button-text-primary-color); - } - - .maskEditor_sidePanelDropdown_dark option:hover { - background: white; - } - .maskEditor_sidePanelDropdown_dark option:active { - background: var(--p-highlight-background); - } - - .maskEditor_sidePanelDropdown_light { - border: 1px solid var(--p-form-field-border-color); - background: var(--comfy-menu-bg); - height: 24px; - padding-left: 5px; - padding-right: 5px; - border-radius: 6px; - transition: background 0.1s; - } - - .maskEditor_sidePanelDropdown_light option { - background: var(--comfy-menu-bg); - } - - .maskEditor_sidePanelDropdown_light:focus { - outline: 1px solid var(--p-surface-300); - } - - .maskEditor_sidePanelDropdown_light option:hover { - background: white; - } - .maskEditor_sidePanelDropdown_light option:active { - background: var(--p-surface-300); - } - - .maskEditor_layerRow { - height: 50px; - width: 200px; - border-radius: 10px; - } - - .maskEditor_sidePanelLayerPreviewContainer { - width: 40px; - height: 30px; - } - - .maskEditor_sidePanelLayerPreviewContainer > svg{ - width: 100%; - height: 100%; - object-fit: contain; - fill: var(--p-surface-100); - } - - #maskEditor_sidePanelImageLayerImage { - width: 100%; - height: 100%; - object-fit: contain; - } - - .maskEditor_sidePanelSubTitle { - text-align: left; - font-size: 12px; - font-family: sans-serif; - color: var(--descrip-text); - } - - .maskEditor_containerDropdown { - position: absolute; - right: 0; - } - - .maskEditor_sidePanelLayerCheckbox { - margin-left: 15px; - } - - .maskEditor_toolPanelZoomIndicator { - width: var(--sidebar-width); - height: var(--sidebar-width); - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - gap: 5px; - color: var(--p-button-text-secondary-color); - position: absolute; - bottom: 0; - transition: background-color 0.2s; - } - - #maskEditor_toolPanelDimensionsText { - font-size: 12px; - } - - #maskEditor_topBarSaveButton { - background: var(--p-primary-color) !important; - color: var(--p-button-primary-color) !important; - } - - #maskEditor_topBarSaveButton:hover { - background: var(--p-primary-hover-color) !important; - } - -`; -var styleSheet = document.createElement("style"); -styleSheet.type = "text/css"; -styleSheet.innerText = styles; -document.head.appendChild(styleSheet); -var BrushShape = /* @__PURE__ */ ((BrushShape2) => { - BrushShape2["Arc"] = "arc"; - BrushShape2["Rect"] = "rect"; - return BrushShape2; -})(BrushShape || {}); -var Tools = /* @__PURE__ */ ((Tools2) => { - Tools2["Pen"] = "pen"; - Tools2["Eraser"] = "eraser"; - Tools2["PaintBucket"] = "paintBucket"; - Tools2["ColorSelect"] = "colorSelect"; - return Tools2; -})(Tools || {}); -var CompositionOperation = /* @__PURE__ */ ((CompositionOperation2) => { - CompositionOperation2["SourceOver"] = "source-over"; - CompositionOperation2["DestinationOut"] = "destination-out"; - return CompositionOperation2; -})(CompositionOperation || {}); -var MaskBlendMode = /* @__PURE__ */ ((MaskBlendMode2) => { - MaskBlendMode2["Black"] = "black"; - MaskBlendMode2["White"] = "white"; - MaskBlendMode2["Negative"] = "negative"; - return MaskBlendMode2; -})(MaskBlendMode || {}); -var ColorComparisonMethod = /* @__PURE__ */ ((ColorComparisonMethod2) => { - ColorComparisonMethod2["Simple"] = "simple"; - ColorComparisonMethod2["HSL"] = "hsl"; - ColorComparisonMethod2["LAB"] = "lab"; - return ColorComparisonMethod2; -})(ColorComparisonMethod || {}); -class MaskEditorDialog extends ComfyDialog { - static { - __name(this, "MaskEditorDialog"); - } - static instance = null; - //new - uiManager; - toolManager; - panAndZoomManager; - brushTool; - paintBucketTool; - colorSelectTool; - canvasHistory; - messageBroker; - keyboardManager; - rootElement; - imageURL; - isLayoutCreated = false; - isOpen = false; - //variables needed? - last_display_style = null; - constructor() { - super(); - this.rootElement = $el( - "div.maskEditor_hidden", - { parent: document.body }, - [] - ); - this.element = this.rootElement; - } - static getInstance() { - if (!ComfyApp.clipspace || !ComfyApp.clipspace.imgs) { - throw new Error("No clipspace images found"); - } - const currentSrc = ComfyApp.clipspace.imgs[ComfyApp.clipspace["selectedIndex"]].src; - if (!MaskEditorDialog.instance || currentSrc !== MaskEditorDialog.instance.imageURL) { - MaskEditorDialog.instance = new MaskEditorDialog(); - } - return MaskEditorDialog.instance; - } - async show() { - this.cleanup(); - if (!this.isLayoutCreated) { - this.messageBroker = new MessageBroker(); - this.canvasHistory = new CanvasHistory(this, 20); - this.paintBucketTool = new PaintBucketTool(this); - this.brushTool = new BrushTool(this); - this.panAndZoomManager = new PanAndZoomManager(this); - this.toolManager = new ToolManager(this); - this.keyboardManager = new KeyboardManager(this); - this.uiManager = new UIManager(this.rootElement, this); - this.colorSelectTool = new ColorSelectTool(this); - const self2 = this; - const observer = new MutationObserver(function(mutations) { - mutations.forEach(function(mutation) { - if (mutation.type === "attributes" && mutation.attributeName === "style") { - if (self2.last_display_style && self2.last_display_style != "none" && self2.element.style.display == "none") { - ComfyApp.onClipspaceEditorClosed(); - } - self2.last_display_style = self2.element.style.display; - } - }); - }); - const config = { attributes: true }; - observer.observe(this.rootElement, config); - this.isLayoutCreated = true; - await this.uiManager.setlayout(); - } - this.rootElement.id = "maskEditor"; - this.rootElement.style.display = "flex"; - this.element.style.display = "flex"; - await this.uiManager.initUI(); - this.paintBucketTool.initPaintBucketTool(); - this.colorSelectTool.initColorSelectTool(); - await this.canvasHistory.saveInitialState(); - this.isOpen = true; - if (ComfyApp.clipspace && ComfyApp.clipspace.imgs) { - this.uiManager.setSidebarImage(); - } - this.keyboardManager.addListeners(); - } - cleanup() { - const maskEditors = document.querySelectorAll('[id^="maskEditor"]'); - maskEditors.forEach((element) => element.remove()); - const brushElements = document.querySelectorAll("#maskEditor_brush"); - brushElements.forEach((element) => element.remove()); - } - isOpened() { - return this.isOpen; - } - async save() { - const backupCanvas = document.createElement("canvas"); - const imageCanvas = this.uiManager.getImgCanvas(); - const maskCanvas = this.uiManager.getMaskCanvas(); - const image = this.uiManager.getImage(); - const backupCtx = backupCanvas.getContext("2d", { - willReadFrequently: true - }); - backupCanvas.width = imageCanvas.width; - backupCanvas.height = imageCanvas.height; - if (!backupCtx) { - return; - } - const maskImageLoaded = new Promise((resolve, reject) => { - const maskImage = new Image(); - maskImage.src = maskCanvas.toDataURL(); - maskImage.onload = () => { - resolve(); - }; - maskImage.onerror = (error) => { - reject(error); - }; - }); - try { - await maskImageLoaded; - } catch (error) { - console.error("Error loading mask image:", error); - return; - } - backupCtx.clearRect(0, 0, backupCanvas.width, backupCanvas.height); - backupCtx.drawImage( - maskCanvas, - 0, - 0, - maskCanvas.width, - maskCanvas.height, - 0, - 0, - backupCanvas.width, - backupCanvas.height - ); - let maskHasContent = false; - const maskData = backupCtx.getImageData( - 0, - 0, - backupCanvas.width, - backupCanvas.height - ); - for (let i = 0; i < maskData.data.length; i += 4) { - if (maskData.data[i + 3] !== 0) { - maskHasContent = true; - break; - } - } - const backupData = backupCtx.getImageData( - 0, - 0, - backupCanvas.width, - backupCanvas.height - ); - let backupHasContent = false; - for (let i = 0; i < backupData.data.length; i += 4) { - if (backupData.data[i + 3] !== 0) { - backupHasContent = true; - break; - } - } - if (maskHasContent && !backupHasContent) { - console.error("Mask appears to be empty"); - alert("Cannot save empty mask"); - return; - } - for (let i = 0; i < backupData.data.length; i += 4) { - const alpha = backupData.data[i + 3]; - backupData.data[i] = 0; - backupData.data[i + 1] = 0; - backupData.data[i + 2] = 0; - backupData.data[i + 3] = 255 - alpha; - } - backupCtx.globalCompositeOperation = "source-over"; - backupCtx.putImageData(backupData, 0, 0); - const formData = new FormData(); - const filename = "clipspace-mask-" + performance.now() + ".png"; - const item = { - filename, - subfolder: "clipspace", - type: "input" - }; - if (ComfyApp?.clipspace?.widgets?.length) { - const index = ComfyApp.clipspace.widgets.findIndex( - (obj) => obj?.name === "image" - ); - if (index >= 0 && item !== void 0) { - try { - ComfyApp.clipspace.widgets[index].value = item; - } catch (err2) { - console.warn("Failed to set widget value:", err2); - } - } - } - const dataURL = backupCanvas.toDataURL(); - const blob = this.dataURLToBlob(dataURL); - let original_url = new URL(image.src); - this.uiManager.setBrushOpacity(0); - const filenameRef = original_url.searchParams.get("filename"); - if (!filenameRef) { - throw new Error("filename parameter is required"); - } - const original_ref = { - filename: filenameRef - }; - let original_subfolder = original_url.searchParams.get("subfolder"); - if (original_subfolder) original_ref.subfolder = original_subfolder; - let original_type = original_url.searchParams.get("type"); - if (original_type) original_ref.type = original_type; - formData.append("image", blob, filename); - formData.append("original_ref", JSON.stringify(original_ref)); - formData.append("type", "input"); - formData.append("subfolder", "clipspace"); - this.uiManager.setSaveButtonText("Saving"); - this.uiManager.setSaveButtonEnabled(false); - this.keyboardManager.removeListeners(); - const maxRetries = 3; - let attempt = 0; - let success = false; - while (attempt < maxRetries && !success) { - try { - await this.uploadMask(item, formData); - success = true; - } catch (error) { - console.error(`Upload attempt ${attempt + 1} failed:`, error); - attempt++; - if (attempt < maxRetries) { - console.log("Retrying upload..."); - } else { - console.log("Max retries reached. Upload failed."); - } - } - } - if (success) { - ComfyApp.onClipspaceEditorSave(); - this.close(); - this.isOpen = false; - } else { - this.uiManager.setSaveButtonText("Save"); - this.uiManager.setSaveButtonEnabled(true); - this.keyboardManager.addListeners(); - } - } - getMessageBroker() { - return this.messageBroker; - } - // Helper function to convert a data URL to a Blob object - dataURLToBlob(dataURL) { - const parts = dataURL.split(";base64,"); - const contentType = parts[0].split(":")[1]; - const byteString = atob(parts[1]); - const arrayBuffer = new ArrayBuffer(byteString.length); - const uint8Array = new Uint8Array(arrayBuffer); - for (let i = 0; i < byteString.length; i++) { - uint8Array[i] = byteString.charCodeAt(i); - } - return new Blob([arrayBuffer], { type: contentType }); - } - async uploadMask(filepath, formData, retries = 3) { - if (retries <= 0) { - throw new Error("Max retries reached"); - return; - } - await api.fetchApi("/upload/mask", { - method: "POST", - body: formData - }).then((response) => { - if (!response.ok) { - console.log("Failed to upload mask:", response); - this.uploadMask(filepath, formData, 2); - } - }).catch((error) => { - console.error("Error:", error); - }); - try { - const selectedIndex = ComfyApp.clipspace?.selectedIndex; - if (ComfyApp.clipspace?.imgs && selectedIndex !== void 0) { - const newImage = new Image(); - newImage.src = api.apiURL( - "/view?" + new URLSearchParams(filepath).toString() + app.getPreviewFormatParam() + app.getRandParam() - ); - ComfyApp.clipspace.imgs[selectedIndex] = newImage; - if (ComfyApp.clipspace.images) { - ComfyApp.clipspace.images[selectedIndex] = filepath; - } - } - } catch (err2) { - console.warn("Failed to update clipspace image:", err2); - } - ClipspaceDialog.invalidatePreview(); - } -} -class CanvasHistory { - static { - __name(this, "CanvasHistory"); - } - maskEditor; - messageBroker; - canvas; - ctx; - states = []; - currentStateIndex = -1; - maxStates = 20; - initialized = false; - constructor(maskEditor, maxStates = 20) { - this.maskEditor = maskEditor; - this.messageBroker = maskEditor.getMessageBroker(); - this.maxStates = maxStates; - this.createListeners(); - } - async pullCanvas() { - this.canvas = await this.messageBroker.pull("maskCanvas"); - this.ctx = await this.messageBroker.pull("maskCtx"); - } - createListeners() { - this.messageBroker.subscribe("saveState", () => this.saveState()); - this.messageBroker.subscribe("undo", () => this.undo()); - this.messageBroker.subscribe("redo", () => this.redo()); - } - clearStates() { - this.states = []; - this.currentStateIndex = -1; - this.initialized = false; - } - async saveInitialState() { - await this.pullCanvas(); - if (!this.canvas.width || !this.canvas.height) { - requestAnimationFrame(() => this.saveInitialState()); - return; - } - this.clearStates(); - const state = this.ctx.getImageData( - 0, - 0, - this.canvas.width, - this.canvas.height - ); - this.states.push(state); - this.currentStateIndex = 0; - this.initialized = true; - } - saveState() { - if (!this.initialized || this.currentStateIndex === -1) { - this.saveInitialState(); - return; - } - this.states = this.states.slice(0, this.currentStateIndex + 1); - const state = this.ctx.getImageData( - 0, - 0, - this.canvas.width, - this.canvas.height - ); - this.states.push(state); - this.currentStateIndex++; - if (this.states.length > this.maxStates) { - this.states.shift(); - this.currentStateIndex--; - } - } - undo() { - if (this.states.length > 1 && this.currentStateIndex > 0) { - this.currentStateIndex--; - this.restoreState(this.states[this.currentStateIndex]); - } else { - alert("No more undo states available"); - } - } - redo() { - if (this.states.length > 1 && this.currentStateIndex < this.states.length - 1) { - this.currentStateIndex++; - this.restoreState(this.states[this.currentStateIndex]); - } else { - alert("No more redo states available"); - } - } - restoreState(state) { - if (state && this.initialized) { - this.ctx.putImageData(state, 0, 0); - } - } -} -class PaintBucketTool { - static { - __name(this, "PaintBucketTool"); - } - maskEditor; - messageBroker; - canvas; - ctx; - width = null; - height = null; - imageData = null; - data = null; - tolerance = 5; - constructor(maskEditor) { - this.maskEditor = maskEditor; - this.messageBroker = maskEditor.getMessageBroker(); - this.createListeners(); - this.addPullTopics(); - } - initPaintBucketTool() { - this.pullCanvas(); - } - async pullCanvas() { - this.canvas = await this.messageBroker.pull("maskCanvas"); - this.ctx = await this.messageBroker.pull("maskCtx"); - } - createListeners() { - this.messageBroker.subscribe( - "setPaintBucketTolerance", - (tolerance) => this.setTolerance(tolerance) - ); - this.messageBroker.subscribe( - "paintBucketFill", - (point) => this.floodFill(point) - ); - this.messageBroker.subscribe("invert", () => this.invertMask()); - } - addPullTopics() { - this.messageBroker.createPullTopic( - "getTolerance", - async () => this.tolerance - ); - } - getPixel(x, y) { - return this.data[(y * this.width + x) * 4 + 3]; - } - setPixel(x, y, alpha, color) { - const index = (y * this.width + x) * 4; - this.data[index] = color.r; - this.data[index + 1] = color.g; - this.data[index + 2] = color.b; - this.data[index + 3] = alpha; - } - shouldProcessPixel(currentAlpha, targetAlpha, tolerance, isFillMode) { - if (currentAlpha === -1) return false; - if (isFillMode) { - return currentAlpha !== 255 && Math.abs(currentAlpha - targetAlpha) <= tolerance; - } else { - return currentAlpha === 255 || Math.abs(currentAlpha - targetAlpha) <= tolerance; - } - } - async floodFill(point) { - let startX = Math.floor(point.x); - let startY = Math.floor(point.y); - this.width = this.canvas.width; - this.height = this.canvas.height; - if (startX < 0 || startX >= this.width || startY < 0 || startY >= this.height) { - return; - } - this.imageData = this.ctx.getImageData(0, 0, this.width, this.height); - this.data = this.imageData.data; - const targetAlpha = this.getPixel(startX, startY); - const isFillMode = targetAlpha !== 255; - if (targetAlpha === -1) return; - const maskColor = await this.messageBroker.pull("getMaskColor"); - const stack = []; - const visited = new Uint8Array(this.width * this.height); - if (this.shouldProcessPixel( - targetAlpha, - targetAlpha, - this.tolerance, - isFillMode - )) { - stack.push([startX, startY]); - } - while (stack.length > 0) { - const [x, y] = stack.pop(); - const visitedIndex = y * this.width + x; - if (visited[visitedIndex]) continue; - const currentAlpha = this.getPixel(x, y); - if (!this.shouldProcessPixel( - currentAlpha, - targetAlpha, - this.tolerance, - isFillMode - )) { - continue; - } - visited[visitedIndex] = 1; - this.setPixel(x, y, isFillMode ? 255 : 0, maskColor); - const checkNeighbor = /* @__PURE__ */ __name((nx, ny) => { - if (nx < 0 || nx >= this.width || ny < 0 || ny >= this.height) return; - if (!visited[ny * this.width + nx]) { - const alpha = this.getPixel(nx, ny); - if (this.shouldProcessPixel( - alpha, - targetAlpha, - this.tolerance, - isFillMode - )) { - stack.push([nx, ny]); - } - } - }, "checkNeighbor"); - checkNeighbor(x - 1, y); - checkNeighbor(x + 1, y); - checkNeighbor(x, y - 1); - checkNeighbor(x, y + 1); - } - this.ctx.putImageData(this.imageData, 0, 0); - this.imageData = null; - this.data = null; - } - setTolerance(tolerance) { - this.tolerance = tolerance; - } - getTolerance() { - return this.tolerance; - } - //invert mask - invertMask() { - const imageData = this.ctx.getImageData( - 0, - 0, - this.canvas.width, - this.canvas.height - ); - const data = imageData.data; - let maskR = 0, maskG = 0, maskB = 0; - for (let i = 0; i < data.length; i += 4) { - if (data[i + 3] > 0) { - maskR = data[i]; - maskG = data[i + 1]; - maskB = data[i + 2]; - break; - } - } - for (let i = 0; i < data.length; i += 4) { - const alpha = data[i + 3]; - data[i + 3] = 255 - alpha; - if (alpha === 0) { - data[i] = maskR; - data[i + 1] = maskG; - data[i + 2] = maskB; - } - } - this.ctx.putImageData(imageData, 0, 0); - this.messageBroker.publish("saveState"); - } -} -class ColorSelectTool { - static { - __name(this, "ColorSelectTool"); - } - maskEditor; - messageBroker; - width = null; - height = null; - canvas; - maskCTX; - imageCTX; - maskData = null; - imageData = null; - tolerance = 20; - livePreview = false; - lastPoint = null; - colorComparisonMethod = "simple"; - applyWholeImage = false; - maskBoundry = false; - maskTolerance = 0; - constructor(maskEditor) { - this.maskEditor = maskEditor; - this.messageBroker = maskEditor.getMessageBroker(); - this.createListeners(); - this.addPullTopics(); - } - async initColorSelectTool() { - await this.pullCanvas(); - } - async pullCanvas() { - this.canvas = await this.messageBroker.pull("imgCanvas"); - this.maskCTX = await this.messageBroker.pull("maskCtx"); - this.imageCTX = await this.messageBroker.pull("imageCtx"); - } - createListeners() { - this.messageBroker.subscribe( - "colorSelectFill", - (point) => this.fillColorSelection(point) - ); - this.messageBroker.subscribe( - "setColorSelectTolerance", - (tolerance) => this.setTolerance(tolerance) - ); - this.messageBroker.subscribe( - "setLivePreview", - (livePreview) => this.setLivePreview(livePreview) - ); - this.messageBroker.subscribe( - "setColorComparisonMethod", - (method) => this.setComparisonMethod(method) - ); - this.messageBroker.subscribe("clearLastPoint", () => this.clearLastPoint()); - this.messageBroker.subscribe( - "setWholeImage", - (applyWholeImage) => this.setApplyWholeImage(applyWholeImage) - ); - this.messageBroker.subscribe( - "setMaskBoundary", - (maskBoundry) => this.setMaskBoundary(maskBoundry) - ); - this.messageBroker.subscribe( - "setMaskTolerance", - (maskTolerance) => this.setMaskTolerance(maskTolerance) - ); - } - async addPullTopics() { - this.messageBroker.createPullTopic( - "getLivePreview", - async () => this.livePreview - ); - } - getPixel(x, y) { - const index = (y * this.width + x) * 4; - return { - r: this.imageData[index], - g: this.imageData[index + 1], - b: this.imageData[index + 2] - }; - } - getMaskAlpha(x, y) { - return this.maskData[(y * this.width + x) * 4 + 3]; - } - isPixelInRange(pixel, target) { - switch (this.colorComparisonMethod) { - case "simple": - return this.isPixelInRangeSimple(pixel, target); - case "hsl": - return this.isPixelInRangeHSL(pixel, target); - case "lab": - return this.isPixelInRangeLab(pixel, target); - default: - return this.isPixelInRangeSimple(pixel, target); - } - } - isPixelInRangeSimple(pixel, target) { - const distance = Math.sqrt( - Math.pow(pixel.r - target.r, 2) + Math.pow(pixel.g - target.g, 2) + Math.pow(pixel.b - target.b, 2) - ); - return distance <= this.tolerance; - } - isPixelInRangeHSL(pixel, target) { - const pixelHSL = this.rgbToHSL(pixel.r, pixel.g, pixel.b); - const targetHSL = this.rgbToHSL(target.r, target.g, target.b); - const hueDiff = Math.abs(pixelHSL.h - targetHSL.h); - const satDiff = Math.abs(pixelHSL.s - targetHSL.s); - const lightDiff = Math.abs(pixelHSL.l - targetHSL.l); - const distance = Math.sqrt( - Math.pow(hueDiff / 360 * 255, 2) + Math.pow(satDiff / 100 * 255, 2) + Math.pow(lightDiff / 100 * 255, 2) - ); - return distance <= this.tolerance; - } - rgbToHSL(r, g, b) { - r /= 255; - g /= 255; - b /= 255; - const max2 = Math.max(r, g, b); - const min = Math.min(r, g, b); - let h = 0, s = 0, l = (max2 + min) / 2; - if (max2 !== min) { - const d = max2 - min; - s = l > 0.5 ? d / (2 - max2 - min) : d / (max2 + min); - switch (max2) { - case r: - h = (g - b) / d + (g < b ? 6 : 0); - break; - case g: - h = (b - r) / d + 2; - break; - case b: - h = (r - g) / d + 4; - break; - } - h /= 6; - } - return { - h: h * 360, - s: s * 100, - l: l * 100 - }; - } - isPixelInRangeLab(pixel, target) { - const pixelLab = this.rgbToLab(pixel); - const targetLab = this.rgbToLab(target); - const deltaE = Math.sqrt( - Math.pow(pixelLab.l - targetLab.l, 2) + Math.pow(pixelLab.a - targetLab.a, 2) + Math.pow(pixelLab.b - targetLab.b, 2) - ); - const normalizedDeltaE = deltaE / 100 * 255; - return normalizedDeltaE <= this.tolerance; - } - rgbToLab(rgb) { - let r = rgb.r / 255; - let g = rgb.g / 255; - let b = rgb.b / 255; - r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92; - g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92; - b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92; - r *= 100; - g *= 100; - b *= 100; - const x = r * 0.4124 + g * 0.3576 + b * 0.1805; - const y = r * 0.2126 + g * 0.7152 + b * 0.0722; - const z = r * 0.0193 + g * 0.1192 + b * 0.9505; - const xn = 95.047; - const yn = 100; - const zn = 108.883; - const xyz = [x / xn, y / yn, z / zn]; - for (let i = 0; i < xyz.length; i++) { - xyz[i] = xyz[i] > 8856e-6 ? Math.pow(xyz[i], 1 / 3) : 7.787 * xyz[i] + 16 / 116; - } - return { - l: 116 * xyz[1] - 16, - a: 500 * (xyz[0] - xyz[1]), - b: 200 * (xyz[1] - xyz[2]) - }; - } - setPixel(x, y, alpha, color) { - const index = (y * this.width + x) * 4; - this.maskData[index] = color.r; - this.maskData[index + 1] = color.g; - this.maskData[index + 2] = color.b; - this.maskData[index + 3] = alpha; - } - async fillColorSelection(point) { - this.width = this.canvas.width; - this.height = this.canvas.height; - this.lastPoint = point; - const maskData = this.maskCTX.getImageData(0, 0, this.width, this.height); - this.maskData = maskData.data; - this.imageData = this.imageCTX.getImageData( - 0, - 0, - this.width, - this.height - ).data; - if (this.applyWholeImage) { - const targetPixel = this.getPixel( - Math.floor(point.x), - Math.floor(point.y) - ); - const maskColor = await this.messageBroker.pull("getMaskColor"); - const width = this.width; - const height = this.height; - const CHUNK_SIZE = 1e4; - for (let i = 0; i < width * height; i += CHUNK_SIZE) { - const endIndex = Math.min(i + CHUNK_SIZE, width * height); - for (let pixelIndex = i; pixelIndex < endIndex; pixelIndex++) { - const x = pixelIndex % width; - const y = Math.floor(pixelIndex / width); - if (this.isPixelInRange(this.getPixel(x, y), targetPixel)) { - this.setPixel(x, y, 255, maskColor); - } - } - await new Promise((resolve) => setTimeout(resolve, 0)); - } - } else { - let startX = Math.floor(point.x); - let startY = Math.floor(point.y); - if (startX < 0 || startX >= this.width || startY < 0 || startY >= this.height) { - return; - } - const pixel = this.getPixel(startX, startY); - const stack = []; - const visited = new Uint8Array(this.width * this.height); - stack.push([startX, startY]); - const maskColor = await this.messageBroker.pull("getMaskColor"); - while (stack.length > 0) { - const [x, y] = stack.pop(); - const visitedIndex = y * this.width + x; - if (visited[visitedIndex] || !this.isPixelInRange(this.getPixel(x, y), pixel)) { - continue; - } - visited[visitedIndex] = 1; - this.setPixel(x, y, 255, maskColor); - if (x > 0 && !visited[y * this.width + (x - 1)] && this.isPixelInRange(this.getPixel(x - 1, y), pixel)) { - if (!this.maskBoundry || 255 - this.getMaskAlpha(x - 1, y) > this.maskTolerance) { - stack.push([x - 1, y]); - } - } - if (x < this.width - 1 && !visited[y * this.width + (x + 1)] && this.isPixelInRange(this.getPixel(x + 1, y), pixel)) { - if (!this.maskBoundry || 255 - this.getMaskAlpha(x + 1, y) > this.maskTolerance) { - stack.push([x + 1, y]); - } - } - if (y > 0 && !visited[(y - 1) * this.width + x] && this.isPixelInRange(this.getPixel(x, y - 1), pixel)) { - if (!this.maskBoundry || 255 - this.getMaskAlpha(x, y - 1) > this.maskTolerance) { - stack.push([x, y - 1]); - } - } - if (y < this.height - 1 && !visited[(y + 1) * this.width + x] && this.isPixelInRange(this.getPixel(x, y + 1), pixel)) { - if (!this.maskBoundry || 255 - this.getMaskAlpha(x, y + 1) > this.maskTolerance) { - stack.push([x, y + 1]); - } - } - } - } - this.maskCTX.putImageData(maskData, 0, 0); - this.messageBroker.publish("saveState"); - this.maskData = null; - this.imageData = null; - } - setTolerance(tolerance) { - this.tolerance = tolerance; - if (this.lastPoint && this.livePreview) { - this.messageBroker.publish("undo"); - this.fillColorSelection(this.lastPoint); - } - } - setLivePreview(livePreview) { - this.livePreview = livePreview; - } - setComparisonMethod(method) { - this.colorComparisonMethod = method; - if (this.lastPoint && this.livePreview) { - this.messageBroker.publish("undo"); - this.fillColorSelection(this.lastPoint); - } - } - clearLastPoint() { - this.lastPoint = null; - } - setApplyWholeImage(applyWholeImage) { - this.applyWholeImage = applyWholeImage; - } - setMaskBoundary(maskBoundry) { - this.maskBoundry = maskBoundry; - } - setMaskTolerance(maskTolerance) { - this.maskTolerance = maskTolerance; - } -} -class BrushTool { - static { - __name(this, "BrushTool"); - } - brushSettings; - //this saves the current brush settings - maskBlendMode; - isDrawing = false; - isDrawingLine = false; - lineStartPoint = null; - smoothingPrecision = 10; - smoothingCordsArray = []; - smoothingLastDrawTime; - maskCtx = null; - initialDraw = true; - brushStrokeCanvas = null; - brushStrokeCtx = null; - //brush adjustment - isBrushAdjusting = false; - brushPreviewGradient = null; - initialPoint = null; - useDominantAxis = false; - brushAdjustmentSpeed = 1; - maskEditor; - messageBroker; - constructor(maskEditor) { - this.maskEditor = maskEditor; - this.messageBroker = maskEditor.getMessageBroker(); - this.createListeners(); - this.addPullTopics(); - this.useDominantAxis = app.extensionManager.setting.get( - "Comfy.MaskEditor.UseDominantAxis" - ); - this.brushAdjustmentSpeed = app.extensionManager.setting.get( - "Comfy.MaskEditor.BrushAdjustmentSpeed" - ); - this.brushSettings = { - size: 10, - opacity: 100, - hardness: 1, - type: "arc" - /* Arc */ - }; - this.maskBlendMode = "black"; - } - createListeners() { - this.messageBroker.subscribe( - "setBrushSize", - (size) => this.setBrushSize(size) - ); - this.messageBroker.subscribe( - "setBrushOpacity", - (opacity) => this.setBrushOpacity(opacity) - ); - this.messageBroker.subscribe( - "setBrushHardness", - (hardness) => this.setBrushHardness(hardness) - ); - this.messageBroker.subscribe( - "setBrushShape", - (type) => this.setBrushType(type) - ); - this.messageBroker.subscribe( - "setBrushSmoothingPrecision", - (precision) => this.setBrushSmoothingPrecision(precision) - ); - this.messageBroker.subscribe( - "brushAdjustmentStart", - (event) => this.startBrushAdjustment(event) - ); - this.messageBroker.subscribe( - "brushAdjustment", - (event) => this.handleBrushAdjustment(event) - ); - this.messageBroker.subscribe( - "drawStart", - (event) => this.startDrawing(event) - ); - this.messageBroker.subscribe( - "draw", - (event) => this.handleDrawing(event) - ); - this.messageBroker.subscribe( - "drawEnd", - (event) => this.drawEnd(event) - ); - } - addPullTopics() { - this.messageBroker.createPullTopic( - "brushSize", - async () => this.brushSettings.size - ); - this.messageBroker.createPullTopic( - "brushOpacity", - async () => this.brushSettings.opacity - ); - this.messageBroker.createPullTopic( - "brushHardness", - async () => this.brushSettings.hardness - ); - this.messageBroker.createPullTopic( - "brushType", - async () => this.brushSettings.type - ); - this.messageBroker.createPullTopic( - "maskBlendMode", - async () => this.maskBlendMode - ); - this.messageBroker.createPullTopic( - "brushSettings", - async () => this.brushSettings - ); - } - async createBrushStrokeCanvas() { - if (this.brushStrokeCanvas !== null) { - return; - } - const maskCanvas = await this.messageBroker.pull("maskCanvas"); - const canvas = document.createElement("canvas"); - canvas.width = maskCanvas.width; - canvas.height = maskCanvas.height; - this.brushStrokeCanvas = canvas; - this.brushStrokeCtx = canvas.getContext("2d"); - } - async startDrawing(event) { - this.isDrawing = true; - let compositionOp; - let currentTool = await this.messageBroker.pull("currentTool"); - let coords = { x: event.offsetX, y: event.offsetY }; - let coords_canvas = await this.messageBroker.pull("screenToCanvas", coords); - await this.createBrushStrokeCanvas(); - if (currentTool === "eraser" || event.buttons == 2) { - compositionOp = "destination-out"; - } else { - compositionOp = "source-over"; - } - if (event.shiftKey && this.lineStartPoint) { - this.isDrawingLine = true; - this.drawLine(this.lineStartPoint, coords_canvas, compositionOp); - } else { - this.isDrawingLine = false; - this.init_shape(compositionOp); - this.draw_shape(coords_canvas); - } - this.lineStartPoint = coords_canvas; - this.smoothingCordsArray = [coords_canvas]; - this.smoothingLastDrawTime = /* @__PURE__ */ new Date(); - } - async handleDrawing(event) { - var diff = performance.now() - this.smoothingLastDrawTime.getTime(); - let coords = { x: event.offsetX, y: event.offsetY }; - let coords_canvas = await this.messageBroker.pull("screenToCanvas", coords); - let currentTool = await this.messageBroker.pull("currentTool"); - if (diff > 20 && !this.isDrawing) - requestAnimationFrame(() => { - this.init_shape( - "source-over" - /* SourceOver */ - ); - this.draw_shape(coords_canvas); - this.smoothingCordsArray.push(coords_canvas); - }); - else - requestAnimationFrame(() => { - if (currentTool === "eraser" || event.buttons == 2) { - this.init_shape( - "destination-out" - /* DestinationOut */ - ); - } else { - this.init_shape( - "source-over" - /* SourceOver */ - ); - } - this.drawWithBetterSmoothing(coords_canvas); - }); - this.smoothingLastDrawTime = /* @__PURE__ */ new Date(); - } - async drawEnd(event) { - const coords = { x: event.offsetX, y: event.offsetY }; - const coords_canvas = await this.messageBroker.pull( - "screenToCanvas", - coords - ); - if (this.isDrawing) { - this.isDrawing = false; - this.messageBroker.publish("saveState"); - this.lineStartPoint = coords_canvas; - this.initialDraw = true; - } - } - drawWithBetterSmoothing(point) { - if (!this.smoothingCordsArray) { - this.smoothingCordsArray = []; - } - const opacityConstant = 1 / (1 + Math.exp(3)); - const interpolatedOpacity = 1 / (1 + Math.exp(-6 * (this.brushSettings.opacity - 0.5))) - opacityConstant; - this.smoothingCordsArray.push(point); - const POINTS_NR = 5; - if (this.smoothingCordsArray.length < POINTS_NR) { - return; - } - let totalLength = 0; - const points = this.smoothingCordsArray; - const len = points.length - 1; - let dx, dy; - for (let i = 0; i < len; i++) { - dx = points[i + 1].x - points[i].x; - dy = points[i + 1].y - points[i].y; - totalLength += Math.sqrt(dx * dx + dy * dy); - } - const distanceBetweenPoints = this.brushSettings.size / this.smoothingPrecision * 6; - const stepNr = Math.ceil(totalLength / distanceBetweenPoints); - let interpolatedPoints = points; - if (stepNr > 0) { - interpolatedPoints = this.generateEquidistantPoints( - this.smoothingCordsArray, - distanceBetweenPoints - // Distance between interpolated points - ); - } - if (!this.initialDraw) { - const spliceIndex = interpolatedPoints.findIndex( - (point2) => point2.x === this.smoothingCordsArray[2].x && point2.y === this.smoothingCordsArray[2].y - ); - if (spliceIndex !== -1) { - interpolatedPoints = interpolatedPoints.slice(spliceIndex + 1); - } - } - for (const point2 of interpolatedPoints) { - this.draw_shape(point2, interpolatedOpacity); - } - if (!this.initialDraw) { - this.smoothingCordsArray = this.smoothingCordsArray.slice(2); - } else { - this.initialDraw = false; - } - } - async drawLine(p1, p2, compositionOp) { - const brush_size = await this.messageBroker.pull("brushSize"); - const distance = Math.sqrt((p2.x - p1.x) ** 2 + (p2.y - p1.y) ** 2); - const steps = Math.ceil( - distance / (brush_size / this.smoothingPrecision * 4) - ); - const interpolatedOpacity = 1 / (1 + Math.exp(-6 * (this.brushSettings.opacity - 0.5))) - 1 / (1 + Math.exp(3)); - this.init_shape(compositionOp); - for (let i = 0; i <= steps; i++) { - const t2 = i / steps; - const x = p1.x + (p2.x - p1.x) * t2; - const y = p1.y + (p2.y - p1.y) * t2; - const point = { x, y }; - this.draw_shape(point, interpolatedOpacity); - } - } - //brush adjustment - async startBrushAdjustment(event) { - event.preventDefault(); - const coords = { x: event.offsetX, y: event.offsetY }; - let coords_canvas = await this.messageBroker.pull("screenToCanvas", coords); - this.messageBroker.publish("setBrushPreviewGradientVisibility", true); - this.initialPoint = coords_canvas; - this.isBrushAdjusting = true; - return; - } - async handleBrushAdjustment(event) { - const coords = { x: event.offsetX, y: event.offsetY }; - const brushDeadZone = 5; - let coords_canvas = await this.messageBroker.pull("screenToCanvas", coords); - const delta_x = coords_canvas.x - this.initialPoint.x; - const delta_y = coords_canvas.y - this.initialPoint.y; - const effectiveDeltaX = Math.abs(delta_x) < brushDeadZone ? 0 : delta_x; - const effectiveDeltaY = Math.abs(delta_y) < brushDeadZone ? 0 : delta_y; - let finalDeltaX = effectiveDeltaX; - let finalDeltaY = effectiveDeltaY; - console.log(this.useDominantAxis); - if (this.useDominantAxis) { - const ratio = Math.abs(effectiveDeltaX) / Math.abs(effectiveDeltaY); - const threshold = 2; - if (ratio > threshold) { - finalDeltaY = 0; - } else if (ratio < 1 / threshold) { - finalDeltaX = 0; - } - } - const cappedDeltaX = Math.max(-100, Math.min(100, finalDeltaX)); - const cappedDeltaY = Math.max(-100, Math.min(100, finalDeltaY)); - const sizeDelta = cappedDeltaX / 40; - const hardnessDelta = cappedDeltaY / 800; - const newSize = Math.max( - 1, - Math.min( - 100, - this.brushSettings.size + cappedDeltaX / 35 * this.brushAdjustmentSpeed - ) - ); - const newHardness = Math.max( - 0, - Math.min( - 1, - this.brushSettings.hardness - cappedDeltaY / 4e3 * this.brushAdjustmentSpeed - ) - ); - this.brushSettings.size = newSize; - this.brushSettings.hardness = newHardness; - this.messageBroker.publish("updateBrushPreview"); - } - //helper functions - async draw_shape(point, overrideOpacity) { - const brushSettings = this.brushSettings; - const maskCtx = this.maskCtx || await this.messageBroker.pull("maskCtx"); - const brushType = await this.messageBroker.pull("brushType"); - const maskColor = await this.messageBroker.pull("getMaskColor"); - const size = brushSettings.size; - const sliderOpacity = brushSettings.opacity; - const opacity = overrideOpacity == void 0 ? sliderOpacity : overrideOpacity; - const hardness = brushSettings.hardness; - const x = point.x; - const y = point.y; - const extendedSize = size * (2 - hardness); - let gradient = maskCtx.createRadialGradient(x, y, 0, x, y, extendedSize); - const isErasing = maskCtx.globalCompositeOperation === "destination-out"; - if (hardness === 1) { - console.log(sliderOpacity, opacity); - gradient.addColorStop( - 0, - isErasing ? `rgba(255, 255, 255, ${opacity})` : `rgba(${maskColor.r}, ${maskColor.g}, ${maskColor.b}, ${opacity})` - ); - gradient.addColorStop( - 1, - isErasing ? `rgba(255, 255, 255, ${opacity})` : `rgba(${maskColor.r}, ${maskColor.g}, ${maskColor.b}, ${opacity})` - ); - } else { - let softness = 1 - hardness; - let innerStop = Math.max(0, hardness - softness); - let outerStop = size / extendedSize; - if (isErasing) { - gradient.addColorStop(0, `rgba(255, 255, 255, ${opacity})`); - gradient.addColorStop(innerStop, `rgba(255, 255, 255, ${opacity})`); - gradient.addColorStop(outerStop, `rgba(255, 255, 255, ${opacity / 2})`); - gradient.addColorStop(1, `rgba(255, 255, 255, 0)`); - } else { - gradient.addColorStop( - 0, - `rgba(${maskColor.r}, ${maskColor.g}, ${maskColor.b}, ${opacity})` - ); - gradient.addColorStop( - innerStop, - `rgba(${maskColor.r}, ${maskColor.g}, ${maskColor.b}, ${opacity})` - ); - gradient.addColorStop( - outerStop, - `rgba(${maskColor.r}, ${maskColor.g}, ${maskColor.b}, ${opacity / 2})` - ); - gradient.addColorStop( - 1, - `rgba(${maskColor.r}, ${maskColor.g}, ${maskColor.b}, 0)` - ); - } - } - maskCtx.fillStyle = gradient; - maskCtx.beginPath(); - if (brushType === "rect") { - maskCtx.rect( - x - extendedSize, - y - extendedSize, - extendedSize * 2, - extendedSize * 2 - ); - } else { - maskCtx.arc(x, y, extendedSize, 0, Math.PI * 2, false); - } - maskCtx.fill(); - } - async init_shape(compositionOperation) { - const maskBlendMode = await this.messageBroker.pull("maskBlendMode"); - const maskCtx = this.maskCtx || await this.messageBroker.pull("maskCtx"); - maskCtx.beginPath(); - if (compositionOperation == "source-over") { - maskCtx.fillStyle = maskBlendMode; - maskCtx.globalCompositeOperation = "source-over"; - } else if (compositionOperation == "destination-out") { - maskCtx.globalCompositeOperation = "destination-out"; - } - } - calculateCubicSplinePoints(points, numSegments = 10) { - const result = []; - const xCoords = points.map((p) => p.x); - const yCoords = points.map((p) => p.y); - const xDerivatives = this.calculateSplineCoefficients(xCoords); - const yDerivatives = this.calculateSplineCoefficients(yCoords); - for (let i = 0; i < points.length - 1; i++) { - const p0 = points[i]; - const p1 = points[i + 1]; - const d0x = xDerivatives[i]; - const d1x = xDerivatives[i + 1]; - const d0y = yDerivatives[i]; - const d1y = yDerivatives[i + 1]; - for (let t2 = 0; t2 <= numSegments; t2++) { - const t_normalized = t2 / numSegments; - const h00 = 2 * t_normalized ** 3 - 3 * t_normalized ** 2 + 1; - const h10 = t_normalized ** 3 - 2 * t_normalized ** 2 + t_normalized; - const h01 = -2 * t_normalized ** 3 + 3 * t_normalized ** 2; - const h11 = t_normalized ** 3 - t_normalized ** 2; - const x = h00 * p0.x + h10 * d0x + h01 * p1.x + h11 * d1x; - const y = h00 * p0.y + h10 * d0y + h01 * p1.y + h11 * d1y; - result.push({ x, y }); - } - } - return result; - } - generateEvenlyDistributedPoints(splinePoints, numPoints) { - const distances = [0]; - for (let i = 1; i < splinePoints.length; i++) { - const dx = splinePoints[i].x - splinePoints[i - 1].x; - const dy = splinePoints[i].y - splinePoints[i - 1].y; - const dist = Math.hypot(dx, dy); - distances.push(distances[i - 1] + dist); - } - const totalLength = distances[distances.length - 1]; - const interval = totalLength / (numPoints - 1); - const result = []; - let currentIndex = 0; - for (let i = 0; i < numPoints; i++) { - const targetDistance = i * interval; - while (currentIndex < distances.length - 1 && distances[currentIndex + 1] < targetDistance) { - currentIndex++; - } - const t2 = (targetDistance - distances[currentIndex]) / (distances[currentIndex + 1] - distances[currentIndex]); - const x = splinePoints[currentIndex].x + t2 * (splinePoints[currentIndex + 1].x - splinePoints[currentIndex].x); - const y = splinePoints[currentIndex].y + t2 * (splinePoints[currentIndex + 1].y - splinePoints[currentIndex].y); - result.push({ x, y }); - } - return result; - } - generateEquidistantPoints(points, distance) { - const result = []; - const cumulativeDistances = [0]; - for (let i = 1; i < points.length; i++) { - const dx = points[i].x - points[i - 1].x; - const dy = points[i].y - points[i - 1].y; - const dist = Math.hypot(dx, dy); - cumulativeDistances[i] = cumulativeDistances[i - 1] + dist; - } - const totalLength = cumulativeDistances[cumulativeDistances.length - 1]; - const numPoints = Math.floor(totalLength / distance); - for (let i = 0; i <= numPoints; i++) { - const targetDistance = i * distance; - let idx = 0; - while (idx < cumulativeDistances.length - 1 && cumulativeDistances[idx + 1] < targetDistance) { - idx++; - } - if (idx >= points.length - 1) { - result.push(points[points.length - 1]); - continue; - } - const d0 = cumulativeDistances[idx]; - const d1 = cumulativeDistances[idx + 1]; - const t2 = (targetDistance - d0) / (d1 - d0); - const x = points[idx].x + t2 * (points[idx + 1].x - points[idx].x); - const y = points[idx].y + t2 * (points[idx + 1].y - points[idx].y); - result.push({ x, y }); - } - return result; - } - calculateSplineCoefficients(values) { - const n = values.length - 1; - const matrix = new Array(n + 1).fill(0).map(() => new Array(n + 1).fill(0)); - const rhs = new Array(n + 1).fill(0); - for (let i = 1; i < n; i++) { - matrix[i][i - 1] = 1; - matrix[i][i] = 4; - matrix[i][i + 1] = 1; - rhs[i] = 3 * (values[i + 1] - values[i - 1]); - } - matrix[0][0] = 2; - matrix[0][1] = 1; - matrix[n][n - 1] = 1; - matrix[n][n] = 2; - rhs[0] = 3 * (values[1] - values[0]); - rhs[n] = 3 * (values[n] - values[n - 1]); - for (let i = 1; i <= n; i++) { - const m = matrix[i][i - 1] / matrix[i - 1][i - 1]; - matrix[i][i] -= m * matrix[i - 1][i]; - rhs[i] -= m * rhs[i - 1]; - } - const solution = new Array(n + 1); - solution[n] = rhs[n] / matrix[n][n]; - for (let i = n - 1; i >= 0; i--) { - solution[i] = (rhs[i] - matrix[i][i + 1] * solution[i + 1]) / matrix[i][i]; - } - return solution; - } - setBrushSize(size) { - this.brushSettings.size = size; - } - setBrushOpacity(opacity) { - this.brushSettings.opacity = opacity; - } - setBrushHardness(hardness) { - this.brushSettings.hardness = hardness; - } - setBrushType(type) { - this.brushSettings.type = type; - } - setBrushSmoothingPrecision(precision) { - this.smoothingPrecision = precision; - } -} -class UIManager { - static { - __name(this, "UIManager"); - } - rootElement; - brush; - brushPreviewGradient; - maskCtx; - imageCtx; - maskCanvas; - imgCanvas; - brushSettingsHTML; - paintBucketSettingsHTML; - colorSelectSettingsHTML; - maskOpacitySlider; - brushHardnessSlider; - brushSizeSlider; - brushOpacitySlider; - sidebarImage; - saveButton; - toolPanel; - sidePanel; - pointerZone; - canvasBackground; - canvasContainer; - image; - imageURL; - darkMode = true; - maskEditor; - messageBroker; - mask_opacity = 1; - maskBlendMode = "black"; - zoomTextHTML; - dimensionsTextHTML; - constructor(rootElement, maskEditor) { - this.rootElement = rootElement; - this.maskEditor = maskEditor; - this.messageBroker = maskEditor.getMessageBroker(); - this.addListeners(); - this.addPullTopics(); - } - addListeners() { - this.messageBroker.subscribe( - "updateBrushPreview", - async () => this.updateBrushPreview() - ); - this.messageBroker.subscribe( - "paintBucketCursor", - (isPaintBucket) => this.handlePaintBucketCursor(isPaintBucket) - ); - this.messageBroker.subscribe( - "panCursor", - (isPan) => this.handlePanCursor(isPan) - ); - this.messageBroker.subscribe( - "setBrushVisibility", - (isVisible) => this.setBrushVisibility(isVisible) - ); - this.messageBroker.subscribe( - "setBrushPreviewGradientVisibility", - (isVisible) => this.setBrushPreviewGradientVisibility(isVisible) - ); - this.messageBroker.subscribe("updateCursor", () => this.updateCursor()); - this.messageBroker.subscribe( - "setZoomText", - (text) => this.setZoomText(text) - ); - } - addPullTopics() { - this.messageBroker.createPullTopic( - "maskCanvas", - async () => this.maskCanvas - ); - this.messageBroker.createPullTopic("maskCtx", async () => this.maskCtx); - this.messageBroker.createPullTopic("imageCtx", async () => this.imageCtx); - this.messageBroker.createPullTopic("imgCanvas", async () => this.imgCanvas); - this.messageBroker.createPullTopic( - "screenToCanvas", - async (coords) => this.screenToCanvas(coords) - ); - this.messageBroker.createPullTopic( - "getCanvasContainer", - async () => this.canvasContainer - ); - this.messageBroker.createPullTopic( - "getMaskColor", - async () => this.getMaskColor() - ); - } - async setlayout() { - this.detectLightMode(); - var user_ui = await this.createUI(); - var canvasContainer = this.createBackgroundUI(); - var brush = await this.createBrush(); - await this.setBrushBorderRadius(); - this.setBrushOpacity(1); - this.rootElement.appendChild(canvasContainer); - this.rootElement.appendChild(user_ui); - document.body.appendChild(brush); - } - async createUI() { - var ui_container = document.createElement("div"); - ui_container.id = "maskEditor_uiContainer"; - var top_bar = await this.createTopBar(); - var ui_horizontal_container = document.createElement("div"); - ui_horizontal_container.id = "maskEditor_uiHorizontalContainer"; - var side_panel_container = await this.createSidePanel(); - var pointer_zone = this.createPointerZone(); - var tool_panel = this.createToolPanel(); - ui_horizontal_container.appendChild(tool_panel); - ui_horizontal_container.appendChild(pointer_zone); - ui_horizontal_container.appendChild(side_panel_container); - ui_container.appendChild(top_bar); - ui_container.appendChild(ui_horizontal_container); - return ui_container; - } - createBackgroundUI() { - const canvasContainer = document.createElement("div"); - canvasContainer.id = "maskEditorCanvasContainer"; - const imgCanvas = document.createElement("canvas"); - imgCanvas.id = "imageCanvas"; - const maskCanvas = document.createElement("canvas"); - maskCanvas.id = "maskCanvas"; - const canvas_background = document.createElement("div"); - canvas_background.id = "canvasBackground"; - canvasContainer.appendChild(imgCanvas); - canvasContainer.appendChild(maskCanvas); - canvasContainer.appendChild(canvas_background); - this.imgCanvas = imgCanvas; - this.maskCanvas = maskCanvas; - this.canvasContainer = canvasContainer; - this.canvasBackground = canvas_background; - let maskCtx = maskCanvas.getContext("2d", { willReadFrequently: true }); - if (maskCtx) { - this.maskCtx = maskCtx; - } - let imgCtx = imgCanvas.getContext("2d", { willReadFrequently: true }); - if (imgCtx) { - this.imageCtx = imgCtx; - } - this.setEventHandler(); - this.imgCanvas.style.position = "absolute"; - this.maskCanvas.style.position = "absolute"; - this.imgCanvas.style.top = "200"; - this.imgCanvas.style.left = "0"; - this.maskCanvas.style.top = this.imgCanvas.style.top; - this.maskCanvas.style.left = this.imgCanvas.style.left; - const maskCanvasStyle = this.getMaskCanvasStyle(); - this.maskCanvas.style.mixBlendMode = maskCanvasStyle.mixBlendMode; - this.maskCanvas.style.opacity = maskCanvasStyle.opacity.toString(); - return canvasContainer; - } - async setBrushBorderRadius() { - const brushSettings = await this.messageBroker.pull("brushSettings"); - if (brushSettings.type === "rect") { - this.brush.style.borderRadius = "0%"; - this.brush.style.MozBorderRadius = "0%"; - this.brush.style.WebkitBorderRadius = "0%"; - } else { - this.brush.style.borderRadius = "50%"; - this.brush.style.MozBorderRadius = "50%"; - this.brush.style.WebkitBorderRadius = "50%"; - } - } - async initUI() { - this.saveButton.innerText = "Save"; - this.saveButton.disabled = false; - await this.setImages(this.imgCanvas); - } - async createSidePanel() { - const side_panel = this.createContainer(true); - side_panel.id = "maskEditor_sidePanel"; - const brush_settings = await this.createBrushSettings(); - brush_settings.id = "maskEditor_brushSettings"; - this.brushSettingsHTML = brush_settings; - const paint_bucket_settings = await this.createPaintBucketSettings(); - paint_bucket_settings.id = "maskEditor_paintBucketSettings"; - this.paintBucketSettingsHTML = paint_bucket_settings; - const color_select_settings = await this.createColorSelectSettings(); - color_select_settings.id = "maskEditor_colorSelectSettings"; - this.colorSelectSettingsHTML = color_select_settings; - const image_layer_settings = await this.createImageLayerSettings(); - const separator = this.createSeparator(); - side_panel.appendChild(brush_settings); - side_panel.appendChild(paint_bucket_settings); - side_panel.appendChild(color_select_settings); - side_panel.appendChild(separator); - side_panel.appendChild(image_layer_settings); - return side_panel; - } - async createBrushSettings() { - const shapeColor = this.darkMode ? "maskEditor_brushShape_dark" : "maskEditor_brushShape_light"; - const brush_settings_container = this.createContainer(true); - const brush_settings_title = this.createHeadline("Brush Settings"); - const brush_shape_outer_container = this.createContainer(true); - const brush_shape_title = this.createContainerTitle("Brush Shape"); - const brush_shape_container = this.createContainer(false); - const accentColor = this.darkMode ? "maskEditor_accent_bg_dark" : "maskEditor_accent_bg_light"; - brush_shape_container.classList.add(accentColor); - brush_shape_container.classList.add("maskEditor_layerRow"); - const circle_shape = document.createElement("div"); - circle_shape.id = "maskEditor_sidePanelBrushShapeCircle"; - circle_shape.classList.add(shapeColor); - circle_shape.style.background = "var(--p-button-text-primary-color)"; - circle_shape.addEventListener("click", () => { - this.messageBroker.publish( - "setBrushShape", - "arc" - /* Arc */ - ); - this.setBrushBorderRadius(); - circle_shape.style.background = "var(--p-button-text-primary-color)"; - square_shape.style.background = ""; - }); - const square_shape = document.createElement("div"); - square_shape.id = "maskEditor_sidePanelBrushShapeSquare"; - square_shape.classList.add(shapeColor); - square_shape.style.background = ""; - square_shape.addEventListener("click", () => { - this.messageBroker.publish( - "setBrushShape", - "rect" - /* Rect */ - ); - this.setBrushBorderRadius(); - square_shape.style.background = "var(--p-button-text-primary-color)"; - circle_shape.style.background = ""; - }); - brush_shape_container.appendChild(circle_shape); - brush_shape_container.appendChild(square_shape); - brush_shape_outer_container.appendChild(brush_shape_title); - brush_shape_outer_container.appendChild(brush_shape_container); - const thicknesSliderObj = this.createSlider( - "Thickness", - 1, - 100, - 1, - 10, - (event, value) => { - this.messageBroker.publish("setBrushSize", parseInt(value)); - this.updateBrushPreview(); - } - ); - this.brushSizeSlider = thicknesSliderObj.slider; - const opacitySliderObj = this.createSlider( - "Opacity", - 0, - 1, - 0.01, - 0.7, - (event, value) => { - this.messageBroker.publish("setBrushOpacity", parseFloat(value)); - this.updateBrushPreview(); - } - ); - this.brushOpacitySlider = opacitySliderObj.slider; - const hardnessSliderObj = this.createSlider( - "Hardness", - 0, - 1, - 0.01, - 1, - (event, value) => { - this.messageBroker.publish("setBrushHardness", parseFloat(value)); - this.updateBrushPreview(); - } - ); - this.brushHardnessSlider = hardnessSliderObj.slider; - const brushSmoothingPrecisionSliderObj = this.createSlider( - "Smoothing Precision", - 1, - 100, - 1, - 10, - (event, value) => { - this.messageBroker.publish( - "setBrushSmoothingPrecision", - parseInt(value) - ); - } - ); - brush_settings_container.appendChild(brush_settings_title); - brush_settings_container.appendChild(brush_shape_outer_container); - brush_settings_container.appendChild(thicknesSliderObj.container); - brush_settings_container.appendChild(opacitySliderObj.container); - brush_settings_container.appendChild(hardnessSliderObj.container); - brush_settings_container.appendChild( - brushSmoothingPrecisionSliderObj.container - ); - return brush_settings_container; - } - async createPaintBucketSettings() { - const paint_bucket_settings_container = this.createContainer(true); - const paint_bucket_settings_title = this.createHeadline( - "Paint Bucket Settings" - ); - const tolerance = await this.messageBroker.pull("getTolerance"); - const paintBucketToleranceSliderObj = this.createSlider( - "Tolerance", - 0, - 255, - 1, - tolerance, - (event, value) => { - this.messageBroker.publish("setPaintBucketTolerance", parseInt(value)); - } - ); - paint_bucket_settings_container.appendChild(paint_bucket_settings_title); - paint_bucket_settings_container.appendChild( - paintBucketToleranceSliderObj.container - ); - return paint_bucket_settings_container; - } - async createColorSelectSettings() { - const color_select_settings_container = this.createContainer(true); - const color_select_settings_title = this.createHeadline( - "Color Select Settings" - ); - var tolerance = await this.messageBroker.pull("getTolerance"); - const colorSelectToleranceSliderObj = this.createSlider( - "Tolerance", - 0, - 255, - 1, - tolerance, - (event, value) => { - this.messageBroker.publish("setColorSelectTolerance", parseInt(value)); - } - ); - const livePreviewToggle = this.createToggle( - "Live Preview", - (event, value) => { - this.messageBroker.publish("setLivePreview", value); - } - ); - const wholeImageToggle = this.createToggle( - "Apply to Whole Image", - (event, value) => { - this.messageBroker.publish("setWholeImage", value); - } - ); - const methodOptions = Object.values(ColorComparisonMethod); - const methodSelect = this.createDropdown( - "Method", - methodOptions, - (event, value) => { - this.messageBroker.publish("setColorComparisonMethod", value); - } - ); - const maskBoundaryToggle = this.createToggle( - "Stop at mask", - (event, value) => { - this.messageBroker.publish("setMaskBoundary", value); - } - ); - const maskToleranceSliderObj = this.createSlider( - "Mask Tolerance", - 0, - 255, - 1, - 0, - (event, value) => { - this.messageBroker.publish("setMaskTolerance", parseInt(value)); - } - ); - color_select_settings_container.appendChild(color_select_settings_title); - color_select_settings_container.appendChild( - colorSelectToleranceSliderObj.container - ); - color_select_settings_container.appendChild(livePreviewToggle); - color_select_settings_container.appendChild(wholeImageToggle); - color_select_settings_container.appendChild(methodSelect); - color_select_settings_container.appendChild(maskBoundaryToggle); - color_select_settings_container.appendChild( - maskToleranceSliderObj.container - ); - return color_select_settings_container; - } - async createImageLayerSettings() { - const accentColor = this.darkMode ? "maskEditor_accent_bg_dark" : "maskEditor_accent_bg_light"; - const image_layer_settings_container = this.createContainer(true); - const image_layer_settings_title = this.createHeadline("Layers"); - const mask_layer_title = this.createContainerTitle("Mask Layer"); - const mask_layer_container = this.createContainer(false); - mask_layer_container.classList.add(accentColor); - mask_layer_container.classList.add("maskEditor_layerRow"); - const mask_layer_visibility_checkbox = document.createElement("input"); - mask_layer_visibility_checkbox.setAttribute("type", "checkbox"); - mask_layer_visibility_checkbox.checked = true; - mask_layer_visibility_checkbox.classList.add( - "maskEditor_sidePanelLayerCheckbox" - ); - mask_layer_visibility_checkbox.addEventListener("change", (event) => { - if (!event.target.checked) { - this.maskCanvas.style.opacity = "0"; - } else { - this.maskCanvas.style.opacity = String(this.mask_opacity); - } - }); - var mask_layer_image_container = document.createElement("div"); - mask_layer_image_container.classList.add( - "maskEditor_sidePanelLayerPreviewContainer" - ); - mask_layer_image_container.innerHTML = ' '; - var blending_options = ["black", "white", "negative"]; - const sidePanelDropdownAccent = this.darkMode ? "maskEditor_sidePanelDropdown_dark" : "maskEditor_sidePanelDropdown_light"; - var mask_layer_dropdown = document.createElement("select"); - mask_layer_dropdown.classList.add(sidePanelDropdownAccent); - mask_layer_dropdown.classList.add(sidePanelDropdownAccent); - blending_options.forEach((option) => { - var option_element = document.createElement("option"); - option_element.value = option; - option_element.innerText = option; - mask_layer_dropdown.appendChild(option_element); - if (option == this.maskBlendMode) { - option_element.selected = true; - } - }); - mask_layer_dropdown.addEventListener("change", (event) => { - const selectedValue = event.target.value; - this.maskBlendMode = selectedValue; - this.updateMaskColor(); - }); - mask_layer_container.appendChild(mask_layer_visibility_checkbox); - mask_layer_container.appendChild(mask_layer_image_container); - mask_layer_container.appendChild(mask_layer_dropdown); - const mask_layer_opacity_sliderObj = this.createSlider( - "Mask Opacity", - 0, - 1, - 0.01, - this.mask_opacity, - (event, value) => { - this.mask_opacity = parseFloat(value); - this.maskCanvas.style.opacity = String(this.mask_opacity); - if (this.mask_opacity == 0) { - mask_layer_visibility_checkbox.checked = false; - } else { - mask_layer_visibility_checkbox.checked = true; - } - } - ); - this.maskOpacitySlider = mask_layer_opacity_sliderObj.slider; - const image_layer_title = this.createContainerTitle("Image Layer"); - const image_layer_container = this.createContainer(false); - image_layer_container.classList.add(accentColor); - image_layer_container.classList.add("maskEditor_layerRow"); - const image_layer_visibility_checkbox = document.createElement("input"); - image_layer_visibility_checkbox.setAttribute("type", "checkbox"); - image_layer_visibility_checkbox.classList.add( - "maskEditor_sidePanelLayerCheckbox" - ); - image_layer_visibility_checkbox.checked = true; - image_layer_visibility_checkbox.addEventListener("change", (event) => { - if (!event.target.checked) { - this.imgCanvas.style.opacity = "0"; - } else { - this.imgCanvas.style.opacity = "1"; - } - }); - const image_layer_image_container = document.createElement("div"); - image_layer_image_container.classList.add( - "maskEditor_sidePanelLayerPreviewContainer" - ); - const image_layer_image = document.createElement("img"); - image_layer_image.id = "maskEditor_sidePanelImageLayerImage"; - image_layer_image.src = ComfyApp.clipspace?.imgs?.[ComfyApp.clipspace?.selectedIndex ?? 0]?.src ?? ""; - this.sidebarImage = image_layer_image; - image_layer_image_container.appendChild(image_layer_image); - image_layer_container.appendChild(image_layer_visibility_checkbox); - image_layer_container.appendChild(image_layer_image_container); - image_layer_settings_container.appendChild(image_layer_settings_title); - image_layer_settings_container.appendChild(mask_layer_title); - image_layer_settings_container.appendChild(mask_layer_container); - image_layer_settings_container.appendChild( - mask_layer_opacity_sliderObj.container - ); - image_layer_settings_container.appendChild(image_layer_title); - image_layer_settings_container.appendChild(image_layer_container); - return image_layer_settings_container; - } - createHeadline(title) { - var headline = document.createElement("h3"); - headline.classList.add("maskEditor_sidePanelTitle"); - headline.innerText = title; - return headline; - } - createContainer(flexDirection) { - var container = document.createElement("div"); - if (flexDirection) { - container.classList.add("maskEditor_sidePanelContainerColumn"); - } else { - container.classList.add("maskEditor_sidePanelContainerRow"); - } - return container; - } - createContainerTitle(title) { - var container_title = document.createElement("span"); - container_title.classList.add("maskEditor_sidePanelSubTitle"); - container_title.innerText = title; - return container_title; - } - createSlider(title, min, max2, step, value, callback) { - var slider_container = this.createContainer(true); - var slider_title = this.createContainerTitle(title); - var slider = document.createElement("input"); - slider.classList.add("maskEditor_sidePanelBrushRange"); - slider.setAttribute("type", "range"); - slider.setAttribute("min", String(min)); - slider.setAttribute("max", String(max2)); - slider.setAttribute("step", String(step)); - slider.setAttribute("value", String(value)); - slider.addEventListener("input", (event) => { - callback(event, event.target.value); - }); - slider_container.appendChild(slider_title); - slider_container.appendChild(slider); - return { container: slider_container, slider }; - } - createToggle(title, callback) { - var outer_Container = this.createContainer(false); - var toggle_title = this.createContainerTitle(title); - var toggle_container = document.createElement("label"); - toggle_container.classList.add("maskEditor_sidePanelToggleContainer"); - var toggle_checkbox = document.createElement("input"); - toggle_checkbox.setAttribute("type", "checkbox"); - toggle_checkbox.classList.add("maskEditor_sidePanelToggleCheckbox"); - toggle_checkbox.addEventListener("change", (event) => { - callback(event, event.target.checked); - }); - var toggleAccentColor = this.darkMode ? "maskEditor_toggle_bg_dark" : "maskEditor_toggle_bg_light"; - var toggle_switch = document.createElement("div"); - toggle_switch.classList.add("maskEditor_sidePanelToggleSwitch"); - toggle_switch.classList.add(toggleAccentColor); - toggle_container.appendChild(toggle_checkbox); - toggle_container.appendChild(toggle_switch); - outer_Container.appendChild(toggle_title); - outer_Container.appendChild(toggle_container); - return outer_Container; - } - createDropdown(title, options, callback) { - const sidePanelDropdownAccent = this.darkMode ? "maskEditor_sidePanelDropdown_dark" : "maskEditor_sidePanelDropdown_light"; - var dropdown_container = this.createContainer(false); - var dropdown_title = this.createContainerTitle(title); - var dropdown = document.createElement("select"); - dropdown.classList.add(sidePanelDropdownAccent); - dropdown.classList.add("maskEditor_containerDropdown"); - options.forEach((option) => { - var option_element = document.createElement("option"); - option_element.value = option; - option_element.innerText = option; - dropdown.appendChild(option_element); - }); - dropdown.addEventListener("change", (event) => { - callback(event, event.target.value); - }); - dropdown_container.appendChild(dropdown_title); - dropdown_container.appendChild(dropdown); - return dropdown_container; - } - createSeparator() { - var separator = document.createElement("div"); - separator.classList.add("maskEditor_sidePanelSeparator"); - return separator; - } - //---------------- - async createTopBar() { - const buttonAccentColor = this.darkMode ? "maskEditor_topPanelButton_dark" : "maskEditor_topPanelButton_light"; - const iconButtonAccentColor = this.darkMode ? "maskEditor_topPanelIconButton_dark" : "maskEditor_topPanelIconButton_light"; - var top_bar = document.createElement("div"); - top_bar.id = "maskEditor_topBar"; - var top_bar_title_container = document.createElement("div"); - top_bar_title_container.id = "maskEditor_topBarTitleContainer"; - var top_bar_title = document.createElement("h1"); - top_bar_title.id = "maskEditor_topBarTitle"; - top_bar_title.innerText = "ComfyUI"; - top_bar_title_container.appendChild(top_bar_title); - var top_bar_shortcuts_container = document.createElement("div"); - top_bar_shortcuts_container.id = "maskEditor_topBarShortcutsContainer"; - var top_bar_undo_button = document.createElement("div"); - top_bar_undo_button.id = "maskEditor_topBarUndoButton"; - top_bar_undo_button.classList.add(iconButtonAccentColor); - top_bar_undo_button.innerHTML = ' '; - top_bar_undo_button.addEventListener("click", () => { - this.messageBroker.publish("undo"); - }); - var top_bar_redo_button = document.createElement("div"); - top_bar_redo_button.id = "maskEditor_topBarRedoButton"; - top_bar_redo_button.classList.add(iconButtonAccentColor); - top_bar_redo_button.innerHTML = ' '; - top_bar_redo_button.addEventListener("click", () => { - this.messageBroker.publish("redo"); - }); - var top_bar_invert_button = document.createElement("button"); - top_bar_invert_button.id = "maskEditor_topBarInvertButton"; - top_bar_invert_button.classList.add(buttonAccentColor); - top_bar_invert_button.innerText = "Invert"; - top_bar_invert_button.addEventListener("click", () => { - this.messageBroker.publish("invert"); - }); - var top_bar_clear_button = document.createElement("button"); - top_bar_clear_button.id = "maskEditor_topBarClearButton"; - top_bar_clear_button.classList.add(buttonAccentColor); - top_bar_clear_button.innerText = "Clear"; - top_bar_clear_button.addEventListener("click", () => { - this.maskCtx.clearRect( - 0, - 0, - this.maskCanvas.width, - this.maskCanvas.height - ); - this.messageBroker.publish("saveState"); - }); - var top_bar_save_button = document.createElement("button"); - top_bar_save_button.id = "maskEditor_topBarSaveButton"; - top_bar_save_button.classList.add(buttonAccentColor); - top_bar_save_button.innerText = "Save"; - this.saveButton = top_bar_save_button; - top_bar_save_button.addEventListener("click", () => { - this.maskEditor.save(); - }); - var top_bar_cancel_button = document.createElement("button"); - top_bar_cancel_button.id = "maskEditor_topBarCancelButton"; - top_bar_cancel_button.classList.add(buttonAccentColor); - top_bar_cancel_button.innerText = "Cancel"; - top_bar_cancel_button.addEventListener("click", () => { - this.maskEditor.close(); - }); - top_bar_shortcuts_container.appendChild(top_bar_undo_button); - top_bar_shortcuts_container.appendChild(top_bar_redo_button); - top_bar_shortcuts_container.appendChild(top_bar_invert_button); - top_bar_shortcuts_container.appendChild(top_bar_clear_button); - top_bar_shortcuts_container.appendChild(top_bar_save_button); - top_bar_shortcuts_container.appendChild(top_bar_cancel_button); - top_bar.appendChild(top_bar_title_container); - top_bar.appendChild(top_bar_shortcuts_container); - return top_bar; - } - createToolPanel() { - var tool_panel = document.createElement("div"); - tool_panel.id = "maskEditor_toolPanel"; - this.toolPanel = tool_panel; - var toolPanelHoverAccent = this.darkMode ? "maskEditor_toolPanelContainerDark" : "maskEditor_toolPanelContainerLight"; - var toolElements = []; - var toolPanel_brushToolContainer = document.createElement("div"); - toolPanel_brushToolContainer.classList.add("maskEditor_toolPanelContainer"); - toolPanel_brushToolContainer.classList.add( - "maskEditor_toolPanelContainerSelected" - ); - toolPanel_brushToolContainer.classList.add(toolPanelHoverAccent); - toolPanel_brushToolContainer.innerHTML = ` - - - - - `; - toolElements.push(toolPanel_brushToolContainer); - toolPanel_brushToolContainer.addEventListener("click", () => { - this.messageBroker.publish( - "setTool", - "pen" - /* Pen */ - ); - for (let toolElement of toolElements) { - if (toolElement != toolPanel_brushToolContainer) { - toolElement.classList.remove("maskEditor_toolPanelContainerSelected"); - } else { - toolElement.classList.add("maskEditor_toolPanelContainerSelected"); - this.brushSettingsHTML.style.display = "flex"; - this.colorSelectSettingsHTML.style.display = "none"; - this.paintBucketSettingsHTML.style.display = "none"; - } - } - this.messageBroker.publish( - "setTool", - "pen" - /* Pen */ - ); - this.pointerZone.style.cursor = "none"; - }); - var toolPanel_brushToolIndicator = document.createElement("div"); - toolPanel_brushToolIndicator.classList.add("maskEditor_toolPanelIndicator"); - toolPanel_brushToolContainer.appendChild(toolPanel_brushToolIndicator); - var toolPanel_eraserToolContainer = document.createElement("div"); - toolPanel_eraserToolContainer.classList.add("maskEditor_toolPanelContainer"); - toolPanel_eraserToolContainer.classList.add(toolPanelHoverAccent); - toolPanel_eraserToolContainer.innerHTML = ` - - - - - - - - `; - toolElements.push(toolPanel_eraserToolContainer); - toolPanel_eraserToolContainer.addEventListener("click", () => { - this.messageBroker.publish( - "setTool", - "eraser" - /* Eraser */ - ); - for (let toolElement of toolElements) { - if (toolElement != toolPanel_eraserToolContainer) { - toolElement.classList.remove("maskEditor_toolPanelContainerSelected"); - } else { - toolElement.classList.add("maskEditor_toolPanelContainerSelected"); - this.brushSettingsHTML.style.display = "flex"; - this.colorSelectSettingsHTML.style.display = "none"; - this.paintBucketSettingsHTML.style.display = "none"; - } - } - this.messageBroker.publish( - "setTool", - "eraser" - /* Eraser */ - ); - this.pointerZone.style.cursor = "none"; - }); - var toolPanel_eraserToolIndicator = document.createElement("div"); - toolPanel_eraserToolIndicator.classList.add("maskEditor_toolPanelIndicator"); - toolPanel_eraserToolContainer.appendChild(toolPanel_eraserToolIndicator); - var toolPanel_paintBucketToolContainer = document.createElement("div"); - toolPanel_paintBucketToolContainer.classList.add( - "maskEditor_toolPanelContainer" - ); - toolPanel_paintBucketToolContainer.classList.add(toolPanelHoverAccent); - toolPanel_paintBucketToolContainer.innerHTML = ` - - - - - - `; - toolElements.push(toolPanel_paintBucketToolContainer); - toolPanel_paintBucketToolContainer.addEventListener("click", () => { - this.messageBroker.publish( - "setTool", - "paintBucket" - /* PaintBucket */ - ); - for (let toolElement of toolElements) { - if (toolElement != toolPanel_paintBucketToolContainer) { - toolElement.classList.remove("maskEditor_toolPanelContainerSelected"); - } else { - toolElement.classList.add("maskEditor_toolPanelContainerSelected"); - this.brushSettingsHTML.style.display = "none"; - this.colorSelectSettingsHTML.style.display = "none"; - this.paintBucketSettingsHTML.style.display = "flex"; - } - } - this.messageBroker.publish( - "setTool", - "paintBucket" - /* PaintBucket */ - ); - this.pointerZone.style.cursor = "url('/cursor/paintBucket.png') 30 25, auto"; - this.brush.style.opacity = "0"; - }); - var toolPanel_paintBucketToolIndicator = document.createElement("div"); - toolPanel_paintBucketToolIndicator.classList.add( - "maskEditor_toolPanelIndicator" - ); - toolPanel_paintBucketToolContainer.appendChild( - toolPanel_paintBucketToolIndicator - ); - var toolPanel_colorSelectToolContainer = document.createElement("div"); - toolPanel_colorSelectToolContainer.classList.add( - "maskEditor_toolPanelContainer" - ); - toolPanel_colorSelectToolContainer.classList.add(toolPanelHoverAccent); - toolPanel_colorSelectToolContainer.innerHTML = ` - - - - `; - toolElements.push(toolPanel_colorSelectToolContainer); - toolPanel_colorSelectToolContainer.addEventListener("click", () => { - this.messageBroker.publish("setTool", "colorSelect"); - for (let toolElement of toolElements) { - if (toolElement != toolPanel_colorSelectToolContainer) { - toolElement.classList.remove("maskEditor_toolPanelContainerSelected"); - } else { - toolElement.classList.add("maskEditor_toolPanelContainerSelected"); - this.brushSettingsHTML.style.display = "none"; - this.paintBucketSettingsHTML.style.display = "none"; - this.colorSelectSettingsHTML.style.display = "flex"; - } - } - this.messageBroker.publish( - "setTool", - "colorSelect" - /* ColorSelect */ - ); - this.pointerZone.style.cursor = "url('/cursor/colorSelect.png') 15 25, auto"; - this.brush.style.opacity = "0"; - }); - var toolPanel_colorSelectToolIndicator = document.createElement("div"); - toolPanel_colorSelectToolIndicator.classList.add( - "maskEditor_toolPanelIndicator" - ); - toolPanel_colorSelectToolContainer.appendChild( - toolPanel_colorSelectToolIndicator - ); - var toolPanel_zoomIndicator = document.createElement("div"); - toolPanel_zoomIndicator.classList.add("maskEditor_toolPanelZoomIndicator"); - toolPanel_zoomIndicator.classList.add(toolPanelHoverAccent); - var toolPanel_zoomText = document.createElement("span"); - toolPanel_zoomText.id = "maskEditor_toolPanelZoomText"; - toolPanel_zoomText.innerText = "100%"; - this.zoomTextHTML = toolPanel_zoomText; - var toolPanel_DimensionsText = document.createElement("span"); - toolPanel_DimensionsText.id = "maskEditor_toolPanelDimensionsText"; - toolPanel_DimensionsText.innerText = " "; - this.dimensionsTextHTML = toolPanel_DimensionsText; - toolPanel_zoomIndicator.appendChild(toolPanel_zoomText); - toolPanel_zoomIndicator.appendChild(toolPanel_DimensionsText); - toolPanel_zoomIndicator.addEventListener("click", () => { - this.messageBroker.publish("resetZoom"); - }); - tool_panel.appendChild(toolPanel_brushToolContainer); - tool_panel.appendChild(toolPanel_eraserToolContainer); - tool_panel.appendChild(toolPanel_paintBucketToolContainer); - tool_panel.appendChild(toolPanel_colorSelectToolContainer); - tool_panel.appendChild(toolPanel_zoomIndicator); - return tool_panel; - } - createPointerZone() { - const pointer_zone = document.createElement("div"); - pointer_zone.id = "maskEditor_pointerZone"; - this.pointerZone = pointer_zone; - pointer_zone.addEventListener("pointerdown", (event) => { - this.messageBroker.publish("pointerDown", event); - }); - pointer_zone.addEventListener("pointermove", (event) => { - this.messageBroker.publish("pointerMove", event); - }); - pointer_zone.addEventListener("pointerup", (event) => { - this.messageBroker.publish("pointerUp", event); - }); - pointer_zone.addEventListener("pointerleave", (event) => { - this.brush.style.opacity = "0"; - this.pointerZone.style.cursor = ""; - }); - pointer_zone.addEventListener("touchstart", (event) => { - this.messageBroker.publish("handleTouchStart", event); - }); - pointer_zone.addEventListener("touchmove", (event) => { - this.messageBroker.publish("handleTouchMove", event); - }); - pointer_zone.addEventListener("touchend", (event) => { - this.messageBroker.publish("handleTouchEnd", event); - }); - pointer_zone.addEventListener( - "wheel", - (event) => this.messageBroker.publish("wheel", event) - ); - pointer_zone.addEventListener( - "pointerenter", - async (event) => { - this.updateCursor(); - } - ); - return pointer_zone; - } - async screenToCanvas(clientPoint) { - const zoomRatio = await this.messageBroker.pull("zoomRatio"); - const canvasRect = this.maskCanvas.getBoundingClientRect(); - const offsetX = clientPoint.x - canvasRect.left + this.toolPanel.clientWidth; - const offsetY = clientPoint.y - canvasRect.top + 44; - const x = offsetX / zoomRatio; - const y = offsetY / zoomRatio; - return { x, y }; - } - setEventHandler() { - this.maskCanvas.addEventListener("contextmenu", (event) => { - event.preventDefault(); - }); - this.rootElement.addEventListener("contextmenu", (event) => { - event.preventDefault(); - }); - this.rootElement.addEventListener("dragstart", (event) => { - if (event.ctrlKey) { - event.preventDefault(); - } - }); - } - async createBrush() { - var brush = document.createElement("div"); - const brushSettings = await this.messageBroker.pull("brushSettings"); - brush.id = "maskEditor_brush"; - var brush_preview_gradient = document.createElement("div"); - brush_preview_gradient.id = "maskEditor_brushPreviewGradient"; - brush.appendChild(brush_preview_gradient); - this.brush = brush; - this.brushPreviewGradient = brush_preview_gradient; - return brush; - } - async setImages(imgCanvas) { - const imgCtx = imgCanvas.getContext("2d", { willReadFrequently: true }); - const maskCtx = this.maskCtx; - const maskCanvas = this.maskCanvas; - imgCtx.clearRect(0, 0, this.imgCanvas.width, this.imgCanvas.height); - maskCtx.clearRect(0, 0, this.maskCanvas.width, this.maskCanvas.height); - const alpha_url = new URL( - ComfyApp.clipspace?.imgs?.[ComfyApp.clipspace?.selectedIndex ?? 0]?.src ?? "" - ); - alpha_url.searchParams.delete("channel"); - alpha_url.searchParams.delete("preview"); - alpha_url.searchParams.set("channel", "a"); - let mask_image = await this.loadImage(alpha_url); - if (!ComfyApp.clipspace?.imgs?.[ComfyApp.clipspace?.selectedIndex ?? 0]?.src) { - throw new Error( - "Unable to access image source - clipspace or image is null" - ); - } - const rgb_url = new URL( - ComfyApp.clipspace.imgs[ComfyApp.clipspace.selectedIndex].src - ); - this.imageURL = rgb_url; - console.log(rgb_url); - rgb_url.searchParams.delete("channel"); - rgb_url.searchParams.set("channel", "rgb"); - this.image = new Image(); - this.image = await new Promise((resolve, reject) => { - const img = new Image(); - img.onload = () => resolve(img); - img.onerror = reject; - img.src = rgb_url.toString(); - }); - maskCanvas.width = this.image.width; - maskCanvas.height = this.image.height; - this.dimensionsTextHTML.innerText = `${this.image.width}x${this.image.height}`; - await this.invalidateCanvas(this.image, mask_image); - this.messageBroker.publish("initZoomPan", [this.image, this.rootElement]); - } - async invalidateCanvas(orig_image, mask_image) { - this.imgCanvas.width = orig_image.width; - this.imgCanvas.height = orig_image.height; - this.maskCanvas.width = orig_image.width; - this.maskCanvas.height = orig_image.height; - let imgCtx = this.imgCanvas.getContext("2d", { willReadFrequently: true }); - let maskCtx = this.maskCanvas.getContext("2d", { - willReadFrequently: true - }); - imgCtx.drawImage(orig_image, 0, 0, orig_image.width, orig_image.height); - await this.prepare_mask( - mask_image, - this.maskCanvas, - maskCtx, - await this.getMaskColor() - ); - } - async prepare_mask(image, maskCanvas, maskCtx, maskColor) { - maskCtx.drawImage(image, 0, 0, maskCanvas.width, maskCanvas.height); - const maskData = maskCtx.getImageData( - 0, - 0, - maskCanvas.width, - maskCanvas.height - ); - for (let i = 0; i < maskData.data.length; i += 4) { - const alpha = maskData.data[i + 3]; - maskData.data[i] = maskColor.r; - maskData.data[i + 1] = maskColor.g; - maskData.data[i + 2] = maskColor.b; - maskData.data[i + 3] = 255 - alpha; - } - maskCtx.globalCompositeOperation = "source-over"; - maskCtx.putImageData(maskData, 0, 0); - } - async updateMaskColor() { - const maskCanvasStyle = this.getMaskCanvasStyle(); - this.maskCanvas.style.mixBlendMode = maskCanvasStyle.mixBlendMode; - this.maskCanvas.style.opacity = maskCanvasStyle.opacity.toString(); - const maskColor = await this.getMaskColor(); - this.maskCtx.fillStyle = `rgb(${maskColor.r}, ${maskColor.g}, ${maskColor.b})`; - this.setCanvasBackground(); - const maskData = this.maskCtx.getImageData( - 0, - 0, - this.maskCanvas.width, - this.maskCanvas.height - ); - for (let i = 0; i < maskData.data.length; i += 4) { - maskData.data[i] = maskColor.r; - maskData.data[i + 1] = maskColor.g; - maskData.data[i + 2] = maskColor.b; - } - this.maskCtx.putImageData(maskData, 0, 0); - } - getMaskCanvasStyle() { - if (this.maskBlendMode === "negative") { - return { - mixBlendMode: "difference", - opacity: "1" - }; - } else { - return { - mixBlendMode: "initial", - opacity: this.mask_opacity - }; - } - } - detectLightMode() { - this.darkMode = document.body.classList.contains("dark-theme"); - } - loadImage(imagePath) { - return new Promise((resolve, reject) => { - const image = new Image(); - image.onload = function() { - resolve(image); - }; - image.onerror = function(error) { - reject(error); - }; - image.src = imagePath.href; - }); - } - async updateBrushPreview() { - const cursorPoint = await this.messageBroker.pull("cursorPoint"); - const pan_offset = await this.messageBroker.pull("panOffset"); - const brushSettings = await this.messageBroker.pull("brushSettings"); - const zoom_ratio = await this.messageBroker.pull("zoomRatio"); - const centerX = cursorPoint.x + pan_offset.x; - const centerY = cursorPoint.y + pan_offset.y; - const brush = this.brush; - const hardness = brushSettings.hardness; - const extendedSize = brushSettings.size * (2 - hardness) * 2 * zoom_ratio; - this.brushSizeSlider.value = String(brushSettings.size); - this.brushHardnessSlider.value = String(hardness); - brush.style.width = extendedSize + "px"; - brush.style.height = extendedSize + "px"; - brush.style.left = centerX - extendedSize / 2 + "px"; - brush.style.top = centerY - extendedSize / 2 + "px"; - if (hardness === 1) { - this.brushPreviewGradient.style.background = "rgba(255, 0, 0, 0.5)"; - return; - } - const opacityStop = hardness / 4 + 0.25; - this.brushPreviewGradient.style.background = ` - radial-gradient( - circle, - rgba(255, 0, 0, 0.5) 0%, - rgba(255, 0, 0, ${opacityStop}) ${hardness * 100}%, - rgba(255, 0, 0, 0) 100% - ) - `; - } - getMaskBlendMode() { - return this.maskBlendMode; - } - setSidebarImage() { - this.sidebarImage.src = this.imageURL.href; - } - async getMaskColor() { - if (this.maskBlendMode === "black") { - return { r: 0, g: 0, b: 0 }; - } - if (this.maskBlendMode === "white") { - return { r: 255, g: 255, b: 255 }; - } - if (this.maskBlendMode === "negative") { - return { r: 255, g: 255, b: 255 }; - } - return { r: 0, g: 0, b: 0 }; - } - async getMaskFillStyle() { - const maskColor = await this.getMaskColor(); - return "rgb(" + maskColor.r + "," + maskColor.g + "," + maskColor.b + ")"; - } - async setCanvasBackground() { - if (this.maskBlendMode === "white") { - this.canvasBackground.style.background = "black"; - } else { - this.canvasBackground.style.background = "white"; - } - } - getMaskCanvas() { - return this.maskCanvas; - } - getImgCanvas() { - return this.imgCanvas; - } - getImage() { - return this.image; - } - setBrushOpacity(opacity) { - this.brush.style.opacity = String(opacity); - } - setSaveButtonEnabled(enabled) { - this.saveButton.disabled = !enabled; - } - setSaveButtonText(text) { - this.saveButton.innerText = text; - } - handlePaintBucketCursor(isPaintBucket) { - if (isPaintBucket) { - this.pointerZone.style.cursor = "url('/cursor/paintBucket.png') 30 25, auto"; - } else { - this.pointerZone.style.cursor = "none"; - } - } - handlePanCursor(isPanning) { - if (isPanning) { - this.pointerZone.style.cursor = "grabbing"; - } else { - this.pointerZone.style.cursor = "none"; - } - } - setBrushVisibility(visible) { - this.brush.style.opacity = visible ? "1" : "0"; - } - setBrushPreviewGradientVisibility(visible) { - this.brushPreviewGradient.style.display = visible ? "block" : "none"; - } - async updateCursor() { - const currentTool = await this.messageBroker.pull("currentTool"); - if (currentTool === "paintBucket") { - this.pointerZone.style.cursor = "url('/cursor/paintBucket.png') 30 25, auto"; - this.setBrushOpacity(0); - } else if (currentTool === "colorSelect") { - this.pointerZone.style.cursor = "url('/cursor/colorSelect.png') 15 25, auto"; - this.setBrushOpacity(0); - } else { - this.pointerZone.style.cursor = "none"; - this.setBrushOpacity(1); - } - this.updateBrushPreview(); - this.setBrushPreviewGradientVisibility(false); - } - setZoomText(zoomText) { - this.zoomTextHTML.innerText = zoomText; - } - setDimensionsText(dimensionsText) { - this.dimensionsTextHTML.innerText = dimensionsText; - } -} -class ToolManager { - static { - __name(this, "ToolManager"); - } - maskEditor; - messageBroker; - mouseDownPoint = null; - currentTool = "pen"; - isAdjustingBrush = false; - // is user adjusting brush size or hardness with alt + right mouse button - constructor(maskEditor) { - this.maskEditor = maskEditor; - this.messageBroker = maskEditor.getMessageBroker(); - this.addListeners(); - this.addPullTopics(); - } - addListeners() { - this.messageBroker.subscribe("setTool", async (tool) => { - this.setTool(tool); - }); - this.messageBroker.subscribe("pointerDown", async (event) => { - this.handlePointerDown(event); - }); - this.messageBroker.subscribe("pointerMove", async (event) => { - this.handlePointerMove(event); - }); - this.messageBroker.subscribe("pointerUp", async (event) => { - this.handlePointerUp(event); - }); - this.messageBroker.subscribe("wheel", async (event) => { - this.handleWheelEvent(event); - }); - } - async addPullTopics() { - this.messageBroker.createPullTopic( - "currentTool", - async () => this.getCurrentTool() - ); - } - //tools - setTool(tool) { - this.currentTool = tool; - if (tool != "colorSelect") { - this.messageBroker.publish("clearLastPoint"); - } - } - getCurrentTool() { - return this.currentTool; - } - async handlePointerDown(event) { - event.preventDefault(); - if (event.pointerType == "touch") return; - var isSpacePressed = await this.messageBroker.pull("isKeyPressed", " "); - if (event.buttons === 4 || event.buttons === 1 && isSpacePressed) { - this.messageBroker.publish("panStart", event); - this.messageBroker.publish("setBrushVisibility", false); - return; - } - if (this.currentTool === "paintBucket" && event.button === 0) { - const offset = { x: event.offsetX, y: event.offsetY }; - const coords_canvas = await this.messageBroker.pull( - "screenToCanvas", - offset - ); - this.messageBroker.publish("paintBucketFill", coords_canvas); - this.messageBroker.publish("saveState"); - return; - } - if (this.currentTool === "colorSelect" && event.button === 0) { - const offset = { x: event.offsetX, y: event.offsetY }; - const coords_canvas = await this.messageBroker.pull( - "screenToCanvas", - offset - ); - this.messageBroker.publish("colorSelectFill", coords_canvas); - return; - } - if (event.altKey && event.button === 2) { - this.isAdjustingBrush = true; - this.messageBroker.publish("brushAdjustmentStart", event); - return; - } - var isDrawingTool = [ - "pen", - "eraser" - /* Eraser */ - ].includes(this.currentTool); - if ([0, 2].includes(event.button) && isDrawingTool) { - this.messageBroker.publish("drawStart", event); - return; - } - } - async handlePointerMove(event) { - event.preventDefault(); - if (event.pointerType == "touch") return; - const newCursorPoint = { x: event.clientX, y: event.clientY }; - this.messageBroker.publish("cursorPoint", newCursorPoint); - var isSpacePressed = await this.messageBroker.pull("isKeyPressed", " "); - this.messageBroker.publish("updateBrushPreview"); - if (event.buttons === 4 || event.buttons === 1 && isSpacePressed) { - this.messageBroker.publish("panMove", event); - return; - } - var isDrawingTool = [ - "pen", - "eraser" - /* Eraser */ - ].includes(this.currentTool); - if (!isDrawingTool) return; - if (this.isAdjustingBrush && (this.currentTool === "pen" || this.currentTool === "eraser") && event.altKey && event.buttons === 2) { - this.messageBroker.publish("brushAdjustment", event); - return; - } - if (event.buttons == 1 || event.buttons == 2) { - this.messageBroker.publish("draw", event); - return; - } - } - handlePointerUp(event) { - this.messageBroker.publish("panCursor", false); - if (event.pointerType === "touch") return; - this.messageBroker.publish("updateCursor"); - this.isAdjustingBrush = false; - this.messageBroker.publish("drawEnd", event); - this.mouseDownPoint = null; - } - handleWheelEvent(event) { - this.messageBroker.publish("zoom", event); - const newCursorPoint = { x: event.clientX, y: event.clientY }; - this.messageBroker.publish("cursorPoint", newCursorPoint); - } -} -class PanAndZoomManager { - static { - __name(this, "PanAndZoomManager"); - } - maskEditor; - messageBroker; - DOUBLE_TAP_DELAY = 300; - lastTwoFingerTap = 0; - isTouchZooming = false; - lastTouchZoomDistance = 0; - lastTouchMidPoint = { x: 0, y: 0 }; - lastTouchPoint = { x: 0, y: 0 }; - zoom_ratio = 1; - interpolatedZoomRatio = 1; - pan_offset = { x: 0, y: 0 }; - mouseDownPoint = null; - initialPan = { x: 0, y: 0 }; - canvasContainer = null; - maskCanvas = null; - rootElement = null; - image = null; - imageRootWidth = 0; - imageRootHeight = 0; - cursorPoint = { x: 0, y: 0 }; - constructor(maskEditor) { - this.maskEditor = maskEditor; - this.messageBroker = maskEditor.getMessageBroker(); - this.addListeners(); - this.addPullTopics(); - } - addListeners() { - this.messageBroker.subscribe( - "initZoomPan", - async (args) => { - await this.initializeCanvasPanZoom(args[0], args[1]); - } - ); - this.messageBroker.subscribe("panStart", async (event) => { - this.handlePanStart(event); - }); - this.messageBroker.subscribe("panMove", async (event) => { - this.handlePanMove(event); - }); - this.messageBroker.subscribe("zoom", async (event) => { - this.zoom(event); - }); - this.messageBroker.subscribe("cursorPoint", async (point) => { - this.updateCursorPosition(point); - }); - this.messageBroker.subscribe( - "handleTouchStart", - async (event) => { - this.handleTouchStart(event); - } - ); - this.messageBroker.subscribe( - "handleTouchMove", - async (event) => { - this.handleTouchMove(event); - } - ); - this.messageBroker.subscribe( - "handleTouchEnd", - async (event) => { - this.handleTouchEnd(event); - } - ); - this.messageBroker.subscribe("resetZoom", async () => { - if (this.interpolatedZoomRatio === 1) return; - await this.smoothResetView(); - }); - } - addPullTopics() { - this.messageBroker.createPullTopic( - "cursorPoint", - async () => this.cursorPoint - ); - this.messageBroker.createPullTopic("zoomRatio", async () => this.zoom_ratio); - this.messageBroker.createPullTopic("panOffset", async () => this.pan_offset); - } - handleTouchStart(event) { - event.preventDefault(); - if (event.touches[0].touchType === "stylus") return; - this.messageBroker.publish("setBrushVisibility", false); - if (event.touches.length === 2) { - const currentTime = (/* @__PURE__ */ new Date()).getTime(); - const tapTimeDiff = currentTime - this.lastTwoFingerTap; - if (tapTimeDiff < this.DOUBLE_TAP_DELAY) { - this.handleDoubleTap(); - this.lastTwoFingerTap = 0; - } else { - this.lastTwoFingerTap = currentTime; - this.isTouchZooming = true; - this.lastTouchZoomDistance = this.getTouchDistance(event.touches); - const midpoint = this.getTouchMidpoint(event.touches); - this.lastTouchMidPoint = midpoint; - } - } else if (event.touches.length === 1) { - this.lastTouchPoint = { - x: event.touches[0].clientX, - y: event.touches[0].clientY - }; - } - } - async handleTouchMove(event) { - event.preventDefault(); - if (event.touches[0].touchType === "stylus") return; - this.lastTwoFingerTap = 0; - if (this.isTouchZooming && event.touches.length === 2) { - const newDistance = this.getTouchDistance(event.touches); - const zoomFactor = newDistance / this.lastTouchZoomDistance; - const oldZoom = this.zoom_ratio; - this.zoom_ratio = Math.max( - 0.2, - Math.min(10, this.zoom_ratio * zoomFactor) - ); - const newZoom = this.zoom_ratio; - const midpoint = this.getTouchMidpoint(event.touches); - if (this.lastTouchMidPoint) { - const deltaX = midpoint.x - this.lastTouchMidPoint.x; - const deltaY = midpoint.y - this.lastTouchMidPoint.y; - this.pan_offset.x += deltaX; - this.pan_offset.y += deltaY; - } - if (this.maskCanvas === null) { - this.maskCanvas = await this.messageBroker.pull("maskCanvas"); - } - const rect = this.maskCanvas.getBoundingClientRect(); - const touchX = midpoint.x - rect.left; - const touchY = midpoint.y - rect.top; - const scaleFactor = newZoom / oldZoom; - this.pan_offset.x += touchX - touchX * scaleFactor; - this.pan_offset.y += touchY - touchY * scaleFactor; - this.invalidatePanZoom(); - this.lastTouchZoomDistance = newDistance; - this.lastTouchMidPoint = midpoint; - } else if (event.touches.length === 1) { - this.handleSingleTouchPan(event.touches[0]); - } - } - handleTouchEnd(event) { - event.preventDefault(); - if (event.touches.length === 0 && event.touches[0].touchType === "stylus") { - return; - } - this.isTouchZooming = false; - this.lastTouchMidPoint = { x: 0, y: 0 }; - if (event.touches.length === 0) { - this.lastTouchPoint = { x: 0, y: 0 }; - } else if (event.touches.length === 1) { - this.lastTouchPoint = { - x: event.touches[0].clientX, - y: event.touches[0].clientY - }; - } - } - getTouchDistance(touches) { - const dx = touches[0].clientX - touches[1].clientX; - const dy = touches[0].clientY - touches[1].clientY; - return Math.sqrt(dx * dx + dy * dy); - } - getTouchMidpoint(touches) { - return { - x: (touches[0].clientX + touches[1].clientX) / 2, - y: (touches[0].clientY + touches[1].clientY) / 2 - }; - } - async handleSingleTouchPan(touch) { - if (this.lastTouchPoint === null) { - this.lastTouchPoint = { x: touch.clientX, y: touch.clientY }; - return; - } - const deltaX = touch.clientX - this.lastTouchPoint.x; - const deltaY = touch.clientY - this.lastTouchPoint.y; - this.pan_offset.x += deltaX; - this.pan_offset.y += deltaY; - await this.invalidatePanZoom(); - this.lastTouchPoint = { x: touch.clientX, y: touch.clientY }; - } - updateCursorPosition(clientPoint) { - var cursorX = clientPoint.x - this.pan_offset.x; - var cursorY = clientPoint.y - this.pan_offset.y; - this.cursorPoint = { x: cursorX, y: cursorY }; - } - //prob redundant - handleDoubleTap() { - this.messageBroker.publish("undo"); - } - async zoom(event) { - const cursorPoint = { x: event.clientX, y: event.clientY }; - const oldZoom = this.zoom_ratio; - const zoomFactor = event.deltaY < 0 ? 1.1 : 0.9; - this.zoom_ratio = Math.max( - 0.2, - Math.min(10, this.zoom_ratio * zoomFactor) - ); - const newZoom = this.zoom_ratio; - const maskCanvas = await this.messageBroker.pull("maskCanvas"); - const rect = maskCanvas.getBoundingClientRect(); - const mouseX = cursorPoint.x - rect.left; - const mouseY = cursorPoint.y - rect.top; - console.log(oldZoom, newZoom); - const scaleFactor = newZoom / oldZoom; - this.pan_offset.x += mouseX - mouseX * scaleFactor; - this.pan_offset.y += mouseY - mouseY * scaleFactor; - await this.invalidatePanZoom(); - const newImageWidth = maskCanvas.clientWidth; - const zoomRatio = newImageWidth / this.imageRootWidth; - this.interpolatedZoomRatio = zoomRatio; - this.messageBroker.publish("setZoomText", `${Math.round(zoomRatio * 100)}%`); - this.updateCursorPosition(cursorPoint); - requestAnimationFrame(() => { - this.messageBroker.publish("updateBrushPreview"); - }); - } - async smoothResetView(duration = 500) { - const startZoom = this.zoom_ratio; - const startPan = { ...this.pan_offset }; - const sidePanelWidth = 220; - const toolPanelWidth = 64; - const topBarHeight = 44; - const availableWidth = this.rootElement.clientWidth - sidePanelWidth - toolPanelWidth; - const availableHeight = this.rootElement.clientHeight - topBarHeight; - const zoomRatioWidth = availableWidth / this.image.width; - const zoomRatioHeight = availableHeight / this.image.height; - const targetZoom = Math.min(zoomRatioWidth, zoomRatioHeight); - const aspectRatio = this.image.width / this.image.height; - let finalWidth = 0; - let finalHeight = 0; - const targetPan = { x: toolPanelWidth, y: topBarHeight }; - if (zoomRatioHeight > zoomRatioWidth) { - finalWidth = availableWidth; - finalHeight = finalWidth / aspectRatio; - targetPan.y = (availableHeight - finalHeight) / 2 + topBarHeight; - } else { - finalHeight = availableHeight; - finalWidth = finalHeight * aspectRatio; - targetPan.x = (availableWidth - finalWidth) / 2 + toolPanelWidth; - } - const startTime = performance.now(); - const animate = /* @__PURE__ */ __name((currentTime) => { - const elapsed = currentTime - startTime; - const progress = Math.min(elapsed / duration, 1); - const eased = 1 - Math.pow(1 - progress, 3); - const currentZoom = startZoom + (targetZoom - startZoom) * eased; - this.zoom_ratio = currentZoom; - this.pan_offset.x = startPan.x + (targetPan.x - startPan.x) * eased; - this.pan_offset.y = startPan.y + (targetPan.y - startPan.y) * eased; - this.invalidatePanZoom(); - const interpolatedZoomRatio = startZoom + (1 - startZoom) * eased; - this.messageBroker.publish( - "setZoomText", - `${Math.round(interpolatedZoomRatio * 100)}%` - ); - if (progress < 1) { - requestAnimationFrame(animate); - } - }, "animate"); - requestAnimationFrame(animate); - this.interpolatedZoomRatio = 1; - } - async initializeCanvasPanZoom(image, rootElement) { - let sidePanelWidth = 220; - const toolPanelWidth = 64; - let topBarHeight = 44; - this.rootElement = rootElement; - let availableWidth = rootElement.clientWidth - sidePanelWidth - toolPanelWidth; - let availableHeight = rootElement.clientHeight - topBarHeight; - let zoomRatioWidth = availableWidth / image.width; - let zoomRatioHeight = availableHeight / image.height; - let aspectRatio = image.width / image.height; - let finalWidth = 0; - let finalHeight = 0; - let pan_offset = { x: toolPanelWidth, y: topBarHeight }; - if (zoomRatioHeight > zoomRatioWidth) { - finalWidth = availableWidth; - finalHeight = finalWidth / aspectRatio; - pan_offset.y = (availableHeight - finalHeight) / 2 + topBarHeight; - } else { - finalHeight = availableHeight; - finalWidth = finalHeight * aspectRatio; - pan_offset.x = (availableWidth - finalWidth) / 2 + toolPanelWidth; - } - if (this.image === null) { - this.image = image; - } - this.imageRootWidth = finalWidth; - this.imageRootHeight = finalHeight; - this.zoom_ratio = Math.min(zoomRatioWidth, zoomRatioHeight); - this.pan_offset = pan_offset; - await this.invalidatePanZoom(); - } - async invalidatePanZoom() { - if (!this.image?.width || !this.image?.height || !this.pan_offset || !this.zoom_ratio) { - console.warn("Missing required properties for pan/zoom"); - return; - } - const raw_width = this.image.width * this.zoom_ratio; - const raw_height = this.image.height * this.zoom_ratio; - this.canvasContainer ??= await this.messageBroker?.pull("getCanvasContainer"); - if (!this.canvasContainer) return; - Object.assign(this.canvasContainer.style, { - width: `${raw_width}px`, - height: `${raw_height}px`, - left: `${this.pan_offset.x}px`, - top: `${this.pan_offset.y}px` - }); - } - handlePanStart(event) { - let coords_canvas = this.messageBroker.pull("screenToCanvas", { - x: event.offsetX, - y: event.offsetY - }); - this.mouseDownPoint = { x: event.clientX, y: event.clientY }; - this.messageBroker.publish("panCursor", true); - this.initialPan = this.pan_offset; - return; - } - handlePanMove(event) { - if (this.mouseDownPoint === null) throw new Error("mouseDownPoint is null"); - let deltaX = this.mouseDownPoint.x - event.clientX; - let deltaY = this.mouseDownPoint.y - event.clientY; - let pan_x = this.initialPan.x - deltaX; - let pan_y = this.initialPan.y - deltaY; - this.pan_offset = { x: pan_x, y: pan_y }; - this.invalidatePanZoom(); - } -} -class MessageBroker { - static { - __name(this, "MessageBroker"); - } - pushTopics = {}; - pullTopics = {}; - constructor() { - this.registerListeners(); - } - // Push - registerListeners() { - this.createPushTopic("panStart"); - this.createPushTopic("paintBucketFill"); - this.createPushTopic("saveState"); - this.createPushTopic("brushAdjustmentStart"); - this.createPushTopic("drawStart"); - this.createPushTopic("panMove"); - this.createPushTopic("updateBrushPreview"); - this.createPushTopic("brushAdjustment"); - this.createPushTopic("draw"); - this.createPushTopic("paintBucketCursor"); - this.createPushTopic("panCursor"); - this.createPushTopic("drawEnd"); - this.createPushTopic("zoom"); - this.createPushTopic("undo"); - this.createPushTopic("redo"); - this.createPushTopic("cursorPoint"); - this.createPushTopic("panOffset"); - this.createPushTopic("zoomRatio"); - this.createPushTopic("getMaskCanvas"); - this.createPushTopic("getCanvasContainer"); - this.createPushTopic("screenToCanvas"); - this.createPushTopic("isKeyPressed"); - this.createPushTopic("isCombinationPressed"); - this.createPushTopic("setPaintBucketTolerance"); - this.createPushTopic("setBrushSize"); - this.createPushTopic("setBrushHardness"); - this.createPushTopic("setBrushOpacity"); - this.createPushTopic("setBrushShape"); - this.createPushTopic("initZoomPan"); - this.createPushTopic("setTool"); - this.createPushTopic("pointerDown"); - this.createPushTopic("pointerMove"); - this.createPushTopic("pointerUp"); - this.createPushTopic("wheel"); - this.createPushTopic("initPaintBucketTool"); - this.createPushTopic("setBrushVisibility"); - this.createPushTopic("setBrushPreviewGradientVisibility"); - this.createPushTopic("handleTouchStart"); - this.createPushTopic("handleTouchMove"); - this.createPushTopic("handleTouchEnd"); - this.createPushTopic("colorSelectFill"); - this.createPushTopic("setColorSelectTolerance"); - this.createPushTopic("setLivePreview"); - this.createPushTopic("updateCursor"); - this.createPushTopic("setColorComparisonMethod"); - this.createPushTopic("clearLastPoint"); - this.createPushTopic("setWholeImage"); - this.createPushTopic("setMaskBoundary"); - this.createPushTopic("setMaskTolerance"); - this.createPushTopic("setBrushSmoothingPrecision"); - this.createPushTopic("setZoomText"); - this.createPushTopic("resetZoom"); - this.createPushTopic("invert"); - } - /** - * Creates a new push topic (listener is notified) - * - * @param {string} topicName - The name of the topic to create. - * @throws {Error} If the topic already exists. - */ - createPushTopic(topicName) { - if (this.topicExists(this.pushTopics, topicName)) { - throw new Error("Topic already exists"); - } - this.pushTopics[topicName] = []; - } - /** - * Subscribe a callback function to the given topic. - * - * @param {string} topicName - The name of the topic to subscribe to. - * @param {Callback} callback - The callback function to be subscribed. - * @throws {Error} If the topic does not exist. - */ - subscribe(topicName, callback) { - if (!this.topicExists(this.pushTopics, topicName)) { - throw new Error(`Topic "${topicName}" does not exist!`); - } - this.pushTopics[topicName].push(callback); - } - /** - * Removes a callback function from the list of subscribers for a given topic. - * - * @param {string} topicName - The name of the topic to unsubscribe from. - * @param {Callback} callback - The callback function to remove from the subscribers list. - * @throws {Error} If the topic does not exist in the list of topics. - */ - unsubscribe(topicName, callback) { - if (!this.topicExists(this.pushTopics, topicName)) { - throw new Error("Topic does not exist"); - } - const index = this.pushTopics[topicName].indexOf(callback); - if (index > -1) { - this.pushTopics[topicName].splice(index, 1); - } - } - /** - * Publishes data to a specified topic with variable number of arguments. - * @param {string} topicName - The name of the topic to publish to. - * @param {...any[]} args - Variable number of arguments to pass to subscribers - * @throws {Error} If the specified topic does not exist. - */ - publish(topicName, ...args) { - if (!this.topicExists(this.pushTopics, topicName)) { - throw new Error(`Topic "${topicName}" does not exist!`); - } - this.pushTopics[topicName].forEach((callback) => { - callback(...args); - }); - } - // Pull - /** - * Creates a new pull topic (listener must request data) - * - * @param {string} topicName - The name of the topic to create. - * @param {() => Promise} callBack - The callback function to be called when data is requested. - * @throws {Error} If the topic already exists. - */ - createPullTopic(topicName, callBack) { - if (this.topicExists(this.pullTopics, topicName)) { - throw new Error("Topic already exists"); - } - this.pullTopics[topicName] = callBack; - } - /** - * Requests data from a specified pull topic. - * @param {string} topicName - The name of the topic to request data from. - * @returns {Promise} - The data from the pull topic. - * @throws {Error} If the specified topic does not exist. - */ - async pull(topicName, data) { - if (!this.topicExists(this.pullTopics, topicName)) { - throw new Error("Topic does not exist"); - } - const callBack = this.pullTopics[topicName]; - try { - const result = await callBack(data); - return result; - } catch (error) { - console.error(`Error pulling data from topic "${topicName}":`, error); - throw error; - } - } - // Helper Methods - /** - * Checks if a topic exists in the given topics object. - * @param {Record} topics - The topics object to check. - * @param {string} topicName - The name of the topic to check. - * @returns {boolean} - True if the topic exists, false otherwise. - */ - topicExists(topics, topicName) { - return topics.hasOwnProperty(topicName); - } -} -class KeyboardManager { - static { - __name(this, "KeyboardManager"); - } - keysDown = []; - maskEditor; - messageBroker; - constructor(maskEditor) { - this.maskEditor = maskEditor; - this.messageBroker = maskEditor.getMessageBroker(); - this.addPullTopics(); - } - addPullTopics() { - this.messageBroker.createPullTopic( - "isKeyPressed", - (key) => Promise.resolve(this.isKeyDown(key)) - ); - } - addListeners() { - document.addEventListener("keydown", (event) => this.handleKeyDown(event)); - document.addEventListener("keyup", (event) => this.handleKeyUp(event)); - window.addEventListener("blur", () => this.clearKeys()); - } - removeListeners() { - document.removeEventListener( - "keydown", - (event) => this.handleKeyDown(event) - ); - document.removeEventListener("keyup", (event) => this.handleKeyUp(event)); - } - clearKeys() { - this.keysDown = []; - } - handleKeyDown(event) { - if (!this.keysDown.includes(event.key)) { - this.keysDown.push(event.key); - } - } - handleKeyUp(event) { - this.keysDown = this.keysDown.filter((key) => key !== event.key); - } - isKeyDown(key) { - return this.keysDown.includes(key); - } - // combinations - undoCombinationPressed() { - const combination = ["ctrl", "z"]; - const keysDownLower = this.keysDown.map((key) => key.toLowerCase()); - const result = combination.every((key) => keysDownLower.includes(key)); - if (result) this.messageBroker.publish("undo"); - return result; - } - redoCombinationPressed() { - const combination = ["ctrl", "shift", "z"]; - const keysDownLower = this.keysDown.map((key) => key.toLowerCase()); - const result = combination.every((key) => keysDownLower.includes(key)); - if (result) this.messageBroker.publish("redo"); - return result; - } -} -app.registerExtension({ - name: "Comfy.MaskEditor", - settings: [ - { - id: "Comfy.MaskEditor.UseNewEditor", - category: ["Mask Editor", "NewEditor"], - name: "Use new mask editor", - tooltip: "Switch to the new mask editor interface", - type: "boolean", - defaultValue: true, - experimental: true - }, - { - id: "Comfy.MaskEditor.BrushAdjustmentSpeed", - category: ["Mask Editor", "BrushAdjustment", "Sensitivity"], - name: "Brush adjustment speed multiplier", - tooltip: "Controls how quickly the brush size and hardness change when adjusting. Higher values mean faster changes.", - experimental: true, - type: "slider", - attrs: { - min: 0.1, - max: 2, - step: 0.1 - }, - defaultValue: 1, - versionAdded: "1.0.0" - }, - { - id: "Comfy.MaskEditor.UseDominantAxis", - category: ["Mask Editor", "BrushAdjustment", "UseDominantAxis"], - name: "Lock brush adjustment to dominant axis", - tooltip: "When enabled, brush adjustments will only affect size OR hardness based on which direction you move more", - type: "boolean", - defaultValue: true, - experimental: true - } - ], - init(app2) { - function openMaskEditor() { - const useNewEditor = app2.extensionManager.setting.get( - "Comfy.MaskEditor.UseNewEditor" - ); - if (useNewEditor) { - const dlg = MaskEditorDialog.getInstance(); - if (dlg?.isOpened && !dlg.isOpened()) { - dlg.show(); - } - } else { - const dlg = MaskEditorDialogOld.getInstance(); - if (dlg?.isOpened && !dlg.isOpened()) { - dlg.show(); - } - } - } - __name(openMaskEditor, "openMaskEditor"); - ; - ComfyApp.open_maskeditor = openMaskEditor; - const context_predicate = /* @__PURE__ */ __name(() => { - return !!(ComfyApp.clipspace && ComfyApp.clipspace.imgs && ComfyApp.clipspace.imgs.length > 0); - }, "context_predicate"); - ClipspaceDialog.registerButton( - "MaskEditor", - context_predicate, - openMaskEditor - ); - } -}); -const id = "Comfy.NodeTemplates"; -const file = "comfy.templates.json"; -class ManageTemplates extends ComfyDialog { - static { - __name(this, "ManageTemplates"); - } - templates; - draggedEl; - saveVisualCue; - emptyImg; - importInput; - constructor() { - super(); - this.load().then((v) => { - this.templates = v; - }); - this.element.classList.add("comfy-manage-templates"); - this.draggedEl = null; - this.saveVisualCue = null; - this.emptyImg = new Image(); - this.emptyImg.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="; - this.importInput = $el("input", { - type: "file", - accept: ".json", - multiple: true, - style: { display: "none" }, - parent: document.body, - onchange: /* @__PURE__ */ __name(() => this.importAll(), "onchange") - }); - } - createButtons() { - const btns = super.createButtons(); - btns[0].textContent = "Close"; - btns[0].onclick = (e) => { - clearTimeout(this.saveVisualCue); - this.close(); - }; - btns.unshift( - $el("button", { - type: "button", - textContent: "Export", - onclick: /* @__PURE__ */ __name(() => this.exportAll(), "onclick") - }) - ); - btns.unshift( - $el("button", { - type: "button", - textContent: "Import", - onclick: /* @__PURE__ */ __name(() => { - this.importInput.click(); - }, "onclick") - }) - ); - return btns; - } - async load() { - let templates = []; - const res = await api.getUserData(file); - if (res.status === 200) { - try { - templates = await res.json(); - } catch (error) { - } - } else if (res.status !== 404) { - console.error(res.status + " " + res.statusText); - } - return templates ?? []; - } - async store() { - const templates = JSON.stringify(this.templates, void 0, 4); - try { - await api.storeUserData(file, templates, { stringify: false }); - } catch (error) { - console.error(error); - useToastStore().addAlert(error.message); - } - } - async importAll() { - for (const file2 of this.importInput.files) { - if (file2.type === "application/json" || file2.name.endsWith(".json")) { - const reader = new FileReader(); - reader.onload = async () => { - const importFile = JSON.parse(reader.result); - if (importFile?.templates) { - for (const template of importFile.templates) { - if (template?.name && template?.data) { - this.templates.push(template); - } - } - await this.store(); - } - }; - await reader.readAsText(file2); - } - } - this.importInput.value = null; - this.close(); - } - exportAll() { - if (this.templates.length == 0) { - useToastStore().addAlert("No templates to export."); - return; - } - const json = JSON.stringify({ templates: this.templates }, null, 2); - const blob = new Blob([json], { type: "application/json" }); - const url = URL.createObjectURL(blob); - const a = $el("a", { - href: url, - download: "node_templates.json", - style: { display: "none" }, - parent: document.body - }); - a.click(); - setTimeout(function() { - a.remove(); - window.URL.revokeObjectURL(url); - }, 0); - } - show() { - super.show( - $el( - "div", - {}, - this.templates.flatMap((t2, i) => { - let nameInput; - return [ - $el( - "div", - { - dataset: { id: i.toString() }, - className: "templateManagerRow", - style: { - display: "grid", - gridTemplateColumns: "1fr auto", - border: "1px dashed transparent", - gap: "5px", - backgroundColor: "var(--comfy-menu-bg)" - }, - ondragstart: /* @__PURE__ */ __name((e) => { - this.draggedEl = e.currentTarget; - e.currentTarget.style.opacity = "0.6"; - e.currentTarget.style.border = "1px dashed yellow"; - e.dataTransfer.effectAllowed = "move"; - e.dataTransfer.setDragImage(this.emptyImg, 0, 0); - }, "ondragstart"), - ondragend: /* @__PURE__ */ __name((e) => { - e.target.style.opacity = "1"; - e.currentTarget.style.border = "1px dashed transparent"; - e.currentTarget.removeAttribute("draggable"); - this.element.querySelectorAll(".templateManagerRow").forEach((el, i2) => { - var prev_i = Number.parseInt(el.dataset.id); - if (el == this.draggedEl && prev_i != i2) { - this.templates.splice( - i2, - 0, - this.templates.splice(prev_i, 1)[0] - ); - } - el.dataset.id = i2.toString(); - }); - this.store(); - }, "ondragend"), - ondragover: /* @__PURE__ */ __name((e) => { - e.preventDefault(); - if (e.currentTarget == this.draggedEl) return; - let rect = e.currentTarget.getBoundingClientRect(); - if (e.clientY > rect.top + rect.height / 2) { - e.currentTarget.parentNode.insertBefore( - this.draggedEl, - e.currentTarget.nextSibling - ); - } else { - e.currentTarget.parentNode.insertBefore( - this.draggedEl, - e.currentTarget - ); - } - }, "ondragover") - }, - [ - $el( - "label", - { - textContent: "Name: ", - style: { - cursor: "grab" - }, - onmousedown: /* @__PURE__ */ __name((e) => { - if (e.target.localName == "label") - e.currentTarget.parentNode.draggable = "true"; - }, "onmousedown") - }, - [ - $el("input", { - value: t2.name, - dataset: { name: t2.name }, - style: { - transitionProperty: "background-color", - transitionDuration: "0s" - }, - onchange: /* @__PURE__ */ __name((e) => { - clearTimeout(this.saveVisualCue); - var el = e.target; - var row = el.parentNode.parentNode; - this.templates[row.dataset.id].name = el.value.trim() || "untitled"; - this.store(); - el.style.backgroundColor = "rgb(40, 95, 40)"; - el.style.transitionDuration = "0s"; - this.saveVisualCue = setTimeout(function() { - el.style.transitionDuration = ".7s"; - el.style.backgroundColor = "var(--comfy-input-bg)"; - }, 15); - }, "onchange"), - onkeypress: /* @__PURE__ */ __name((e) => { - var el = e.target; - clearTimeout(this.saveVisualCue); - el.style.transitionDuration = "0s"; - el.style.backgroundColor = "var(--comfy-input-bg)"; - }, "onkeypress"), - $: /* @__PURE__ */ __name((el) => nameInput = el, "$") - }) - ] - ), - $el("div", {}, [ - $el("button", { - textContent: "Export", - style: { - fontSize: "12px", - fontWeight: "normal" - }, - onclick: /* @__PURE__ */ __name((e) => { - const json = JSON.stringify({ templates: [t2] }, null, 2); - const blob = new Blob([json], { - type: "application/json" - }); - const url = URL.createObjectURL(blob); - const a = $el("a", { - href: url, - download: (nameInput.value || t2.name) + ".json", - style: { display: "none" }, - parent: document.body - }); - a.click(); - setTimeout(function() { - a.remove(); - window.URL.revokeObjectURL(url); - }, 0); - }, "onclick") - }), - $el("button", { - textContent: "Delete", - style: { - fontSize: "12px", - color: "red", - fontWeight: "normal" - }, - onclick: /* @__PURE__ */ __name((e) => { - const item = e.target.parentNode.parentNode; - item.parentNode.removeChild(item); - this.templates.splice(item.dataset.id * 1, 1); - this.store(); - var that = this; - setTimeout(function() { - that.element.querySelectorAll(".templateManagerRow").forEach((el, i2) => { - el.dataset.id = i2.toString(); - }); - }, 0); - }, "onclick") - }) - ]) - ] - ) - ]; - }) - ) - ); - } -} -app.registerExtension({ - name: id, - setup() { - const manage = new ManageTemplates(); - const clipboardAction = /* @__PURE__ */ __name(async (cb) => { - const old = localStorage.getItem("litegrapheditor_clipboard"); - await cb(); - localStorage.setItem("litegrapheditor_clipboard", old); - }, "clipboardAction"); - const orig = LGraphCanvas.prototype.getCanvasMenuOptions; - LGraphCanvas.prototype.getCanvasMenuOptions = function() { - const options = orig.apply(this, arguments); - options.push(null); - options.push({ - content: `Save Selected as Template`, - disabled: !Object.keys(app.canvas.selected_nodes || {}).length, - callback: /* @__PURE__ */ __name(async () => { - const name = await showPromptDialog({ - title: t("nodeTemplates.saveAsTemplate"), - message: t("nodeTemplates.enterName"), - defaultValue: "" - }); - if (!name?.trim()) return; - clipboardAction(() => { - app.canvas.copyToClipboard(); - let data = localStorage.getItem("litegrapheditor_clipboard"); - data = JSON.parse(data); - const nodeIds = Object.keys(app.canvas.selected_nodes); - for (let i = 0; i < nodeIds.length; i++) { - const node = app.graph.getNodeById(nodeIds[i]); - const nodeData = node?.constructor.nodeData; - let groupData = GroupNodeHandler.getGroupData(node); - if (groupData) { - groupData = groupData.nodeData; - if (!data.groupNodes) { - data.groupNodes = {}; - } - data.groupNodes[nodeData.name] = groupData; - data.nodes[i].type = nodeData.name; - } - } - manage.templates.push({ - name, - data: JSON.stringify(data) - }); - manage.store(); - }); - }, "callback") - }); - const subItems = manage.templates.map((t2) => { - return { - content: t2.name, - callback: /* @__PURE__ */ __name(() => { - clipboardAction(async () => { - const data = JSON.parse(t2.data); - await GroupNodeConfig.registerFromWorkflow(data.groupNodes, {}); - if (!data.reroutes) { - deserialiseAndCreate(t2.data, app.canvas); - } else { - localStorage.setItem("litegrapheditor_clipboard", t2.data); - app.canvas.pasteFromClipboard(); - } - }); - }, "callback") - }; - }); - subItems.push(null, { - content: "Manage", - callback: /* @__PURE__ */ __name(() => manage.show(), "callback") - }); - options.push({ - content: "Node Templates", - submenu: { - options: subItems - } - }); - return options; - }; - } -}); -app.registerExtension({ - name: "Comfy.NoteNode", - registerCustomNodes() { - class NoteNode extends LGraphNode { - static { - __name(this, "NoteNode"); - } - static category; - color = LGraphCanvas.node_colors.yellow.color; - bgcolor = LGraphCanvas.node_colors.yellow.bgcolor; - groupcolor = LGraphCanvas.node_colors.yellow.groupcolor; - isVirtualNode; - collapsable; - title_mode; - constructor(title) { - super(title); - if (!this.properties) { - this.properties = { text: "" }; - } - ComfyWidgets.STRING( - // Should we extends LGraphNode? Yesss - this, - "", - ["", { default: this.properties.text, multiline: true }], - app - ); - this.serialize_widgets = true; - this.isVirtualNode = true; - } - } - LiteGraph.registerNodeType( - "Note", - Object.assign(NoteNode, { - title_mode: LiteGraph.NORMAL_TITLE, - title: "Note", - collapsable: true - }) - ); - NoteNode.category = "utils"; - } -}); -app.registerExtension({ - name: "Comfy.RerouteNode", - registerCustomNodes(app2) { - class RerouteNode extends LGraphNode { - static { - __name(this, "RerouteNode"); - } - static category; - static defaultVisibility = false; - constructor(title) { - super(title); - if (!this.properties) { - this.properties = {}; - } - this.properties.showOutputText = RerouteNode.defaultVisibility; - this.properties.horizontal = false; - this.addInput("", "*"); - this.addOutput(this.properties.showOutputText ? "*" : "", "*"); - this.onAfterGraphConfigured = function() { - requestAnimationFrame(() => { - this.onConnectionsChange(LiteGraph.INPUT, null, true, null); - }); - }; - this.onConnectionsChange = (type, index, connected, link_info) => { - this.applyOrientation(); - if (connected && type === LiteGraph.OUTPUT) { - const types = new Set( - this.outputs[0].links.map((l) => app2.graph.links[l].type).filter((t2) => t2 !== "*") - ); - if (types.size > 1) { - const linksToDisconnect = []; - for (let i = 0; i < this.outputs[0].links.length - 1; i++) { - const linkId = this.outputs[0].links[i]; - const link = app2.graph.links[linkId]; - linksToDisconnect.push(link); - } - for (const link of linksToDisconnect) { - const node = app2.graph.getNodeById(link.target_id); - node.disconnectInput(link.target_slot); - } - } - } - let currentNode = this; - let updateNodes = []; - let inputType = null; - let inputNode = null; - while (currentNode) { - updateNodes.unshift(currentNode); - const linkId = currentNode.inputs[0].link; - if (linkId !== null) { - const link = app2.graph.links[linkId]; - if (!link) return; - const node = app2.graph.getNodeById(link.origin_id); - const type2 = node.constructor.type; - if (type2 === "Reroute") { - if (node === this) { - currentNode.disconnectInput(link.target_slot); - currentNode = null; - } else { - currentNode = node; - } - } else { - inputNode = currentNode; - inputType = node.outputs[link.origin_slot]?.type ?? null; - break; - } - } else { - currentNode = null; - break; - } - } - const nodes = [this]; - let outputType = null; - while (nodes.length) { - currentNode = nodes.pop(); - const outputs = (currentNode.outputs ? currentNode.outputs[0].links : []) || []; - if (outputs.length) { - for (const linkId of outputs) { - const link = app2.graph.links[linkId]; - if (!link) continue; - const node = app2.graph.getNodeById(link.target_id); - const type2 = node.constructor.type; - if (type2 === "Reroute") { - nodes.push(node); - updateNodes.push(node); - } else { - const nodeOutType = node.inputs && node.inputs[link?.target_slot] && node.inputs[link.target_slot].type ? node.inputs[link.target_slot].type : null; - if (inputType && !LiteGraph.isValidConnection(inputType, nodeOutType)) { - node.disconnectInput(link.target_slot); - } else { - outputType = nodeOutType; - } - } - } - } else { - } - } - const displayType = inputType || outputType || "*"; - const color = LGraphCanvas.link_type_colors[displayType]; - let widgetConfig; - let targetWidget; - let widgetType; - for (const node of updateNodes) { - node.outputs[0].type = inputType || "*"; - node.__outputType = displayType; - node.outputs[0].name = node.properties.showOutputText ? displayType : ""; - node.size = node.computeSize(); - node.applyOrientation(); - for (const l of node.outputs[0].links || []) { - const link = app2.graph.links[l]; - if (link) { - link.color = color; - if (app2.configuringGraph) continue; - const targetNode = app2.graph.getNodeById(link.target_id); - const targetInput = targetNode.inputs?.[link.target_slot]; - if (targetInput?.widget) { - const config = getWidgetConfig(targetInput); - if (!widgetConfig) { - widgetConfig = config[1] ?? {}; - widgetType = config[0]; - } - if (!targetWidget) { - targetWidget = targetNode.widgets?.find( - (w) => w.name === targetInput.widget.name - ); - } - const merged = mergeIfValid(targetInput, [ - config[0], - widgetConfig - ]); - if (merged.customConfig) { - widgetConfig = merged.customConfig; - } - } - } - } - } - for (const node of updateNodes) { - if (widgetConfig && outputType) { - node.inputs[0].widget = { name: "value" }; - setWidgetConfig( - node.inputs[0], - [widgetType ?? displayType, widgetConfig], - targetWidget - ); - } else { - setWidgetConfig(node.inputs[0], null); - } - } - if (inputNode) { - const link = app2.graph.links[inputNode.inputs[0].link]; - if (link) { - link.color = color; - } - } - }; - this.clone = function() { - const cloned = RerouteNode.prototype.clone.apply(this); - cloned.removeOutput(0); - cloned.addOutput(this.properties.showOutputText ? "*" : "", "*"); - cloned.size = cloned.computeSize(); - return cloned; - }; - this.isVirtualNode = true; - } - getExtraMenuOptions(_, options) { - options.unshift( - { - content: (this.properties.showOutputText ? "Hide" : "Show") + " Type", - callback: /* @__PURE__ */ __name(() => { - this.properties.showOutputText = !this.properties.showOutputText; - if (this.properties.showOutputText) { - this.outputs[0].name = this.__outputType || this.outputs[0].type; - } else { - this.outputs[0].name = ""; - } - this.size = this.computeSize(); - this.applyOrientation(); - app2.graph.setDirtyCanvas(true, true); - }, "callback") - }, - { - content: (RerouteNode.defaultVisibility ? "Hide" : "Show") + " Type By Default", - callback: /* @__PURE__ */ __name(() => { - RerouteNode.setDefaultTextVisibility( - !RerouteNode.defaultVisibility - ); - }, "callback") - }, - { - // naming is inverted with respect to LiteGraphNode.horizontal - // LiteGraphNode.horizontal == true means that - // each slot in the inputs and outputs are laid out horizontally, - // which is the opposite of the visual orientation of the inputs and outputs as a node - content: "Set " + (this.properties.horizontal ? "Horizontal" : "Vertical"), - callback: /* @__PURE__ */ __name(() => { - this.properties.horizontal = !this.properties.horizontal; - this.applyOrientation(); - }, "callback") - } - ); - return []; - } - applyOrientation() { - this.horizontal = this.properties.horizontal; - if (this.horizontal) { - this.inputs[0].pos = [this.size[0] / 2, 0]; - } else { - delete this.inputs[0].pos; - } - app2.graph.setDirtyCanvas(true, true); - } - computeSize() { - return [ - this.properties.showOutputText && this.outputs && this.outputs.length ? Math.max( - 75, - LiteGraph.NODE_TEXT_SIZE * this.outputs[0].name.length * 0.6 + 40 - ) : 75, - 26 - ]; - } - static setDefaultTextVisibility(visible) { - RerouteNode.defaultVisibility = visible; - if (visible) { - localStorage["Comfy.RerouteNode.DefaultVisibility"] = "true"; - } else { - delete localStorage["Comfy.RerouteNode.DefaultVisibility"]; - } - } - } - RerouteNode.setDefaultTextVisibility( - !!localStorage["Comfy.RerouteNode.DefaultVisibility"] - ); - LiteGraph.registerNodeType( - "Reroute", - Object.assign(RerouteNode, { - title_mode: LiteGraph.NO_TITLE, - title: "Reroute", - collapsable: false - }) - ); - RerouteNode.category = "utils"; - } -}); -app.registerExtension({ - name: "Comfy.SaveImageExtraOutput", - async beforeRegisterNodeDef(nodeType, nodeData, app2) { - if (nodeData.name === "SaveImage" || nodeData.name === "SaveAnimatedWEBP") { - const onNodeCreated = nodeType.prototype.onNodeCreated; - nodeType.prototype.onNodeCreated = function() { - const r = onNodeCreated ? onNodeCreated.apply(this, arguments) : void 0; - const widget = this.widgets.find((w) => w.name === "filename_prefix"); - widget.serializeValue = () => { - return applyTextReplacements(app2, widget.value); - }; - return r; - }; - } else { - const onNodeCreated = nodeType.prototype.onNodeCreated; - nodeType.prototype.onNodeCreated = function() { - const r = onNodeCreated ? onNodeCreated.apply(this, arguments) : void 0; - if (!this.properties || !("Node name for S&R" in this.properties)) { - this.addProperty("Node name for S&R", this.constructor.type, "string"); - } - return r; - }; - } - } -}); -let touchZooming; -let touchCount = 0; -app.registerExtension({ - name: "Comfy.SimpleTouchSupport", - setup() { - let touchDist; - let touchTime; - let lastTouch; - let lastScale; - function getMultiTouchPos(e) { - return Math.hypot( - e.touches[0].clientX - e.touches[1].clientX, - e.touches[0].clientY - e.touches[1].clientY - ); - } - __name(getMultiTouchPos, "getMultiTouchPos"); - function getMultiTouchCenter(e) { - return { - clientX: (e.touches[0].clientX + e.touches[1].clientX) / 2, - clientY: (e.touches[0].clientY + e.touches[1].clientY) / 2 - }; - } - __name(getMultiTouchCenter, "getMultiTouchCenter"); - app.canvasEl.parentElement.addEventListener( - "touchstart", - (e) => { - touchCount++; - lastTouch = null; - lastScale = null; - if (e.touches?.length === 1) { - touchTime = /* @__PURE__ */ new Date(); - lastTouch = e.touches[0]; - } else { - touchTime = null; - if (e.touches?.length === 2) { - lastScale = app.canvas.ds.scale; - lastTouch = getMultiTouchCenter(e); - touchDist = getMultiTouchPos(e); - app.canvas.pointer.isDown = false; - } - } - }, - true - ); - app.canvasEl.parentElement.addEventListener("touchend", (e) => { - touchCount--; - if (e.touches?.length !== 1) touchZooming = false; - if (touchTime && !e.touches?.length) { - if ((/* @__PURE__ */ new Date()).getTime() - touchTime > 600) { - if (e.target === app.canvasEl) { - app.canvasEl.dispatchEvent( - new PointerEvent("pointerdown", { - button: 2, - clientX: e.changedTouches[0].clientX, - clientY: e.changedTouches[0].clientY - }) - ); - e.preventDefault(); - } - } - touchTime = null; - } - }); - app.canvasEl.parentElement.addEventListener( - "touchmove", - (e) => { - touchTime = null; - if (e.touches?.length === 2 && lastTouch && !e.ctrlKey && !e.shiftKey) { - e.preventDefault(); - app.canvas.pointer.isDown = false; - touchZooming = true; - LiteGraph.closeAllContextMenus(window); - app.canvas.search_box?.close(); - const newTouchDist = getMultiTouchPos(e); - const center = getMultiTouchCenter(e); - let scale = lastScale * newTouchDist / touchDist; - const newX = (center.clientX - lastTouch.clientX) / scale; - const newY = (center.clientY - lastTouch.clientY) / scale; - if (scale < app.canvas.ds.min_scale) { - scale = app.canvas.ds.min_scale; - } else if (scale > app.canvas.ds.max_scale) { - scale = app.canvas.ds.max_scale; - } - const oldScale = app.canvas.ds.scale; - app.canvas.ds.scale = scale; - if (Math.abs(app.canvas.ds.scale - 1) < 0.01) { - app.canvas.ds.scale = 1; - } - const newScale = app.canvas.ds.scale; - const convertScaleToOffset = /* @__PURE__ */ __name((scale2) => [ - center.clientX / scale2 - app.canvas.ds.offset[0], - center.clientY / scale2 - app.canvas.ds.offset[1] - ], "convertScaleToOffset"); - var oldCenter = convertScaleToOffset(oldScale); - var newCenter = convertScaleToOffset(newScale); - app.canvas.ds.offset[0] += newX + newCenter[0] - oldCenter[0]; - app.canvas.ds.offset[1] += newY + newCenter[1] - oldCenter[1]; - lastTouch.clientX = center.clientX; - lastTouch.clientY = center.clientY; - app.canvas.setDirty(true, true); - } - }, - true - ); - } -}); -const processMouseDown = LGraphCanvas.prototype.processMouseDown; -LGraphCanvas.prototype.processMouseDown = function(e) { - if (touchZooming || touchCount) { - return; - } - app.canvas.pointer.isDown = false; - return processMouseDown.apply(this, arguments); -}; -const processMouseMove = LGraphCanvas.prototype.processMouseMove; -LGraphCanvas.prototype.processMouseMove = function(e) { - if (touchZooming || touchCount > 1) { - return; - } - return processMouseMove.apply(this, arguments); -}; -app.registerExtension({ - name: "Comfy.SlotDefaults", - suggestionsNumber: null, - init() { - LiteGraph.search_filter_enabled = true; - LiteGraph.middle_click_slot_add_default_node = true; - this.suggestionsNumber = app.ui.settings.addSetting({ - id: "Comfy.NodeSuggestions.number", - category: ["Comfy", "Node Search Box", "NodeSuggestions"], - name: "Number of nodes suggestions", - tooltip: "Only for litegraph searchbox/context menu", - type: "slider", - attrs: { - min: 1, - max: 100, - step: 1 - }, - defaultValue: 5, - onChange: /* @__PURE__ */ __name((newVal, oldVal) => { - this.setDefaults(newVal); - }, "onChange") - }); - }, - slot_types_default_out: {}, - slot_types_default_in: {}, - async beforeRegisterNodeDef(nodeType, nodeData, app2) { - var nodeId = nodeData.name; - const inputs = nodeData["input"]?.["required"]; - for (const inputKey in inputs) { - var input = inputs[inputKey]; - if (typeof input[0] !== "string") continue; - var type = input[0]; - if (type in ComfyWidgets) { - var customProperties = input[1]; - if (!customProperties?.forceInput) continue; - } - if (!(type in this.slot_types_default_out)) { - this.slot_types_default_out[type] = ["Reroute"]; - } - if (this.slot_types_default_out[type].includes(nodeId)) continue; - this.slot_types_default_out[type].push(nodeId); - const lowerType = type.toLocaleLowerCase(); - if (!(lowerType in LiteGraph.registered_slot_in_types)) { - LiteGraph.registered_slot_in_types[lowerType] = { nodes: [] }; - } - LiteGraph.registered_slot_in_types[lowerType].nodes.push( - // @ts-expect-error ComfyNode - nodeType.comfyClass - ); - } - var outputs = nodeData["output"] ?? []; - for (const el of outputs) { - const type2 = el; - if (!(type2 in this.slot_types_default_in)) { - this.slot_types_default_in[type2] = ["Reroute"]; - } - this.slot_types_default_in[type2].push(nodeId); - if (!(type2 in LiteGraph.registered_slot_out_types)) { - LiteGraph.registered_slot_out_types[type2] = { nodes: [] }; - } - LiteGraph.registered_slot_out_types[type2].nodes.push(nodeType.comfyClass); - if (!LiteGraph.slot_types_out.includes(type2)) { - LiteGraph.slot_types_out.push(type2); - } - } - var maxNum = this.suggestionsNumber.value; - this.setDefaults(maxNum); - }, - setDefaults(maxNum) { - LiteGraph.slot_types_default_out = {}; - LiteGraph.slot_types_default_in = {}; - for (const type in this.slot_types_default_out) { - LiteGraph.slot_types_default_out[type] = this.slot_types_default_out[type].slice(0, maxNum); - } - for (const type in this.slot_types_default_in) { - LiteGraph.slot_types_default_in[type] = this.slot_types_default_in[type].slice(0, maxNum); - } - } -}); -app.registerExtension({ - name: "Comfy.UploadImage", - beforeRegisterNodeDef(nodeType, nodeData) { - if (nodeData?.input?.required?.image?.[1]?.image_upload === true) { - nodeData.input.required.upload = ["IMAGEUPLOAD"]; - } - } -}); -const WEBCAM_READY = Symbol(); -app.registerExtension({ - name: "Comfy.WebcamCapture", - getCustomWidgets(app2) { - return { - WEBCAM(node, inputName) { - let res; - node[WEBCAM_READY] = new Promise((resolve) => res = resolve); - const container = document.createElement("div"); - container.style.background = "rgba(0,0,0,0.25)"; - container.style.textAlign = "center"; - const video = document.createElement("video"); - video.style.height = video.style.width = "100%"; - const loadVideo = /* @__PURE__ */ __name(async () => { - try { - const stream = await navigator.mediaDevices.getUserMedia({ - video: true, - audio: false - }); - container.replaceChildren(video); - setTimeout(() => res(video), 500); - video.addEventListener("loadedmetadata", () => res(video), false); - video.srcObject = stream; - video.play(); - } catch (error) { - const label = document.createElement("div"); - label.style.color = "red"; - label.style.overflow = "auto"; - label.style.maxHeight = "100%"; - label.style.whiteSpace = "pre-wrap"; - if (window.isSecureContext) { - label.textContent = "Unable to load webcam, please ensure access is granted:\n" + error.message; - } else { - label.textContent = "Unable to load webcam. A secure context is required, if you are not accessing ComfyUI on localhost (127.0.0.1) you will have to enable TLS (https)\n\n" + error.message; - } - container.replaceChildren(label); - } - }, "loadVideo"); - loadVideo(); - return { widget: node.addDOMWidget(inputName, "WEBCAM", container) }; - } - }; - }, - nodeCreated(node) { - if (node.type, node.constructor.comfyClass !== "WebcamCapture") return; - let video; - const camera = node.widgets.find((w2) => w2.name === "image"); - const w = node.widgets.find((w2) => w2.name === "width"); - const h = node.widgets.find((w2) => w2.name === "height"); - const captureOnQueue = node.widgets.find( - (w2) => w2.name === "capture_on_queue" - ); - const canvas = document.createElement("canvas"); - const capture = /* @__PURE__ */ __name(() => { - canvas.width = w.value; - canvas.height = h.value; - const ctx = canvas.getContext("2d"); - ctx.drawImage(video, 0, 0, w.value, h.value); - const data = canvas.toDataURL("image/png"); - const img = new Image(); - img.onload = () => { - node.imgs = [img]; - app.graph.setDirtyCanvas(true); - requestAnimationFrame(() => { - node.setSizeForImage?.(); - }); - }; - img.src = data; - }, "capture"); - const btn = node.addWidget( - "button", - "waiting for camera...", - "capture", - capture - ); - btn.disabled = true; - btn.serializeValue = () => void 0; - camera.serializeValue = async () => { - if (captureOnQueue.value) { - capture(); - } else if (!node.imgs?.length) { - const err2 = `No webcam image captured`; - useToastStore().addAlert(err2); - throw new Error(err2); - } - const blob = await new Promise((r) => canvas.toBlob(r)); - const name = `${+/* @__PURE__ */ new Date()}.png`; - const file2 = new File([blob], name); - const body = new FormData(); - body.append("image", file2); - body.append("subfolder", "webcam"); - body.append("type", "temp"); - const resp = await api.fetchApi("/upload/image", { - method: "POST", - body - }); - if (resp.status !== 200) { - const err2 = `Error uploading camera image: ${resp.status} - ${resp.statusText}`; - useToastStore().addAlert(err2); - throw new Error(err2); - } - return `webcam/${name} [temp]`; - }; - node[WEBCAM_READY].then((v) => { - video = v; - if (!w.value) { - w.value = video.videoWidth || 640; - h.value = video.videoHeight || 480; - } - btn.disabled = false; - btn.label = "capture"; - }); - } -}); -function splitFilePath$1(path) { - const folder_separator = path.lastIndexOf("/"); - if (folder_separator === -1) { - return ["", path]; - } - return [ - path.substring(0, folder_separator), - path.substring(folder_separator + 1) - ]; -} -__name(splitFilePath$1, "splitFilePath$1"); -function getResourceURL$1(subfolder, filename, type = "input") { - const params = [ - "filename=" + encodeURIComponent(filename), - "type=" + type, - "subfolder=" + subfolder, - app.getRandParam().substring(1) - ].join("&"); - return `/view?${params}`; -} -__name(getResourceURL$1, "getResourceURL$1"); -async function uploadFile$1(audioWidget, audioUIWidget, file2, updateNode, pasted = false) { - try { - const body = new FormData(); - body.append("image", file2); - if (pasted) body.append("subfolder", "pasted"); - const resp = await api.fetchApi("/upload/image", { - method: "POST", - body - }); - if (resp.status === 200) { - const data = await resp.json(); - let path = data.name; - if (data.subfolder) path = data.subfolder + "/" + path; - if (!audioWidget.options.values.includes(path)) { - audioWidget.options.values.push(path); - } - if (updateNode) { - audioUIWidget.element.src = api.apiURL( - getResourceURL$1(...splitFilePath$1(path)) - ); - audioWidget.value = path; - } - } else { - useToastStore().addAlert(resp.status + " - " + resp.statusText); - } - } catch (error) { - useToastStore().addAlert(error); - } -} -__name(uploadFile$1, "uploadFile$1"); -app.registerExtension({ - name: "Comfy.AudioWidget", - async beforeRegisterNodeDef(nodeType, nodeData) { - if ( - // @ts-expect-error ComfyNode - ["LoadAudio", "SaveAudio", "PreviewAudio"].includes(nodeType.comfyClass) - ) { - nodeData.input.required.audioUI = ["AUDIO_UI"]; - } - }, - getCustomWidgets() { - return { - AUDIO_UI(node, inputName) { - const audio = document.createElement("audio"); - audio.controls = true; - audio.classList.add("comfy-audio"); - audio.setAttribute("name", "media"); - const audioUIWidget = node.addDOMWidget( - inputName, - /* name=*/ - "audioUI", - audio, - { - serialize: false - } - ); - const isOutputNode = node.constructor.nodeData.output_node; - if (isOutputNode) { - audioUIWidget.element.classList.add("empty-audio-widget"); - const onExecuted = node.onExecuted; - node.onExecuted = function(message) { - onExecuted?.apply(this, arguments); - const audios = message.audio; - if (!audios) return; - const audio2 = audios[0]; - audioUIWidget.element.src = api.apiURL( - getResourceURL$1(audio2.subfolder, audio2.filename, audio2.type) - ); - audioUIWidget.element.classList.remove("empty-audio-widget"); - }; - } - return { widget: audioUIWidget }; - } - }; - }, - onNodeOutputsUpdated(nodeOutputs) { - for (const [nodeId, output] of Object.entries(nodeOutputs)) { - const node = app.graph.getNodeById(nodeId); - if ("audio" in output) { - const audioUIWidget = node.widgets.find( - (w) => w.name === "audioUI" - ); - const audio = output.audio[0]; - audioUIWidget.element.src = api.apiURL( - getResourceURL$1(audio.subfolder, audio.filename, audio.type) - ); - audioUIWidget.element.classList.remove("empty-audio-widget"); - } - } - } -}); -app.registerExtension({ - name: "Comfy.UploadAudio", - async beforeRegisterNodeDef(nodeType, nodeData) { - if (nodeData?.input?.required?.audio?.[1]?.audio_upload === true) { - nodeData.input.required.upload = ["AUDIOUPLOAD"]; - } - }, - getCustomWidgets() { - return { - AUDIOUPLOAD(node, inputName) { - const audioWidget = node.widgets.find( - (w) => w.name === "audio" - ); - const audioUIWidget = node.widgets.find( - (w) => w.name === "audioUI" - ); - const onAudioWidgetUpdate = /* @__PURE__ */ __name(() => { - audioUIWidget.element.src = api.apiURL( - getResourceURL$1(...splitFilePath$1(audioWidget.value)) - ); - }, "onAudioWidgetUpdate"); - if (audioWidget.value) { - onAudioWidgetUpdate(); - } - audioWidget.callback = onAudioWidgetUpdate; - const onGraphConfigured = node.onGraphConfigured; - node.onGraphConfigured = function() { - onGraphConfigured?.apply(this, arguments); - if (audioWidget.value) { - onAudioWidgetUpdate(); - } - }; - const fileInput = document.createElement("input"); - fileInput.type = "file"; - fileInput.accept = "audio/*"; - fileInput.style.display = "none"; - fileInput.onchange = () => { - if (fileInput.files.length) { - uploadFile$1(audioWidget, audioUIWidget, fileInput.files[0], true); - } - }; - const uploadWidget = node.addWidget( - "button", - inputName, - /* value=*/ - "", - () => { - fileInput.click(); - }, - { serialize: false } - ); - uploadWidget.label = "choose file to upload"; - return { widget: uploadWidget }; - } - }; - } -}); -(async () => { - if (!isElectron()) return; - const electronAPI$1 = electronAPI(); - const desktopAppVersion = await electronAPI$1.getElectronVersion(); - const onChangeRestartApp = /* @__PURE__ */ __name((newValue, oldValue) => { - if (oldValue !== void 0 && newValue !== oldValue) { - electronAPI$1.restartApp("Restart ComfyUI to apply changes.", 1500); - } - }, "onChangeRestartApp"); - app.registerExtension({ - name: "Comfy.ElectronAdapter", - settings: [ - { - id: "Comfy-Desktop.AutoUpdate", - category: ["Comfy-Desktop", "General", "AutoUpdate"], - name: "Automatically check for updates", - type: "boolean", - defaultValue: true, - onChange: onChangeRestartApp - }, - { - id: "Comfy-Desktop.SendStatistics", - category: ["Comfy-Desktop", "General", "Send Statistics"], - name: "Send anonymous crash reports", - type: "boolean", - defaultValue: true, - onChange: onChangeRestartApp - } - ], - commands: [ - { - id: "Comfy-Desktop.Folders.OpenLogsFolder", - label: "Open Logs Folder", - icon: "pi pi-folder-open", - function() { - electronAPI$1.openLogsFolder(); - } - }, - { - id: "Comfy-Desktop.Folders.OpenModelsFolder", - label: "Open Models Folder", - icon: "pi pi-folder-open", - function() { - electronAPI$1.openModelsFolder(); - } - }, - { - id: "Comfy-Desktop.Folders.OpenOutputsFolder", - label: "Open Outputs Folder", - icon: "pi pi-folder-open", - function() { - electronAPI$1.openOutputsFolder(); - } - }, - { - id: "Comfy-Desktop.Folders.OpenInputsFolder", - label: "Open Inputs Folder", - icon: "pi pi-folder-open", - function() { - electronAPI$1.openInputsFolder(); - } - }, - { - id: "Comfy-Desktop.Folders.OpenCustomNodesFolder", - label: "Open Custom Nodes Folder", - icon: "pi pi-folder-open", - function() { - electronAPI$1.openCustomNodesFolder(); - } - }, - { - id: "Comfy-Desktop.Folders.OpenModelConfig", - label: "Open extra_model_paths.yaml", - icon: "pi pi-file", - function() { - electronAPI$1.openModelConfig(); - } - }, - { - id: "Comfy-Desktop.OpenDevTools", - label: "Open DevTools", - icon: "pi pi-code", - function() { - electronAPI$1.openDevTools(); - } - }, - { - id: "Comfy-Desktop.OpenFeedbackPage", - label: "Feedback", - icon: "pi pi-envelope", - function() { - window.open("https://forum.comfy.org/c/v1-feedback/", "_blank"); - } - }, - { - id: "Comfy-Desktop.OpenUserGuide", - label: "Desktop User Guide", - icon: "pi pi-book", - function() { - window.open("https://comfyorg.notion.site/", "_blank"); - } - }, - { - id: "Comfy-Desktop.Reinstall", - label: "Reinstall", - icon: "pi pi-refresh", - async function() { - const proceed = await showConfirmationDialog({ - message: t("desktopMenu.confirmReinstall"), - title: t("desktopMenu.reinstall"), - type: "reinstall" - }); - if (proceed) electronAPI$1.reinstall(); - } - }, - { - id: "Comfy-Desktop.Restart", - label: "Restart", - icon: "pi pi-refresh", - function() { - electronAPI$1.restartApp(); - } - } - ], - menuCommands: [ - { - path: ["Help"], - commands: [ - "Comfy-Desktop.OpenUserGuide", - "Comfy-Desktop.OpenFeedbackPage" - ] - }, - { - path: ["Help"], - commands: ["Comfy-Desktop.OpenDevTools"] - }, - { - path: ["Help", "Open Folder"], - commands: [ - "Comfy-Desktop.Folders.OpenLogsFolder", - "Comfy-Desktop.Folders.OpenModelsFolder", - "Comfy-Desktop.Folders.OpenOutputsFolder", - "Comfy-Desktop.Folders.OpenInputsFolder", - "Comfy-Desktop.Folders.OpenCustomNodesFolder", - "Comfy-Desktop.Folders.OpenModelConfig" - ] - }, - { - path: ["Help"], - commands: ["Comfy-Desktop.Reinstall"] - } - ], - aboutPageBadges: [ - { - label: "ComfyUI_desktop v" + desktopAppVersion, - url: "https://github.com/Comfy-Org/electron", - icon: "pi pi-github" - } - ] - }); -})(); /** * @license * Copyright 2010-2024 Three.js Authors @@ -41692,4140 +36361,6 @@ function interceptControlUp(event) { } } __name(interceptControlUp, "interceptControlUp"); -function computeMikkTSpaceTangents(geometry, MikkTSpace, negateSign = true) { - if (!MikkTSpace || !MikkTSpace.isReady) { - throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required."); - } - if (!geometry.hasAttribute("position") || !geometry.hasAttribute("normal") || !geometry.hasAttribute("uv")) { - throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.'); - } - function getAttributeArray(attribute) { - if (attribute.normalized || attribute.isInterleavedBufferAttribute) { - const dstArray = new Float32Array(attribute.count * attribute.itemSize); - for (let i = 0, j = 0; i < attribute.count; i++) { - dstArray[j++] = attribute.getX(i); - dstArray[j++] = attribute.getY(i); - if (attribute.itemSize > 2) { - dstArray[j++] = attribute.getZ(i); - } - } - return dstArray; - } - if (attribute.array instanceof Float32Array) { - return attribute.array; - } - return new Float32Array(attribute.array); - } - __name(getAttributeArray, "getAttributeArray"); - const _geometry2 = geometry.index ? geometry.toNonIndexed() : geometry; - const tangents = MikkTSpace.generateTangents( - getAttributeArray(_geometry2.attributes.position), - getAttributeArray(_geometry2.attributes.normal), - getAttributeArray(_geometry2.attributes.uv) - ); - if (negateSign) { - for (let i = 3; i < tangents.length; i += 4) { - tangents[i] *= -1; - } - } - _geometry2.setAttribute("tangent", new BufferAttribute(tangents, 4)); - if (geometry !== _geometry2) { - geometry.copy(_geometry2); - } - return geometry; -} -__name(computeMikkTSpaceTangents, "computeMikkTSpaceTangents"); -function mergeGeometries(geometries, useGroups = false) { - const isIndexed = geometries[0].index !== null; - const attributesUsed = new Set(Object.keys(geometries[0].attributes)); - const morphAttributesUsed = new Set(Object.keys(geometries[0].morphAttributes)); - const attributes = {}; - const morphAttributes = {}; - const morphTargetsRelative = geometries[0].morphTargetsRelative; - const mergedGeometry = new BufferGeometry(); - let offset = 0; - for (let i = 0; i < geometries.length; ++i) { - const geometry = geometries[i]; - let attributesCount = 0; - if (isIndexed !== (geometry.index !== null)) { - console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."); - return null; - } - for (const name in geometry.attributes) { - if (!attributesUsed.has(name)) { - console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + '. All geometries must have compatible attributes; make sure "' + name + '" attribute exists among all geometries, or in none of them.'); - return null; - } - if (attributes[name] === void 0) attributes[name] = []; - attributes[name].push(geometry.attributes[name]); - attributesCount++; - } - if (attributesCount !== attributesUsed.size) { - console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". Make sure all geometries have the same number of attributes."); - return null; - } - if (morphTargetsRelative !== geometry.morphTargetsRelative) { - console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". .morphTargetsRelative must be consistent throughout all geometries."); - return null; - } - for (const name in geometry.morphAttributes) { - if (!morphAttributesUsed.has(name)) { - console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". .morphAttributes must be consistent throughout all geometries."); - return null; - } - if (morphAttributes[name] === void 0) morphAttributes[name] = []; - morphAttributes[name].push(geometry.morphAttributes[name]); - } - if (useGroups) { - let count; - if (isIndexed) { - count = geometry.index.count; - } else if (geometry.attributes.position !== void 0) { - count = geometry.attributes.position.count; - } else { - console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". The geometry must have either an index or a position attribute"); - return null; - } - mergedGeometry.addGroup(offset, count, i); - offset += count; - } - } - if (isIndexed) { - let indexOffset = 0; - const mergedIndex = []; - for (let i = 0; i < geometries.length; ++i) { - const index = geometries[i].index; - for (let j = 0; j < index.count; ++j) { - mergedIndex.push(index.getX(j) + indexOffset); - } - indexOffset += geometries[i].attributes.position.count; - } - mergedGeometry.setIndex(mergedIndex); - } - for (const name in attributes) { - const mergedAttribute = mergeAttributes(attributes[name]); - if (!mergedAttribute) { - console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + name + " attribute."); - return null; - } - mergedGeometry.setAttribute(name, mergedAttribute); - } - for (const name in morphAttributes) { - const numMorphTargets = morphAttributes[name][0].length; - if (numMorphTargets === 0) break; - mergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {}; - mergedGeometry.morphAttributes[name] = []; - for (let i = 0; i < numMorphTargets; ++i) { - const morphAttributesToMerge = []; - for (let j = 0; j < morphAttributes[name].length; ++j) { - morphAttributesToMerge.push(morphAttributes[name][j][i]); - } - const mergedMorphAttribute = mergeAttributes(morphAttributesToMerge); - if (!mergedMorphAttribute) { - console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + name + " morphAttribute."); - return null; - } - mergedGeometry.morphAttributes[name].push(mergedMorphAttribute); - } - } - return mergedGeometry; -} -__name(mergeGeometries, "mergeGeometries"); -function mergeAttributes(attributes) { - let TypedArray; - let itemSize; - let normalized; - let gpuType = -1; - let arrayLength = 0; - for (let i = 0; i < attributes.length; ++i) { - const attribute = attributes[i]; - if (TypedArray === void 0) TypedArray = attribute.array.constructor; - if (TypedArray !== attribute.array.constructor) { - console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."); - return null; - } - if (itemSize === void 0) itemSize = attribute.itemSize; - if (itemSize !== attribute.itemSize) { - console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."); - return null; - } - if (normalized === void 0) normalized = attribute.normalized; - if (normalized !== attribute.normalized) { - console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."); - return null; - } - if (gpuType === -1) gpuType = attribute.gpuType; - if (gpuType !== attribute.gpuType) { - console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."); - return null; - } - arrayLength += attribute.count * itemSize; - } - const array = new TypedArray(arrayLength); - const result = new BufferAttribute(array, itemSize, normalized); - let offset = 0; - for (let i = 0; i < attributes.length; ++i) { - const attribute = attributes[i]; - if (attribute.isInterleavedBufferAttribute) { - const tupleOffset = offset / itemSize; - for (let j = 0, l = attribute.count; j < l; j++) { - for (let c = 0; c < itemSize; c++) { - const value = attribute.getComponent(j, c); - result.setComponent(j + tupleOffset, c, value); - } - } - } else { - array.set(attribute.array, offset); - } - offset += attribute.count * itemSize; - } - if (gpuType !== void 0) { - result.gpuType = gpuType; - } - return result; -} -__name(mergeAttributes, "mergeAttributes"); -function deepCloneAttribute(attribute) { - if (attribute.isInstancedInterleavedBufferAttribute || attribute.isInterleavedBufferAttribute) { - return deinterleaveAttribute(attribute); - } - if (attribute.isInstancedBufferAttribute) { - return new InstancedBufferAttribute().copy(attribute); - } - return new BufferAttribute().copy(attribute); -} -__name(deepCloneAttribute, "deepCloneAttribute"); -function interleaveAttributes(attributes) { - let TypedArray; - let arrayLength = 0; - let stride = 0; - for (let i = 0, l = attributes.length; i < l; ++i) { - const attribute = attributes[i]; - if (TypedArray === void 0) TypedArray = attribute.array.constructor; - if (TypedArray !== attribute.array.constructor) { - console.error("AttributeBuffers of different types cannot be interleaved"); - return null; - } - arrayLength += attribute.array.length; - stride += attribute.itemSize; - } - const interleavedBuffer = new InterleavedBuffer(new TypedArray(arrayLength), stride); - let offset = 0; - const res = []; - const getters = ["getX", "getY", "getZ", "getW"]; - const setters = ["setX", "setY", "setZ", "setW"]; - for (let j = 0, l = attributes.length; j < l; j++) { - const attribute = attributes[j]; - const itemSize = attribute.itemSize; - const count = attribute.count; - const iba = new InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, attribute.normalized); - res.push(iba); - offset += itemSize; - for (let c = 0; c < count; c++) { - for (let k = 0; k < itemSize; k++) { - iba[setters[k]](c, attribute[getters[k]](c)); - } - } - } - return res; -} -__name(interleaveAttributes, "interleaveAttributes"); -function deinterleaveAttribute(attribute) { - const cons = attribute.data.array.constructor; - const count = attribute.count; - const itemSize = attribute.itemSize; - const normalized = attribute.normalized; - const array = new cons(count * itemSize); - let newAttribute; - if (attribute.isInstancedInterleavedBufferAttribute) { - newAttribute = new InstancedBufferAttribute(array, itemSize, normalized, attribute.meshPerAttribute); - } else { - newAttribute = new BufferAttribute(array, itemSize, normalized); - } - for (let i = 0; i < count; i++) { - newAttribute.setX(i, attribute.getX(i)); - if (itemSize >= 2) { - newAttribute.setY(i, attribute.getY(i)); - } - if (itemSize >= 3) { - newAttribute.setZ(i, attribute.getZ(i)); - } - if (itemSize >= 4) { - newAttribute.setW(i, attribute.getW(i)); - } - } - return newAttribute; -} -__name(deinterleaveAttribute, "deinterleaveAttribute"); -function deinterleaveGeometry(geometry) { - const attributes = geometry.attributes; - const morphTargets = geometry.morphTargets; - const attrMap = /* @__PURE__ */ new Map(); - for (const key in attributes) { - const attr = attributes[key]; - if (attr.isInterleavedBufferAttribute) { - if (!attrMap.has(attr)) { - attrMap.set(attr, deinterleaveAttribute(attr)); - } - attributes[key] = attrMap.get(attr); - } - } - for (const key in morphTargets) { - const attr = morphTargets[key]; - if (attr.isInterleavedBufferAttribute) { - if (!attrMap.has(attr)) { - attrMap.set(attr, deinterleaveAttribute(attr)); - } - morphTargets[key] = attrMap.get(attr); - } - } -} -__name(deinterleaveGeometry, "deinterleaveGeometry"); -function estimateBytesUsed(geometry) { - let mem = 0; - for (const name in geometry.attributes) { - const attr = geometry.getAttribute(name); - mem += attr.count * attr.itemSize * attr.array.BYTES_PER_ELEMENT; - } - const indices = geometry.getIndex(); - mem += indices ? indices.count * indices.itemSize * indices.array.BYTES_PER_ELEMENT : 0; - return mem; -} -__name(estimateBytesUsed, "estimateBytesUsed"); -function mergeVertices(geometry, tolerance = 1e-4) { - tolerance = Math.max(tolerance, Number.EPSILON); - const hashToIndex = {}; - const indices = geometry.getIndex(); - const positions = geometry.getAttribute("position"); - const vertexCount = indices ? indices.count : positions.count; - let nextIndex = 0; - const attributeNames = Object.keys(geometry.attributes); - const tmpAttributes = {}; - const tmpMorphAttributes = {}; - const newIndices = []; - const getters = ["getX", "getY", "getZ", "getW"]; - const setters = ["setX", "setY", "setZ", "setW"]; - for (let i = 0, l = attributeNames.length; i < l; i++) { - const name = attributeNames[i]; - const attr = geometry.attributes[name]; - tmpAttributes[name] = new attr.constructor( - new attr.array.constructor(attr.count * attr.itemSize), - attr.itemSize, - attr.normalized - ); - const morphAttributes = geometry.morphAttributes[name]; - if (morphAttributes) { - if (!tmpMorphAttributes[name]) tmpMorphAttributes[name] = []; - morphAttributes.forEach((morphAttr, i2) => { - const array = new morphAttr.array.constructor(morphAttr.count * morphAttr.itemSize); - tmpMorphAttributes[name][i2] = new morphAttr.constructor(array, morphAttr.itemSize, morphAttr.normalized); - }); - } - } - const halfTolerance = tolerance * 0.5; - const exponent = Math.log10(1 / tolerance); - const hashMultiplier = Math.pow(10, exponent); - const hashAdditive = halfTolerance * hashMultiplier; - for (let i = 0; i < vertexCount; i++) { - const index = indices ? indices.getX(i) : i; - let hash = ""; - for (let j = 0, l = attributeNames.length; j < l; j++) { - const name = attributeNames[j]; - const attribute = geometry.getAttribute(name); - const itemSize = attribute.itemSize; - for (let k = 0; k < itemSize; k++) { - hash += `${~~(attribute[getters[k]](index) * hashMultiplier + hashAdditive)},`; - } - } - if (hash in hashToIndex) { - newIndices.push(hashToIndex[hash]); - } else { - for (let j = 0, l = attributeNames.length; j < l; j++) { - const name = attributeNames[j]; - const attribute = geometry.getAttribute(name); - const morphAttributes = geometry.morphAttributes[name]; - const itemSize = attribute.itemSize; - const newArray = tmpAttributes[name]; - const newMorphArrays = tmpMorphAttributes[name]; - for (let k = 0; k < itemSize; k++) { - const getterFunc = getters[k]; - const setterFunc = setters[k]; - newArray[setterFunc](nextIndex, attribute[getterFunc](index)); - if (morphAttributes) { - for (let m = 0, ml = morphAttributes.length; m < ml; m++) { - newMorphArrays[m][setterFunc](nextIndex, morphAttributes[m][getterFunc](index)); - } - } - } - } - hashToIndex[hash] = nextIndex; - newIndices.push(nextIndex); - nextIndex++; - } - } - const result = geometry.clone(); - for (const name in geometry.attributes) { - const tmpAttribute = tmpAttributes[name]; - result.setAttribute(name, new tmpAttribute.constructor( - tmpAttribute.array.slice(0, nextIndex * tmpAttribute.itemSize), - tmpAttribute.itemSize, - tmpAttribute.normalized - )); - if (!(name in tmpMorphAttributes)) continue; - for (let j = 0; j < tmpMorphAttributes[name].length; j++) { - const tmpMorphAttribute = tmpMorphAttributes[name][j]; - result.morphAttributes[name][j] = new tmpMorphAttribute.constructor( - tmpMorphAttribute.array.slice(0, nextIndex * tmpMorphAttribute.itemSize), - tmpMorphAttribute.itemSize, - tmpMorphAttribute.normalized - ); - } - } - result.setIndex(newIndices); - return result; -} -__name(mergeVertices, "mergeVertices"); -function toTrianglesDrawMode(geometry, drawMode) { - if (drawMode === TrianglesDrawMode) { - console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."); - return geometry; - } - if (drawMode === TriangleFanDrawMode || drawMode === TriangleStripDrawMode) { - let index = geometry.getIndex(); - if (index === null) { - const indices = []; - const position = geometry.getAttribute("position"); - if (position !== void 0) { - for (let i = 0; i < position.count; i++) { - indices.push(i); - } - geometry.setIndex(indices); - index = geometry.getIndex(); - } else { - console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."); - return geometry; - } - } - const numberOfTriangles = index.count - 2; - const newIndices = []; - if (drawMode === TriangleFanDrawMode) { - for (let i = 1; i <= numberOfTriangles; i++) { - newIndices.push(index.getX(0)); - newIndices.push(index.getX(i)); - newIndices.push(index.getX(i + 1)); - } - } else { - for (let i = 0; i < numberOfTriangles; i++) { - if (i % 2 === 0) { - newIndices.push(index.getX(i)); - newIndices.push(index.getX(i + 1)); - newIndices.push(index.getX(i + 2)); - } else { - newIndices.push(index.getX(i + 2)); - newIndices.push(index.getX(i + 1)); - newIndices.push(index.getX(i)); - } - } - } - if (newIndices.length / 3 !== numberOfTriangles) { - console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles."); - } - const newGeometry = geometry.clone(); - newGeometry.setIndex(newIndices); - newGeometry.clearGroups(); - return newGeometry; - } else { - console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", drawMode); - return geometry; - } -} -__name(toTrianglesDrawMode, "toTrianglesDrawMode"); -function computeMorphedAttributes(object) { - const _vA2 = new Vector3(); - const _vB2 = new Vector3(); - const _vC2 = new Vector3(); - const _tempA2 = new Vector3(); - const _tempB = new Vector3(); - const _tempC = new Vector3(); - const _morphA2 = new Vector3(); - const _morphB = new Vector3(); - const _morphC = new Vector3(); - function _calculateMorphedAttributeData(object2, attribute, morphAttribute, morphTargetsRelative2, a2, b3, c2, modifiedAttributeArray) { - _vA2.fromBufferAttribute(attribute, a2); - _vB2.fromBufferAttribute(attribute, b3); - _vC2.fromBufferAttribute(attribute, c2); - const morphInfluences = object2.morphTargetInfluences; - if (morphAttribute && morphInfluences) { - _morphA2.set(0, 0, 0); - _morphB.set(0, 0, 0); - _morphC.set(0, 0, 0); - for (let i2 = 0, il2 = morphAttribute.length; i2 < il2; i2++) { - const influence = morphInfluences[i2]; - const morph = morphAttribute[i2]; - if (influence === 0) continue; - _tempA2.fromBufferAttribute(morph, a2); - _tempB.fromBufferAttribute(morph, b3); - _tempC.fromBufferAttribute(morph, c2); - if (morphTargetsRelative2) { - _morphA2.addScaledVector(_tempA2, influence); - _morphB.addScaledVector(_tempB, influence); - _morphC.addScaledVector(_tempC, influence); - } else { - _morphA2.addScaledVector(_tempA2.sub(_vA2), influence); - _morphB.addScaledVector(_tempB.sub(_vB2), influence); - _morphC.addScaledVector(_tempC.sub(_vC2), influence); - } - } - _vA2.add(_morphA2); - _vB2.add(_morphB); - _vC2.add(_morphC); - } - if (object2.isSkinnedMesh) { - object2.applyBoneTransform(a2, _vA2); - object2.applyBoneTransform(b3, _vB2); - object2.applyBoneTransform(c2, _vC2); - } - modifiedAttributeArray[a2 * 3 + 0] = _vA2.x; - modifiedAttributeArray[a2 * 3 + 1] = _vA2.y; - modifiedAttributeArray[a2 * 3 + 2] = _vA2.z; - modifiedAttributeArray[b3 * 3 + 0] = _vB2.x; - modifiedAttributeArray[b3 * 3 + 1] = _vB2.y; - modifiedAttributeArray[b3 * 3 + 2] = _vB2.z; - modifiedAttributeArray[c2 * 3 + 0] = _vC2.x; - modifiedAttributeArray[c2 * 3 + 1] = _vC2.y; - modifiedAttributeArray[c2 * 3 + 2] = _vC2.z; - } - __name(_calculateMorphedAttributeData, "_calculateMorphedAttributeData"); - const geometry = object.geometry; - const material = object.material; - let a, b, c; - const index = geometry.index; - const positionAttribute = geometry.attributes.position; - const morphPosition = geometry.morphAttributes.position; - const morphTargetsRelative = geometry.morphTargetsRelative; - const normalAttribute = geometry.attributes.normal; - const morphNormal = geometry.morphAttributes.position; - const groups = geometry.groups; - const drawRange = geometry.drawRange; - let i, j, il, jl; - let group; - let start, end; - const modifiedPosition = new Float32Array(positionAttribute.count * positionAttribute.itemSize); - const modifiedNormal = new Float32Array(normalAttribute.count * normalAttribute.itemSize); - if (index !== null) { - if (Array.isArray(material)) { - for (i = 0, il = groups.length; i < il; i++) { - group = groups[i]; - start = Math.max(group.start, drawRange.start); - end = Math.min(group.start + group.count, drawRange.start + drawRange.count); - for (j = start, jl = end; j < jl; j += 3) { - a = index.getX(j); - b = index.getX(j + 1); - c = index.getX(j + 2); - _calculateMorphedAttributeData( - object, - positionAttribute, - morphPosition, - morphTargetsRelative, - a, - b, - c, - modifiedPosition - ); - _calculateMorphedAttributeData( - object, - normalAttribute, - morphNormal, - morphTargetsRelative, - a, - b, - c, - modifiedNormal - ); - } - } - } else { - start = Math.max(0, drawRange.start); - end = Math.min(index.count, drawRange.start + drawRange.count); - for (i = start, il = end; i < il; i += 3) { - a = index.getX(i); - b = index.getX(i + 1); - c = index.getX(i + 2); - _calculateMorphedAttributeData( - object, - positionAttribute, - morphPosition, - morphTargetsRelative, - a, - b, - c, - modifiedPosition - ); - _calculateMorphedAttributeData( - object, - normalAttribute, - morphNormal, - morphTargetsRelative, - a, - b, - c, - modifiedNormal - ); - } - } - } else { - if (Array.isArray(material)) { - for (i = 0, il = groups.length; i < il; i++) { - group = groups[i]; - start = Math.max(group.start, drawRange.start); - end = Math.min(group.start + group.count, drawRange.start + drawRange.count); - for (j = start, jl = end; j < jl; j += 3) { - a = j; - b = j + 1; - c = j + 2; - _calculateMorphedAttributeData( - object, - positionAttribute, - morphPosition, - morphTargetsRelative, - a, - b, - c, - modifiedPosition - ); - _calculateMorphedAttributeData( - object, - normalAttribute, - morphNormal, - morphTargetsRelative, - a, - b, - c, - modifiedNormal - ); - } - } - } else { - start = Math.max(0, drawRange.start); - end = Math.min(positionAttribute.count, drawRange.start + drawRange.count); - for (i = start, il = end; i < il; i += 3) { - a = i; - b = i + 1; - c = i + 2; - _calculateMorphedAttributeData( - object, - positionAttribute, - morphPosition, - morphTargetsRelative, - a, - b, - c, - modifiedPosition - ); - _calculateMorphedAttributeData( - object, - normalAttribute, - morphNormal, - morphTargetsRelative, - a, - b, - c, - modifiedNormal - ); - } - } - } - const morphedPositionAttribute = new Float32BufferAttribute(modifiedPosition, 3); - const morphedNormalAttribute = new Float32BufferAttribute(modifiedNormal, 3); - return { - positionAttribute, - normalAttribute, - morphedPositionAttribute, - morphedNormalAttribute - }; -} -__name(computeMorphedAttributes, "computeMorphedAttributes"); -function mergeGroups(geometry) { - if (geometry.groups.length === 0) { - console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."); - return geometry; - } - let groups = geometry.groups; - groups = groups.sort((a, b) => { - if (a.materialIndex !== b.materialIndex) return a.materialIndex - b.materialIndex; - return a.start - b.start; - }); - if (geometry.getIndex() === null) { - const positionAttribute = geometry.getAttribute("position"); - const indices = []; - for (let i = 0; i < positionAttribute.count; i += 3) { - indices.push(i, i + 1, i + 2); - } - geometry.setIndex(indices); - } - const index = geometry.getIndex(); - const newIndices = []; - for (let i = 0; i < groups.length; i++) { - const group = groups[i]; - const groupStart = group.start; - const groupLength = groupStart + group.count; - for (let j = groupStart; j < groupLength; j++) { - newIndices.push(index.getX(j)); - } - } - geometry.dispose(); - geometry.setIndex(newIndices); - let start = 0; - for (let i = 0; i < groups.length; i++) { - const group = groups[i]; - group.start = start; - start += group.count; - } - let currentGroup = groups[0]; - geometry.groups = [currentGroup]; - for (let i = 1; i < groups.length; i++) { - const group = groups[i]; - if (currentGroup.materialIndex === group.materialIndex) { - currentGroup.count += group.count; - } else { - currentGroup = group; - geometry.groups.push(currentGroup); - } - } - return geometry; -} -__name(mergeGroups, "mergeGroups"); -function toCreasedNormals(geometry, creaseAngle = Math.PI / 3) { - const creaseDot = Math.cos(creaseAngle); - const hashMultiplier = (1 + 1e-10) * 100; - const verts = [new Vector3(), new Vector3(), new Vector3()]; - const tempVec1 = new Vector3(); - const tempVec2 = new Vector3(); - const tempNorm = new Vector3(); - const tempNorm2 = new Vector3(); - function hashVertex(v) { - const x = ~~(v.x * hashMultiplier); - const y = ~~(v.y * hashMultiplier); - const z = ~~(v.z * hashMultiplier); - return `${x},${y},${z}`; - } - __name(hashVertex, "hashVertex"); - const resultGeometry = geometry.index ? geometry.toNonIndexed() : geometry; - const posAttr = resultGeometry.attributes.position; - const vertexMap = {}; - for (let i = 0, l = posAttr.count / 3; i < l; i++) { - const i3 = 3 * i; - const a = verts[0].fromBufferAttribute(posAttr, i3 + 0); - const b = verts[1].fromBufferAttribute(posAttr, i3 + 1); - const c = verts[2].fromBufferAttribute(posAttr, i3 + 2); - tempVec1.subVectors(c, b); - tempVec2.subVectors(a, b); - const normal = new Vector3().crossVectors(tempVec1, tempVec2).normalize(); - for (let n = 0; n < 3; n++) { - const vert = verts[n]; - const hash = hashVertex(vert); - if (!(hash in vertexMap)) { - vertexMap[hash] = []; - } - vertexMap[hash].push(normal); - } - } - const normalArray = new Float32Array(posAttr.count * 3); - const normAttr = new BufferAttribute(normalArray, 3, false); - for (let i = 0, l = posAttr.count / 3; i < l; i++) { - const i3 = 3 * i; - const a = verts[0].fromBufferAttribute(posAttr, i3 + 0); - const b = verts[1].fromBufferAttribute(posAttr, i3 + 1); - const c = verts[2].fromBufferAttribute(posAttr, i3 + 2); - tempVec1.subVectors(c, b); - tempVec2.subVectors(a, b); - tempNorm.crossVectors(tempVec1, tempVec2).normalize(); - for (let n = 0; n < 3; n++) { - const vert = verts[n]; - const hash = hashVertex(vert); - const otherNormals = vertexMap[hash]; - tempNorm2.set(0, 0, 0); - for (let k = 0, lk = otherNormals.length; k < lk; k++) { - const otherNorm = otherNormals[k]; - if (tempNorm.dot(otherNorm) > creaseDot) { - tempNorm2.add(otherNorm); - } - } - tempNorm2.normalize(); - normAttr.setXYZ(i3 + n, tempNorm2.x, tempNorm2.y, tempNorm2.z); - } - } - resultGeometry.setAttribute("normal", normAttr); - return resultGeometry; -} -__name(toCreasedNormals, "toCreasedNormals"); -class GLTFLoader extends Loader { - static { - __name(this, "GLTFLoader"); - } - constructor(manager) { - super(manager); - this.dracoLoader = null; - this.ktx2Loader = null; - this.meshoptDecoder = null; - this.pluginCallbacks = []; - this.register(function(parser) { - return new GLTFMaterialsClearcoatExtension(parser); - }); - this.register(function(parser) { - return new GLTFMaterialsDispersionExtension(parser); - }); - this.register(function(parser) { - return new GLTFTextureBasisUExtension(parser); - }); - this.register(function(parser) { - return new GLTFTextureWebPExtension(parser); - }); - this.register(function(parser) { - return new GLTFTextureAVIFExtension(parser); - }); - this.register(function(parser) { - return new GLTFMaterialsSheenExtension(parser); - }); - this.register(function(parser) { - return new GLTFMaterialsTransmissionExtension(parser); - }); - this.register(function(parser) { - return new GLTFMaterialsVolumeExtension(parser); - }); - this.register(function(parser) { - return new GLTFMaterialsIorExtension(parser); - }); - this.register(function(parser) { - return new GLTFMaterialsEmissiveStrengthExtension(parser); - }); - this.register(function(parser) { - return new GLTFMaterialsSpecularExtension(parser); - }); - this.register(function(parser) { - return new GLTFMaterialsIridescenceExtension(parser); - }); - this.register(function(parser) { - return new GLTFMaterialsAnisotropyExtension(parser); - }); - this.register(function(parser) { - return new GLTFMaterialsBumpExtension(parser); - }); - this.register(function(parser) { - return new GLTFLightsExtension(parser); - }); - this.register(function(parser) { - return new GLTFMeshoptCompression(parser); - }); - this.register(function(parser) { - return new GLTFMeshGpuInstancing(parser); - }); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - let resourcePath; - if (this.resourcePath !== "") { - resourcePath = this.resourcePath; - } else if (this.path !== "") { - const relativeUrl = LoaderUtils.extractUrlBase(url); - resourcePath = LoaderUtils.resolveURL(relativeUrl, this.path); - } else { - resourcePath = LoaderUtils.extractUrlBase(url); - } - this.manager.itemStart(url); - const _onError = /* @__PURE__ */ __name(function(e) { - if (onError) { - onError(e); - } else { - console.error(e); - } - scope.manager.itemError(url); - scope.manager.itemEnd(url); - }, "_onError"); - const loader = new FileLoader(this.manager); - loader.setPath(this.path); - loader.setResponseType("arraybuffer"); - loader.setRequestHeader(this.requestHeader); - loader.setWithCredentials(this.withCredentials); - loader.load(url, function(data) { - try { - scope.parse(data, resourcePath, function(gltf) { - onLoad(gltf); - scope.manager.itemEnd(url); - }, _onError); - } catch (e) { - _onError(e); - } - }, onProgress, _onError); - } - setDRACOLoader(dracoLoader) { - this.dracoLoader = dracoLoader; - return this; - } - setKTX2Loader(ktx2Loader) { - this.ktx2Loader = ktx2Loader; - return this; - } - setMeshoptDecoder(meshoptDecoder) { - this.meshoptDecoder = meshoptDecoder; - return this; - } - register(callback) { - if (this.pluginCallbacks.indexOf(callback) === -1) { - this.pluginCallbacks.push(callback); - } - return this; - } - unregister(callback) { - if (this.pluginCallbacks.indexOf(callback) !== -1) { - this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback), 1); - } - return this; - } - parse(data, path, onLoad, onError) { - let json; - const extensions = {}; - const plugins = {}; - const textDecoder = new TextDecoder(); - if (typeof data === "string") { - json = JSON.parse(data); - } else if (data instanceof ArrayBuffer) { - const magic = textDecoder.decode(new Uint8Array(data, 0, 4)); - if (magic === BINARY_EXTENSION_HEADER_MAGIC) { - try { - extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data); - } catch (error) { - if (onError) onError(error); - return; - } - json = JSON.parse(extensions[EXTENSIONS.KHR_BINARY_GLTF].content); - } else { - json = JSON.parse(textDecoder.decode(data)); - } - } else { - json = data; - } - if (json.asset === void 0 || json.asset.version[0] < 2) { - if (onError) onError(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")); - return; - } - const parser = new GLTFParser(json, { - path: path || this.resourcePath || "", - crossOrigin: this.crossOrigin, - requestHeader: this.requestHeader, - manager: this.manager, - ktx2Loader: this.ktx2Loader, - meshoptDecoder: this.meshoptDecoder - }); - parser.fileLoader.setRequestHeader(this.requestHeader); - for (let i = 0; i < this.pluginCallbacks.length; i++) { - const plugin = this.pluginCallbacks[i](parser); - if (!plugin.name) console.error("THREE.GLTFLoader: Invalid plugin found: missing name"); - plugins[plugin.name] = plugin; - extensions[plugin.name] = true; - } - if (json.extensionsUsed) { - for (let i = 0; i < json.extensionsUsed.length; ++i) { - const extensionName = json.extensionsUsed[i]; - const extensionsRequired = json.extensionsRequired || []; - switch (extensionName) { - case EXTENSIONS.KHR_MATERIALS_UNLIT: - extensions[extensionName] = new GLTFMaterialsUnlitExtension(); - break; - case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION: - extensions[extensionName] = new GLTFDracoMeshCompressionExtension(json, this.dracoLoader); - break; - case EXTENSIONS.KHR_TEXTURE_TRANSFORM: - extensions[extensionName] = new GLTFTextureTransformExtension(); - break; - case EXTENSIONS.KHR_MESH_QUANTIZATION: - extensions[extensionName] = new GLTFMeshQuantizationExtension(); - break; - default: - if (extensionsRequired.indexOf(extensionName) >= 0 && plugins[extensionName] === void 0) { - console.warn('THREE.GLTFLoader: Unknown extension "' + extensionName + '".'); - } - } - } - } - parser.setExtensions(extensions); - parser.setPlugins(plugins); - parser.parse(onLoad, onError); - } - parseAsync(data, path) { - const scope = this; - return new Promise(function(resolve, reject) { - scope.parse(data, path, resolve, reject); - }); - } -} -function GLTFRegistry() { - let objects = {}; - return { - get: /* @__PURE__ */ __name(function(key) { - return objects[key]; - }, "get"), - add: /* @__PURE__ */ __name(function(key, object) { - objects[key] = object; - }, "add"), - remove: /* @__PURE__ */ __name(function(key) { - delete objects[key]; - }, "remove"), - removeAll: /* @__PURE__ */ __name(function() { - objects = {}; - }, "removeAll") - }; -} -__name(GLTFRegistry, "GLTFRegistry"); -const EXTENSIONS = { - KHR_BINARY_GLTF: "KHR_binary_glTF", - KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression", - KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual", - KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat", - KHR_MATERIALS_DISPERSION: "KHR_materials_dispersion", - KHR_MATERIALS_IOR: "KHR_materials_ior", - KHR_MATERIALS_SHEEN: "KHR_materials_sheen", - KHR_MATERIALS_SPECULAR: "KHR_materials_specular", - KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission", - KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence", - KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy", - KHR_MATERIALS_UNLIT: "KHR_materials_unlit", - KHR_MATERIALS_VOLUME: "KHR_materials_volume", - KHR_TEXTURE_BASISU: "KHR_texture_basisu", - KHR_TEXTURE_TRANSFORM: "KHR_texture_transform", - KHR_MESH_QUANTIZATION: "KHR_mesh_quantization", - KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength", - EXT_MATERIALS_BUMP: "EXT_materials_bump", - EXT_TEXTURE_WEBP: "EXT_texture_webp", - EXT_TEXTURE_AVIF: "EXT_texture_avif", - EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression", - EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing" -}; -class GLTFLightsExtension { - static { - __name(this, "GLTFLightsExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL; - this.cache = { refs: {}, uses: {} }; - } - _markDefs() { - const parser = this.parser; - const nodeDefs = this.parser.json.nodes || []; - for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) { - const nodeDef = nodeDefs[nodeIndex]; - if (nodeDef.extensions && nodeDef.extensions[this.name] && nodeDef.extensions[this.name].light !== void 0) { - parser._addNodeRef(this.cache, nodeDef.extensions[this.name].light); - } - } - } - _loadLight(lightIndex) { - const parser = this.parser; - const cacheKey = "light:" + lightIndex; - let dependency = parser.cache.get(cacheKey); - if (dependency) return dependency; - const json = parser.json; - const extensions = json.extensions && json.extensions[this.name] || {}; - const lightDefs = extensions.lights || []; - const lightDef = lightDefs[lightIndex]; - let lightNode; - const color = new Color(16777215); - if (lightDef.color !== void 0) color.setRGB(lightDef.color[0], lightDef.color[1], lightDef.color[2], LinearSRGBColorSpace); - const range = lightDef.range !== void 0 ? lightDef.range : 0; - switch (lightDef.type) { - case "directional": - lightNode = new DirectionalLight(color); - lightNode.target.position.set(0, 0, -1); - lightNode.add(lightNode.target); - break; - case "point": - lightNode = new PointLight(color); - lightNode.distance = range; - break; - case "spot": - lightNode = new SpotLight(color); - lightNode.distance = range; - lightDef.spot = lightDef.spot || {}; - lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== void 0 ? lightDef.spot.innerConeAngle : 0; - lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== void 0 ? lightDef.spot.outerConeAngle : Math.PI / 4; - lightNode.angle = lightDef.spot.outerConeAngle; - lightNode.penumbra = 1 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle; - lightNode.target.position.set(0, 0, -1); - lightNode.add(lightNode.target); - break; - default: - throw new Error("THREE.GLTFLoader: Unexpected light type: " + lightDef.type); - } - lightNode.position.set(0, 0, 0); - lightNode.decay = 2; - assignExtrasToUserData(lightNode, lightDef); - if (lightDef.intensity !== void 0) lightNode.intensity = lightDef.intensity; - lightNode.name = parser.createUniqueName(lightDef.name || "light_" + lightIndex); - dependency = Promise.resolve(lightNode); - parser.cache.add(cacheKey, dependency); - return dependency; - } - getDependency(type, index) { - if (type !== "light") return; - return this._loadLight(index); - } - createNodeAttachment(nodeIndex) { - const self2 = this; - const parser = this.parser; - const json = parser.json; - const nodeDef = json.nodes[nodeIndex]; - const lightDef = nodeDef.extensions && nodeDef.extensions[this.name] || {}; - const lightIndex = lightDef.light; - if (lightIndex === void 0) return null; - return this._loadLight(lightIndex).then(function(light) { - return parser._getNodeRef(self2.cache, lightIndex, light); - }); - } -} -class GLTFMaterialsUnlitExtension { - static { - __name(this, "GLTFMaterialsUnlitExtension"); - } - constructor() { - this.name = EXTENSIONS.KHR_MATERIALS_UNLIT; - } - getMaterialType() { - return MeshBasicMaterial; - } - extendParams(materialParams, materialDef, parser) { - const pending = []; - materialParams.color = new Color(1, 1, 1); - materialParams.opacity = 1; - const metallicRoughness = materialDef.pbrMetallicRoughness; - if (metallicRoughness) { - if (Array.isArray(metallicRoughness.baseColorFactor)) { - const array = metallicRoughness.baseColorFactor; - materialParams.color.setRGB(array[0], array[1], array[2], LinearSRGBColorSpace); - materialParams.opacity = array[3]; - } - if (metallicRoughness.baseColorTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, SRGBColorSpace)); - } - } - return Promise.all(pending); - } -} -class GLTFMaterialsEmissiveStrengthExtension { - static { - __name(this, "GLTFMaterialsEmissiveStrengthExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.KHR_MATERIALS_EMISSIVE_STRENGTH; - } - extendMaterialParams(materialIndex, materialParams) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) { - return Promise.resolve(); - } - const emissiveStrength = materialDef.extensions[this.name].emissiveStrength; - if (emissiveStrength !== void 0) { - materialParams.emissiveIntensity = emissiveStrength; - } - return Promise.resolve(); - } -} -class GLTFMaterialsClearcoatExtension { - static { - __name(this, "GLTFMaterialsClearcoatExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT; - } - getMaterialType(materialIndex) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; - return MeshPhysicalMaterial; - } - extendMaterialParams(materialIndex, materialParams) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) { - return Promise.resolve(); - } - const pending = []; - const extension = materialDef.extensions[this.name]; - if (extension.clearcoatFactor !== void 0) { - materialParams.clearcoat = extension.clearcoatFactor; - } - if (extension.clearcoatTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "clearcoatMap", extension.clearcoatTexture)); - } - if (extension.clearcoatRoughnessFactor !== void 0) { - materialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor; - } - if (extension.clearcoatRoughnessTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "clearcoatRoughnessMap", extension.clearcoatRoughnessTexture)); - } - if (extension.clearcoatNormalTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "clearcoatNormalMap", extension.clearcoatNormalTexture)); - if (extension.clearcoatNormalTexture.scale !== void 0) { - const scale = extension.clearcoatNormalTexture.scale; - materialParams.clearcoatNormalScale = new Vector2(scale, scale); - } - } - return Promise.all(pending); - } -} -class GLTFMaterialsDispersionExtension { - static { - __name(this, "GLTFMaterialsDispersionExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.KHR_MATERIALS_DISPERSION; - } - getMaterialType(materialIndex) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; - return MeshPhysicalMaterial; - } - extendMaterialParams(materialIndex, materialParams) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) { - return Promise.resolve(); - } - const extension = materialDef.extensions[this.name]; - materialParams.dispersion = extension.dispersion !== void 0 ? extension.dispersion : 0; - return Promise.resolve(); - } -} -class GLTFMaterialsIridescenceExtension { - static { - __name(this, "GLTFMaterialsIridescenceExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.KHR_MATERIALS_IRIDESCENCE; - } - getMaterialType(materialIndex) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; - return MeshPhysicalMaterial; - } - extendMaterialParams(materialIndex, materialParams) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) { - return Promise.resolve(); - } - const pending = []; - const extension = materialDef.extensions[this.name]; - if (extension.iridescenceFactor !== void 0) { - materialParams.iridescence = extension.iridescenceFactor; - } - if (extension.iridescenceTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "iridescenceMap", extension.iridescenceTexture)); - } - if (extension.iridescenceIor !== void 0) { - materialParams.iridescenceIOR = extension.iridescenceIor; - } - if (materialParams.iridescenceThicknessRange === void 0) { - materialParams.iridescenceThicknessRange = [100, 400]; - } - if (extension.iridescenceThicknessMinimum !== void 0) { - materialParams.iridescenceThicknessRange[0] = extension.iridescenceThicknessMinimum; - } - if (extension.iridescenceThicknessMaximum !== void 0) { - materialParams.iridescenceThicknessRange[1] = extension.iridescenceThicknessMaximum; - } - if (extension.iridescenceThicknessTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "iridescenceThicknessMap", extension.iridescenceThicknessTexture)); - } - return Promise.all(pending); - } -} -class GLTFMaterialsSheenExtension { - static { - __name(this, "GLTFMaterialsSheenExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.KHR_MATERIALS_SHEEN; - } - getMaterialType(materialIndex) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; - return MeshPhysicalMaterial; - } - extendMaterialParams(materialIndex, materialParams) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) { - return Promise.resolve(); - } - const pending = []; - materialParams.sheenColor = new Color(0, 0, 0); - materialParams.sheenRoughness = 0; - materialParams.sheen = 1; - const extension = materialDef.extensions[this.name]; - if (extension.sheenColorFactor !== void 0) { - const colorFactor = extension.sheenColorFactor; - materialParams.sheenColor.setRGB(colorFactor[0], colorFactor[1], colorFactor[2], LinearSRGBColorSpace); - } - if (extension.sheenRoughnessFactor !== void 0) { - materialParams.sheenRoughness = extension.sheenRoughnessFactor; - } - if (extension.sheenColorTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "sheenColorMap", extension.sheenColorTexture, SRGBColorSpace)); - } - if (extension.sheenRoughnessTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "sheenRoughnessMap", extension.sheenRoughnessTexture)); - } - return Promise.all(pending); - } -} -class GLTFMaterialsTransmissionExtension { - static { - __name(this, "GLTFMaterialsTransmissionExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.KHR_MATERIALS_TRANSMISSION; - } - getMaterialType(materialIndex) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; - return MeshPhysicalMaterial; - } - extendMaterialParams(materialIndex, materialParams) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) { - return Promise.resolve(); - } - const pending = []; - const extension = materialDef.extensions[this.name]; - if (extension.transmissionFactor !== void 0) { - materialParams.transmission = extension.transmissionFactor; - } - if (extension.transmissionTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "transmissionMap", extension.transmissionTexture)); - } - return Promise.all(pending); - } -} -class GLTFMaterialsVolumeExtension { - static { - __name(this, "GLTFMaterialsVolumeExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.KHR_MATERIALS_VOLUME; - } - getMaterialType(materialIndex) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; - return MeshPhysicalMaterial; - } - extendMaterialParams(materialIndex, materialParams) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) { - return Promise.resolve(); - } - const pending = []; - const extension = materialDef.extensions[this.name]; - materialParams.thickness = extension.thicknessFactor !== void 0 ? extension.thicknessFactor : 0; - if (extension.thicknessTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "thicknessMap", extension.thicknessTexture)); - } - materialParams.attenuationDistance = extension.attenuationDistance || Infinity; - const colorArray = extension.attenuationColor || [1, 1, 1]; - materialParams.attenuationColor = new Color().setRGB(colorArray[0], colorArray[1], colorArray[2], LinearSRGBColorSpace); - return Promise.all(pending); - } -} -class GLTFMaterialsIorExtension { - static { - __name(this, "GLTFMaterialsIorExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.KHR_MATERIALS_IOR; - } - getMaterialType(materialIndex) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; - return MeshPhysicalMaterial; - } - extendMaterialParams(materialIndex, materialParams) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) { - return Promise.resolve(); - } - const extension = materialDef.extensions[this.name]; - materialParams.ior = extension.ior !== void 0 ? extension.ior : 1.5; - return Promise.resolve(); - } -} -class GLTFMaterialsSpecularExtension { - static { - __name(this, "GLTFMaterialsSpecularExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.KHR_MATERIALS_SPECULAR; - } - getMaterialType(materialIndex) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; - return MeshPhysicalMaterial; - } - extendMaterialParams(materialIndex, materialParams) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) { - return Promise.resolve(); - } - const pending = []; - const extension = materialDef.extensions[this.name]; - materialParams.specularIntensity = extension.specularFactor !== void 0 ? extension.specularFactor : 1; - if (extension.specularTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "specularIntensityMap", extension.specularTexture)); - } - const colorArray = extension.specularColorFactor || [1, 1, 1]; - materialParams.specularColor = new Color().setRGB(colorArray[0], colorArray[1], colorArray[2], LinearSRGBColorSpace); - if (extension.specularColorTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "specularColorMap", extension.specularColorTexture, SRGBColorSpace)); - } - return Promise.all(pending); - } -} -class GLTFMaterialsBumpExtension { - static { - __name(this, "GLTFMaterialsBumpExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.EXT_MATERIALS_BUMP; - } - getMaterialType(materialIndex) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; - return MeshPhysicalMaterial; - } - extendMaterialParams(materialIndex, materialParams) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) { - return Promise.resolve(); - } - const pending = []; - const extension = materialDef.extensions[this.name]; - materialParams.bumpScale = extension.bumpFactor !== void 0 ? extension.bumpFactor : 1; - if (extension.bumpTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "bumpMap", extension.bumpTexture)); - } - return Promise.all(pending); - } -} -class GLTFMaterialsAnisotropyExtension { - static { - __name(this, "GLTFMaterialsAnisotropyExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.KHR_MATERIALS_ANISOTROPY; - } - getMaterialType(materialIndex) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; - return MeshPhysicalMaterial; - } - extendMaterialParams(materialIndex, materialParams) { - const parser = this.parser; - const materialDef = parser.json.materials[materialIndex]; - if (!materialDef.extensions || !materialDef.extensions[this.name]) { - return Promise.resolve(); - } - const pending = []; - const extension = materialDef.extensions[this.name]; - if (extension.anisotropyStrength !== void 0) { - materialParams.anisotropy = extension.anisotropyStrength; - } - if (extension.anisotropyRotation !== void 0) { - materialParams.anisotropyRotation = extension.anisotropyRotation; - } - if (extension.anisotropyTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "anisotropyMap", extension.anisotropyTexture)); - } - return Promise.all(pending); - } -} -class GLTFTextureBasisUExtension { - static { - __name(this, "GLTFTextureBasisUExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.KHR_TEXTURE_BASISU; - } - loadTexture(textureIndex) { - const parser = this.parser; - const json = parser.json; - const textureDef = json.textures[textureIndex]; - if (!textureDef.extensions || !textureDef.extensions[this.name]) { - return null; - } - const extension = textureDef.extensions[this.name]; - const loader = parser.options.ktx2Loader; - if (!loader) { - if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) { - throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures"); - } else { - return null; - } - } - return parser.loadTextureImage(textureIndex, extension.source, loader); - } -} -class GLTFTextureWebPExtension { - static { - __name(this, "GLTFTextureWebPExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.EXT_TEXTURE_WEBP; - this.isSupported = null; - } - loadTexture(textureIndex) { - const name = this.name; - const parser = this.parser; - const json = parser.json; - const textureDef = json.textures[textureIndex]; - if (!textureDef.extensions || !textureDef.extensions[name]) { - return null; - } - const extension = textureDef.extensions[name]; - const source = json.images[extension.source]; - let loader = parser.textureLoader; - if (source.uri) { - const handler = parser.options.manager.getHandler(source.uri); - if (handler !== null) loader = handler; - } - return this.detectSupport().then(function(isSupported) { - if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader); - if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) { - throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported."); - } - return parser.loadTexture(textureIndex); - }); - } - detectSupport() { - if (!this.isSupported) { - this.isSupported = new Promise(function(resolve) { - const image = new Image(); - image.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"; - image.onload = image.onerror = function() { - resolve(image.height === 1); - }; - }); - } - return this.isSupported; - } -} -class GLTFTextureAVIFExtension { - static { - __name(this, "GLTFTextureAVIFExtension"); - } - constructor(parser) { - this.parser = parser; - this.name = EXTENSIONS.EXT_TEXTURE_AVIF; - this.isSupported = null; - } - loadTexture(textureIndex) { - const name = this.name; - const parser = this.parser; - const json = parser.json; - const textureDef = json.textures[textureIndex]; - if (!textureDef.extensions || !textureDef.extensions[name]) { - return null; - } - const extension = textureDef.extensions[name]; - const source = json.images[extension.source]; - let loader = parser.textureLoader; - if (source.uri) { - const handler = parser.options.manager.getHandler(source.uri); - if (handler !== null) loader = handler; - } - return this.detectSupport().then(function(isSupported) { - if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader); - if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) { - throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported."); - } - return parser.loadTexture(textureIndex); - }); - } - detectSupport() { - if (!this.isSupported) { - this.isSupported = new Promise(function(resolve) { - const image = new Image(); - image.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI="; - image.onload = image.onerror = function() { - resolve(image.height === 1); - }; - }); - } - return this.isSupported; - } -} -class GLTFMeshoptCompression { - static { - __name(this, "GLTFMeshoptCompression"); - } - constructor(parser) { - this.name = EXTENSIONS.EXT_MESHOPT_COMPRESSION; - this.parser = parser; - } - loadBufferView(index) { - const json = this.parser.json; - const bufferView = json.bufferViews[index]; - if (bufferView.extensions && bufferView.extensions[this.name]) { - const extensionDef = bufferView.extensions[this.name]; - const buffer = this.parser.getDependency("buffer", extensionDef.buffer); - const decoder = this.parser.options.meshoptDecoder; - if (!decoder || !decoder.supported) { - if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) { - throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files"); - } else { - return null; - } - } - return buffer.then(function(res) { - const byteOffset = extensionDef.byteOffset || 0; - const byteLength = extensionDef.byteLength || 0; - const count = extensionDef.count; - const stride = extensionDef.byteStride; - const source = new Uint8Array(res, byteOffset, byteLength); - if (decoder.decodeGltfBufferAsync) { - return decoder.decodeGltfBufferAsync(count, stride, source, extensionDef.mode, extensionDef.filter).then(function(res2) { - return res2.buffer; - }); - } else { - return decoder.ready.then(function() { - const result = new ArrayBuffer(count * stride); - decoder.decodeGltfBuffer(new Uint8Array(result), count, stride, source, extensionDef.mode, extensionDef.filter); - return result; - }); - } - }); - } else { - return null; - } - } -} -class GLTFMeshGpuInstancing { - static { - __name(this, "GLTFMeshGpuInstancing"); - } - constructor(parser) { - this.name = EXTENSIONS.EXT_MESH_GPU_INSTANCING; - this.parser = parser; - } - createNodeMesh(nodeIndex) { - const json = this.parser.json; - const nodeDef = json.nodes[nodeIndex]; - if (!nodeDef.extensions || !nodeDef.extensions[this.name] || nodeDef.mesh === void 0) { - return null; - } - const meshDef = json.meshes[nodeDef.mesh]; - for (const primitive of meshDef.primitives) { - if (primitive.mode !== WEBGL_CONSTANTS.TRIANGLES && primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_STRIP && primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_FAN && primitive.mode !== void 0) { - return null; - } - } - const extensionDef = nodeDef.extensions[this.name]; - const attributesDef = extensionDef.attributes; - const pending = []; - const attributes = {}; - for (const key in attributesDef) { - pending.push(this.parser.getDependency("accessor", attributesDef[key]).then((accessor) => { - attributes[key] = accessor; - return attributes[key]; - })); - } - if (pending.length < 1) { - return null; - } - pending.push(this.parser.createNodeMesh(nodeIndex)); - return Promise.all(pending).then((results) => { - const nodeObject = results.pop(); - const meshes = nodeObject.isGroup ? nodeObject.children : [nodeObject]; - const count = results[0].count; - const instancedMeshes = []; - for (const mesh of meshes) { - const m = new Matrix4(); - const p = new Vector3(); - const q = new Quaternion(); - const s = new Vector3(1, 1, 1); - const instancedMesh = new InstancedMesh(mesh.geometry, mesh.material, count); - for (let i = 0; i < count; i++) { - if (attributes.TRANSLATION) { - p.fromBufferAttribute(attributes.TRANSLATION, i); - } - if (attributes.ROTATION) { - q.fromBufferAttribute(attributes.ROTATION, i); - } - if (attributes.SCALE) { - s.fromBufferAttribute(attributes.SCALE, i); - } - instancedMesh.setMatrixAt(i, m.compose(p, q, s)); - } - for (const attributeName in attributes) { - if (attributeName === "_COLOR_0") { - const attr = attributes[attributeName]; - instancedMesh.instanceColor = new InstancedBufferAttribute(attr.array, attr.itemSize, attr.normalized); - } else if (attributeName !== "TRANSLATION" && attributeName !== "ROTATION" && attributeName !== "SCALE") { - mesh.geometry.setAttribute(attributeName, attributes[attributeName]); - } - } - Object3D.prototype.copy.call(instancedMesh, mesh); - this.parser.assignFinalMaterial(instancedMesh); - instancedMeshes.push(instancedMesh); - } - if (nodeObject.isGroup) { - nodeObject.clear(); - nodeObject.add(...instancedMeshes); - return nodeObject; - } - return instancedMeshes[0]; - }); - } -} -const BINARY_EXTENSION_HEADER_MAGIC = "glTF"; -const BINARY_EXTENSION_HEADER_LENGTH = 12; -const BINARY_EXTENSION_CHUNK_TYPES = { JSON: 1313821514, BIN: 5130562 }; -class GLTFBinaryExtension { - static { - __name(this, "GLTFBinaryExtension"); - } - constructor(data) { - this.name = EXTENSIONS.KHR_BINARY_GLTF; - this.content = null; - this.body = null; - const headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH); - const textDecoder = new TextDecoder(); - this.header = { - magic: textDecoder.decode(new Uint8Array(data.slice(0, 4))), - version: headerView.getUint32(4, true), - length: headerView.getUint32(8, true) - }; - if (this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC) { - throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header."); - } else if (this.header.version < 2) { - throw new Error("THREE.GLTFLoader: Legacy binary file detected."); - } - const chunkContentsLength = this.header.length - BINARY_EXTENSION_HEADER_LENGTH; - const chunkView = new DataView(data, BINARY_EXTENSION_HEADER_LENGTH); - let chunkIndex = 0; - while (chunkIndex < chunkContentsLength) { - const chunkLength = chunkView.getUint32(chunkIndex, true); - chunkIndex += 4; - const chunkType = chunkView.getUint32(chunkIndex, true); - chunkIndex += 4; - if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) { - const contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength); - this.content = textDecoder.decode(contentArray); - } else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) { - const byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex; - this.body = data.slice(byteOffset, byteOffset + chunkLength); - } - chunkIndex += chunkLength; - } - if (this.content === null) { - throw new Error("THREE.GLTFLoader: JSON content not found."); - } - } -} -class GLTFDracoMeshCompressionExtension { - static { - __name(this, "GLTFDracoMeshCompressionExtension"); - } - constructor(json, dracoLoader) { - if (!dracoLoader) { - throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided."); - } - this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION; - this.json = json; - this.dracoLoader = dracoLoader; - this.dracoLoader.preload(); - } - decodePrimitive(primitive, parser) { - const json = this.json; - const dracoLoader = this.dracoLoader; - const bufferViewIndex = primitive.extensions[this.name].bufferView; - const gltfAttributeMap = primitive.extensions[this.name].attributes; - const threeAttributeMap = {}; - const attributeNormalizedMap = {}; - const attributeTypeMap = {}; - for (const attributeName in gltfAttributeMap) { - const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase(); - threeAttributeMap[threeAttributeName] = gltfAttributeMap[attributeName]; - } - for (const attributeName in primitive.attributes) { - const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase(); - if (gltfAttributeMap[attributeName] !== void 0) { - const accessorDef = json.accessors[primitive.attributes[attributeName]]; - const componentType = WEBGL_COMPONENT_TYPES[accessorDef.componentType]; - attributeTypeMap[threeAttributeName] = componentType.name; - attributeNormalizedMap[threeAttributeName] = accessorDef.normalized === true; - } - } - return parser.getDependency("bufferView", bufferViewIndex).then(function(bufferView) { - return new Promise(function(resolve, reject) { - dracoLoader.decodeDracoFile(bufferView, function(geometry) { - for (const attributeName in geometry.attributes) { - const attribute = geometry.attributes[attributeName]; - const normalized = attributeNormalizedMap[attributeName]; - if (normalized !== void 0) attribute.normalized = normalized; - } - resolve(geometry); - }, threeAttributeMap, attributeTypeMap, LinearSRGBColorSpace, reject); - }); - }); - } -} -class GLTFTextureTransformExtension { - static { - __name(this, "GLTFTextureTransformExtension"); - } - constructor() { - this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM; - } - extendTexture(texture, transform) { - if ((transform.texCoord === void 0 || transform.texCoord === texture.channel) && transform.offset === void 0 && transform.rotation === void 0 && transform.scale === void 0) { - return texture; - } - texture = texture.clone(); - if (transform.texCoord !== void 0) { - texture.channel = transform.texCoord; - } - if (transform.offset !== void 0) { - texture.offset.fromArray(transform.offset); - } - if (transform.rotation !== void 0) { - texture.rotation = transform.rotation; - } - if (transform.scale !== void 0) { - texture.repeat.fromArray(transform.scale); - } - texture.needsUpdate = true; - return texture; - } -} -class GLTFMeshQuantizationExtension { - static { - __name(this, "GLTFMeshQuantizationExtension"); - } - constructor() { - this.name = EXTENSIONS.KHR_MESH_QUANTIZATION; - } -} -class GLTFCubicSplineInterpolant extends Interpolant { - static { - __name(this, "GLTFCubicSplineInterpolant"); - } - constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { - super(parameterPositions, sampleValues, sampleSize, resultBuffer); - } - copySampleValue_(index) { - const result = this.resultBuffer, values = this.sampleValues, valueSize = this.valueSize, offset = index * valueSize * 3 + valueSize; - for (let i = 0; i !== valueSize; i++) { - result[i] = values[offset + i]; - } - return result; - } - interpolate_(i1, t0, t2, t1) { - const result = this.resultBuffer; - const values = this.sampleValues; - const stride = this.valueSize; - const stride2 = stride * 2; - const stride3 = stride * 3; - const td2 = t1 - t0; - const p = (t2 - t0) / td2; - const pp = p * p; - const ppp = pp * p; - const offset1 = i1 * stride3; - const offset0 = offset1 - stride3; - const s2 = -2 * ppp + 3 * pp; - const s3 = ppp - pp; - const s0 = 1 - s2; - const s1 = s3 - pp + p; - for (let i = 0; i !== stride; i++) { - const p0 = values[offset0 + i + stride]; - const m0 = values[offset0 + i + stride2] * td2; - const p1 = values[offset1 + i + stride]; - const m1 = values[offset1 + i] * td2; - result[i] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1; - } - return result; - } -} -const _q = new Quaternion(); -class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant { - static { - __name(this, "GLTFCubicSplineQuaternionInterpolant"); - } - interpolate_(i1, t0, t2, t1) { - const result = super.interpolate_(i1, t0, t2, t1); - _q.fromArray(result).normalize().toArray(result); - return result; - } -} -const WEBGL_CONSTANTS = { - FLOAT: 5126, - //FLOAT_MAT2: 35674, - FLOAT_MAT3: 35675, - FLOAT_MAT4: 35676, - FLOAT_VEC2: 35664, - FLOAT_VEC3: 35665, - FLOAT_VEC4: 35666, - LINEAR: 9729, - REPEAT: 10497, - SAMPLER_2D: 35678, - POINTS: 0, - LINES: 1, - LINE_LOOP: 2, - LINE_STRIP: 3, - TRIANGLES: 4, - TRIANGLE_STRIP: 5, - TRIANGLE_FAN: 6, - UNSIGNED_BYTE: 5121, - UNSIGNED_SHORT: 5123 -}; -const WEBGL_COMPONENT_TYPES = { - 5120: Int8Array, - 5121: Uint8Array, - 5122: Int16Array, - 5123: Uint16Array, - 5125: Uint32Array, - 5126: Float32Array -}; -const WEBGL_FILTERS = { - 9728: NearestFilter, - 9729: LinearFilter, - 9984: NearestMipmapNearestFilter, - 9985: LinearMipmapNearestFilter, - 9986: NearestMipmapLinearFilter, - 9987: LinearMipmapLinearFilter -}; -const WEBGL_WRAPPINGS = { - 33071: ClampToEdgeWrapping, - 33648: MirroredRepeatWrapping, - 10497: RepeatWrapping -}; -const WEBGL_TYPE_SIZES = { - "SCALAR": 1, - "VEC2": 2, - "VEC3": 3, - "VEC4": 4, - "MAT2": 4, - "MAT3": 9, - "MAT4": 16 -}; -const ATTRIBUTES = { - POSITION: "position", - NORMAL: "normal", - TANGENT: "tangent", - TEXCOORD_0: "uv", - TEXCOORD_1: "uv1", - TEXCOORD_2: "uv2", - TEXCOORD_3: "uv3", - COLOR_0: "color", - WEIGHTS_0: "skinWeight", - JOINTS_0: "skinIndex" -}; -const PATH_PROPERTIES = { - scale: "scale", - translation: "position", - rotation: "quaternion", - weights: "morphTargetInfluences" -}; -const INTERPOLATION = { - CUBICSPLINE: void 0, - // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each - // keyframe track will be initialized with a default interpolation type, then modified. - LINEAR: InterpolateLinear, - STEP: InterpolateDiscrete -}; -const ALPHA_MODES = { - OPAQUE: "OPAQUE", - MASK: "MASK", - BLEND: "BLEND" -}; -function createDefaultMaterial(cache) { - if (cache["DefaultMaterial"] === void 0) { - cache["DefaultMaterial"] = new MeshStandardMaterial({ - color: 16777215, - emissive: 0, - metalness: 1, - roughness: 1, - transparent: false, - depthTest: true, - side: FrontSide - }); - } - return cache["DefaultMaterial"]; -} -__name(createDefaultMaterial, "createDefaultMaterial"); -function addUnknownExtensionsToUserData(knownExtensions, object, objectDef) { - for (const name in objectDef.extensions) { - if (knownExtensions[name] === void 0) { - object.userData.gltfExtensions = object.userData.gltfExtensions || {}; - object.userData.gltfExtensions[name] = objectDef.extensions[name]; - } - } -} -__name(addUnknownExtensionsToUserData, "addUnknownExtensionsToUserData"); -function assignExtrasToUserData(object, gltfDef) { - if (gltfDef.extras !== void 0) { - if (typeof gltfDef.extras === "object") { - Object.assign(object.userData, gltfDef.extras); - } else { - console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + gltfDef.extras); - } - } -} -__name(assignExtrasToUserData, "assignExtrasToUserData"); -function addMorphTargets(geometry, targets, parser) { - let hasMorphPosition = false; - let hasMorphNormal = false; - let hasMorphColor = false; - for (let i = 0, il = targets.length; i < il; i++) { - const target = targets[i]; - if (target.POSITION !== void 0) hasMorphPosition = true; - if (target.NORMAL !== void 0) hasMorphNormal = true; - if (target.COLOR_0 !== void 0) hasMorphColor = true; - if (hasMorphPosition && hasMorphNormal && hasMorphColor) break; - } - if (!hasMorphPosition && !hasMorphNormal && !hasMorphColor) return Promise.resolve(geometry); - const pendingPositionAccessors = []; - const pendingNormalAccessors = []; - const pendingColorAccessors = []; - for (let i = 0, il = targets.length; i < il; i++) { - const target = targets[i]; - if (hasMorphPosition) { - const pendingAccessor = target.POSITION !== void 0 ? parser.getDependency("accessor", target.POSITION) : geometry.attributes.position; - pendingPositionAccessors.push(pendingAccessor); - } - if (hasMorphNormal) { - const pendingAccessor = target.NORMAL !== void 0 ? parser.getDependency("accessor", target.NORMAL) : geometry.attributes.normal; - pendingNormalAccessors.push(pendingAccessor); - } - if (hasMorphColor) { - const pendingAccessor = target.COLOR_0 !== void 0 ? parser.getDependency("accessor", target.COLOR_0) : geometry.attributes.color; - pendingColorAccessors.push(pendingAccessor); - } - } - return Promise.all([ - Promise.all(pendingPositionAccessors), - Promise.all(pendingNormalAccessors), - Promise.all(pendingColorAccessors) - ]).then(function(accessors) { - const morphPositions = accessors[0]; - const morphNormals = accessors[1]; - const morphColors = accessors[2]; - if (hasMorphPosition) geometry.morphAttributes.position = morphPositions; - if (hasMorphNormal) geometry.morphAttributes.normal = morphNormals; - if (hasMorphColor) geometry.morphAttributes.color = morphColors; - geometry.morphTargetsRelative = true; - return geometry; - }); -} -__name(addMorphTargets, "addMorphTargets"); -function updateMorphTargets(mesh, meshDef) { - mesh.updateMorphTargets(); - if (meshDef.weights !== void 0) { - for (let i = 0, il = meshDef.weights.length; i < il; i++) { - mesh.morphTargetInfluences[i] = meshDef.weights[i]; - } - } - if (meshDef.extras && Array.isArray(meshDef.extras.targetNames)) { - const targetNames = meshDef.extras.targetNames; - if (mesh.morphTargetInfluences.length === targetNames.length) { - mesh.morphTargetDictionary = {}; - for (let i = 0, il = targetNames.length; i < il; i++) { - mesh.morphTargetDictionary[targetNames[i]] = i; - } - } else { - console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names."); - } - } -} -__name(updateMorphTargets, "updateMorphTargets"); -function createPrimitiveKey(primitiveDef) { - let geometryKey; - const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]; - if (dracoExtension) { - geometryKey = "draco:" + dracoExtension.bufferView + ":" + dracoExtension.indices + ":" + createAttributesKey(dracoExtension.attributes); - } else { - geometryKey = primitiveDef.indices + ":" + createAttributesKey(primitiveDef.attributes) + ":" + primitiveDef.mode; - } - if (primitiveDef.targets !== void 0) { - for (let i = 0, il = primitiveDef.targets.length; i < il; i++) { - geometryKey += ":" + createAttributesKey(primitiveDef.targets[i]); - } - } - return geometryKey; -} -__name(createPrimitiveKey, "createPrimitiveKey"); -function createAttributesKey(attributes) { - let attributesKey = ""; - const keys = Object.keys(attributes).sort(); - for (let i = 0, il = keys.length; i < il; i++) { - attributesKey += keys[i] + ":" + attributes[keys[i]] + ";"; - } - return attributesKey; -} -__name(createAttributesKey, "createAttributesKey"); -function getNormalizedComponentScale(constructor) { - switch (constructor) { - case Int8Array: - return 1 / 127; - case Uint8Array: - return 1 / 255; - case Int16Array: - return 1 / 32767; - case Uint16Array: - return 1 / 65535; - default: - throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type."); - } -} -__name(getNormalizedComponentScale, "getNormalizedComponentScale"); -function getImageURIMimeType(uri) { - if (uri.search(/\.jpe?g($|\?)/i) > 0 || uri.search(/^data\:image\/jpeg/) === 0) return "image/jpeg"; - if (uri.search(/\.webp($|\?)/i) > 0 || uri.search(/^data\:image\/webp/) === 0) return "image/webp"; - if (uri.search(/\.ktx2($|\?)/i) > 0 || uri.search(/^data\:image\/ktx2/) === 0) return "image/ktx2"; - return "image/png"; -} -__name(getImageURIMimeType, "getImageURIMimeType"); -const _identityMatrix = new Matrix4(); -class GLTFParser { - static { - __name(this, "GLTFParser"); - } - constructor(json = {}, options = {}) { - this.json = json; - this.extensions = {}; - this.plugins = {}; - this.options = options; - this.cache = new GLTFRegistry(); - this.associations = /* @__PURE__ */ new Map(); - this.primitiveCache = {}; - this.nodeCache = {}; - this.meshCache = { refs: {}, uses: {} }; - this.cameraCache = { refs: {}, uses: {} }; - this.lightCache = { refs: {}, uses: {} }; - this.sourceCache = {}; - this.textureCache = {}; - this.nodeNamesUsed = {}; - let isSafari = false; - let safariVersion = -1; - let isFirefox = false; - let firefoxVersion = -1; - if (typeof navigator !== "undefined") { - const userAgent = navigator.userAgent; - isSafari = /^((?!chrome|android).)*safari/i.test(userAgent) === true; - const safariMatch = userAgent.match(/Version\/(\d+)/); - safariVersion = isSafari && safariMatch ? parseInt(safariMatch[1], 10) : -1; - isFirefox = userAgent.indexOf("Firefox") > -1; - firefoxVersion = isFirefox ? userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1; - } - if (typeof createImageBitmap === "undefined" || isSafari && safariVersion < 17 || isFirefox && firefoxVersion < 98) { - this.textureLoader = new TextureLoader(this.options.manager); - } else { - this.textureLoader = new ImageBitmapLoader(this.options.manager); - } - this.textureLoader.setCrossOrigin(this.options.crossOrigin); - this.textureLoader.setRequestHeader(this.options.requestHeader); - this.fileLoader = new FileLoader(this.options.manager); - this.fileLoader.setResponseType("arraybuffer"); - if (this.options.crossOrigin === "use-credentials") { - this.fileLoader.setWithCredentials(true); - } - } - setExtensions(extensions) { - this.extensions = extensions; - } - setPlugins(plugins) { - this.plugins = plugins; - } - parse(onLoad, onError) { - const parser = this; - const json = this.json; - const extensions = this.extensions; - this.cache.removeAll(); - this.nodeCache = {}; - this._invokeAll(function(ext2) { - return ext2._markDefs && ext2._markDefs(); - }); - Promise.all(this._invokeAll(function(ext2) { - return ext2.beforeRoot && ext2.beforeRoot(); - })).then(function() { - return Promise.all([ - parser.getDependencies("scene"), - parser.getDependencies("animation"), - parser.getDependencies("camera") - ]); - }).then(function(dependencies) { - const result = { - scene: dependencies[0][json.scene || 0], - scenes: dependencies[0], - animations: dependencies[1], - cameras: dependencies[2], - asset: json.asset, - parser, - userData: {} - }; - addUnknownExtensionsToUserData(extensions, result, json); - assignExtrasToUserData(result, json); - return Promise.all(parser._invokeAll(function(ext2) { - return ext2.afterRoot && ext2.afterRoot(result); - })).then(function() { - for (const scene of result.scenes) { - scene.updateMatrixWorld(); - } - onLoad(result); - }); - }).catch(onError); - } - /** - * Marks the special nodes/meshes in json for efficient parse. - */ - _markDefs() { - const nodeDefs = this.json.nodes || []; - const skinDefs = this.json.skins || []; - const meshDefs = this.json.meshes || []; - for (let skinIndex = 0, skinLength = skinDefs.length; skinIndex < skinLength; skinIndex++) { - const joints = skinDefs[skinIndex].joints; - for (let i = 0, il = joints.length; i < il; i++) { - nodeDefs[joints[i]].isBone = true; - } - } - for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) { - const nodeDef = nodeDefs[nodeIndex]; - if (nodeDef.mesh !== void 0) { - this._addNodeRef(this.meshCache, nodeDef.mesh); - if (nodeDef.skin !== void 0) { - meshDefs[nodeDef.mesh].isSkinnedMesh = true; - } - } - if (nodeDef.camera !== void 0) { - this._addNodeRef(this.cameraCache, nodeDef.camera); - } - } - } - /** - * Counts references to shared node / Object3D resources. These resources - * can be reused, or "instantiated", at multiple nodes in the scene - * hierarchy. Mesh, Camera, and Light instances are instantiated and must - * be marked. Non-scenegraph resources (like Materials, Geometries, and - * Textures) can be reused directly and are not marked here. - * - * Example: CesiumMilkTruck sample model reuses "Wheel" meshes. - */ - _addNodeRef(cache, index) { - if (index === void 0) return; - if (cache.refs[index] === void 0) { - cache.refs[index] = cache.uses[index] = 0; - } - cache.refs[index]++; - } - /** Returns a reference to a shared resource, cloning it if necessary. */ - _getNodeRef(cache, index, object) { - if (cache.refs[index] <= 1) return object; - const ref = object.clone(); - const updateMappings = /* @__PURE__ */ __name((original, clone) => { - const mappings = this.associations.get(original); - if (mappings != null) { - this.associations.set(clone, mappings); - } - for (const [i, child] of original.children.entries()) { - updateMappings(child, clone.children[i]); - } - }, "updateMappings"); - updateMappings(object, ref); - ref.name += "_instance_" + cache.uses[index]++; - return ref; - } - _invokeOne(func) { - const extensions = Object.values(this.plugins); - extensions.push(this); - for (let i = 0; i < extensions.length; i++) { - const result = func(extensions[i]); - if (result) return result; - } - return null; - } - _invokeAll(func) { - const extensions = Object.values(this.plugins); - extensions.unshift(this); - const pending = []; - for (let i = 0; i < extensions.length; i++) { - const result = func(extensions[i]); - if (result) pending.push(result); - } - return pending; - } - /** - * Requests the specified dependency asynchronously, with caching. - * @param {string} type - * @param {number} index - * @return {Promise} - */ - getDependency(type, index) { - const cacheKey = type + ":" + index; - let dependency = this.cache.get(cacheKey); - if (!dependency) { - switch (type) { - case "scene": - dependency = this.loadScene(index); - break; - case "node": - dependency = this._invokeOne(function(ext2) { - return ext2.loadNode && ext2.loadNode(index); - }); - break; - case "mesh": - dependency = this._invokeOne(function(ext2) { - return ext2.loadMesh && ext2.loadMesh(index); - }); - break; - case "accessor": - dependency = this.loadAccessor(index); - break; - case "bufferView": - dependency = this._invokeOne(function(ext2) { - return ext2.loadBufferView && ext2.loadBufferView(index); - }); - break; - case "buffer": - dependency = this.loadBuffer(index); - break; - case "material": - dependency = this._invokeOne(function(ext2) { - return ext2.loadMaterial && ext2.loadMaterial(index); - }); - break; - case "texture": - dependency = this._invokeOne(function(ext2) { - return ext2.loadTexture && ext2.loadTexture(index); - }); - break; - case "skin": - dependency = this.loadSkin(index); - break; - case "animation": - dependency = this._invokeOne(function(ext2) { - return ext2.loadAnimation && ext2.loadAnimation(index); - }); - break; - case "camera": - dependency = this.loadCamera(index); - break; - default: - dependency = this._invokeOne(function(ext2) { - return ext2 != this && ext2.getDependency && ext2.getDependency(type, index); - }); - if (!dependency) { - throw new Error("Unknown type: " + type); - } - break; - } - this.cache.add(cacheKey, dependency); - } - return dependency; - } - /** - * Requests all dependencies of the specified type asynchronously, with caching. - * @param {string} type - * @return {Promise>} - */ - getDependencies(type) { - let dependencies = this.cache.get(type); - if (!dependencies) { - const parser = this; - const defs = this.json[type + (type === "mesh" ? "es" : "s")] || []; - dependencies = Promise.all(defs.map(function(def, index) { - return parser.getDependency(type, index); - })); - this.cache.add(type, dependencies); - } - return dependencies; - } - /** - * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views - * @param {number} bufferIndex - * @return {Promise} - */ - loadBuffer(bufferIndex) { - const bufferDef = this.json.buffers[bufferIndex]; - const loader = this.fileLoader; - if (bufferDef.type && bufferDef.type !== "arraybuffer") { - throw new Error("THREE.GLTFLoader: " + bufferDef.type + " buffer type is not supported."); - } - if (bufferDef.uri === void 0 && bufferIndex === 0) { - return Promise.resolve(this.extensions[EXTENSIONS.KHR_BINARY_GLTF].body); - } - const options = this.options; - return new Promise(function(resolve, reject) { - loader.load(LoaderUtils.resolveURL(bufferDef.uri, options.path), resolve, void 0, function() { - reject(new Error('THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".')); - }); - }); - } - /** - * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views - * @param {number} bufferViewIndex - * @return {Promise} - */ - loadBufferView(bufferViewIndex) { - const bufferViewDef = this.json.bufferViews[bufferViewIndex]; - return this.getDependency("buffer", bufferViewDef.buffer).then(function(buffer) { - const byteLength = bufferViewDef.byteLength || 0; - const byteOffset = bufferViewDef.byteOffset || 0; - return buffer.slice(byteOffset, byteOffset + byteLength); - }); - } - /** - * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors - * @param {number} accessorIndex - * @return {Promise} - */ - loadAccessor(accessorIndex) { - const parser = this; - const json = this.json; - const accessorDef = this.json.accessors[accessorIndex]; - if (accessorDef.bufferView === void 0 && accessorDef.sparse === void 0) { - const itemSize = WEBGL_TYPE_SIZES[accessorDef.type]; - const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType]; - const normalized = accessorDef.normalized === true; - const array = new TypedArray(accessorDef.count * itemSize); - return Promise.resolve(new BufferAttribute(array, itemSize, normalized)); - } - const pendingBufferViews = []; - if (accessorDef.bufferView !== void 0) { - pendingBufferViews.push(this.getDependency("bufferView", accessorDef.bufferView)); - } else { - pendingBufferViews.push(null); - } - if (accessorDef.sparse !== void 0) { - pendingBufferViews.push(this.getDependency("bufferView", accessorDef.sparse.indices.bufferView)); - pendingBufferViews.push(this.getDependency("bufferView", accessorDef.sparse.values.bufferView)); - } - return Promise.all(pendingBufferViews).then(function(bufferViews) { - const bufferView = bufferViews[0]; - const itemSize = WEBGL_TYPE_SIZES[accessorDef.type]; - const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType]; - const elementBytes = TypedArray.BYTES_PER_ELEMENT; - const itemBytes = elementBytes * itemSize; - const byteOffset = accessorDef.byteOffset || 0; - const byteStride = accessorDef.bufferView !== void 0 ? json.bufferViews[accessorDef.bufferView].byteStride : void 0; - const normalized = accessorDef.normalized === true; - let array, bufferAttribute; - if (byteStride && byteStride !== itemBytes) { - const ibSlice = Math.floor(byteOffset / byteStride); - const ibCacheKey = "InterleavedBuffer:" + accessorDef.bufferView + ":" + accessorDef.componentType + ":" + ibSlice + ":" + accessorDef.count; - let ib = parser.cache.get(ibCacheKey); - if (!ib) { - array = new TypedArray(bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes); - ib = new InterleavedBuffer(array, byteStride / elementBytes); - parser.cache.add(ibCacheKey, ib); - } - bufferAttribute = new InterleavedBufferAttribute(ib, itemSize, byteOffset % byteStride / elementBytes, normalized); - } else { - if (bufferView === null) { - array = new TypedArray(accessorDef.count * itemSize); - } else { - array = new TypedArray(bufferView, byteOffset, accessorDef.count * itemSize); - } - bufferAttribute = new BufferAttribute(array, itemSize, normalized); - } - if (accessorDef.sparse !== void 0) { - const itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR; - const TypedArrayIndices = WEBGL_COMPONENT_TYPES[accessorDef.sparse.indices.componentType]; - const byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0; - const byteOffsetValues = accessorDef.sparse.values.byteOffset || 0; - const sparseIndices = new TypedArrayIndices(bufferViews[1], byteOffsetIndices, accessorDef.sparse.count * itemSizeIndices); - const sparseValues = new TypedArray(bufferViews[2], byteOffsetValues, accessorDef.sparse.count * itemSize); - if (bufferView !== null) { - bufferAttribute = new BufferAttribute(bufferAttribute.array.slice(), bufferAttribute.itemSize, bufferAttribute.normalized); - } - bufferAttribute.normalized = false; - for (let i = 0, il = sparseIndices.length; i < il; i++) { - const index = sparseIndices[i]; - bufferAttribute.setX(index, sparseValues[i * itemSize]); - if (itemSize >= 2) bufferAttribute.setY(index, sparseValues[i * itemSize + 1]); - if (itemSize >= 3) bufferAttribute.setZ(index, sparseValues[i * itemSize + 2]); - if (itemSize >= 4) bufferAttribute.setW(index, sparseValues[i * itemSize + 3]); - if (itemSize >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute."); - } - bufferAttribute.normalized = normalized; - } - return bufferAttribute; - }); - } - /** - * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures - * @param {number} textureIndex - * @return {Promise} - */ - loadTexture(textureIndex) { - const json = this.json; - const options = this.options; - const textureDef = json.textures[textureIndex]; - const sourceIndex = textureDef.source; - const sourceDef = json.images[sourceIndex]; - let loader = this.textureLoader; - if (sourceDef.uri) { - const handler = options.manager.getHandler(sourceDef.uri); - if (handler !== null) loader = handler; - } - return this.loadTextureImage(textureIndex, sourceIndex, loader); - } - loadTextureImage(textureIndex, sourceIndex, loader) { - const parser = this; - const json = this.json; - const textureDef = json.textures[textureIndex]; - const sourceDef = json.images[sourceIndex]; - const cacheKey = (sourceDef.uri || sourceDef.bufferView) + ":" + textureDef.sampler; - if (this.textureCache[cacheKey]) { - return this.textureCache[cacheKey]; - } - const promise = this.loadImageSource(sourceIndex, loader).then(function(texture) { - texture.flipY = false; - texture.name = textureDef.name || sourceDef.name || ""; - if (texture.name === "" && typeof sourceDef.uri === "string" && sourceDef.uri.startsWith("data:image/") === false) { - texture.name = sourceDef.uri; - } - const samplers = json.samplers || {}; - const sampler = samplers[textureDef.sampler] || {}; - texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || LinearFilter; - texture.minFilter = WEBGL_FILTERS[sampler.minFilter] || LinearMipmapLinearFilter; - texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || RepeatWrapping; - texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || RepeatWrapping; - texture.generateMipmaps = !texture.isCompressedTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter; - parser.associations.set(texture, { textures: textureIndex }); - return texture; - }).catch(function() { - return null; - }); - this.textureCache[cacheKey] = promise; - return promise; - } - loadImageSource(sourceIndex, loader) { - const parser = this; - const json = this.json; - const options = this.options; - if (this.sourceCache[sourceIndex] !== void 0) { - return this.sourceCache[sourceIndex].then((texture) => texture.clone()); - } - const sourceDef = json.images[sourceIndex]; - const URL2 = self.URL || self.webkitURL; - let sourceURI = sourceDef.uri || ""; - let isObjectURL = false; - if (sourceDef.bufferView !== void 0) { - sourceURI = parser.getDependency("bufferView", sourceDef.bufferView).then(function(bufferView) { - isObjectURL = true; - const blob = new Blob([bufferView], { type: sourceDef.mimeType }); - sourceURI = URL2.createObjectURL(blob); - return sourceURI; - }); - } else if (sourceDef.uri === void 0) { - throw new Error("THREE.GLTFLoader: Image " + sourceIndex + " is missing URI and bufferView"); - } - const promise = Promise.resolve(sourceURI).then(function(sourceURI2) { - return new Promise(function(resolve, reject) { - let onLoad = resolve; - if (loader.isImageBitmapLoader === true) { - onLoad = /* @__PURE__ */ __name(function(imageBitmap) { - const texture = new Texture(imageBitmap); - texture.needsUpdate = true; - resolve(texture); - }, "onLoad"); - } - loader.load(LoaderUtils.resolveURL(sourceURI2, options.path), onLoad, void 0, reject); - }); - }).then(function(texture) { - if (isObjectURL === true) { - URL2.revokeObjectURL(sourceURI); - } - assignExtrasToUserData(texture, sourceDef); - texture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType(sourceDef.uri); - return texture; - }).catch(function(error) { - console.error("THREE.GLTFLoader: Couldn't load texture", sourceURI); - throw error; - }); - this.sourceCache[sourceIndex] = promise; - return promise; - } - /** - * Asynchronously assigns a texture to the given material parameters. - * @param {Object} materialParams - * @param {string} mapName - * @param {Object} mapDef - * @return {Promise} - */ - assignTexture(materialParams, mapName, mapDef, colorSpace) { - const parser = this; - return this.getDependency("texture", mapDef.index).then(function(texture) { - if (!texture) return null; - if (mapDef.texCoord !== void 0 && mapDef.texCoord > 0) { - texture = texture.clone(); - texture.channel = mapDef.texCoord; - } - if (parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]) { - const transform = mapDef.extensions !== void 0 ? mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] : void 0; - if (transform) { - const gltfReference = parser.associations.get(texture); - texture = parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(texture, transform); - parser.associations.set(texture, gltfReference); - } - } - if (colorSpace !== void 0) { - texture.colorSpace = colorSpace; - } - materialParams[mapName] = texture; - return texture; - }); - } - /** - * Assigns final material to a Mesh, Line, or Points instance. The instance - * already has a material (generated from the glTF material options alone) - * but reuse of the same glTF material may require multiple threejs materials - * to accommodate different primitive types, defines, etc. New materials will - * be created if necessary, and reused from a cache. - * @param {Object3D} mesh Mesh, Line, or Points instance. - */ - assignFinalMaterial(mesh) { - const geometry = mesh.geometry; - let material = mesh.material; - const useDerivativeTangents = geometry.attributes.tangent === void 0; - const useVertexColors = geometry.attributes.color !== void 0; - const useFlatShading = geometry.attributes.normal === void 0; - if (mesh.isPoints) { - const cacheKey = "PointsMaterial:" + material.uuid; - let pointsMaterial = this.cache.get(cacheKey); - if (!pointsMaterial) { - pointsMaterial = new PointsMaterial(); - Material.prototype.copy.call(pointsMaterial, material); - pointsMaterial.color.copy(material.color); - pointsMaterial.map = material.map; - pointsMaterial.sizeAttenuation = false; - this.cache.add(cacheKey, pointsMaterial); - } - material = pointsMaterial; - } else if (mesh.isLine) { - const cacheKey = "LineBasicMaterial:" + material.uuid; - let lineMaterial = this.cache.get(cacheKey); - if (!lineMaterial) { - lineMaterial = new LineBasicMaterial(); - Material.prototype.copy.call(lineMaterial, material); - lineMaterial.color.copy(material.color); - lineMaterial.map = material.map; - this.cache.add(cacheKey, lineMaterial); - } - material = lineMaterial; - } - if (useDerivativeTangents || useVertexColors || useFlatShading) { - let cacheKey = "ClonedMaterial:" + material.uuid + ":"; - if (useDerivativeTangents) cacheKey += "derivative-tangents:"; - if (useVertexColors) cacheKey += "vertex-colors:"; - if (useFlatShading) cacheKey += "flat-shading:"; - let cachedMaterial = this.cache.get(cacheKey); - if (!cachedMaterial) { - cachedMaterial = material.clone(); - if (useVertexColors) cachedMaterial.vertexColors = true; - if (useFlatShading) cachedMaterial.flatShading = true; - if (useDerivativeTangents) { - if (cachedMaterial.normalScale) cachedMaterial.normalScale.y *= -1; - if (cachedMaterial.clearcoatNormalScale) cachedMaterial.clearcoatNormalScale.y *= -1; - } - this.cache.add(cacheKey, cachedMaterial); - this.associations.set(cachedMaterial, this.associations.get(material)); - } - material = cachedMaterial; - } - mesh.material = material; - } - getMaterialType() { - return MeshStandardMaterial; - } - /** - * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials - * @param {number} materialIndex - * @return {Promise} - */ - loadMaterial(materialIndex) { - const parser = this; - const json = this.json; - const extensions = this.extensions; - const materialDef = json.materials[materialIndex]; - let materialType; - const materialParams = {}; - const materialExtensions = materialDef.extensions || {}; - const pending = []; - if (materialExtensions[EXTENSIONS.KHR_MATERIALS_UNLIT]) { - const kmuExtension = extensions[EXTENSIONS.KHR_MATERIALS_UNLIT]; - materialType = kmuExtension.getMaterialType(); - pending.push(kmuExtension.extendParams(materialParams, materialDef, parser)); - } else { - const metallicRoughness = materialDef.pbrMetallicRoughness || {}; - materialParams.color = new Color(1, 1, 1); - materialParams.opacity = 1; - if (Array.isArray(metallicRoughness.baseColorFactor)) { - const array = metallicRoughness.baseColorFactor; - materialParams.color.setRGB(array[0], array[1], array[2], LinearSRGBColorSpace); - materialParams.opacity = array[3]; - } - if (metallicRoughness.baseColorTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, SRGBColorSpace)); - } - materialParams.metalness = metallicRoughness.metallicFactor !== void 0 ? metallicRoughness.metallicFactor : 1; - materialParams.roughness = metallicRoughness.roughnessFactor !== void 0 ? metallicRoughness.roughnessFactor : 1; - if (metallicRoughness.metallicRoughnessTexture !== void 0) { - pending.push(parser.assignTexture(materialParams, "metalnessMap", metallicRoughness.metallicRoughnessTexture)); - pending.push(parser.assignTexture(materialParams, "roughnessMap", metallicRoughness.metallicRoughnessTexture)); - } - materialType = this._invokeOne(function(ext2) { - return ext2.getMaterialType && ext2.getMaterialType(materialIndex); - }); - pending.push(Promise.all(this._invokeAll(function(ext2) { - return ext2.extendMaterialParams && ext2.extendMaterialParams(materialIndex, materialParams); - }))); - } - if (materialDef.doubleSided === true) { - materialParams.side = DoubleSide; - } - const alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE; - if (alphaMode === ALPHA_MODES.BLEND) { - materialParams.transparent = true; - materialParams.depthWrite = false; - } else { - materialParams.transparent = false; - if (alphaMode === ALPHA_MODES.MASK) { - materialParams.alphaTest = materialDef.alphaCutoff !== void 0 ? materialDef.alphaCutoff : 0.5; - } - } - if (materialDef.normalTexture !== void 0 && materialType !== MeshBasicMaterial) { - pending.push(parser.assignTexture(materialParams, "normalMap", materialDef.normalTexture)); - materialParams.normalScale = new Vector2(1, 1); - if (materialDef.normalTexture.scale !== void 0) { - const scale = materialDef.normalTexture.scale; - materialParams.normalScale.set(scale, scale); - } - } - if (materialDef.occlusionTexture !== void 0 && materialType !== MeshBasicMaterial) { - pending.push(parser.assignTexture(materialParams, "aoMap", materialDef.occlusionTexture)); - if (materialDef.occlusionTexture.strength !== void 0) { - materialParams.aoMapIntensity = materialDef.occlusionTexture.strength; - } - } - if (materialDef.emissiveFactor !== void 0 && materialType !== MeshBasicMaterial) { - const emissiveFactor = materialDef.emissiveFactor; - materialParams.emissive = new Color().setRGB(emissiveFactor[0], emissiveFactor[1], emissiveFactor[2], LinearSRGBColorSpace); - } - if (materialDef.emissiveTexture !== void 0 && materialType !== MeshBasicMaterial) { - pending.push(parser.assignTexture(materialParams, "emissiveMap", materialDef.emissiveTexture, SRGBColorSpace)); - } - return Promise.all(pending).then(function() { - const material = new materialType(materialParams); - if (materialDef.name) material.name = materialDef.name; - assignExtrasToUserData(material, materialDef); - parser.associations.set(material, { materials: materialIndex }); - if (materialDef.extensions) addUnknownExtensionsToUserData(extensions, material, materialDef); - return material; - }); - } - /** When Object3D instances are targeted by animation, they need unique names. */ - createUniqueName(originalName) { - const sanitizedName = PropertyBinding.sanitizeNodeName(originalName || ""); - if (sanitizedName in this.nodeNamesUsed) { - return sanitizedName + "_" + ++this.nodeNamesUsed[sanitizedName]; - } else { - this.nodeNamesUsed[sanitizedName] = 0; - return sanitizedName; - } - } - /** - * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry - * - * Creates BufferGeometries from primitives. - * - * @param {Array} primitives - * @return {Promise>} - */ - loadGeometries(primitives) { - const parser = this; - const extensions = this.extensions; - const cache = this.primitiveCache; - function createDracoPrimitive(primitive) { - return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(primitive, parser).then(function(geometry) { - return addPrimitiveAttributes(geometry, primitive, parser); - }); - } - __name(createDracoPrimitive, "createDracoPrimitive"); - const pending = []; - for (let i = 0, il = primitives.length; i < il; i++) { - const primitive = primitives[i]; - const cacheKey = createPrimitiveKey(primitive); - const cached = cache[cacheKey]; - if (cached) { - pending.push(cached.promise); - } else { - let geometryPromise; - if (primitive.extensions && primitive.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]) { - geometryPromise = createDracoPrimitive(primitive); - } else { - geometryPromise = addPrimitiveAttributes(new BufferGeometry(), primitive, parser); - } - cache[cacheKey] = { primitive, promise: geometryPromise }; - pending.push(geometryPromise); - } - } - return Promise.all(pending); - } - /** - * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes - * @param {number} meshIndex - * @return {Promise} - */ - loadMesh(meshIndex) { - const parser = this; - const json = this.json; - const extensions = this.extensions; - const meshDef = json.meshes[meshIndex]; - const primitives = meshDef.primitives; - const pending = []; - for (let i = 0, il = primitives.length; i < il; i++) { - const material = primitives[i].material === void 0 ? createDefaultMaterial(this.cache) : this.getDependency("material", primitives[i].material); - pending.push(material); - } - pending.push(parser.loadGeometries(primitives)); - return Promise.all(pending).then(function(results) { - const materials = results.slice(0, results.length - 1); - const geometries = results[results.length - 1]; - const meshes = []; - for (let i = 0, il = geometries.length; i < il; i++) { - const geometry = geometries[i]; - const primitive = primitives[i]; - let mesh; - const material = materials[i]; - if (primitive.mode === WEBGL_CONSTANTS.TRIANGLES || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN || primitive.mode === void 0) { - mesh = meshDef.isSkinnedMesh === true ? new SkinnedMesh(geometry, material) : new Mesh(geometry, material); - if (mesh.isSkinnedMesh === true) { - mesh.normalizeSkinWeights(); - } - if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP) { - mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleStripDrawMode); - } else if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN) { - mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleFanDrawMode); - } - } else if (primitive.mode === WEBGL_CONSTANTS.LINES) { - mesh = new LineSegments(geometry, material); - } else if (primitive.mode === WEBGL_CONSTANTS.LINE_STRIP) { - mesh = new Line(geometry, material); - } else if (primitive.mode === WEBGL_CONSTANTS.LINE_LOOP) { - mesh = new LineLoop(geometry, material); - } else if (primitive.mode === WEBGL_CONSTANTS.POINTS) { - mesh = new Points(geometry, material); - } else { - throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + primitive.mode); - } - if (Object.keys(mesh.geometry.morphAttributes).length > 0) { - updateMorphTargets(mesh, meshDef); - } - mesh.name = parser.createUniqueName(meshDef.name || "mesh_" + meshIndex); - assignExtrasToUserData(mesh, meshDef); - if (primitive.extensions) addUnknownExtensionsToUserData(extensions, mesh, primitive); - parser.assignFinalMaterial(mesh); - meshes.push(mesh); - } - for (let i = 0, il = meshes.length; i < il; i++) { - parser.associations.set(meshes[i], { - meshes: meshIndex, - primitives: i - }); - } - if (meshes.length === 1) { - if (meshDef.extensions) addUnknownExtensionsToUserData(extensions, meshes[0], meshDef); - return meshes[0]; - } - const group = new Group(); - if (meshDef.extensions) addUnknownExtensionsToUserData(extensions, group, meshDef); - parser.associations.set(group, { meshes: meshIndex }); - for (let i = 0, il = meshes.length; i < il; i++) { - group.add(meshes[i]); - } - return group; - }); - } - /** - * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras - * @param {number} cameraIndex - * @return {Promise} - */ - loadCamera(cameraIndex) { - let camera; - const cameraDef = this.json.cameras[cameraIndex]; - const params = cameraDef[cameraDef.type]; - if (!params) { - console.warn("THREE.GLTFLoader: Missing camera parameters."); - return; - } - if (cameraDef.type === "perspective") { - camera = new PerspectiveCamera(MathUtils.radToDeg(params.yfov), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6); - } else if (cameraDef.type === "orthographic") { - camera = new OrthographicCamera(-params.xmag, params.xmag, params.ymag, -params.ymag, params.znear, params.zfar); - } - if (cameraDef.name) camera.name = this.createUniqueName(cameraDef.name); - assignExtrasToUserData(camera, cameraDef); - return Promise.resolve(camera); - } - /** - * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins - * @param {number} skinIndex - * @return {Promise} - */ - loadSkin(skinIndex) { - const skinDef = this.json.skins[skinIndex]; - const pending = []; - for (let i = 0, il = skinDef.joints.length; i < il; i++) { - pending.push(this._loadNodeShallow(skinDef.joints[i])); - } - if (skinDef.inverseBindMatrices !== void 0) { - pending.push(this.getDependency("accessor", skinDef.inverseBindMatrices)); - } else { - pending.push(null); - } - return Promise.all(pending).then(function(results) { - const inverseBindMatrices = results.pop(); - const jointNodes = results; - const bones = []; - const boneInverses = []; - for (let i = 0, il = jointNodes.length; i < il; i++) { - const jointNode = jointNodes[i]; - if (jointNode) { - bones.push(jointNode); - const mat = new Matrix4(); - if (inverseBindMatrices !== null) { - mat.fromArray(inverseBindMatrices.array, i * 16); - } - boneInverses.push(mat); - } else { - console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', skinDef.joints[i]); - } - } - return new Skeleton(bones, boneInverses); - }); - } - /** - * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations - * @param {number} animationIndex - * @return {Promise} - */ - loadAnimation(animationIndex) { - const json = this.json; - const parser = this; - const animationDef = json.animations[animationIndex]; - const animationName = animationDef.name ? animationDef.name : "animation_" + animationIndex; - const pendingNodes = []; - const pendingInputAccessors = []; - const pendingOutputAccessors = []; - const pendingSamplers = []; - const pendingTargets = []; - for (let i = 0, il = animationDef.channels.length; i < il; i++) { - const channel = animationDef.channels[i]; - const sampler = animationDef.samplers[channel.sampler]; - const target = channel.target; - const name = target.node; - const input = animationDef.parameters !== void 0 ? animationDef.parameters[sampler.input] : sampler.input; - const output = animationDef.parameters !== void 0 ? animationDef.parameters[sampler.output] : sampler.output; - if (target.node === void 0) continue; - pendingNodes.push(this.getDependency("node", name)); - pendingInputAccessors.push(this.getDependency("accessor", input)); - pendingOutputAccessors.push(this.getDependency("accessor", output)); - pendingSamplers.push(sampler); - pendingTargets.push(target); - } - return Promise.all([ - Promise.all(pendingNodes), - Promise.all(pendingInputAccessors), - Promise.all(pendingOutputAccessors), - Promise.all(pendingSamplers), - Promise.all(pendingTargets) - ]).then(function(dependencies) { - const nodes = dependencies[0]; - const inputAccessors = dependencies[1]; - const outputAccessors = dependencies[2]; - const samplers = dependencies[3]; - const targets = dependencies[4]; - const tracks = []; - for (let i = 0, il = nodes.length; i < il; i++) { - const node = nodes[i]; - const inputAccessor = inputAccessors[i]; - const outputAccessor = outputAccessors[i]; - const sampler = samplers[i]; - const target = targets[i]; - if (node === void 0) continue; - if (node.updateMatrix) { - node.updateMatrix(); - } - const createdTracks = parser._createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target); - if (createdTracks) { - for (let k = 0; k < createdTracks.length; k++) { - tracks.push(createdTracks[k]); - } - } - } - return new AnimationClip(animationName, void 0, tracks); - }); - } - createNodeMesh(nodeIndex) { - const json = this.json; - const parser = this; - const nodeDef = json.nodes[nodeIndex]; - if (nodeDef.mesh === void 0) return null; - return parser.getDependency("mesh", nodeDef.mesh).then(function(mesh) { - const node = parser._getNodeRef(parser.meshCache, nodeDef.mesh, mesh); - if (nodeDef.weights !== void 0) { - node.traverse(function(o) { - if (!o.isMesh) return; - for (let i = 0, il = nodeDef.weights.length; i < il; i++) { - o.morphTargetInfluences[i] = nodeDef.weights[i]; - } - }); - } - return node; - }); - } - /** - * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy - * @param {number} nodeIndex - * @return {Promise} - */ - loadNode(nodeIndex) { - const json = this.json; - const parser = this; - const nodeDef = json.nodes[nodeIndex]; - const nodePending = parser._loadNodeShallow(nodeIndex); - const childPending = []; - const childrenDef = nodeDef.children || []; - for (let i = 0, il = childrenDef.length; i < il; i++) { - childPending.push(parser.getDependency("node", childrenDef[i])); - } - const skeletonPending = nodeDef.skin === void 0 ? Promise.resolve(null) : parser.getDependency("skin", nodeDef.skin); - return Promise.all([ - nodePending, - Promise.all(childPending), - skeletonPending - ]).then(function(results) { - const node = results[0]; - const children = results[1]; - const skeleton = results[2]; - if (skeleton !== null) { - node.traverse(function(mesh) { - if (!mesh.isSkinnedMesh) return; - mesh.bind(skeleton, _identityMatrix); - }); - } - for (let i = 0, il = children.length; i < il; i++) { - node.add(children[i]); - } - return node; - }); - } - // ._loadNodeShallow() parses a single node. - // skin and child nodes are created and added in .loadNode() (no '_' prefix). - _loadNodeShallow(nodeIndex) { - const json = this.json; - const extensions = this.extensions; - const parser = this; - if (this.nodeCache[nodeIndex] !== void 0) { - return this.nodeCache[nodeIndex]; - } - const nodeDef = json.nodes[nodeIndex]; - const nodeName = nodeDef.name ? parser.createUniqueName(nodeDef.name) : ""; - const pending = []; - const meshPromise = parser._invokeOne(function(ext2) { - return ext2.createNodeMesh && ext2.createNodeMesh(nodeIndex); - }); - if (meshPromise) { - pending.push(meshPromise); - } - if (nodeDef.camera !== void 0) { - pending.push(parser.getDependency("camera", nodeDef.camera).then(function(camera) { - return parser._getNodeRef(parser.cameraCache, nodeDef.camera, camera); - })); - } - parser._invokeAll(function(ext2) { - return ext2.createNodeAttachment && ext2.createNodeAttachment(nodeIndex); - }).forEach(function(promise) { - pending.push(promise); - }); - this.nodeCache[nodeIndex] = Promise.all(pending).then(function(objects) { - let node; - if (nodeDef.isBone === true) { - node = new Bone(); - } else if (objects.length > 1) { - node = new Group(); - } else if (objects.length === 1) { - node = objects[0]; - } else { - node = new Object3D(); - } - if (node !== objects[0]) { - for (let i = 0, il = objects.length; i < il; i++) { - node.add(objects[i]); - } - } - if (nodeDef.name) { - node.userData.name = nodeDef.name; - node.name = nodeName; - } - assignExtrasToUserData(node, nodeDef); - if (nodeDef.extensions) addUnknownExtensionsToUserData(extensions, node, nodeDef); - if (nodeDef.matrix !== void 0) { - const matrix = new Matrix4(); - matrix.fromArray(nodeDef.matrix); - node.applyMatrix4(matrix); - } else { - if (nodeDef.translation !== void 0) { - node.position.fromArray(nodeDef.translation); - } - if (nodeDef.rotation !== void 0) { - node.quaternion.fromArray(nodeDef.rotation); - } - if (nodeDef.scale !== void 0) { - node.scale.fromArray(nodeDef.scale); - } - } - if (!parser.associations.has(node)) { - parser.associations.set(node, {}); - } - parser.associations.get(node).nodes = nodeIndex; - return node; - }); - return this.nodeCache[nodeIndex]; - } - /** - * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes - * @param {number} sceneIndex - * @return {Promise} - */ - loadScene(sceneIndex) { - const extensions = this.extensions; - const sceneDef = this.json.scenes[sceneIndex]; - const parser = this; - const scene = new Group(); - if (sceneDef.name) scene.name = parser.createUniqueName(sceneDef.name); - assignExtrasToUserData(scene, sceneDef); - if (sceneDef.extensions) addUnknownExtensionsToUserData(extensions, scene, sceneDef); - const nodeIds = sceneDef.nodes || []; - const pending = []; - for (let i = 0, il = nodeIds.length; i < il; i++) { - pending.push(parser.getDependency("node", nodeIds[i])); - } - return Promise.all(pending).then(function(nodes) { - for (let i = 0, il = nodes.length; i < il; i++) { - scene.add(nodes[i]); - } - const reduceAssociations = /* @__PURE__ */ __name((node) => { - const reducedAssociations = /* @__PURE__ */ new Map(); - for (const [key, value] of parser.associations) { - if (key instanceof Material || key instanceof Texture) { - reducedAssociations.set(key, value); - } - } - node.traverse((node2) => { - const mappings = parser.associations.get(node2); - if (mappings != null) { - reducedAssociations.set(node2, mappings); - } - }); - return reducedAssociations; - }, "reduceAssociations"); - parser.associations = reduceAssociations(scene); - return scene; - }); - } - _createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target) { - const tracks = []; - const targetName = node.name ? node.name : node.uuid; - const targetNames = []; - if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) { - node.traverse(function(object) { - if (object.morphTargetInfluences) { - targetNames.push(object.name ? object.name : object.uuid); - } - }); - } else { - targetNames.push(targetName); - } - let TypedKeyframeTrack; - switch (PATH_PROPERTIES[target.path]) { - case PATH_PROPERTIES.weights: - TypedKeyframeTrack = NumberKeyframeTrack; - break; - case PATH_PROPERTIES.rotation: - TypedKeyframeTrack = QuaternionKeyframeTrack; - break; - case PATH_PROPERTIES.position: - case PATH_PROPERTIES.scale: - TypedKeyframeTrack = VectorKeyframeTrack; - break; - default: - switch (outputAccessor.itemSize) { - case 1: - TypedKeyframeTrack = NumberKeyframeTrack; - break; - case 2: - case 3: - default: - TypedKeyframeTrack = VectorKeyframeTrack; - break; - } - break; - } - const interpolation = sampler.interpolation !== void 0 ? INTERPOLATION[sampler.interpolation] : InterpolateLinear; - const outputArray = this._getArrayFromAccessor(outputAccessor); - for (let j = 0, jl = targetNames.length; j < jl; j++) { - const track = new TypedKeyframeTrack( - targetNames[j] + "." + PATH_PROPERTIES[target.path], - inputAccessor.array, - outputArray, - interpolation - ); - if (sampler.interpolation === "CUBICSPLINE") { - this._createCubicSplineTrackInterpolant(track); - } - tracks.push(track); - } - return tracks; - } - _getArrayFromAccessor(accessor) { - let outputArray = accessor.array; - if (accessor.normalized) { - const scale = getNormalizedComponentScale(outputArray.constructor); - const scaled = new Float32Array(outputArray.length); - for (let j = 0, jl = outputArray.length; j < jl; j++) { - scaled[j] = outputArray[j] * scale; - } - outputArray = scaled; - } - return outputArray; - } - _createCubicSplineTrackInterpolant(track) { - track.createInterpolant = /* @__PURE__ */ __name(function InterpolantFactoryMethodGLTFCubicSpline(result) { - const interpolantType = this instanceof QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant; - return new interpolantType(this.times, this.values, this.getValueSize() / 3, result); - }, "InterpolantFactoryMethodGLTFCubicSpline"); - track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true; - } -} -function computeBounds(geometry, primitiveDef, parser) { - const attributes = primitiveDef.attributes; - const box = new Box3(); - if (attributes.POSITION !== void 0) { - const accessor = parser.json.accessors[attributes.POSITION]; - const min = accessor.min; - const max2 = accessor.max; - if (min !== void 0 && max2 !== void 0) { - box.set( - new Vector3(min[0], min[1], min[2]), - new Vector3(max2[0], max2[1], max2[2]) - ); - if (accessor.normalized) { - const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType]); - box.min.multiplyScalar(boxScale); - box.max.multiplyScalar(boxScale); - } - } else { - console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."); - return; - } - } else { - return; - } - const targets = primitiveDef.targets; - if (targets !== void 0) { - const maxDisplacement = new Vector3(); - const vector = new Vector3(); - for (let i = 0, il = targets.length; i < il; i++) { - const target = targets[i]; - if (target.POSITION !== void 0) { - const accessor = parser.json.accessors[target.POSITION]; - const min = accessor.min; - const max2 = accessor.max; - if (min !== void 0 && max2 !== void 0) { - vector.setX(Math.max(Math.abs(min[0]), Math.abs(max2[0]))); - vector.setY(Math.max(Math.abs(min[1]), Math.abs(max2[1]))); - vector.setZ(Math.max(Math.abs(min[2]), Math.abs(max2[2]))); - if (accessor.normalized) { - const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType]); - vector.multiplyScalar(boxScale); - } - maxDisplacement.max(vector); - } else { - console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."); - } - } - } - box.expandByVector(maxDisplacement); - } - geometry.boundingBox = box; - const sphere = new Sphere(); - box.getCenter(sphere.center); - sphere.radius = box.min.distanceTo(box.max) / 2; - geometry.boundingSphere = sphere; -} -__name(computeBounds, "computeBounds"); -function addPrimitiveAttributes(geometry, primitiveDef, parser) { - const attributes = primitiveDef.attributes; - const pending = []; - function assignAttributeAccessor(accessorIndex, attributeName) { - return parser.getDependency("accessor", accessorIndex).then(function(accessor) { - geometry.setAttribute(attributeName, accessor); - }); - } - __name(assignAttributeAccessor, "assignAttributeAccessor"); - for (const gltfAttributeName in attributes) { - const threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase(); - if (threeAttributeName in geometry.attributes) continue; - pending.push(assignAttributeAccessor(attributes[gltfAttributeName], threeAttributeName)); - } - if (primitiveDef.indices !== void 0 && !geometry.index) { - const accessor = parser.getDependency("accessor", primitiveDef.indices).then(function(accessor2) { - geometry.setIndex(accessor2); - }); - pending.push(accessor); - } - if (ColorManagement.workingColorSpace !== LinearSRGBColorSpace && "COLOR_0" in attributes) { - console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ColorManagement.workingColorSpace}" not supported.`); - } - assignExtrasToUserData(geometry, primitiveDef); - computeBounds(geometry, primitiveDef, parser); - return Promise.all(pending).then(function() { - return primitiveDef.targets !== void 0 ? addMorphTargets(geometry, primitiveDef.targets, parser) : geometry; - }); -} -__name(addPrimitiveAttributes, "addPrimitiveAttributes"); -const _object_pattern = /^[og]\s*(.+)?/; -const _material_library_pattern = /^mtllib /; -const _material_use_pattern = /^usemtl /; -const _map_use_pattern = /^usemap /; -const _face_vertex_data_separator_pattern = /\s+/; -const _vA = new Vector3(); -const _vB = new Vector3(); -const _vC = new Vector3(); -const _ab = new Vector3(); -const _cb = new Vector3(); -const _color = new Color(); -function ParserState() { - const state = { - objects: [], - object: {}, - vertices: [], - normals: [], - colors: [], - uvs: [], - materials: {}, - materialLibraries: [], - startObject: /* @__PURE__ */ __name(function(name, fromDeclaration) { - if (this.object && this.object.fromDeclaration === false) { - this.object.name = name; - this.object.fromDeclaration = fromDeclaration !== false; - return; - } - const previousMaterial = this.object && typeof this.object.currentMaterial === "function" ? this.object.currentMaterial() : void 0; - if (this.object && typeof this.object._finalize === "function") { - this.object._finalize(true); - } - this.object = { - name: name || "", - fromDeclaration: fromDeclaration !== false, - geometry: { - vertices: [], - normals: [], - colors: [], - uvs: [], - hasUVIndices: false - }, - materials: [], - smooth: true, - startMaterial: /* @__PURE__ */ __name(function(name2, libraries) { - const previous = this._finalize(false); - if (previous && (previous.inherited || previous.groupCount <= 0)) { - this.materials.splice(previous.index, 1); - } - const material = { - index: this.materials.length, - name: name2 || "", - mtllib: Array.isArray(libraries) && libraries.length > 0 ? libraries[libraries.length - 1] : "", - smooth: previous !== void 0 ? previous.smooth : this.smooth, - groupStart: previous !== void 0 ? previous.groupEnd : 0, - groupEnd: -1, - groupCount: -1, - inherited: false, - clone: /* @__PURE__ */ __name(function(index) { - const cloned = { - index: typeof index === "number" ? index : this.index, - name: this.name, - mtllib: this.mtllib, - smooth: this.smooth, - groupStart: 0, - groupEnd: -1, - groupCount: -1, - inherited: false - }; - cloned.clone = this.clone.bind(cloned); - return cloned; - }, "clone") - }; - this.materials.push(material); - return material; - }, "startMaterial"), - currentMaterial: /* @__PURE__ */ __name(function() { - if (this.materials.length > 0) { - return this.materials[this.materials.length - 1]; - } - return void 0; - }, "currentMaterial"), - _finalize: /* @__PURE__ */ __name(function(end) { - const lastMultiMaterial = this.currentMaterial(); - if (lastMultiMaterial && lastMultiMaterial.groupEnd === -1) { - lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3; - lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart; - lastMultiMaterial.inherited = false; - } - if (end && this.materials.length > 1) { - for (let mi = this.materials.length - 1; mi >= 0; mi--) { - if (this.materials[mi].groupCount <= 0) { - this.materials.splice(mi, 1); - } - } - } - if (end && this.materials.length === 0) { - this.materials.push({ - name: "", - smooth: this.smooth - }); - } - return lastMultiMaterial; - }, "_finalize") - }; - if (previousMaterial && previousMaterial.name && typeof previousMaterial.clone === "function") { - const declared = previousMaterial.clone(0); - declared.inherited = true; - this.object.materials.push(declared); - } - this.objects.push(this.object); - }, "startObject"), - finalize: /* @__PURE__ */ __name(function() { - if (this.object && typeof this.object._finalize === "function") { - this.object._finalize(true); - } - }, "finalize"), - parseVertexIndex: /* @__PURE__ */ __name(function(value, len) { - const index = parseInt(value, 10); - return (index >= 0 ? index - 1 : index + len / 3) * 3; - }, "parseVertexIndex"), - parseNormalIndex: /* @__PURE__ */ __name(function(value, len) { - const index = parseInt(value, 10); - return (index >= 0 ? index - 1 : index + len / 3) * 3; - }, "parseNormalIndex"), - parseUVIndex: /* @__PURE__ */ __name(function(value, len) { - const index = parseInt(value, 10); - return (index >= 0 ? index - 1 : index + len / 2) * 2; - }, "parseUVIndex"), - addVertex: /* @__PURE__ */ __name(function(a, b, c) { - const src = this.vertices; - const dst = this.object.geometry.vertices; - dst.push(src[a + 0], src[a + 1], src[a + 2]); - dst.push(src[b + 0], src[b + 1], src[b + 2]); - dst.push(src[c + 0], src[c + 1], src[c + 2]); - }, "addVertex"), - addVertexPoint: /* @__PURE__ */ __name(function(a) { - const src = this.vertices; - const dst = this.object.geometry.vertices; - dst.push(src[a + 0], src[a + 1], src[a + 2]); - }, "addVertexPoint"), - addVertexLine: /* @__PURE__ */ __name(function(a) { - const src = this.vertices; - const dst = this.object.geometry.vertices; - dst.push(src[a + 0], src[a + 1], src[a + 2]); - }, "addVertexLine"), - addNormal: /* @__PURE__ */ __name(function(a, b, c) { - const src = this.normals; - const dst = this.object.geometry.normals; - dst.push(src[a + 0], src[a + 1], src[a + 2]); - dst.push(src[b + 0], src[b + 1], src[b + 2]); - dst.push(src[c + 0], src[c + 1], src[c + 2]); - }, "addNormal"), - addFaceNormal: /* @__PURE__ */ __name(function(a, b, c) { - const src = this.vertices; - const dst = this.object.geometry.normals; - _vA.fromArray(src, a); - _vB.fromArray(src, b); - _vC.fromArray(src, c); - _cb.subVectors(_vC, _vB); - _ab.subVectors(_vA, _vB); - _cb.cross(_ab); - _cb.normalize(); - dst.push(_cb.x, _cb.y, _cb.z); - dst.push(_cb.x, _cb.y, _cb.z); - dst.push(_cb.x, _cb.y, _cb.z); - }, "addFaceNormal"), - addColor: /* @__PURE__ */ __name(function(a, b, c) { - const src = this.colors; - const dst = this.object.geometry.colors; - if (src[a] !== void 0) dst.push(src[a + 0], src[a + 1], src[a + 2]); - if (src[b] !== void 0) dst.push(src[b + 0], src[b + 1], src[b + 2]); - if (src[c] !== void 0) dst.push(src[c + 0], src[c + 1], src[c + 2]); - }, "addColor"), - addUV: /* @__PURE__ */ __name(function(a, b, c) { - const src = this.uvs; - const dst = this.object.geometry.uvs; - dst.push(src[a + 0], src[a + 1]); - dst.push(src[b + 0], src[b + 1]); - dst.push(src[c + 0], src[c + 1]); - }, "addUV"), - addDefaultUV: /* @__PURE__ */ __name(function() { - const dst = this.object.geometry.uvs; - dst.push(0, 0); - dst.push(0, 0); - dst.push(0, 0); - }, "addDefaultUV"), - addUVLine: /* @__PURE__ */ __name(function(a) { - const src = this.uvs; - const dst = this.object.geometry.uvs; - dst.push(src[a + 0], src[a + 1]); - }, "addUVLine"), - addFace: /* @__PURE__ */ __name(function(a, b, c, ua, ub, uc, na, nb, nc) { - const vLen = this.vertices.length; - let ia = this.parseVertexIndex(a, vLen); - let ib = this.parseVertexIndex(b, vLen); - let ic = this.parseVertexIndex(c, vLen); - this.addVertex(ia, ib, ic); - this.addColor(ia, ib, ic); - if (na !== void 0 && na !== "") { - const nLen = this.normals.length; - ia = this.parseNormalIndex(na, nLen); - ib = this.parseNormalIndex(nb, nLen); - ic = this.parseNormalIndex(nc, nLen); - this.addNormal(ia, ib, ic); - } else { - this.addFaceNormal(ia, ib, ic); - } - if (ua !== void 0 && ua !== "") { - const uvLen = this.uvs.length; - ia = this.parseUVIndex(ua, uvLen); - ib = this.parseUVIndex(ub, uvLen); - ic = this.parseUVIndex(uc, uvLen); - this.addUV(ia, ib, ic); - this.object.geometry.hasUVIndices = true; - } else { - this.addDefaultUV(); - } - }, "addFace"), - addPointGeometry: /* @__PURE__ */ __name(function(vertices) { - this.object.geometry.type = "Points"; - const vLen = this.vertices.length; - for (let vi = 0, l = vertices.length; vi < l; vi++) { - const index = this.parseVertexIndex(vertices[vi], vLen); - this.addVertexPoint(index); - this.addColor(index); - } - }, "addPointGeometry"), - addLineGeometry: /* @__PURE__ */ __name(function(vertices, uvs) { - this.object.geometry.type = "Line"; - const vLen = this.vertices.length; - const uvLen = this.uvs.length; - for (let vi = 0, l = vertices.length; vi < l; vi++) { - this.addVertexLine(this.parseVertexIndex(vertices[vi], vLen)); - } - for (let uvi = 0, l = uvs.length; uvi < l; uvi++) { - this.addUVLine(this.parseUVIndex(uvs[uvi], uvLen)); - } - }, "addLineGeometry") - }; - state.startObject("", false); - return state; -} -__name(ParserState, "ParserState"); -class OBJLoader extends Loader { - static { - __name(this, "OBJLoader"); - } - constructor(manager) { - super(manager); - this.materials = null; - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(this.manager); - loader.setPath(this.path); - loader.setRequestHeader(this.requestHeader); - loader.setWithCredentials(this.withCredentials); - loader.load(url, function(text) { - try { - onLoad(scope.parse(text)); - } catch (e) { - if (onError) { - onError(e); - } else { - console.error(e); - } - scope.manager.itemError(url); - } - }, onProgress, onError); - } - setMaterials(materials) { - this.materials = materials; - return this; - } - parse(text) { - const state = new ParserState(); - if (text.indexOf("\r\n") !== -1) { - text = text.replace(/\r\n/g, "\n"); - } - if (text.indexOf("\\\n") !== -1) { - text = text.replace(/\\\n/g, ""); - } - const lines = text.split("\n"); - let result = []; - for (let i = 0, l = lines.length; i < l; i++) { - const line = lines[i].trimStart(); - if (line.length === 0) continue; - const lineFirstChar = line.charAt(0); - if (lineFirstChar === "#") continue; - if (lineFirstChar === "v") { - const data = line.split(_face_vertex_data_separator_pattern); - switch (data[0]) { - case "v": - state.vertices.push( - parseFloat(data[1]), - parseFloat(data[2]), - parseFloat(data[3]) - ); - if (data.length >= 7) { - _color.setRGB( - parseFloat(data[4]), - parseFloat(data[5]), - parseFloat(data[6]), - SRGBColorSpace - ); - state.colors.push(_color.r, _color.g, _color.b); - } else { - state.colors.push(void 0, void 0, void 0); - } - break; - case "vn": - state.normals.push( - parseFloat(data[1]), - parseFloat(data[2]), - parseFloat(data[3]) - ); - break; - case "vt": - state.uvs.push( - parseFloat(data[1]), - parseFloat(data[2]) - ); - break; - } - } else if (lineFirstChar === "f") { - const lineData = line.slice(1).trim(); - const vertexData = lineData.split(_face_vertex_data_separator_pattern); - const faceVertices = []; - for (let j = 0, jl = vertexData.length; j < jl; j++) { - const vertex2 = vertexData[j]; - if (vertex2.length > 0) { - const vertexParts = vertex2.split("/"); - faceVertices.push(vertexParts); - } - } - const v1 = faceVertices[0]; - for (let j = 1, jl = faceVertices.length - 1; j < jl; j++) { - const v2 = faceVertices[j]; - const v3 = faceVertices[j + 1]; - state.addFace( - v1[0], - v2[0], - v3[0], - v1[1], - v2[1], - v3[1], - v1[2], - v2[2], - v3[2] - ); - } - } else if (lineFirstChar === "l") { - const lineParts = line.substring(1).trim().split(" "); - let lineVertices = []; - const lineUVs = []; - if (line.indexOf("/") === -1) { - lineVertices = lineParts; - } else { - for (let li = 0, llen = lineParts.length; li < llen; li++) { - const parts = lineParts[li].split("/"); - if (parts[0] !== "") lineVertices.push(parts[0]); - if (parts[1] !== "") lineUVs.push(parts[1]); - } - } - state.addLineGeometry(lineVertices, lineUVs); - } else if (lineFirstChar === "p") { - const lineData = line.slice(1).trim(); - const pointData = lineData.split(" "); - state.addPointGeometry(pointData); - } else if ((result = _object_pattern.exec(line)) !== null) { - const name = (" " + result[0].slice(1).trim()).slice(1); - state.startObject(name); - } else if (_material_use_pattern.test(line)) { - state.object.startMaterial(line.substring(7).trim(), state.materialLibraries); - } else if (_material_library_pattern.test(line)) { - state.materialLibraries.push(line.substring(7).trim()); - } else if (_map_use_pattern.test(line)) { - console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'); - } else if (lineFirstChar === "s") { - result = line.split(" "); - if (result.length > 1) { - const value = result[1].trim().toLowerCase(); - state.object.smooth = value !== "0" && value !== "off"; - } else { - state.object.smooth = true; - } - const material = state.object.currentMaterial(); - if (material) material.smooth = state.object.smooth; - } else { - if (line === "\0") continue; - console.warn('THREE.OBJLoader: Unexpected line: "' + line + '"'); - } - } - state.finalize(); - const container = new Group(); - container.materialLibraries = [].concat(state.materialLibraries); - const hasPrimitives = !(state.objects.length === 1 && state.objects[0].geometry.vertices.length === 0); - if (hasPrimitives === true) { - for (let i = 0, l = state.objects.length; i < l; i++) { - const object = state.objects[i]; - const geometry = object.geometry; - const materials = object.materials; - const isLine = geometry.type === "Line"; - const isPoints = geometry.type === "Points"; - let hasVertexColors = false; - if (geometry.vertices.length === 0) continue; - const buffergeometry = new BufferGeometry(); - buffergeometry.setAttribute("position", new Float32BufferAttribute(geometry.vertices, 3)); - if (geometry.normals.length > 0) { - buffergeometry.setAttribute("normal", new Float32BufferAttribute(geometry.normals, 3)); - } - if (geometry.colors.length > 0) { - hasVertexColors = true; - buffergeometry.setAttribute("color", new Float32BufferAttribute(geometry.colors, 3)); - } - if (geometry.hasUVIndices === true) { - buffergeometry.setAttribute("uv", new Float32BufferAttribute(geometry.uvs, 2)); - } - const createdMaterials = []; - for (let mi = 0, miLen = materials.length; mi < miLen; mi++) { - const sourceMaterial = materials[mi]; - const materialHash = sourceMaterial.name + "_" + sourceMaterial.smooth + "_" + hasVertexColors; - let material = state.materials[materialHash]; - if (this.materials !== null) { - material = this.materials.create(sourceMaterial.name); - if (isLine && material && !(material instanceof LineBasicMaterial)) { - const materialLine = new LineBasicMaterial(); - Material.prototype.copy.call(materialLine, material); - materialLine.color.copy(material.color); - material = materialLine; - } else if (isPoints && material && !(material instanceof PointsMaterial)) { - const materialPoints = new PointsMaterial({ size: 10, sizeAttenuation: false }); - Material.prototype.copy.call(materialPoints, material); - materialPoints.color.copy(material.color); - materialPoints.map = material.map; - material = materialPoints; - } - } - if (material === void 0) { - if (isLine) { - material = new LineBasicMaterial(); - } else if (isPoints) { - material = new PointsMaterial({ size: 1, sizeAttenuation: false }); - } else { - material = new MeshPhongMaterial(); - } - material.name = sourceMaterial.name; - material.flatShading = sourceMaterial.smooth ? false : true; - material.vertexColors = hasVertexColors; - state.materials[materialHash] = material; - } - createdMaterials.push(material); - } - let mesh; - if (createdMaterials.length > 1) { - for (let mi = 0, miLen = materials.length; mi < miLen; mi++) { - const sourceMaterial = materials[mi]; - buffergeometry.addGroup(sourceMaterial.groupStart, sourceMaterial.groupCount, mi); - } - if (isLine) { - mesh = new LineSegments(buffergeometry, createdMaterials); - } else if (isPoints) { - mesh = new Points(buffergeometry, createdMaterials); - } else { - mesh = new Mesh(buffergeometry, createdMaterials); - } - } else { - if (isLine) { - mesh = new LineSegments(buffergeometry, createdMaterials[0]); - } else if (isPoints) { - mesh = new Points(buffergeometry, createdMaterials[0]); - } else { - mesh = new Mesh(buffergeometry, createdMaterials[0]); - } - } - mesh.name = object.name; - container.add(mesh); - } - } else { - if (state.vertices.length > 0) { - const material = new PointsMaterial({ size: 1, sizeAttenuation: false }); - const buffergeometry = new BufferGeometry(); - buffergeometry.setAttribute("position", new Float32BufferAttribute(state.vertices, 3)); - if (state.colors.length > 0 && state.colors[0] !== void 0) { - buffergeometry.setAttribute("color", new Float32BufferAttribute(state.colors, 3)); - material.vertexColors = true; - } - const points = new Points(buffergeometry, material); - container.add(points); - } - } - return container; - } -} -class MTLLoader extends Loader { - static { - __name(this, "MTLLoader"); - } - constructor(manager) { - super(manager); - } - /** - * Loads and parses a MTL asset from a URL. - * - * @param {String} url - URL to the MTL file. - * @param {Function} [onLoad] - Callback invoked with the loaded object. - * @param {Function} [onProgress] - Callback for download progress. - * @param {Function} [onError] - Callback for download errors. - * - * @see setPath setResourcePath - * - * @note In order for relative texture references to resolve correctly - * you must call setResourcePath() explicitly prior to load. - */ - load(url, onLoad, onProgress, onError) { - const scope = this; - const path = this.path === "" ? LoaderUtils.extractUrlBase(url) : this.path; - const loader = new FileLoader(this.manager); - loader.setPath(this.path); - loader.setRequestHeader(this.requestHeader); - loader.setWithCredentials(this.withCredentials); - loader.load(url, function(text) { - try { - onLoad(scope.parse(text, path)); - } catch (e) { - if (onError) { - onError(e); - } else { - console.error(e); - } - scope.manager.itemError(url); - } - }, onProgress, onError); - } - setMaterialOptions(value) { - this.materialOptions = value; - return this; - } - /** - * Parses a MTL file. - * - * @param {String} text - Content of MTL file - * @return {MaterialCreator} - * - * @see setPath setResourcePath - * - * @note In order for relative texture references to resolve correctly - * you must call setResourcePath() explicitly prior to parse. - */ - parse(text, path) { - const lines = text.split("\n"); - let info = {}; - const delimiter_pattern = /\s+/; - const materialsInfo = {}; - for (let i = 0; i < lines.length; i++) { - let line = lines[i]; - line = line.trim(); - if (line.length === 0 || line.charAt(0) === "#") { - continue; - } - const pos = line.indexOf(" "); - let key = pos >= 0 ? line.substring(0, pos) : line; - key = key.toLowerCase(); - let value = pos >= 0 ? line.substring(pos + 1) : ""; - value = value.trim(); - if (key === "newmtl") { - info = { name: value }; - materialsInfo[value] = info; - } else { - if (key === "ka" || key === "kd" || key === "ks" || key === "ke") { - const ss = value.split(delimiter_pattern, 3); - info[key] = [parseFloat(ss[0]), parseFloat(ss[1]), parseFloat(ss[2])]; - } else { - info[key] = value; - } - } - } - const materialCreator = new MaterialCreator(this.resourcePath || path, this.materialOptions); - materialCreator.setCrossOrigin(this.crossOrigin); - materialCreator.setManager(this.manager); - materialCreator.setMaterials(materialsInfo); - return materialCreator; - } -} -class MaterialCreator { - static { - __name(this, "MaterialCreator"); - } - constructor(baseUrl = "", options = {}) { - this.baseUrl = baseUrl; - this.options = options; - this.materialsInfo = {}; - this.materials = {}; - this.materialsArray = []; - this.nameLookup = {}; - this.crossOrigin = "anonymous"; - this.side = this.options.side !== void 0 ? this.options.side : FrontSide; - this.wrap = this.options.wrap !== void 0 ? this.options.wrap : RepeatWrapping; - } - setCrossOrigin(value) { - this.crossOrigin = value; - return this; - } - setManager(value) { - this.manager = value; - } - setMaterials(materialsInfo) { - this.materialsInfo = this.convert(materialsInfo); - this.materials = {}; - this.materialsArray = []; - this.nameLookup = {}; - } - convert(materialsInfo) { - if (!this.options) return materialsInfo; - const converted = {}; - for (const mn in materialsInfo) { - const mat = materialsInfo[mn]; - const covmat = {}; - converted[mn] = covmat; - for (const prop in mat) { - let save = true; - let value = mat[prop]; - const lprop = prop.toLowerCase(); - switch (lprop) { - case "kd": - case "ka": - case "ks": - if (this.options && this.options.normalizeRGB) { - value = [value[0] / 255, value[1] / 255, value[2] / 255]; - } - if (this.options && this.options.ignoreZeroRGBs) { - if (value[0] === 0 && value[1] === 0 && value[2] === 0) { - save = false; - } - } - break; - default: - break; - } - if (save) { - covmat[lprop] = value; - } - } - } - return converted; - } - preload() { - for (const mn in this.materialsInfo) { - this.create(mn); - } - } - getIndex(materialName) { - return this.nameLookup[materialName]; - } - getAsArray() { - let index = 0; - for (const mn in this.materialsInfo) { - this.materialsArray[index] = this.create(mn); - this.nameLookup[mn] = index; - index++; - } - return this.materialsArray; - } - create(materialName) { - if (this.materials[materialName] === void 0) { - this.createMaterial_(materialName); - } - return this.materials[materialName]; - } - createMaterial_(materialName) { - const scope = this; - const mat = this.materialsInfo[materialName]; - const params = { - name: materialName, - side: this.side - }; - function resolveURL(baseUrl, url) { - if (typeof url !== "string" || url === "") - return ""; - if (/^https?:\/\//i.test(url)) return url; - return baseUrl + url; - } - __name(resolveURL, "resolveURL"); - function setMapForType(mapType, value) { - if (params[mapType]) return; - const texParams = scope.getTextureParams(value, params); - const map = scope.loadTexture(resolveURL(scope.baseUrl, texParams.url)); - map.repeat.copy(texParams.scale); - map.offset.copy(texParams.offset); - map.wrapS = scope.wrap; - map.wrapT = scope.wrap; - if (mapType === "map" || mapType === "emissiveMap") { - map.colorSpace = SRGBColorSpace; - } - params[mapType] = map; - } - __name(setMapForType, "setMapForType"); - for (const prop in mat) { - const value = mat[prop]; - let n; - if (value === "") continue; - switch (prop.toLowerCase()) { - case "kd": - params.color = ColorManagement.toWorkingColorSpace(new Color().fromArray(value), SRGBColorSpace); - break; - case "ks": - params.specular = ColorManagement.toWorkingColorSpace(new Color().fromArray(value), SRGBColorSpace); - break; - case "ke": - params.emissive = ColorManagement.toWorkingColorSpace(new Color().fromArray(value), SRGBColorSpace); - break; - case "map_kd": - setMapForType("map", value); - break; - case "map_ks": - setMapForType("specularMap", value); - break; - case "map_ke": - setMapForType("emissiveMap", value); - break; - case "norm": - setMapForType("normalMap", value); - break; - case "map_bump": - case "bump": - setMapForType("bumpMap", value); - break; - case "map_d": - setMapForType("alphaMap", value); - params.transparent = true; - break; - case "ns": - params.shininess = parseFloat(value); - break; - case "d": - n = parseFloat(value); - if (n < 1) { - params.opacity = n; - params.transparent = true; - } - break; - case "tr": - n = parseFloat(value); - if (this.options && this.options.invertTrProperty) n = 1 - n; - if (n > 0) { - params.opacity = 1 - n; - params.transparent = true; - } - break; - default: - break; - } - } - this.materials[materialName] = new MeshPhongMaterial(params); - return this.materials[materialName]; - } - getTextureParams(value, matParams) { - const texParams = { - scale: new Vector2(1, 1), - offset: new Vector2(0, 0) - }; - const items = value.split(/\s+/); - let pos; - pos = items.indexOf("-bm"); - if (pos >= 0) { - matParams.bumpScale = parseFloat(items[pos + 1]); - items.splice(pos, 2); - } - pos = items.indexOf("-s"); - if (pos >= 0) { - texParams.scale.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2])); - items.splice(pos, 4); - } - pos = items.indexOf("-o"); - if (pos >= 0) { - texParams.offset.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2])); - items.splice(pos, 4); - } - texParams.url = items.join(" ").trim(); - return texParams; - } - loadTexture(url, mapping, onLoad, onProgress, onError) { - const manager = this.manager !== void 0 ? this.manager : DefaultLoadingManager; - let loader = manager.getHandler(url); - if (loader === null) { - loader = new TextureLoader(manager); - } - if (loader.setCrossOrigin) loader.setCrossOrigin(this.crossOrigin); - const texture = loader.load(url, onLoad, onProgress, onError); - if (mapping !== void 0) texture.mapping = mapping; - return texture; - } -} /*! fflate - fast JavaScript compression/decompression @@ -50882,6 +41417,4140 @@ function slice(a, b, from, to) { return a; } __name(slice, "slice"); +function computeMikkTSpaceTangents(geometry, MikkTSpace, negateSign = true) { + if (!MikkTSpace || !MikkTSpace.isReady) { + throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required."); + } + if (!geometry.hasAttribute("position") || !geometry.hasAttribute("normal") || !geometry.hasAttribute("uv")) { + throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.'); + } + function getAttributeArray(attribute) { + if (attribute.normalized || attribute.isInterleavedBufferAttribute) { + const dstArray = new Float32Array(attribute.count * attribute.itemSize); + for (let i = 0, j = 0; i < attribute.count; i++) { + dstArray[j++] = attribute.getX(i); + dstArray[j++] = attribute.getY(i); + if (attribute.itemSize > 2) { + dstArray[j++] = attribute.getZ(i); + } + } + return dstArray; + } + if (attribute.array instanceof Float32Array) { + return attribute.array; + } + return new Float32Array(attribute.array); + } + __name(getAttributeArray, "getAttributeArray"); + const _geometry2 = geometry.index ? geometry.toNonIndexed() : geometry; + const tangents = MikkTSpace.generateTangents( + getAttributeArray(_geometry2.attributes.position), + getAttributeArray(_geometry2.attributes.normal), + getAttributeArray(_geometry2.attributes.uv) + ); + if (negateSign) { + for (let i = 3; i < tangents.length; i += 4) { + tangents[i] *= -1; + } + } + _geometry2.setAttribute("tangent", new BufferAttribute(tangents, 4)); + if (geometry !== _geometry2) { + geometry.copy(_geometry2); + } + return geometry; +} +__name(computeMikkTSpaceTangents, "computeMikkTSpaceTangents"); +function mergeGeometries(geometries, useGroups = false) { + const isIndexed = geometries[0].index !== null; + const attributesUsed = new Set(Object.keys(geometries[0].attributes)); + const morphAttributesUsed = new Set(Object.keys(geometries[0].morphAttributes)); + const attributes = {}; + const morphAttributes = {}; + const morphTargetsRelative = geometries[0].morphTargetsRelative; + const mergedGeometry = new BufferGeometry(); + let offset = 0; + for (let i = 0; i < geometries.length; ++i) { + const geometry = geometries[i]; + let attributesCount = 0; + if (isIndexed !== (geometry.index !== null)) { + console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."); + return null; + } + for (const name in geometry.attributes) { + if (!attributesUsed.has(name)) { + console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + '. All geometries must have compatible attributes; make sure "' + name + '" attribute exists among all geometries, or in none of them.'); + return null; + } + if (attributes[name] === void 0) attributes[name] = []; + attributes[name].push(geometry.attributes[name]); + attributesCount++; + } + if (attributesCount !== attributesUsed.size) { + console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". Make sure all geometries have the same number of attributes."); + return null; + } + if (morphTargetsRelative !== geometry.morphTargetsRelative) { + console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". .morphTargetsRelative must be consistent throughout all geometries."); + return null; + } + for (const name in geometry.morphAttributes) { + if (!morphAttributesUsed.has(name)) { + console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". .morphAttributes must be consistent throughout all geometries."); + return null; + } + if (morphAttributes[name] === void 0) morphAttributes[name] = []; + morphAttributes[name].push(geometry.morphAttributes[name]); + } + if (useGroups) { + let count; + if (isIndexed) { + count = geometry.index.count; + } else if (geometry.attributes.position !== void 0) { + count = geometry.attributes.position.count; + } else { + console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". The geometry must have either an index or a position attribute"); + return null; + } + mergedGeometry.addGroup(offset, count, i); + offset += count; + } + } + if (isIndexed) { + let indexOffset = 0; + const mergedIndex = []; + for (let i = 0; i < geometries.length; ++i) { + const index = geometries[i].index; + for (let j = 0; j < index.count; ++j) { + mergedIndex.push(index.getX(j) + indexOffset); + } + indexOffset += geometries[i].attributes.position.count; + } + mergedGeometry.setIndex(mergedIndex); + } + for (const name in attributes) { + const mergedAttribute = mergeAttributes(attributes[name]); + if (!mergedAttribute) { + console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + name + " attribute."); + return null; + } + mergedGeometry.setAttribute(name, mergedAttribute); + } + for (const name in morphAttributes) { + const numMorphTargets = morphAttributes[name][0].length; + if (numMorphTargets === 0) break; + mergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {}; + mergedGeometry.morphAttributes[name] = []; + for (let i = 0; i < numMorphTargets; ++i) { + const morphAttributesToMerge = []; + for (let j = 0; j < morphAttributes[name].length; ++j) { + morphAttributesToMerge.push(morphAttributes[name][j][i]); + } + const mergedMorphAttribute = mergeAttributes(morphAttributesToMerge); + if (!mergedMorphAttribute) { + console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + name + " morphAttribute."); + return null; + } + mergedGeometry.morphAttributes[name].push(mergedMorphAttribute); + } + } + return mergedGeometry; +} +__name(mergeGeometries, "mergeGeometries"); +function mergeAttributes(attributes) { + let TypedArray; + let itemSize; + let normalized; + let gpuType = -1; + let arrayLength = 0; + for (let i = 0; i < attributes.length; ++i) { + const attribute = attributes[i]; + if (TypedArray === void 0) TypedArray = attribute.array.constructor; + if (TypedArray !== attribute.array.constructor) { + console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."); + return null; + } + if (itemSize === void 0) itemSize = attribute.itemSize; + if (itemSize !== attribute.itemSize) { + console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."); + return null; + } + if (normalized === void 0) normalized = attribute.normalized; + if (normalized !== attribute.normalized) { + console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."); + return null; + } + if (gpuType === -1) gpuType = attribute.gpuType; + if (gpuType !== attribute.gpuType) { + console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."); + return null; + } + arrayLength += attribute.count * itemSize; + } + const array = new TypedArray(arrayLength); + const result = new BufferAttribute(array, itemSize, normalized); + let offset = 0; + for (let i = 0; i < attributes.length; ++i) { + const attribute = attributes[i]; + if (attribute.isInterleavedBufferAttribute) { + const tupleOffset = offset / itemSize; + for (let j = 0, l = attribute.count; j < l; j++) { + for (let c = 0; c < itemSize; c++) { + const value = attribute.getComponent(j, c); + result.setComponent(j + tupleOffset, c, value); + } + } + } else { + array.set(attribute.array, offset); + } + offset += attribute.count * itemSize; + } + if (gpuType !== void 0) { + result.gpuType = gpuType; + } + return result; +} +__name(mergeAttributes, "mergeAttributes"); +function deepCloneAttribute(attribute) { + if (attribute.isInstancedInterleavedBufferAttribute || attribute.isInterleavedBufferAttribute) { + return deinterleaveAttribute(attribute); + } + if (attribute.isInstancedBufferAttribute) { + return new InstancedBufferAttribute().copy(attribute); + } + return new BufferAttribute().copy(attribute); +} +__name(deepCloneAttribute, "deepCloneAttribute"); +function interleaveAttributes(attributes) { + let TypedArray; + let arrayLength = 0; + let stride = 0; + for (let i = 0, l = attributes.length; i < l; ++i) { + const attribute = attributes[i]; + if (TypedArray === void 0) TypedArray = attribute.array.constructor; + if (TypedArray !== attribute.array.constructor) { + console.error("AttributeBuffers of different types cannot be interleaved"); + return null; + } + arrayLength += attribute.array.length; + stride += attribute.itemSize; + } + const interleavedBuffer = new InterleavedBuffer(new TypedArray(arrayLength), stride); + let offset = 0; + const res = []; + const getters = ["getX", "getY", "getZ", "getW"]; + const setters = ["setX", "setY", "setZ", "setW"]; + for (let j = 0, l = attributes.length; j < l; j++) { + const attribute = attributes[j]; + const itemSize = attribute.itemSize; + const count = attribute.count; + const iba = new InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, attribute.normalized); + res.push(iba); + offset += itemSize; + for (let c = 0; c < count; c++) { + for (let k = 0; k < itemSize; k++) { + iba[setters[k]](c, attribute[getters[k]](c)); + } + } + } + return res; +} +__name(interleaveAttributes, "interleaveAttributes"); +function deinterleaveAttribute(attribute) { + const cons = attribute.data.array.constructor; + const count = attribute.count; + const itemSize = attribute.itemSize; + const normalized = attribute.normalized; + const array = new cons(count * itemSize); + let newAttribute; + if (attribute.isInstancedInterleavedBufferAttribute) { + newAttribute = new InstancedBufferAttribute(array, itemSize, normalized, attribute.meshPerAttribute); + } else { + newAttribute = new BufferAttribute(array, itemSize, normalized); + } + for (let i = 0; i < count; i++) { + newAttribute.setX(i, attribute.getX(i)); + if (itemSize >= 2) { + newAttribute.setY(i, attribute.getY(i)); + } + if (itemSize >= 3) { + newAttribute.setZ(i, attribute.getZ(i)); + } + if (itemSize >= 4) { + newAttribute.setW(i, attribute.getW(i)); + } + } + return newAttribute; +} +__name(deinterleaveAttribute, "deinterleaveAttribute"); +function deinterleaveGeometry(geometry) { + const attributes = geometry.attributes; + const morphTargets = geometry.morphTargets; + const attrMap = /* @__PURE__ */ new Map(); + for (const key in attributes) { + const attr = attributes[key]; + if (attr.isInterleavedBufferAttribute) { + if (!attrMap.has(attr)) { + attrMap.set(attr, deinterleaveAttribute(attr)); + } + attributes[key] = attrMap.get(attr); + } + } + for (const key in morphTargets) { + const attr = morphTargets[key]; + if (attr.isInterleavedBufferAttribute) { + if (!attrMap.has(attr)) { + attrMap.set(attr, deinterleaveAttribute(attr)); + } + morphTargets[key] = attrMap.get(attr); + } + } +} +__name(deinterleaveGeometry, "deinterleaveGeometry"); +function estimateBytesUsed(geometry) { + let mem = 0; + for (const name in geometry.attributes) { + const attr = geometry.getAttribute(name); + mem += attr.count * attr.itemSize * attr.array.BYTES_PER_ELEMENT; + } + const indices = geometry.getIndex(); + mem += indices ? indices.count * indices.itemSize * indices.array.BYTES_PER_ELEMENT : 0; + return mem; +} +__name(estimateBytesUsed, "estimateBytesUsed"); +function mergeVertices(geometry, tolerance = 1e-4) { + tolerance = Math.max(tolerance, Number.EPSILON); + const hashToIndex = {}; + const indices = geometry.getIndex(); + const positions = geometry.getAttribute("position"); + const vertexCount = indices ? indices.count : positions.count; + let nextIndex = 0; + const attributeNames = Object.keys(geometry.attributes); + const tmpAttributes = {}; + const tmpMorphAttributes = {}; + const newIndices = []; + const getters = ["getX", "getY", "getZ", "getW"]; + const setters = ["setX", "setY", "setZ", "setW"]; + for (let i = 0, l = attributeNames.length; i < l; i++) { + const name = attributeNames[i]; + const attr = geometry.attributes[name]; + tmpAttributes[name] = new attr.constructor( + new attr.array.constructor(attr.count * attr.itemSize), + attr.itemSize, + attr.normalized + ); + const morphAttributes = geometry.morphAttributes[name]; + if (morphAttributes) { + if (!tmpMorphAttributes[name]) tmpMorphAttributes[name] = []; + morphAttributes.forEach((morphAttr, i2) => { + const array = new morphAttr.array.constructor(morphAttr.count * morphAttr.itemSize); + tmpMorphAttributes[name][i2] = new morphAttr.constructor(array, morphAttr.itemSize, morphAttr.normalized); + }); + } + } + const halfTolerance = tolerance * 0.5; + const exponent = Math.log10(1 / tolerance); + const hashMultiplier = Math.pow(10, exponent); + const hashAdditive = halfTolerance * hashMultiplier; + for (let i = 0; i < vertexCount; i++) { + const index = indices ? indices.getX(i) : i; + let hash = ""; + for (let j = 0, l = attributeNames.length; j < l; j++) { + const name = attributeNames[j]; + const attribute = geometry.getAttribute(name); + const itemSize = attribute.itemSize; + for (let k = 0; k < itemSize; k++) { + hash += `${~~(attribute[getters[k]](index) * hashMultiplier + hashAdditive)},`; + } + } + if (hash in hashToIndex) { + newIndices.push(hashToIndex[hash]); + } else { + for (let j = 0, l = attributeNames.length; j < l; j++) { + const name = attributeNames[j]; + const attribute = geometry.getAttribute(name); + const morphAttributes = geometry.morphAttributes[name]; + const itemSize = attribute.itemSize; + const newArray = tmpAttributes[name]; + const newMorphArrays = tmpMorphAttributes[name]; + for (let k = 0; k < itemSize; k++) { + const getterFunc = getters[k]; + const setterFunc = setters[k]; + newArray[setterFunc](nextIndex, attribute[getterFunc](index)); + if (morphAttributes) { + for (let m = 0, ml = morphAttributes.length; m < ml; m++) { + newMorphArrays[m][setterFunc](nextIndex, morphAttributes[m][getterFunc](index)); + } + } + } + } + hashToIndex[hash] = nextIndex; + newIndices.push(nextIndex); + nextIndex++; + } + } + const result = geometry.clone(); + for (const name in geometry.attributes) { + const tmpAttribute = tmpAttributes[name]; + result.setAttribute(name, new tmpAttribute.constructor( + tmpAttribute.array.slice(0, nextIndex * tmpAttribute.itemSize), + tmpAttribute.itemSize, + tmpAttribute.normalized + )); + if (!(name in tmpMorphAttributes)) continue; + for (let j = 0; j < tmpMorphAttributes[name].length; j++) { + const tmpMorphAttribute = tmpMorphAttributes[name][j]; + result.morphAttributes[name][j] = new tmpMorphAttribute.constructor( + tmpMorphAttribute.array.slice(0, nextIndex * tmpMorphAttribute.itemSize), + tmpMorphAttribute.itemSize, + tmpMorphAttribute.normalized + ); + } + } + result.setIndex(newIndices); + return result; +} +__name(mergeVertices, "mergeVertices"); +function toTrianglesDrawMode(geometry, drawMode) { + if (drawMode === TrianglesDrawMode) { + console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."); + return geometry; + } + if (drawMode === TriangleFanDrawMode || drawMode === TriangleStripDrawMode) { + let index = geometry.getIndex(); + if (index === null) { + const indices = []; + const position = geometry.getAttribute("position"); + if (position !== void 0) { + for (let i = 0; i < position.count; i++) { + indices.push(i); + } + geometry.setIndex(indices); + index = geometry.getIndex(); + } else { + console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."); + return geometry; + } + } + const numberOfTriangles = index.count - 2; + const newIndices = []; + if (drawMode === TriangleFanDrawMode) { + for (let i = 1; i <= numberOfTriangles; i++) { + newIndices.push(index.getX(0)); + newIndices.push(index.getX(i)); + newIndices.push(index.getX(i + 1)); + } + } else { + for (let i = 0; i < numberOfTriangles; i++) { + if (i % 2 === 0) { + newIndices.push(index.getX(i)); + newIndices.push(index.getX(i + 1)); + newIndices.push(index.getX(i + 2)); + } else { + newIndices.push(index.getX(i + 2)); + newIndices.push(index.getX(i + 1)); + newIndices.push(index.getX(i)); + } + } + } + if (newIndices.length / 3 !== numberOfTriangles) { + console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles."); + } + const newGeometry = geometry.clone(); + newGeometry.setIndex(newIndices); + newGeometry.clearGroups(); + return newGeometry; + } else { + console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", drawMode); + return geometry; + } +} +__name(toTrianglesDrawMode, "toTrianglesDrawMode"); +function computeMorphedAttributes(object) { + const _vA2 = new Vector3(); + const _vB2 = new Vector3(); + const _vC2 = new Vector3(); + const _tempA2 = new Vector3(); + const _tempB = new Vector3(); + const _tempC = new Vector3(); + const _morphA2 = new Vector3(); + const _morphB = new Vector3(); + const _morphC = new Vector3(); + function _calculateMorphedAttributeData(object2, attribute, morphAttribute, morphTargetsRelative2, a2, b3, c2, modifiedAttributeArray) { + _vA2.fromBufferAttribute(attribute, a2); + _vB2.fromBufferAttribute(attribute, b3); + _vC2.fromBufferAttribute(attribute, c2); + const morphInfluences = object2.morphTargetInfluences; + if (morphAttribute && morphInfluences) { + _morphA2.set(0, 0, 0); + _morphB.set(0, 0, 0); + _morphC.set(0, 0, 0); + for (let i2 = 0, il2 = morphAttribute.length; i2 < il2; i2++) { + const influence = morphInfluences[i2]; + const morph = morphAttribute[i2]; + if (influence === 0) continue; + _tempA2.fromBufferAttribute(morph, a2); + _tempB.fromBufferAttribute(morph, b3); + _tempC.fromBufferAttribute(morph, c2); + if (morphTargetsRelative2) { + _morphA2.addScaledVector(_tempA2, influence); + _morphB.addScaledVector(_tempB, influence); + _morphC.addScaledVector(_tempC, influence); + } else { + _morphA2.addScaledVector(_tempA2.sub(_vA2), influence); + _morphB.addScaledVector(_tempB.sub(_vB2), influence); + _morphC.addScaledVector(_tempC.sub(_vC2), influence); + } + } + _vA2.add(_morphA2); + _vB2.add(_morphB); + _vC2.add(_morphC); + } + if (object2.isSkinnedMesh) { + object2.applyBoneTransform(a2, _vA2); + object2.applyBoneTransform(b3, _vB2); + object2.applyBoneTransform(c2, _vC2); + } + modifiedAttributeArray[a2 * 3 + 0] = _vA2.x; + modifiedAttributeArray[a2 * 3 + 1] = _vA2.y; + modifiedAttributeArray[a2 * 3 + 2] = _vA2.z; + modifiedAttributeArray[b3 * 3 + 0] = _vB2.x; + modifiedAttributeArray[b3 * 3 + 1] = _vB2.y; + modifiedAttributeArray[b3 * 3 + 2] = _vB2.z; + modifiedAttributeArray[c2 * 3 + 0] = _vC2.x; + modifiedAttributeArray[c2 * 3 + 1] = _vC2.y; + modifiedAttributeArray[c2 * 3 + 2] = _vC2.z; + } + __name(_calculateMorphedAttributeData, "_calculateMorphedAttributeData"); + const geometry = object.geometry; + const material = object.material; + let a, b, c; + const index = geometry.index; + const positionAttribute = geometry.attributes.position; + const morphPosition = geometry.morphAttributes.position; + const morphTargetsRelative = geometry.morphTargetsRelative; + const normalAttribute = geometry.attributes.normal; + const morphNormal = geometry.morphAttributes.position; + const groups = geometry.groups; + const drawRange = geometry.drawRange; + let i, j, il, jl; + let group; + let start, end; + const modifiedPosition = new Float32Array(positionAttribute.count * positionAttribute.itemSize); + const modifiedNormal = new Float32Array(normalAttribute.count * normalAttribute.itemSize); + if (index !== null) { + if (Array.isArray(material)) { + for (i = 0, il = groups.length; i < il; i++) { + group = groups[i]; + start = Math.max(group.start, drawRange.start); + end = Math.min(group.start + group.count, drawRange.start + drawRange.count); + for (j = start, jl = end; j < jl; j += 3) { + a = index.getX(j); + b = index.getX(j + 1); + c = index.getX(j + 2); + _calculateMorphedAttributeData( + object, + positionAttribute, + morphPosition, + morphTargetsRelative, + a, + b, + c, + modifiedPosition + ); + _calculateMorphedAttributeData( + object, + normalAttribute, + morphNormal, + morphTargetsRelative, + a, + b, + c, + modifiedNormal + ); + } + } + } else { + start = Math.max(0, drawRange.start); + end = Math.min(index.count, drawRange.start + drawRange.count); + for (i = start, il = end; i < il; i += 3) { + a = index.getX(i); + b = index.getX(i + 1); + c = index.getX(i + 2); + _calculateMorphedAttributeData( + object, + positionAttribute, + morphPosition, + morphTargetsRelative, + a, + b, + c, + modifiedPosition + ); + _calculateMorphedAttributeData( + object, + normalAttribute, + morphNormal, + morphTargetsRelative, + a, + b, + c, + modifiedNormal + ); + } + } + } else { + if (Array.isArray(material)) { + for (i = 0, il = groups.length; i < il; i++) { + group = groups[i]; + start = Math.max(group.start, drawRange.start); + end = Math.min(group.start + group.count, drawRange.start + drawRange.count); + for (j = start, jl = end; j < jl; j += 3) { + a = j; + b = j + 1; + c = j + 2; + _calculateMorphedAttributeData( + object, + positionAttribute, + morphPosition, + morphTargetsRelative, + a, + b, + c, + modifiedPosition + ); + _calculateMorphedAttributeData( + object, + normalAttribute, + morphNormal, + morphTargetsRelative, + a, + b, + c, + modifiedNormal + ); + } + } + } else { + start = Math.max(0, drawRange.start); + end = Math.min(positionAttribute.count, drawRange.start + drawRange.count); + for (i = start, il = end; i < il; i += 3) { + a = i; + b = i + 1; + c = i + 2; + _calculateMorphedAttributeData( + object, + positionAttribute, + morphPosition, + morphTargetsRelative, + a, + b, + c, + modifiedPosition + ); + _calculateMorphedAttributeData( + object, + normalAttribute, + morphNormal, + morphTargetsRelative, + a, + b, + c, + modifiedNormal + ); + } + } + } + const morphedPositionAttribute = new Float32BufferAttribute(modifiedPosition, 3); + const morphedNormalAttribute = new Float32BufferAttribute(modifiedNormal, 3); + return { + positionAttribute, + normalAttribute, + morphedPositionAttribute, + morphedNormalAttribute + }; +} +__name(computeMorphedAttributes, "computeMorphedAttributes"); +function mergeGroups(geometry) { + if (geometry.groups.length === 0) { + console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."); + return geometry; + } + let groups = geometry.groups; + groups = groups.sort((a, b) => { + if (a.materialIndex !== b.materialIndex) return a.materialIndex - b.materialIndex; + return a.start - b.start; + }); + if (geometry.getIndex() === null) { + const positionAttribute = geometry.getAttribute("position"); + const indices = []; + for (let i = 0; i < positionAttribute.count; i += 3) { + indices.push(i, i + 1, i + 2); + } + geometry.setIndex(indices); + } + const index = geometry.getIndex(); + const newIndices = []; + for (let i = 0; i < groups.length; i++) { + const group = groups[i]; + const groupStart = group.start; + const groupLength = groupStart + group.count; + for (let j = groupStart; j < groupLength; j++) { + newIndices.push(index.getX(j)); + } + } + geometry.dispose(); + geometry.setIndex(newIndices); + let start = 0; + for (let i = 0; i < groups.length; i++) { + const group = groups[i]; + group.start = start; + start += group.count; + } + let currentGroup = groups[0]; + geometry.groups = [currentGroup]; + for (let i = 1; i < groups.length; i++) { + const group = groups[i]; + if (currentGroup.materialIndex === group.materialIndex) { + currentGroup.count += group.count; + } else { + currentGroup = group; + geometry.groups.push(currentGroup); + } + } + return geometry; +} +__name(mergeGroups, "mergeGroups"); +function toCreasedNormals(geometry, creaseAngle = Math.PI / 3) { + const creaseDot = Math.cos(creaseAngle); + const hashMultiplier = (1 + 1e-10) * 100; + const verts = [new Vector3(), new Vector3(), new Vector3()]; + const tempVec1 = new Vector3(); + const tempVec2 = new Vector3(); + const tempNorm = new Vector3(); + const tempNorm2 = new Vector3(); + function hashVertex(v) { + const x = ~~(v.x * hashMultiplier); + const y = ~~(v.y * hashMultiplier); + const z = ~~(v.z * hashMultiplier); + return `${x},${y},${z}`; + } + __name(hashVertex, "hashVertex"); + const resultGeometry = geometry.index ? geometry.toNonIndexed() : geometry; + const posAttr = resultGeometry.attributes.position; + const vertexMap = {}; + for (let i = 0, l = posAttr.count / 3; i < l; i++) { + const i3 = 3 * i; + const a = verts[0].fromBufferAttribute(posAttr, i3 + 0); + const b = verts[1].fromBufferAttribute(posAttr, i3 + 1); + const c = verts[2].fromBufferAttribute(posAttr, i3 + 2); + tempVec1.subVectors(c, b); + tempVec2.subVectors(a, b); + const normal = new Vector3().crossVectors(tempVec1, tempVec2).normalize(); + for (let n = 0; n < 3; n++) { + const vert = verts[n]; + const hash = hashVertex(vert); + if (!(hash in vertexMap)) { + vertexMap[hash] = []; + } + vertexMap[hash].push(normal); + } + } + const normalArray = new Float32Array(posAttr.count * 3); + const normAttr = new BufferAttribute(normalArray, 3, false); + for (let i = 0, l = posAttr.count / 3; i < l; i++) { + const i3 = 3 * i; + const a = verts[0].fromBufferAttribute(posAttr, i3 + 0); + const b = verts[1].fromBufferAttribute(posAttr, i3 + 1); + const c = verts[2].fromBufferAttribute(posAttr, i3 + 2); + tempVec1.subVectors(c, b); + tempVec2.subVectors(a, b); + tempNorm.crossVectors(tempVec1, tempVec2).normalize(); + for (let n = 0; n < 3; n++) { + const vert = verts[n]; + const hash = hashVertex(vert); + const otherNormals = vertexMap[hash]; + tempNorm2.set(0, 0, 0); + for (let k = 0, lk = otherNormals.length; k < lk; k++) { + const otherNorm = otherNormals[k]; + if (tempNorm.dot(otherNorm) > creaseDot) { + tempNorm2.add(otherNorm); + } + } + tempNorm2.normalize(); + normAttr.setXYZ(i3 + n, tempNorm2.x, tempNorm2.y, tempNorm2.z); + } + } + resultGeometry.setAttribute("normal", normAttr); + return resultGeometry; +} +__name(toCreasedNormals, "toCreasedNormals"); +class GLTFLoader extends Loader { + static { + __name(this, "GLTFLoader"); + } + constructor(manager) { + super(manager); + this.dracoLoader = null; + this.ktx2Loader = null; + this.meshoptDecoder = null; + this.pluginCallbacks = []; + this.register(function(parser) { + return new GLTFMaterialsClearcoatExtension(parser); + }); + this.register(function(parser) { + return new GLTFMaterialsDispersionExtension(parser); + }); + this.register(function(parser) { + return new GLTFTextureBasisUExtension(parser); + }); + this.register(function(parser) { + return new GLTFTextureWebPExtension(parser); + }); + this.register(function(parser) { + return new GLTFTextureAVIFExtension(parser); + }); + this.register(function(parser) { + return new GLTFMaterialsSheenExtension(parser); + }); + this.register(function(parser) { + return new GLTFMaterialsTransmissionExtension(parser); + }); + this.register(function(parser) { + return new GLTFMaterialsVolumeExtension(parser); + }); + this.register(function(parser) { + return new GLTFMaterialsIorExtension(parser); + }); + this.register(function(parser) { + return new GLTFMaterialsEmissiveStrengthExtension(parser); + }); + this.register(function(parser) { + return new GLTFMaterialsSpecularExtension(parser); + }); + this.register(function(parser) { + return new GLTFMaterialsIridescenceExtension(parser); + }); + this.register(function(parser) { + return new GLTFMaterialsAnisotropyExtension(parser); + }); + this.register(function(parser) { + return new GLTFMaterialsBumpExtension(parser); + }); + this.register(function(parser) { + return new GLTFLightsExtension(parser); + }); + this.register(function(parser) { + return new GLTFMeshoptCompression(parser); + }); + this.register(function(parser) { + return new GLTFMeshGpuInstancing(parser); + }); + } + load(url, onLoad, onProgress, onError) { + const scope = this; + let resourcePath; + if (this.resourcePath !== "") { + resourcePath = this.resourcePath; + } else if (this.path !== "") { + const relativeUrl = LoaderUtils.extractUrlBase(url); + resourcePath = LoaderUtils.resolveURL(relativeUrl, this.path); + } else { + resourcePath = LoaderUtils.extractUrlBase(url); + } + this.manager.itemStart(url); + const _onError = /* @__PURE__ */ __name(function(e) { + if (onError) { + onError(e); + } else { + console.error(e); + } + scope.manager.itemError(url); + scope.manager.itemEnd(url); + }, "_onError"); + const loader = new FileLoader(this.manager); + loader.setPath(this.path); + loader.setResponseType("arraybuffer"); + loader.setRequestHeader(this.requestHeader); + loader.setWithCredentials(this.withCredentials); + loader.load(url, function(data) { + try { + scope.parse(data, resourcePath, function(gltf) { + onLoad(gltf); + scope.manager.itemEnd(url); + }, _onError); + } catch (e) { + _onError(e); + } + }, onProgress, _onError); + } + setDRACOLoader(dracoLoader) { + this.dracoLoader = dracoLoader; + return this; + } + setKTX2Loader(ktx2Loader) { + this.ktx2Loader = ktx2Loader; + return this; + } + setMeshoptDecoder(meshoptDecoder) { + this.meshoptDecoder = meshoptDecoder; + return this; + } + register(callback) { + if (this.pluginCallbacks.indexOf(callback) === -1) { + this.pluginCallbacks.push(callback); + } + return this; + } + unregister(callback) { + if (this.pluginCallbacks.indexOf(callback) !== -1) { + this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback), 1); + } + return this; + } + parse(data, path, onLoad, onError) { + let json; + const extensions = {}; + const plugins = {}; + const textDecoder = new TextDecoder(); + if (typeof data === "string") { + json = JSON.parse(data); + } else if (data instanceof ArrayBuffer) { + const magic = textDecoder.decode(new Uint8Array(data, 0, 4)); + if (magic === BINARY_EXTENSION_HEADER_MAGIC) { + try { + extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data); + } catch (error) { + if (onError) onError(error); + return; + } + json = JSON.parse(extensions[EXTENSIONS.KHR_BINARY_GLTF].content); + } else { + json = JSON.parse(textDecoder.decode(data)); + } + } else { + json = data; + } + if (json.asset === void 0 || json.asset.version[0] < 2) { + if (onError) onError(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")); + return; + } + const parser = new GLTFParser(json, { + path: path || this.resourcePath || "", + crossOrigin: this.crossOrigin, + requestHeader: this.requestHeader, + manager: this.manager, + ktx2Loader: this.ktx2Loader, + meshoptDecoder: this.meshoptDecoder + }); + parser.fileLoader.setRequestHeader(this.requestHeader); + for (let i = 0; i < this.pluginCallbacks.length; i++) { + const plugin = this.pluginCallbacks[i](parser); + if (!plugin.name) console.error("THREE.GLTFLoader: Invalid plugin found: missing name"); + plugins[plugin.name] = plugin; + extensions[plugin.name] = true; + } + if (json.extensionsUsed) { + for (let i = 0; i < json.extensionsUsed.length; ++i) { + const extensionName = json.extensionsUsed[i]; + const extensionsRequired = json.extensionsRequired || []; + switch (extensionName) { + case EXTENSIONS.KHR_MATERIALS_UNLIT: + extensions[extensionName] = new GLTFMaterialsUnlitExtension(); + break; + case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION: + extensions[extensionName] = new GLTFDracoMeshCompressionExtension(json, this.dracoLoader); + break; + case EXTENSIONS.KHR_TEXTURE_TRANSFORM: + extensions[extensionName] = new GLTFTextureTransformExtension(); + break; + case EXTENSIONS.KHR_MESH_QUANTIZATION: + extensions[extensionName] = new GLTFMeshQuantizationExtension(); + break; + default: + if (extensionsRequired.indexOf(extensionName) >= 0 && plugins[extensionName] === void 0) { + console.warn('THREE.GLTFLoader: Unknown extension "' + extensionName + '".'); + } + } + } + } + parser.setExtensions(extensions); + parser.setPlugins(plugins); + parser.parse(onLoad, onError); + } + parseAsync(data, path) { + const scope = this; + return new Promise(function(resolve, reject) { + scope.parse(data, path, resolve, reject); + }); + } +} +function GLTFRegistry() { + let objects = {}; + return { + get: /* @__PURE__ */ __name(function(key) { + return objects[key]; + }, "get"), + add: /* @__PURE__ */ __name(function(key, object) { + objects[key] = object; + }, "add"), + remove: /* @__PURE__ */ __name(function(key) { + delete objects[key]; + }, "remove"), + removeAll: /* @__PURE__ */ __name(function() { + objects = {}; + }, "removeAll") + }; +} +__name(GLTFRegistry, "GLTFRegistry"); +const EXTENSIONS = { + KHR_BINARY_GLTF: "KHR_binary_glTF", + KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression", + KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual", + KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat", + KHR_MATERIALS_DISPERSION: "KHR_materials_dispersion", + KHR_MATERIALS_IOR: "KHR_materials_ior", + KHR_MATERIALS_SHEEN: "KHR_materials_sheen", + KHR_MATERIALS_SPECULAR: "KHR_materials_specular", + KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission", + KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence", + KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy", + KHR_MATERIALS_UNLIT: "KHR_materials_unlit", + KHR_MATERIALS_VOLUME: "KHR_materials_volume", + KHR_TEXTURE_BASISU: "KHR_texture_basisu", + KHR_TEXTURE_TRANSFORM: "KHR_texture_transform", + KHR_MESH_QUANTIZATION: "KHR_mesh_quantization", + KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength", + EXT_MATERIALS_BUMP: "EXT_materials_bump", + EXT_TEXTURE_WEBP: "EXT_texture_webp", + EXT_TEXTURE_AVIF: "EXT_texture_avif", + EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression", + EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing" +}; +class GLTFLightsExtension { + static { + __name(this, "GLTFLightsExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL; + this.cache = { refs: {}, uses: {} }; + } + _markDefs() { + const parser = this.parser; + const nodeDefs = this.parser.json.nodes || []; + for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) { + const nodeDef = nodeDefs[nodeIndex]; + if (nodeDef.extensions && nodeDef.extensions[this.name] && nodeDef.extensions[this.name].light !== void 0) { + parser._addNodeRef(this.cache, nodeDef.extensions[this.name].light); + } + } + } + _loadLight(lightIndex) { + const parser = this.parser; + const cacheKey = "light:" + lightIndex; + let dependency = parser.cache.get(cacheKey); + if (dependency) return dependency; + const json = parser.json; + const extensions = json.extensions && json.extensions[this.name] || {}; + const lightDefs = extensions.lights || []; + const lightDef = lightDefs[lightIndex]; + let lightNode; + const color = new Color(16777215); + if (lightDef.color !== void 0) color.setRGB(lightDef.color[0], lightDef.color[1], lightDef.color[2], LinearSRGBColorSpace); + const range = lightDef.range !== void 0 ? lightDef.range : 0; + switch (lightDef.type) { + case "directional": + lightNode = new DirectionalLight(color); + lightNode.target.position.set(0, 0, -1); + lightNode.add(lightNode.target); + break; + case "point": + lightNode = new PointLight(color); + lightNode.distance = range; + break; + case "spot": + lightNode = new SpotLight(color); + lightNode.distance = range; + lightDef.spot = lightDef.spot || {}; + lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== void 0 ? lightDef.spot.innerConeAngle : 0; + lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== void 0 ? lightDef.spot.outerConeAngle : Math.PI / 4; + lightNode.angle = lightDef.spot.outerConeAngle; + lightNode.penumbra = 1 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle; + lightNode.target.position.set(0, 0, -1); + lightNode.add(lightNode.target); + break; + default: + throw new Error("THREE.GLTFLoader: Unexpected light type: " + lightDef.type); + } + lightNode.position.set(0, 0, 0); + lightNode.decay = 2; + assignExtrasToUserData(lightNode, lightDef); + if (lightDef.intensity !== void 0) lightNode.intensity = lightDef.intensity; + lightNode.name = parser.createUniqueName(lightDef.name || "light_" + lightIndex); + dependency = Promise.resolve(lightNode); + parser.cache.add(cacheKey, dependency); + return dependency; + } + getDependency(type, index) { + if (type !== "light") return; + return this._loadLight(index); + } + createNodeAttachment(nodeIndex) { + const self2 = this; + const parser = this.parser; + const json = parser.json; + const nodeDef = json.nodes[nodeIndex]; + const lightDef = nodeDef.extensions && nodeDef.extensions[this.name] || {}; + const lightIndex = lightDef.light; + if (lightIndex === void 0) return null; + return this._loadLight(lightIndex).then(function(light) { + return parser._getNodeRef(self2.cache, lightIndex, light); + }); + } +} +class GLTFMaterialsUnlitExtension { + static { + __name(this, "GLTFMaterialsUnlitExtension"); + } + constructor() { + this.name = EXTENSIONS.KHR_MATERIALS_UNLIT; + } + getMaterialType() { + return MeshBasicMaterial; + } + extendParams(materialParams, materialDef, parser) { + const pending = []; + materialParams.color = new Color(1, 1, 1); + materialParams.opacity = 1; + const metallicRoughness = materialDef.pbrMetallicRoughness; + if (metallicRoughness) { + if (Array.isArray(metallicRoughness.baseColorFactor)) { + const array = metallicRoughness.baseColorFactor; + materialParams.color.setRGB(array[0], array[1], array[2], LinearSRGBColorSpace); + materialParams.opacity = array[3]; + } + if (metallicRoughness.baseColorTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, SRGBColorSpace)); + } + } + return Promise.all(pending); + } +} +class GLTFMaterialsEmissiveStrengthExtension { + static { + __name(this, "GLTFMaterialsEmissiveStrengthExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.KHR_MATERIALS_EMISSIVE_STRENGTH; + } + extendMaterialParams(materialIndex, materialParams) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) { + return Promise.resolve(); + } + const emissiveStrength = materialDef.extensions[this.name].emissiveStrength; + if (emissiveStrength !== void 0) { + materialParams.emissiveIntensity = emissiveStrength; + } + return Promise.resolve(); + } +} +class GLTFMaterialsClearcoatExtension { + static { + __name(this, "GLTFMaterialsClearcoatExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT; + } + getMaterialType(materialIndex) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; + return MeshPhysicalMaterial; + } + extendMaterialParams(materialIndex, materialParams) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) { + return Promise.resolve(); + } + const pending = []; + const extension = materialDef.extensions[this.name]; + if (extension.clearcoatFactor !== void 0) { + materialParams.clearcoat = extension.clearcoatFactor; + } + if (extension.clearcoatTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "clearcoatMap", extension.clearcoatTexture)); + } + if (extension.clearcoatRoughnessFactor !== void 0) { + materialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor; + } + if (extension.clearcoatRoughnessTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "clearcoatRoughnessMap", extension.clearcoatRoughnessTexture)); + } + if (extension.clearcoatNormalTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "clearcoatNormalMap", extension.clearcoatNormalTexture)); + if (extension.clearcoatNormalTexture.scale !== void 0) { + const scale = extension.clearcoatNormalTexture.scale; + materialParams.clearcoatNormalScale = new Vector2(scale, scale); + } + } + return Promise.all(pending); + } +} +class GLTFMaterialsDispersionExtension { + static { + __name(this, "GLTFMaterialsDispersionExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.KHR_MATERIALS_DISPERSION; + } + getMaterialType(materialIndex) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; + return MeshPhysicalMaterial; + } + extendMaterialParams(materialIndex, materialParams) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) { + return Promise.resolve(); + } + const extension = materialDef.extensions[this.name]; + materialParams.dispersion = extension.dispersion !== void 0 ? extension.dispersion : 0; + return Promise.resolve(); + } +} +class GLTFMaterialsIridescenceExtension { + static { + __name(this, "GLTFMaterialsIridescenceExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.KHR_MATERIALS_IRIDESCENCE; + } + getMaterialType(materialIndex) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; + return MeshPhysicalMaterial; + } + extendMaterialParams(materialIndex, materialParams) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) { + return Promise.resolve(); + } + const pending = []; + const extension = materialDef.extensions[this.name]; + if (extension.iridescenceFactor !== void 0) { + materialParams.iridescence = extension.iridescenceFactor; + } + if (extension.iridescenceTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "iridescenceMap", extension.iridescenceTexture)); + } + if (extension.iridescenceIor !== void 0) { + materialParams.iridescenceIOR = extension.iridescenceIor; + } + if (materialParams.iridescenceThicknessRange === void 0) { + materialParams.iridescenceThicknessRange = [100, 400]; + } + if (extension.iridescenceThicknessMinimum !== void 0) { + materialParams.iridescenceThicknessRange[0] = extension.iridescenceThicknessMinimum; + } + if (extension.iridescenceThicknessMaximum !== void 0) { + materialParams.iridescenceThicknessRange[1] = extension.iridescenceThicknessMaximum; + } + if (extension.iridescenceThicknessTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "iridescenceThicknessMap", extension.iridescenceThicknessTexture)); + } + return Promise.all(pending); + } +} +class GLTFMaterialsSheenExtension { + static { + __name(this, "GLTFMaterialsSheenExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.KHR_MATERIALS_SHEEN; + } + getMaterialType(materialIndex) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; + return MeshPhysicalMaterial; + } + extendMaterialParams(materialIndex, materialParams) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) { + return Promise.resolve(); + } + const pending = []; + materialParams.sheenColor = new Color(0, 0, 0); + materialParams.sheenRoughness = 0; + materialParams.sheen = 1; + const extension = materialDef.extensions[this.name]; + if (extension.sheenColorFactor !== void 0) { + const colorFactor = extension.sheenColorFactor; + materialParams.sheenColor.setRGB(colorFactor[0], colorFactor[1], colorFactor[2], LinearSRGBColorSpace); + } + if (extension.sheenRoughnessFactor !== void 0) { + materialParams.sheenRoughness = extension.sheenRoughnessFactor; + } + if (extension.sheenColorTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "sheenColorMap", extension.sheenColorTexture, SRGBColorSpace)); + } + if (extension.sheenRoughnessTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "sheenRoughnessMap", extension.sheenRoughnessTexture)); + } + return Promise.all(pending); + } +} +class GLTFMaterialsTransmissionExtension { + static { + __name(this, "GLTFMaterialsTransmissionExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.KHR_MATERIALS_TRANSMISSION; + } + getMaterialType(materialIndex) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; + return MeshPhysicalMaterial; + } + extendMaterialParams(materialIndex, materialParams) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) { + return Promise.resolve(); + } + const pending = []; + const extension = materialDef.extensions[this.name]; + if (extension.transmissionFactor !== void 0) { + materialParams.transmission = extension.transmissionFactor; + } + if (extension.transmissionTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "transmissionMap", extension.transmissionTexture)); + } + return Promise.all(pending); + } +} +class GLTFMaterialsVolumeExtension { + static { + __name(this, "GLTFMaterialsVolumeExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.KHR_MATERIALS_VOLUME; + } + getMaterialType(materialIndex) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; + return MeshPhysicalMaterial; + } + extendMaterialParams(materialIndex, materialParams) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) { + return Promise.resolve(); + } + const pending = []; + const extension = materialDef.extensions[this.name]; + materialParams.thickness = extension.thicknessFactor !== void 0 ? extension.thicknessFactor : 0; + if (extension.thicknessTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "thicknessMap", extension.thicknessTexture)); + } + materialParams.attenuationDistance = extension.attenuationDistance || Infinity; + const colorArray = extension.attenuationColor || [1, 1, 1]; + materialParams.attenuationColor = new Color().setRGB(colorArray[0], colorArray[1], colorArray[2], LinearSRGBColorSpace); + return Promise.all(pending); + } +} +class GLTFMaterialsIorExtension { + static { + __name(this, "GLTFMaterialsIorExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.KHR_MATERIALS_IOR; + } + getMaterialType(materialIndex) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; + return MeshPhysicalMaterial; + } + extendMaterialParams(materialIndex, materialParams) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) { + return Promise.resolve(); + } + const extension = materialDef.extensions[this.name]; + materialParams.ior = extension.ior !== void 0 ? extension.ior : 1.5; + return Promise.resolve(); + } +} +class GLTFMaterialsSpecularExtension { + static { + __name(this, "GLTFMaterialsSpecularExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.KHR_MATERIALS_SPECULAR; + } + getMaterialType(materialIndex) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; + return MeshPhysicalMaterial; + } + extendMaterialParams(materialIndex, materialParams) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) { + return Promise.resolve(); + } + const pending = []; + const extension = materialDef.extensions[this.name]; + materialParams.specularIntensity = extension.specularFactor !== void 0 ? extension.specularFactor : 1; + if (extension.specularTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "specularIntensityMap", extension.specularTexture)); + } + const colorArray = extension.specularColorFactor || [1, 1, 1]; + materialParams.specularColor = new Color().setRGB(colorArray[0], colorArray[1], colorArray[2], LinearSRGBColorSpace); + if (extension.specularColorTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "specularColorMap", extension.specularColorTexture, SRGBColorSpace)); + } + return Promise.all(pending); + } +} +class GLTFMaterialsBumpExtension { + static { + __name(this, "GLTFMaterialsBumpExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.EXT_MATERIALS_BUMP; + } + getMaterialType(materialIndex) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; + return MeshPhysicalMaterial; + } + extendMaterialParams(materialIndex, materialParams) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) { + return Promise.resolve(); + } + const pending = []; + const extension = materialDef.extensions[this.name]; + materialParams.bumpScale = extension.bumpFactor !== void 0 ? extension.bumpFactor : 1; + if (extension.bumpTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "bumpMap", extension.bumpTexture)); + } + return Promise.all(pending); + } +} +class GLTFMaterialsAnisotropyExtension { + static { + __name(this, "GLTFMaterialsAnisotropyExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.KHR_MATERIALS_ANISOTROPY; + } + getMaterialType(materialIndex) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) return null; + return MeshPhysicalMaterial; + } + extendMaterialParams(materialIndex, materialParams) { + const parser = this.parser; + const materialDef = parser.json.materials[materialIndex]; + if (!materialDef.extensions || !materialDef.extensions[this.name]) { + return Promise.resolve(); + } + const pending = []; + const extension = materialDef.extensions[this.name]; + if (extension.anisotropyStrength !== void 0) { + materialParams.anisotropy = extension.anisotropyStrength; + } + if (extension.anisotropyRotation !== void 0) { + materialParams.anisotropyRotation = extension.anisotropyRotation; + } + if (extension.anisotropyTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "anisotropyMap", extension.anisotropyTexture)); + } + return Promise.all(pending); + } +} +class GLTFTextureBasisUExtension { + static { + __name(this, "GLTFTextureBasisUExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.KHR_TEXTURE_BASISU; + } + loadTexture(textureIndex) { + const parser = this.parser; + const json = parser.json; + const textureDef = json.textures[textureIndex]; + if (!textureDef.extensions || !textureDef.extensions[this.name]) { + return null; + } + const extension = textureDef.extensions[this.name]; + const loader = parser.options.ktx2Loader; + if (!loader) { + if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) { + throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures"); + } else { + return null; + } + } + return parser.loadTextureImage(textureIndex, extension.source, loader); + } +} +class GLTFTextureWebPExtension { + static { + __name(this, "GLTFTextureWebPExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.EXT_TEXTURE_WEBP; + this.isSupported = null; + } + loadTexture(textureIndex) { + const name = this.name; + const parser = this.parser; + const json = parser.json; + const textureDef = json.textures[textureIndex]; + if (!textureDef.extensions || !textureDef.extensions[name]) { + return null; + } + const extension = textureDef.extensions[name]; + const source = json.images[extension.source]; + let loader = parser.textureLoader; + if (source.uri) { + const handler = parser.options.manager.getHandler(source.uri); + if (handler !== null) loader = handler; + } + return this.detectSupport().then(function(isSupported) { + if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader); + if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) { + throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported."); + } + return parser.loadTexture(textureIndex); + }); + } + detectSupport() { + if (!this.isSupported) { + this.isSupported = new Promise(function(resolve) { + const image = new Image(); + image.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"; + image.onload = image.onerror = function() { + resolve(image.height === 1); + }; + }); + } + return this.isSupported; + } +} +class GLTFTextureAVIFExtension { + static { + __name(this, "GLTFTextureAVIFExtension"); + } + constructor(parser) { + this.parser = parser; + this.name = EXTENSIONS.EXT_TEXTURE_AVIF; + this.isSupported = null; + } + loadTexture(textureIndex) { + const name = this.name; + const parser = this.parser; + const json = parser.json; + const textureDef = json.textures[textureIndex]; + if (!textureDef.extensions || !textureDef.extensions[name]) { + return null; + } + const extension = textureDef.extensions[name]; + const source = json.images[extension.source]; + let loader = parser.textureLoader; + if (source.uri) { + const handler = parser.options.manager.getHandler(source.uri); + if (handler !== null) loader = handler; + } + return this.detectSupport().then(function(isSupported) { + if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader); + if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) { + throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported."); + } + return parser.loadTexture(textureIndex); + }); + } + detectSupport() { + if (!this.isSupported) { + this.isSupported = new Promise(function(resolve) { + const image = new Image(); + image.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI="; + image.onload = image.onerror = function() { + resolve(image.height === 1); + }; + }); + } + return this.isSupported; + } +} +class GLTFMeshoptCompression { + static { + __name(this, "GLTFMeshoptCompression"); + } + constructor(parser) { + this.name = EXTENSIONS.EXT_MESHOPT_COMPRESSION; + this.parser = parser; + } + loadBufferView(index) { + const json = this.parser.json; + const bufferView = json.bufferViews[index]; + if (bufferView.extensions && bufferView.extensions[this.name]) { + const extensionDef = bufferView.extensions[this.name]; + const buffer = this.parser.getDependency("buffer", extensionDef.buffer); + const decoder = this.parser.options.meshoptDecoder; + if (!decoder || !decoder.supported) { + if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) { + throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files"); + } else { + return null; + } + } + return buffer.then(function(res) { + const byteOffset = extensionDef.byteOffset || 0; + const byteLength = extensionDef.byteLength || 0; + const count = extensionDef.count; + const stride = extensionDef.byteStride; + const source = new Uint8Array(res, byteOffset, byteLength); + if (decoder.decodeGltfBufferAsync) { + return decoder.decodeGltfBufferAsync(count, stride, source, extensionDef.mode, extensionDef.filter).then(function(res2) { + return res2.buffer; + }); + } else { + return decoder.ready.then(function() { + const result = new ArrayBuffer(count * stride); + decoder.decodeGltfBuffer(new Uint8Array(result), count, stride, source, extensionDef.mode, extensionDef.filter); + return result; + }); + } + }); + } else { + return null; + } + } +} +class GLTFMeshGpuInstancing { + static { + __name(this, "GLTFMeshGpuInstancing"); + } + constructor(parser) { + this.name = EXTENSIONS.EXT_MESH_GPU_INSTANCING; + this.parser = parser; + } + createNodeMesh(nodeIndex) { + const json = this.parser.json; + const nodeDef = json.nodes[nodeIndex]; + if (!nodeDef.extensions || !nodeDef.extensions[this.name] || nodeDef.mesh === void 0) { + return null; + } + const meshDef = json.meshes[nodeDef.mesh]; + for (const primitive of meshDef.primitives) { + if (primitive.mode !== WEBGL_CONSTANTS.TRIANGLES && primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_STRIP && primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_FAN && primitive.mode !== void 0) { + return null; + } + } + const extensionDef = nodeDef.extensions[this.name]; + const attributesDef = extensionDef.attributes; + const pending = []; + const attributes = {}; + for (const key in attributesDef) { + pending.push(this.parser.getDependency("accessor", attributesDef[key]).then((accessor) => { + attributes[key] = accessor; + return attributes[key]; + })); + } + if (pending.length < 1) { + return null; + } + pending.push(this.parser.createNodeMesh(nodeIndex)); + return Promise.all(pending).then((results) => { + const nodeObject = results.pop(); + const meshes = nodeObject.isGroup ? nodeObject.children : [nodeObject]; + const count = results[0].count; + const instancedMeshes = []; + for (const mesh of meshes) { + const m = new Matrix4(); + const p = new Vector3(); + const q = new Quaternion(); + const s = new Vector3(1, 1, 1); + const instancedMesh = new InstancedMesh(mesh.geometry, mesh.material, count); + for (let i = 0; i < count; i++) { + if (attributes.TRANSLATION) { + p.fromBufferAttribute(attributes.TRANSLATION, i); + } + if (attributes.ROTATION) { + q.fromBufferAttribute(attributes.ROTATION, i); + } + if (attributes.SCALE) { + s.fromBufferAttribute(attributes.SCALE, i); + } + instancedMesh.setMatrixAt(i, m.compose(p, q, s)); + } + for (const attributeName in attributes) { + if (attributeName === "_COLOR_0") { + const attr = attributes[attributeName]; + instancedMesh.instanceColor = new InstancedBufferAttribute(attr.array, attr.itemSize, attr.normalized); + } else if (attributeName !== "TRANSLATION" && attributeName !== "ROTATION" && attributeName !== "SCALE") { + mesh.geometry.setAttribute(attributeName, attributes[attributeName]); + } + } + Object3D.prototype.copy.call(instancedMesh, mesh); + this.parser.assignFinalMaterial(instancedMesh); + instancedMeshes.push(instancedMesh); + } + if (nodeObject.isGroup) { + nodeObject.clear(); + nodeObject.add(...instancedMeshes); + return nodeObject; + } + return instancedMeshes[0]; + }); + } +} +const BINARY_EXTENSION_HEADER_MAGIC = "glTF"; +const BINARY_EXTENSION_HEADER_LENGTH = 12; +const BINARY_EXTENSION_CHUNK_TYPES = { JSON: 1313821514, BIN: 5130562 }; +class GLTFBinaryExtension { + static { + __name(this, "GLTFBinaryExtension"); + } + constructor(data) { + this.name = EXTENSIONS.KHR_BINARY_GLTF; + this.content = null; + this.body = null; + const headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH); + const textDecoder = new TextDecoder(); + this.header = { + magic: textDecoder.decode(new Uint8Array(data.slice(0, 4))), + version: headerView.getUint32(4, true), + length: headerView.getUint32(8, true) + }; + if (this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC) { + throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header."); + } else if (this.header.version < 2) { + throw new Error("THREE.GLTFLoader: Legacy binary file detected."); + } + const chunkContentsLength = this.header.length - BINARY_EXTENSION_HEADER_LENGTH; + const chunkView = new DataView(data, BINARY_EXTENSION_HEADER_LENGTH); + let chunkIndex = 0; + while (chunkIndex < chunkContentsLength) { + const chunkLength = chunkView.getUint32(chunkIndex, true); + chunkIndex += 4; + const chunkType = chunkView.getUint32(chunkIndex, true); + chunkIndex += 4; + if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) { + const contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength); + this.content = textDecoder.decode(contentArray); + } else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) { + const byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex; + this.body = data.slice(byteOffset, byteOffset + chunkLength); + } + chunkIndex += chunkLength; + } + if (this.content === null) { + throw new Error("THREE.GLTFLoader: JSON content not found."); + } + } +} +class GLTFDracoMeshCompressionExtension { + static { + __name(this, "GLTFDracoMeshCompressionExtension"); + } + constructor(json, dracoLoader) { + if (!dracoLoader) { + throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided."); + } + this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION; + this.json = json; + this.dracoLoader = dracoLoader; + this.dracoLoader.preload(); + } + decodePrimitive(primitive, parser) { + const json = this.json; + const dracoLoader = this.dracoLoader; + const bufferViewIndex = primitive.extensions[this.name].bufferView; + const gltfAttributeMap = primitive.extensions[this.name].attributes; + const threeAttributeMap = {}; + const attributeNormalizedMap = {}; + const attributeTypeMap = {}; + for (const attributeName in gltfAttributeMap) { + const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase(); + threeAttributeMap[threeAttributeName] = gltfAttributeMap[attributeName]; + } + for (const attributeName in primitive.attributes) { + const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase(); + if (gltfAttributeMap[attributeName] !== void 0) { + const accessorDef = json.accessors[primitive.attributes[attributeName]]; + const componentType = WEBGL_COMPONENT_TYPES[accessorDef.componentType]; + attributeTypeMap[threeAttributeName] = componentType.name; + attributeNormalizedMap[threeAttributeName] = accessorDef.normalized === true; + } + } + return parser.getDependency("bufferView", bufferViewIndex).then(function(bufferView) { + return new Promise(function(resolve, reject) { + dracoLoader.decodeDracoFile(bufferView, function(geometry) { + for (const attributeName in geometry.attributes) { + const attribute = geometry.attributes[attributeName]; + const normalized = attributeNormalizedMap[attributeName]; + if (normalized !== void 0) attribute.normalized = normalized; + } + resolve(geometry); + }, threeAttributeMap, attributeTypeMap, LinearSRGBColorSpace, reject); + }); + }); + } +} +class GLTFTextureTransformExtension { + static { + __name(this, "GLTFTextureTransformExtension"); + } + constructor() { + this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM; + } + extendTexture(texture, transform) { + if ((transform.texCoord === void 0 || transform.texCoord === texture.channel) && transform.offset === void 0 && transform.rotation === void 0 && transform.scale === void 0) { + return texture; + } + texture = texture.clone(); + if (transform.texCoord !== void 0) { + texture.channel = transform.texCoord; + } + if (transform.offset !== void 0) { + texture.offset.fromArray(transform.offset); + } + if (transform.rotation !== void 0) { + texture.rotation = transform.rotation; + } + if (transform.scale !== void 0) { + texture.repeat.fromArray(transform.scale); + } + texture.needsUpdate = true; + return texture; + } +} +class GLTFMeshQuantizationExtension { + static { + __name(this, "GLTFMeshQuantizationExtension"); + } + constructor() { + this.name = EXTENSIONS.KHR_MESH_QUANTIZATION; + } +} +class GLTFCubicSplineInterpolant extends Interpolant { + static { + __name(this, "GLTFCubicSplineInterpolant"); + } + constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { + super(parameterPositions, sampleValues, sampleSize, resultBuffer); + } + copySampleValue_(index) { + const result = this.resultBuffer, values = this.sampleValues, valueSize = this.valueSize, offset = index * valueSize * 3 + valueSize; + for (let i = 0; i !== valueSize; i++) { + result[i] = values[offset + i]; + } + return result; + } + interpolate_(i1, t0, t2, t1) { + const result = this.resultBuffer; + const values = this.sampleValues; + const stride = this.valueSize; + const stride2 = stride * 2; + const stride3 = stride * 3; + const td2 = t1 - t0; + const p = (t2 - t0) / td2; + const pp = p * p; + const ppp = pp * p; + const offset1 = i1 * stride3; + const offset0 = offset1 - stride3; + const s2 = -2 * ppp + 3 * pp; + const s3 = ppp - pp; + const s0 = 1 - s2; + const s1 = s3 - pp + p; + for (let i = 0; i !== stride; i++) { + const p0 = values[offset0 + i + stride]; + const m0 = values[offset0 + i + stride2] * td2; + const p1 = values[offset1 + i + stride]; + const m1 = values[offset1 + i] * td2; + result[i] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1; + } + return result; + } +} +const _q = new Quaternion(); +class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant { + static { + __name(this, "GLTFCubicSplineQuaternionInterpolant"); + } + interpolate_(i1, t0, t2, t1) { + const result = super.interpolate_(i1, t0, t2, t1); + _q.fromArray(result).normalize().toArray(result); + return result; + } +} +const WEBGL_CONSTANTS = { + FLOAT: 5126, + //FLOAT_MAT2: 35674, + FLOAT_MAT3: 35675, + FLOAT_MAT4: 35676, + FLOAT_VEC2: 35664, + FLOAT_VEC3: 35665, + FLOAT_VEC4: 35666, + LINEAR: 9729, + REPEAT: 10497, + SAMPLER_2D: 35678, + POINTS: 0, + LINES: 1, + LINE_LOOP: 2, + LINE_STRIP: 3, + TRIANGLES: 4, + TRIANGLE_STRIP: 5, + TRIANGLE_FAN: 6, + UNSIGNED_BYTE: 5121, + UNSIGNED_SHORT: 5123 +}; +const WEBGL_COMPONENT_TYPES = { + 5120: Int8Array, + 5121: Uint8Array, + 5122: Int16Array, + 5123: Uint16Array, + 5125: Uint32Array, + 5126: Float32Array +}; +const WEBGL_FILTERS = { + 9728: NearestFilter, + 9729: LinearFilter, + 9984: NearestMipmapNearestFilter, + 9985: LinearMipmapNearestFilter, + 9986: NearestMipmapLinearFilter, + 9987: LinearMipmapLinearFilter +}; +const WEBGL_WRAPPINGS = { + 33071: ClampToEdgeWrapping, + 33648: MirroredRepeatWrapping, + 10497: RepeatWrapping +}; +const WEBGL_TYPE_SIZES = { + "SCALAR": 1, + "VEC2": 2, + "VEC3": 3, + "VEC4": 4, + "MAT2": 4, + "MAT3": 9, + "MAT4": 16 +}; +const ATTRIBUTES = { + POSITION: "position", + NORMAL: "normal", + TANGENT: "tangent", + TEXCOORD_0: "uv", + TEXCOORD_1: "uv1", + TEXCOORD_2: "uv2", + TEXCOORD_3: "uv3", + COLOR_0: "color", + WEIGHTS_0: "skinWeight", + JOINTS_0: "skinIndex" +}; +const PATH_PROPERTIES = { + scale: "scale", + translation: "position", + rotation: "quaternion", + weights: "morphTargetInfluences" +}; +const INTERPOLATION = { + CUBICSPLINE: void 0, + // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each + // keyframe track will be initialized with a default interpolation type, then modified. + LINEAR: InterpolateLinear, + STEP: InterpolateDiscrete +}; +const ALPHA_MODES = { + OPAQUE: "OPAQUE", + MASK: "MASK", + BLEND: "BLEND" +}; +function createDefaultMaterial(cache) { + if (cache["DefaultMaterial"] === void 0) { + cache["DefaultMaterial"] = new MeshStandardMaterial({ + color: 16777215, + emissive: 0, + metalness: 1, + roughness: 1, + transparent: false, + depthTest: true, + side: FrontSide + }); + } + return cache["DefaultMaterial"]; +} +__name(createDefaultMaterial, "createDefaultMaterial"); +function addUnknownExtensionsToUserData(knownExtensions, object, objectDef) { + for (const name in objectDef.extensions) { + if (knownExtensions[name] === void 0) { + object.userData.gltfExtensions = object.userData.gltfExtensions || {}; + object.userData.gltfExtensions[name] = objectDef.extensions[name]; + } + } +} +__name(addUnknownExtensionsToUserData, "addUnknownExtensionsToUserData"); +function assignExtrasToUserData(object, gltfDef) { + if (gltfDef.extras !== void 0) { + if (typeof gltfDef.extras === "object") { + Object.assign(object.userData, gltfDef.extras); + } else { + console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + gltfDef.extras); + } + } +} +__name(assignExtrasToUserData, "assignExtrasToUserData"); +function addMorphTargets(geometry, targets, parser) { + let hasMorphPosition = false; + let hasMorphNormal = false; + let hasMorphColor = false; + for (let i = 0, il = targets.length; i < il; i++) { + const target = targets[i]; + if (target.POSITION !== void 0) hasMorphPosition = true; + if (target.NORMAL !== void 0) hasMorphNormal = true; + if (target.COLOR_0 !== void 0) hasMorphColor = true; + if (hasMorphPosition && hasMorphNormal && hasMorphColor) break; + } + if (!hasMorphPosition && !hasMorphNormal && !hasMorphColor) return Promise.resolve(geometry); + const pendingPositionAccessors = []; + const pendingNormalAccessors = []; + const pendingColorAccessors = []; + for (let i = 0, il = targets.length; i < il; i++) { + const target = targets[i]; + if (hasMorphPosition) { + const pendingAccessor = target.POSITION !== void 0 ? parser.getDependency("accessor", target.POSITION) : geometry.attributes.position; + pendingPositionAccessors.push(pendingAccessor); + } + if (hasMorphNormal) { + const pendingAccessor = target.NORMAL !== void 0 ? parser.getDependency("accessor", target.NORMAL) : geometry.attributes.normal; + pendingNormalAccessors.push(pendingAccessor); + } + if (hasMorphColor) { + const pendingAccessor = target.COLOR_0 !== void 0 ? parser.getDependency("accessor", target.COLOR_0) : geometry.attributes.color; + pendingColorAccessors.push(pendingAccessor); + } + } + return Promise.all([ + Promise.all(pendingPositionAccessors), + Promise.all(pendingNormalAccessors), + Promise.all(pendingColorAccessors) + ]).then(function(accessors) { + const morphPositions = accessors[0]; + const morphNormals = accessors[1]; + const morphColors = accessors[2]; + if (hasMorphPosition) geometry.morphAttributes.position = morphPositions; + if (hasMorphNormal) geometry.morphAttributes.normal = morphNormals; + if (hasMorphColor) geometry.morphAttributes.color = morphColors; + geometry.morphTargetsRelative = true; + return geometry; + }); +} +__name(addMorphTargets, "addMorphTargets"); +function updateMorphTargets(mesh, meshDef) { + mesh.updateMorphTargets(); + if (meshDef.weights !== void 0) { + for (let i = 0, il = meshDef.weights.length; i < il; i++) { + mesh.morphTargetInfluences[i] = meshDef.weights[i]; + } + } + if (meshDef.extras && Array.isArray(meshDef.extras.targetNames)) { + const targetNames = meshDef.extras.targetNames; + if (mesh.morphTargetInfluences.length === targetNames.length) { + mesh.morphTargetDictionary = {}; + for (let i = 0, il = targetNames.length; i < il; i++) { + mesh.morphTargetDictionary[targetNames[i]] = i; + } + } else { + console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names."); + } + } +} +__name(updateMorphTargets, "updateMorphTargets"); +function createPrimitiveKey(primitiveDef) { + let geometryKey; + const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]; + if (dracoExtension) { + geometryKey = "draco:" + dracoExtension.bufferView + ":" + dracoExtension.indices + ":" + createAttributesKey(dracoExtension.attributes); + } else { + geometryKey = primitiveDef.indices + ":" + createAttributesKey(primitiveDef.attributes) + ":" + primitiveDef.mode; + } + if (primitiveDef.targets !== void 0) { + for (let i = 0, il = primitiveDef.targets.length; i < il; i++) { + geometryKey += ":" + createAttributesKey(primitiveDef.targets[i]); + } + } + return geometryKey; +} +__name(createPrimitiveKey, "createPrimitiveKey"); +function createAttributesKey(attributes) { + let attributesKey = ""; + const keys = Object.keys(attributes).sort(); + for (let i = 0, il = keys.length; i < il; i++) { + attributesKey += keys[i] + ":" + attributes[keys[i]] + ";"; + } + return attributesKey; +} +__name(createAttributesKey, "createAttributesKey"); +function getNormalizedComponentScale(constructor) { + switch (constructor) { + case Int8Array: + return 1 / 127; + case Uint8Array: + return 1 / 255; + case Int16Array: + return 1 / 32767; + case Uint16Array: + return 1 / 65535; + default: + throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type."); + } +} +__name(getNormalizedComponentScale, "getNormalizedComponentScale"); +function getImageURIMimeType(uri) { + if (uri.search(/\.jpe?g($|\?)/i) > 0 || uri.search(/^data\:image\/jpeg/) === 0) return "image/jpeg"; + if (uri.search(/\.webp($|\?)/i) > 0 || uri.search(/^data\:image\/webp/) === 0) return "image/webp"; + if (uri.search(/\.ktx2($|\?)/i) > 0 || uri.search(/^data\:image\/ktx2/) === 0) return "image/ktx2"; + return "image/png"; +} +__name(getImageURIMimeType, "getImageURIMimeType"); +const _identityMatrix = new Matrix4(); +class GLTFParser { + static { + __name(this, "GLTFParser"); + } + constructor(json = {}, options = {}) { + this.json = json; + this.extensions = {}; + this.plugins = {}; + this.options = options; + this.cache = new GLTFRegistry(); + this.associations = /* @__PURE__ */ new Map(); + this.primitiveCache = {}; + this.nodeCache = {}; + this.meshCache = { refs: {}, uses: {} }; + this.cameraCache = { refs: {}, uses: {} }; + this.lightCache = { refs: {}, uses: {} }; + this.sourceCache = {}; + this.textureCache = {}; + this.nodeNamesUsed = {}; + let isSafari = false; + let safariVersion = -1; + let isFirefox = false; + let firefoxVersion = -1; + if (typeof navigator !== "undefined") { + const userAgent = navigator.userAgent; + isSafari = /^((?!chrome|android).)*safari/i.test(userAgent) === true; + const safariMatch = userAgent.match(/Version\/(\d+)/); + safariVersion = isSafari && safariMatch ? parseInt(safariMatch[1], 10) : -1; + isFirefox = userAgent.indexOf("Firefox") > -1; + firefoxVersion = isFirefox ? userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1; + } + if (typeof createImageBitmap === "undefined" || isSafari && safariVersion < 17 || isFirefox && firefoxVersion < 98) { + this.textureLoader = new TextureLoader(this.options.manager); + } else { + this.textureLoader = new ImageBitmapLoader(this.options.manager); + } + this.textureLoader.setCrossOrigin(this.options.crossOrigin); + this.textureLoader.setRequestHeader(this.options.requestHeader); + this.fileLoader = new FileLoader(this.options.manager); + this.fileLoader.setResponseType("arraybuffer"); + if (this.options.crossOrigin === "use-credentials") { + this.fileLoader.setWithCredentials(true); + } + } + setExtensions(extensions) { + this.extensions = extensions; + } + setPlugins(plugins) { + this.plugins = plugins; + } + parse(onLoad, onError) { + const parser = this; + const json = this.json; + const extensions = this.extensions; + this.cache.removeAll(); + this.nodeCache = {}; + this._invokeAll(function(ext2) { + return ext2._markDefs && ext2._markDefs(); + }); + Promise.all(this._invokeAll(function(ext2) { + return ext2.beforeRoot && ext2.beforeRoot(); + })).then(function() { + return Promise.all([ + parser.getDependencies("scene"), + parser.getDependencies("animation"), + parser.getDependencies("camera") + ]); + }).then(function(dependencies) { + const result = { + scene: dependencies[0][json.scene || 0], + scenes: dependencies[0], + animations: dependencies[1], + cameras: dependencies[2], + asset: json.asset, + parser, + userData: {} + }; + addUnknownExtensionsToUserData(extensions, result, json); + assignExtrasToUserData(result, json); + return Promise.all(parser._invokeAll(function(ext2) { + return ext2.afterRoot && ext2.afterRoot(result); + })).then(function() { + for (const scene of result.scenes) { + scene.updateMatrixWorld(); + } + onLoad(result); + }); + }).catch(onError); + } + /** + * Marks the special nodes/meshes in json for efficient parse. + */ + _markDefs() { + const nodeDefs = this.json.nodes || []; + const skinDefs = this.json.skins || []; + const meshDefs = this.json.meshes || []; + for (let skinIndex = 0, skinLength = skinDefs.length; skinIndex < skinLength; skinIndex++) { + const joints = skinDefs[skinIndex].joints; + for (let i = 0, il = joints.length; i < il; i++) { + nodeDefs[joints[i]].isBone = true; + } + } + for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) { + const nodeDef = nodeDefs[nodeIndex]; + if (nodeDef.mesh !== void 0) { + this._addNodeRef(this.meshCache, nodeDef.mesh); + if (nodeDef.skin !== void 0) { + meshDefs[nodeDef.mesh].isSkinnedMesh = true; + } + } + if (nodeDef.camera !== void 0) { + this._addNodeRef(this.cameraCache, nodeDef.camera); + } + } + } + /** + * Counts references to shared node / Object3D resources. These resources + * can be reused, or "instantiated", at multiple nodes in the scene + * hierarchy. Mesh, Camera, and Light instances are instantiated and must + * be marked. Non-scenegraph resources (like Materials, Geometries, and + * Textures) can be reused directly and are not marked here. + * + * Example: CesiumMilkTruck sample model reuses "Wheel" meshes. + */ + _addNodeRef(cache, index) { + if (index === void 0) return; + if (cache.refs[index] === void 0) { + cache.refs[index] = cache.uses[index] = 0; + } + cache.refs[index]++; + } + /** Returns a reference to a shared resource, cloning it if necessary. */ + _getNodeRef(cache, index, object) { + if (cache.refs[index] <= 1) return object; + const ref = object.clone(); + const updateMappings = /* @__PURE__ */ __name((original, clone) => { + const mappings = this.associations.get(original); + if (mappings != null) { + this.associations.set(clone, mappings); + } + for (const [i, child] of original.children.entries()) { + updateMappings(child, clone.children[i]); + } + }, "updateMappings"); + updateMappings(object, ref); + ref.name += "_instance_" + cache.uses[index]++; + return ref; + } + _invokeOne(func) { + const extensions = Object.values(this.plugins); + extensions.push(this); + for (let i = 0; i < extensions.length; i++) { + const result = func(extensions[i]); + if (result) return result; + } + return null; + } + _invokeAll(func) { + const extensions = Object.values(this.plugins); + extensions.unshift(this); + const pending = []; + for (let i = 0; i < extensions.length; i++) { + const result = func(extensions[i]); + if (result) pending.push(result); + } + return pending; + } + /** + * Requests the specified dependency asynchronously, with caching. + * @param {string} type + * @param {number} index + * @return {Promise} + */ + getDependency(type, index) { + const cacheKey = type + ":" + index; + let dependency = this.cache.get(cacheKey); + if (!dependency) { + switch (type) { + case "scene": + dependency = this.loadScene(index); + break; + case "node": + dependency = this._invokeOne(function(ext2) { + return ext2.loadNode && ext2.loadNode(index); + }); + break; + case "mesh": + dependency = this._invokeOne(function(ext2) { + return ext2.loadMesh && ext2.loadMesh(index); + }); + break; + case "accessor": + dependency = this.loadAccessor(index); + break; + case "bufferView": + dependency = this._invokeOne(function(ext2) { + return ext2.loadBufferView && ext2.loadBufferView(index); + }); + break; + case "buffer": + dependency = this.loadBuffer(index); + break; + case "material": + dependency = this._invokeOne(function(ext2) { + return ext2.loadMaterial && ext2.loadMaterial(index); + }); + break; + case "texture": + dependency = this._invokeOne(function(ext2) { + return ext2.loadTexture && ext2.loadTexture(index); + }); + break; + case "skin": + dependency = this.loadSkin(index); + break; + case "animation": + dependency = this._invokeOne(function(ext2) { + return ext2.loadAnimation && ext2.loadAnimation(index); + }); + break; + case "camera": + dependency = this.loadCamera(index); + break; + default: + dependency = this._invokeOne(function(ext2) { + return ext2 != this && ext2.getDependency && ext2.getDependency(type, index); + }); + if (!dependency) { + throw new Error("Unknown type: " + type); + } + break; + } + this.cache.add(cacheKey, dependency); + } + return dependency; + } + /** + * Requests all dependencies of the specified type asynchronously, with caching. + * @param {string} type + * @return {Promise>} + */ + getDependencies(type) { + let dependencies = this.cache.get(type); + if (!dependencies) { + const parser = this; + const defs = this.json[type + (type === "mesh" ? "es" : "s")] || []; + dependencies = Promise.all(defs.map(function(def, index) { + return parser.getDependency(type, index); + })); + this.cache.add(type, dependencies); + } + return dependencies; + } + /** + * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views + * @param {number} bufferIndex + * @return {Promise} + */ + loadBuffer(bufferIndex) { + const bufferDef = this.json.buffers[bufferIndex]; + const loader = this.fileLoader; + if (bufferDef.type && bufferDef.type !== "arraybuffer") { + throw new Error("THREE.GLTFLoader: " + bufferDef.type + " buffer type is not supported."); + } + if (bufferDef.uri === void 0 && bufferIndex === 0) { + return Promise.resolve(this.extensions[EXTENSIONS.KHR_BINARY_GLTF].body); + } + const options = this.options; + return new Promise(function(resolve, reject) { + loader.load(LoaderUtils.resolveURL(bufferDef.uri, options.path), resolve, void 0, function() { + reject(new Error('THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".')); + }); + }); + } + /** + * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views + * @param {number} bufferViewIndex + * @return {Promise} + */ + loadBufferView(bufferViewIndex) { + const bufferViewDef = this.json.bufferViews[bufferViewIndex]; + return this.getDependency("buffer", bufferViewDef.buffer).then(function(buffer) { + const byteLength = bufferViewDef.byteLength || 0; + const byteOffset = bufferViewDef.byteOffset || 0; + return buffer.slice(byteOffset, byteOffset + byteLength); + }); + } + /** + * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors + * @param {number} accessorIndex + * @return {Promise} + */ + loadAccessor(accessorIndex) { + const parser = this; + const json = this.json; + const accessorDef = this.json.accessors[accessorIndex]; + if (accessorDef.bufferView === void 0 && accessorDef.sparse === void 0) { + const itemSize = WEBGL_TYPE_SIZES[accessorDef.type]; + const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType]; + const normalized = accessorDef.normalized === true; + const array = new TypedArray(accessorDef.count * itemSize); + return Promise.resolve(new BufferAttribute(array, itemSize, normalized)); + } + const pendingBufferViews = []; + if (accessorDef.bufferView !== void 0) { + pendingBufferViews.push(this.getDependency("bufferView", accessorDef.bufferView)); + } else { + pendingBufferViews.push(null); + } + if (accessorDef.sparse !== void 0) { + pendingBufferViews.push(this.getDependency("bufferView", accessorDef.sparse.indices.bufferView)); + pendingBufferViews.push(this.getDependency("bufferView", accessorDef.sparse.values.bufferView)); + } + return Promise.all(pendingBufferViews).then(function(bufferViews) { + const bufferView = bufferViews[0]; + const itemSize = WEBGL_TYPE_SIZES[accessorDef.type]; + const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType]; + const elementBytes = TypedArray.BYTES_PER_ELEMENT; + const itemBytes = elementBytes * itemSize; + const byteOffset = accessorDef.byteOffset || 0; + const byteStride = accessorDef.bufferView !== void 0 ? json.bufferViews[accessorDef.bufferView].byteStride : void 0; + const normalized = accessorDef.normalized === true; + let array, bufferAttribute; + if (byteStride && byteStride !== itemBytes) { + const ibSlice = Math.floor(byteOffset / byteStride); + const ibCacheKey = "InterleavedBuffer:" + accessorDef.bufferView + ":" + accessorDef.componentType + ":" + ibSlice + ":" + accessorDef.count; + let ib = parser.cache.get(ibCacheKey); + if (!ib) { + array = new TypedArray(bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes); + ib = new InterleavedBuffer(array, byteStride / elementBytes); + parser.cache.add(ibCacheKey, ib); + } + bufferAttribute = new InterleavedBufferAttribute(ib, itemSize, byteOffset % byteStride / elementBytes, normalized); + } else { + if (bufferView === null) { + array = new TypedArray(accessorDef.count * itemSize); + } else { + array = new TypedArray(bufferView, byteOffset, accessorDef.count * itemSize); + } + bufferAttribute = new BufferAttribute(array, itemSize, normalized); + } + if (accessorDef.sparse !== void 0) { + const itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR; + const TypedArrayIndices = WEBGL_COMPONENT_TYPES[accessorDef.sparse.indices.componentType]; + const byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0; + const byteOffsetValues = accessorDef.sparse.values.byteOffset || 0; + const sparseIndices = new TypedArrayIndices(bufferViews[1], byteOffsetIndices, accessorDef.sparse.count * itemSizeIndices); + const sparseValues = new TypedArray(bufferViews[2], byteOffsetValues, accessorDef.sparse.count * itemSize); + if (bufferView !== null) { + bufferAttribute = new BufferAttribute(bufferAttribute.array.slice(), bufferAttribute.itemSize, bufferAttribute.normalized); + } + bufferAttribute.normalized = false; + for (let i = 0, il = sparseIndices.length; i < il; i++) { + const index = sparseIndices[i]; + bufferAttribute.setX(index, sparseValues[i * itemSize]); + if (itemSize >= 2) bufferAttribute.setY(index, sparseValues[i * itemSize + 1]); + if (itemSize >= 3) bufferAttribute.setZ(index, sparseValues[i * itemSize + 2]); + if (itemSize >= 4) bufferAttribute.setW(index, sparseValues[i * itemSize + 3]); + if (itemSize >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute."); + } + bufferAttribute.normalized = normalized; + } + return bufferAttribute; + }); + } + /** + * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures + * @param {number} textureIndex + * @return {Promise} + */ + loadTexture(textureIndex) { + const json = this.json; + const options = this.options; + const textureDef = json.textures[textureIndex]; + const sourceIndex = textureDef.source; + const sourceDef = json.images[sourceIndex]; + let loader = this.textureLoader; + if (sourceDef.uri) { + const handler = options.manager.getHandler(sourceDef.uri); + if (handler !== null) loader = handler; + } + return this.loadTextureImage(textureIndex, sourceIndex, loader); + } + loadTextureImage(textureIndex, sourceIndex, loader) { + const parser = this; + const json = this.json; + const textureDef = json.textures[textureIndex]; + const sourceDef = json.images[sourceIndex]; + const cacheKey = (sourceDef.uri || sourceDef.bufferView) + ":" + textureDef.sampler; + if (this.textureCache[cacheKey]) { + return this.textureCache[cacheKey]; + } + const promise = this.loadImageSource(sourceIndex, loader).then(function(texture) { + texture.flipY = false; + texture.name = textureDef.name || sourceDef.name || ""; + if (texture.name === "" && typeof sourceDef.uri === "string" && sourceDef.uri.startsWith("data:image/") === false) { + texture.name = sourceDef.uri; + } + const samplers = json.samplers || {}; + const sampler = samplers[textureDef.sampler] || {}; + texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || LinearFilter; + texture.minFilter = WEBGL_FILTERS[sampler.minFilter] || LinearMipmapLinearFilter; + texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || RepeatWrapping; + texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || RepeatWrapping; + texture.generateMipmaps = !texture.isCompressedTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter; + parser.associations.set(texture, { textures: textureIndex }); + return texture; + }).catch(function() { + return null; + }); + this.textureCache[cacheKey] = promise; + return promise; + } + loadImageSource(sourceIndex, loader) { + const parser = this; + const json = this.json; + const options = this.options; + if (this.sourceCache[sourceIndex] !== void 0) { + return this.sourceCache[sourceIndex].then((texture) => texture.clone()); + } + const sourceDef = json.images[sourceIndex]; + const URL2 = self.URL || self.webkitURL; + let sourceURI = sourceDef.uri || ""; + let isObjectURL = false; + if (sourceDef.bufferView !== void 0) { + sourceURI = parser.getDependency("bufferView", sourceDef.bufferView).then(function(bufferView) { + isObjectURL = true; + const blob = new Blob([bufferView], { type: sourceDef.mimeType }); + sourceURI = URL2.createObjectURL(blob); + return sourceURI; + }); + } else if (sourceDef.uri === void 0) { + throw new Error("THREE.GLTFLoader: Image " + sourceIndex + " is missing URI and bufferView"); + } + const promise = Promise.resolve(sourceURI).then(function(sourceURI2) { + return new Promise(function(resolve, reject) { + let onLoad = resolve; + if (loader.isImageBitmapLoader === true) { + onLoad = /* @__PURE__ */ __name(function(imageBitmap) { + const texture = new Texture(imageBitmap); + texture.needsUpdate = true; + resolve(texture); + }, "onLoad"); + } + loader.load(LoaderUtils.resolveURL(sourceURI2, options.path), onLoad, void 0, reject); + }); + }).then(function(texture) { + if (isObjectURL === true) { + URL2.revokeObjectURL(sourceURI); + } + assignExtrasToUserData(texture, sourceDef); + texture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType(sourceDef.uri); + return texture; + }).catch(function(error) { + console.error("THREE.GLTFLoader: Couldn't load texture", sourceURI); + throw error; + }); + this.sourceCache[sourceIndex] = promise; + return promise; + } + /** + * Asynchronously assigns a texture to the given material parameters. + * @param {Object} materialParams + * @param {string} mapName + * @param {Object} mapDef + * @return {Promise} + */ + assignTexture(materialParams, mapName, mapDef, colorSpace) { + const parser = this; + return this.getDependency("texture", mapDef.index).then(function(texture) { + if (!texture) return null; + if (mapDef.texCoord !== void 0 && mapDef.texCoord > 0) { + texture = texture.clone(); + texture.channel = mapDef.texCoord; + } + if (parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]) { + const transform = mapDef.extensions !== void 0 ? mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] : void 0; + if (transform) { + const gltfReference = parser.associations.get(texture); + texture = parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(texture, transform); + parser.associations.set(texture, gltfReference); + } + } + if (colorSpace !== void 0) { + texture.colorSpace = colorSpace; + } + materialParams[mapName] = texture; + return texture; + }); + } + /** + * Assigns final material to a Mesh, Line, or Points instance. The instance + * already has a material (generated from the glTF material options alone) + * but reuse of the same glTF material may require multiple threejs materials + * to accommodate different primitive types, defines, etc. New materials will + * be created if necessary, and reused from a cache. + * @param {Object3D} mesh Mesh, Line, or Points instance. + */ + assignFinalMaterial(mesh) { + const geometry = mesh.geometry; + let material = mesh.material; + const useDerivativeTangents = geometry.attributes.tangent === void 0; + const useVertexColors = geometry.attributes.color !== void 0; + const useFlatShading = geometry.attributes.normal === void 0; + if (mesh.isPoints) { + const cacheKey = "PointsMaterial:" + material.uuid; + let pointsMaterial = this.cache.get(cacheKey); + if (!pointsMaterial) { + pointsMaterial = new PointsMaterial(); + Material.prototype.copy.call(pointsMaterial, material); + pointsMaterial.color.copy(material.color); + pointsMaterial.map = material.map; + pointsMaterial.sizeAttenuation = false; + this.cache.add(cacheKey, pointsMaterial); + } + material = pointsMaterial; + } else if (mesh.isLine) { + const cacheKey = "LineBasicMaterial:" + material.uuid; + let lineMaterial = this.cache.get(cacheKey); + if (!lineMaterial) { + lineMaterial = new LineBasicMaterial(); + Material.prototype.copy.call(lineMaterial, material); + lineMaterial.color.copy(material.color); + lineMaterial.map = material.map; + this.cache.add(cacheKey, lineMaterial); + } + material = lineMaterial; + } + if (useDerivativeTangents || useVertexColors || useFlatShading) { + let cacheKey = "ClonedMaterial:" + material.uuid + ":"; + if (useDerivativeTangents) cacheKey += "derivative-tangents:"; + if (useVertexColors) cacheKey += "vertex-colors:"; + if (useFlatShading) cacheKey += "flat-shading:"; + let cachedMaterial = this.cache.get(cacheKey); + if (!cachedMaterial) { + cachedMaterial = material.clone(); + if (useVertexColors) cachedMaterial.vertexColors = true; + if (useFlatShading) cachedMaterial.flatShading = true; + if (useDerivativeTangents) { + if (cachedMaterial.normalScale) cachedMaterial.normalScale.y *= -1; + if (cachedMaterial.clearcoatNormalScale) cachedMaterial.clearcoatNormalScale.y *= -1; + } + this.cache.add(cacheKey, cachedMaterial); + this.associations.set(cachedMaterial, this.associations.get(material)); + } + material = cachedMaterial; + } + mesh.material = material; + } + getMaterialType() { + return MeshStandardMaterial; + } + /** + * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials + * @param {number} materialIndex + * @return {Promise} + */ + loadMaterial(materialIndex) { + const parser = this; + const json = this.json; + const extensions = this.extensions; + const materialDef = json.materials[materialIndex]; + let materialType; + const materialParams = {}; + const materialExtensions = materialDef.extensions || {}; + const pending = []; + if (materialExtensions[EXTENSIONS.KHR_MATERIALS_UNLIT]) { + const kmuExtension = extensions[EXTENSIONS.KHR_MATERIALS_UNLIT]; + materialType = kmuExtension.getMaterialType(); + pending.push(kmuExtension.extendParams(materialParams, materialDef, parser)); + } else { + const metallicRoughness = materialDef.pbrMetallicRoughness || {}; + materialParams.color = new Color(1, 1, 1); + materialParams.opacity = 1; + if (Array.isArray(metallicRoughness.baseColorFactor)) { + const array = metallicRoughness.baseColorFactor; + materialParams.color.setRGB(array[0], array[1], array[2], LinearSRGBColorSpace); + materialParams.opacity = array[3]; + } + if (metallicRoughness.baseColorTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, SRGBColorSpace)); + } + materialParams.metalness = metallicRoughness.metallicFactor !== void 0 ? metallicRoughness.metallicFactor : 1; + materialParams.roughness = metallicRoughness.roughnessFactor !== void 0 ? metallicRoughness.roughnessFactor : 1; + if (metallicRoughness.metallicRoughnessTexture !== void 0) { + pending.push(parser.assignTexture(materialParams, "metalnessMap", metallicRoughness.metallicRoughnessTexture)); + pending.push(parser.assignTexture(materialParams, "roughnessMap", metallicRoughness.metallicRoughnessTexture)); + } + materialType = this._invokeOne(function(ext2) { + return ext2.getMaterialType && ext2.getMaterialType(materialIndex); + }); + pending.push(Promise.all(this._invokeAll(function(ext2) { + return ext2.extendMaterialParams && ext2.extendMaterialParams(materialIndex, materialParams); + }))); + } + if (materialDef.doubleSided === true) { + materialParams.side = DoubleSide; + } + const alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE; + if (alphaMode === ALPHA_MODES.BLEND) { + materialParams.transparent = true; + materialParams.depthWrite = false; + } else { + materialParams.transparent = false; + if (alphaMode === ALPHA_MODES.MASK) { + materialParams.alphaTest = materialDef.alphaCutoff !== void 0 ? materialDef.alphaCutoff : 0.5; + } + } + if (materialDef.normalTexture !== void 0 && materialType !== MeshBasicMaterial) { + pending.push(parser.assignTexture(materialParams, "normalMap", materialDef.normalTexture)); + materialParams.normalScale = new Vector2(1, 1); + if (materialDef.normalTexture.scale !== void 0) { + const scale = materialDef.normalTexture.scale; + materialParams.normalScale.set(scale, scale); + } + } + if (materialDef.occlusionTexture !== void 0 && materialType !== MeshBasicMaterial) { + pending.push(parser.assignTexture(materialParams, "aoMap", materialDef.occlusionTexture)); + if (materialDef.occlusionTexture.strength !== void 0) { + materialParams.aoMapIntensity = materialDef.occlusionTexture.strength; + } + } + if (materialDef.emissiveFactor !== void 0 && materialType !== MeshBasicMaterial) { + const emissiveFactor = materialDef.emissiveFactor; + materialParams.emissive = new Color().setRGB(emissiveFactor[0], emissiveFactor[1], emissiveFactor[2], LinearSRGBColorSpace); + } + if (materialDef.emissiveTexture !== void 0 && materialType !== MeshBasicMaterial) { + pending.push(parser.assignTexture(materialParams, "emissiveMap", materialDef.emissiveTexture, SRGBColorSpace)); + } + return Promise.all(pending).then(function() { + const material = new materialType(materialParams); + if (materialDef.name) material.name = materialDef.name; + assignExtrasToUserData(material, materialDef); + parser.associations.set(material, { materials: materialIndex }); + if (materialDef.extensions) addUnknownExtensionsToUserData(extensions, material, materialDef); + return material; + }); + } + /** When Object3D instances are targeted by animation, they need unique names. */ + createUniqueName(originalName) { + const sanitizedName = PropertyBinding.sanitizeNodeName(originalName || ""); + if (sanitizedName in this.nodeNamesUsed) { + return sanitizedName + "_" + ++this.nodeNamesUsed[sanitizedName]; + } else { + this.nodeNamesUsed[sanitizedName] = 0; + return sanitizedName; + } + } + /** + * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry + * + * Creates BufferGeometries from primitives. + * + * @param {Array} primitives + * @return {Promise>} + */ + loadGeometries(primitives) { + const parser = this; + const extensions = this.extensions; + const cache = this.primitiveCache; + function createDracoPrimitive(primitive) { + return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(primitive, parser).then(function(geometry) { + return addPrimitiveAttributes(geometry, primitive, parser); + }); + } + __name(createDracoPrimitive, "createDracoPrimitive"); + const pending = []; + for (let i = 0, il = primitives.length; i < il; i++) { + const primitive = primitives[i]; + const cacheKey = createPrimitiveKey(primitive); + const cached = cache[cacheKey]; + if (cached) { + pending.push(cached.promise); + } else { + let geometryPromise; + if (primitive.extensions && primitive.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]) { + geometryPromise = createDracoPrimitive(primitive); + } else { + geometryPromise = addPrimitiveAttributes(new BufferGeometry(), primitive, parser); + } + cache[cacheKey] = { primitive, promise: geometryPromise }; + pending.push(geometryPromise); + } + } + return Promise.all(pending); + } + /** + * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes + * @param {number} meshIndex + * @return {Promise} + */ + loadMesh(meshIndex) { + const parser = this; + const json = this.json; + const extensions = this.extensions; + const meshDef = json.meshes[meshIndex]; + const primitives = meshDef.primitives; + const pending = []; + for (let i = 0, il = primitives.length; i < il; i++) { + const material = primitives[i].material === void 0 ? createDefaultMaterial(this.cache) : this.getDependency("material", primitives[i].material); + pending.push(material); + } + pending.push(parser.loadGeometries(primitives)); + return Promise.all(pending).then(function(results) { + const materials = results.slice(0, results.length - 1); + const geometries = results[results.length - 1]; + const meshes = []; + for (let i = 0, il = geometries.length; i < il; i++) { + const geometry = geometries[i]; + const primitive = primitives[i]; + let mesh; + const material = materials[i]; + if (primitive.mode === WEBGL_CONSTANTS.TRIANGLES || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN || primitive.mode === void 0) { + mesh = meshDef.isSkinnedMesh === true ? new SkinnedMesh(geometry, material) : new Mesh(geometry, material); + if (mesh.isSkinnedMesh === true) { + mesh.normalizeSkinWeights(); + } + if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP) { + mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleStripDrawMode); + } else if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN) { + mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleFanDrawMode); + } + } else if (primitive.mode === WEBGL_CONSTANTS.LINES) { + mesh = new LineSegments(geometry, material); + } else if (primitive.mode === WEBGL_CONSTANTS.LINE_STRIP) { + mesh = new Line(geometry, material); + } else if (primitive.mode === WEBGL_CONSTANTS.LINE_LOOP) { + mesh = new LineLoop(geometry, material); + } else if (primitive.mode === WEBGL_CONSTANTS.POINTS) { + mesh = new Points(geometry, material); + } else { + throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + primitive.mode); + } + if (Object.keys(mesh.geometry.morphAttributes).length > 0) { + updateMorphTargets(mesh, meshDef); + } + mesh.name = parser.createUniqueName(meshDef.name || "mesh_" + meshIndex); + assignExtrasToUserData(mesh, meshDef); + if (primitive.extensions) addUnknownExtensionsToUserData(extensions, mesh, primitive); + parser.assignFinalMaterial(mesh); + meshes.push(mesh); + } + for (let i = 0, il = meshes.length; i < il; i++) { + parser.associations.set(meshes[i], { + meshes: meshIndex, + primitives: i + }); + } + if (meshes.length === 1) { + if (meshDef.extensions) addUnknownExtensionsToUserData(extensions, meshes[0], meshDef); + return meshes[0]; + } + const group = new Group(); + if (meshDef.extensions) addUnknownExtensionsToUserData(extensions, group, meshDef); + parser.associations.set(group, { meshes: meshIndex }); + for (let i = 0, il = meshes.length; i < il; i++) { + group.add(meshes[i]); + } + return group; + }); + } + /** + * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras + * @param {number} cameraIndex + * @return {Promise} + */ + loadCamera(cameraIndex) { + let camera; + const cameraDef = this.json.cameras[cameraIndex]; + const params = cameraDef[cameraDef.type]; + if (!params) { + console.warn("THREE.GLTFLoader: Missing camera parameters."); + return; + } + if (cameraDef.type === "perspective") { + camera = new PerspectiveCamera(MathUtils.radToDeg(params.yfov), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6); + } else if (cameraDef.type === "orthographic") { + camera = new OrthographicCamera(-params.xmag, params.xmag, params.ymag, -params.ymag, params.znear, params.zfar); + } + if (cameraDef.name) camera.name = this.createUniqueName(cameraDef.name); + assignExtrasToUserData(camera, cameraDef); + return Promise.resolve(camera); + } + /** + * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins + * @param {number} skinIndex + * @return {Promise} + */ + loadSkin(skinIndex) { + const skinDef = this.json.skins[skinIndex]; + const pending = []; + for (let i = 0, il = skinDef.joints.length; i < il; i++) { + pending.push(this._loadNodeShallow(skinDef.joints[i])); + } + if (skinDef.inverseBindMatrices !== void 0) { + pending.push(this.getDependency("accessor", skinDef.inverseBindMatrices)); + } else { + pending.push(null); + } + return Promise.all(pending).then(function(results) { + const inverseBindMatrices = results.pop(); + const jointNodes = results; + const bones = []; + const boneInverses = []; + for (let i = 0, il = jointNodes.length; i < il; i++) { + const jointNode = jointNodes[i]; + if (jointNode) { + bones.push(jointNode); + const mat = new Matrix4(); + if (inverseBindMatrices !== null) { + mat.fromArray(inverseBindMatrices.array, i * 16); + } + boneInverses.push(mat); + } else { + console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', skinDef.joints[i]); + } + } + return new Skeleton(bones, boneInverses); + }); + } + /** + * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations + * @param {number} animationIndex + * @return {Promise} + */ + loadAnimation(animationIndex) { + const json = this.json; + const parser = this; + const animationDef = json.animations[animationIndex]; + const animationName = animationDef.name ? animationDef.name : "animation_" + animationIndex; + const pendingNodes = []; + const pendingInputAccessors = []; + const pendingOutputAccessors = []; + const pendingSamplers = []; + const pendingTargets = []; + for (let i = 0, il = animationDef.channels.length; i < il; i++) { + const channel = animationDef.channels[i]; + const sampler = animationDef.samplers[channel.sampler]; + const target = channel.target; + const name = target.node; + const input = animationDef.parameters !== void 0 ? animationDef.parameters[sampler.input] : sampler.input; + const output = animationDef.parameters !== void 0 ? animationDef.parameters[sampler.output] : sampler.output; + if (target.node === void 0) continue; + pendingNodes.push(this.getDependency("node", name)); + pendingInputAccessors.push(this.getDependency("accessor", input)); + pendingOutputAccessors.push(this.getDependency("accessor", output)); + pendingSamplers.push(sampler); + pendingTargets.push(target); + } + return Promise.all([ + Promise.all(pendingNodes), + Promise.all(pendingInputAccessors), + Promise.all(pendingOutputAccessors), + Promise.all(pendingSamplers), + Promise.all(pendingTargets) + ]).then(function(dependencies) { + const nodes = dependencies[0]; + const inputAccessors = dependencies[1]; + const outputAccessors = dependencies[2]; + const samplers = dependencies[3]; + const targets = dependencies[4]; + const tracks = []; + for (let i = 0, il = nodes.length; i < il; i++) { + const node = nodes[i]; + const inputAccessor = inputAccessors[i]; + const outputAccessor = outputAccessors[i]; + const sampler = samplers[i]; + const target = targets[i]; + if (node === void 0) continue; + if (node.updateMatrix) { + node.updateMatrix(); + } + const createdTracks = parser._createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target); + if (createdTracks) { + for (let k = 0; k < createdTracks.length; k++) { + tracks.push(createdTracks[k]); + } + } + } + return new AnimationClip(animationName, void 0, tracks); + }); + } + createNodeMesh(nodeIndex) { + const json = this.json; + const parser = this; + const nodeDef = json.nodes[nodeIndex]; + if (nodeDef.mesh === void 0) return null; + return parser.getDependency("mesh", nodeDef.mesh).then(function(mesh) { + const node = parser._getNodeRef(parser.meshCache, nodeDef.mesh, mesh); + if (nodeDef.weights !== void 0) { + node.traverse(function(o) { + if (!o.isMesh) return; + for (let i = 0, il = nodeDef.weights.length; i < il; i++) { + o.morphTargetInfluences[i] = nodeDef.weights[i]; + } + }); + } + return node; + }); + } + /** + * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy + * @param {number} nodeIndex + * @return {Promise} + */ + loadNode(nodeIndex) { + const json = this.json; + const parser = this; + const nodeDef = json.nodes[nodeIndex]; + const nodePending = parser._loadNodeShallow(nodeIndex); + const childPending = []; + const childrenDef = nodeDef.children || []; + for (let i = 0, il = childrenDef.length; i < il; i++) { + childPending.push(parser.getDependency("node", childrenDef[i])); + } + const skeletonPending = nodeDef.skin === void 0 ? Promise.resolve(null) : parser.getDependency("skin", nodeDef.skin); + return Promise.all([ + nodePending, + Promise.all(childPending), + skeletonPending + ]).then(function(results) { + const node = results[0]; + const children = results[1]; + const skeleton = results[2]; + if (skeleton !== null) { + node.traverse(function(mesh) { + if (!mesh.isSkinnedMesh) return; + mesh.bind(skeleton, _identityMatrix); + }); + } + for (let i = 0, il = children.length; i < il; i++) { + node.add(children[i]); + } + return node; + }); + } + // ._loadNodeShallow() parses a single node. + // skin and child nodes are created and added in .loadNode() (no '_' prefix). + _loadNodeShallow(nodeIndex) { + const json = this.json; + const extensions = this.extensions; + const parser = this; + if (this.nodeCache[nodeIndex] !== void 0) { + return this.nodeCache[nodeIndex]; + } + const nodeDef = json.nodes[nodeIndex]; + const nodeName = nodeDef.name ? parser.createUniqueName(nodeDef.name) : ""; + const pending = []; + const meshPromise = parser._invokeOne(function(ext2) { + return ext2.createNodeMesh && ext2.createNodeMesh(nodeIndex); + }); + if (meshPromise) { + pending.push(meshPromise); + } + if (nodeDef.camera !== void 0) { + pending.push(parser.getDependency("camera", nodeDef.camera).then(function(camera) { + return parser._getNodeRef(parser.cameraCache, nodeDef.camera, camera); + })); + } + parser._invokeAll(function(ext2) { + return ext2.createNodeAttachment && ext2.createNodeAttachment(nodeIndex); + }).forEach(function(promise) { + pending.push(promise); + }); + this.nodeCache[nodeIndex] = Promise.all(pending).then(function(objects) { + let node; + if (nodeDef.isBone === true) { + node = new Bone(); + } else if (objects.length > 1) { + node = new Group(); + } else if (objects.length === 1) { + node = objects[0]; + } else { + node = new Object3D(); + } + if (node !== objects[0]) { + for (let i = 0, il = objects.length; i < il; i++) { + node.add(objects[i]); + } + } + if (nodeDef.name) { + node.userData.name = nodeDef.name; + node.name = nodeName; + } + assignExtrasToUserData(node, nodeDef); + if (nodeDef.extensions) addUnknownExtensionsToUserData(extensions, node, nodeDef); + if (nodeDef.matrix !== void 0) { + const matrix = new Matrix4(); + matrix.fromArray(nodeDef.matrix); + node.applyMatrix4(matrix); + } else { + if (nodeDef.translation !== void 0) { + node.position.fromArray(nodeDef.translation); + } + if (nodeDef.rotation !== void 0) { + node.quaternion.fromArray(nodeDef.rotation); + } + if (nodeDef.scale !== void 0) { + node.scale.fromArray(nodeDef.scale); + } + } + if (!parser.associations.has(node)) { + parser.associations.set(node, {}); + } + parser.associations.get(node).nodes = nodeIndex; + return node; + }); + return this.nodeCache[nodeIndex]; + } + /** + * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes + * @param {number} sceneIndex + * @return {Promise} + */ + loadScene(sceneIndex) { + const extensions = this.extensions; + const sceneDef = this.json.scenes[sceneIndex]; + const parser = this; + const scene = new Group(); + if (sceneDef.name) scene.name = parser.createUniqueName(sceneDef.name); + assignExtrasToUserData(scene, sceneDef); + if (sceneDef.extensions) addUnknownExtensionsToUserData(extensions, scene, sceneDef); + const nodeIds = sceneDef.nodes || []; + const pending = []; + for (let i = 0, il = nodeIds.length; i < il; i++) { + pending.push(parser.getDependency("node", nodeIds[i])); + } + return Promise.all(pending).then(function(nodes) { + for (let i = 0, il = nodes.length; i < il; i++) { + scene.add(nodes[i]); + } + const reduceAssociations = /* @__PURE__ */ __name((node) => { + const reducedAssociations = /* @__PURE__ */ new Map(); + for (const [key, value] of parser.associations) { + if (key instanceof Material || key instanceof Texture) { + reducedAssociations.set(key, value); + } + } + node.traverse((node2) => { + const mappings = parser.associations.get(node2); + if (mappings != null) { + reducedAssociations.set(node2, mappings); + } + }); + return reducedAssociations; + }, "reduceAssociations"); + parser.associations = reduceAssociations(scene); + return scene; + }); + } + _createAnimationTracks(node, inputAccessor, outputAccessor, sampler, target) { + const tracks = []; + const targetName = node.name ? node.name : node.uuid; + const targetNames = []; + if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) { + node.traverse(function(object) { + if (object.morphTargetInfluences) { + targetNames.push(object.name ? object.name : object.uuid); + } + }); + } else { + targetNames.push(targetName); + } + let TypedKeyframeTrack; + switch (PATH_PROPERTIES[target.path]) { + case PATH_PROPERTIES.weights: + TypedKeyframeTrack = NumberKeyframeTrack; + break; + case PATH_PROPERTIES.rotation: + TypedKeyframeTrack = QuaternionKeyframeTrack; + break; + case PATH_PROPERTIES.position: + case PATH_PROPERTIES.scale: + TypedKeyframeTrack = VectorKeyframeTrack; + break; + default: + switch (outputAccessor.itemSize) { + case 1: + TypedKeyframeTrack = NumberKeyframeTrack; + break; + case 2: + case 3: + default: + TypedKeyframeTrack = VectorKeyframeTrack; + break; + } + break; + } + const interpolation = sampler.interpolation !== void 0 ? INTERPOLATION[sampler.interpolation] : InterpolateLinear; + const outputArray = this._getArrayFromAccessor(outputAccessor); + for (let j = 0, jl = targetNames.length; j < jl; j++) { + const track = new TypedKeyframeTrack( + targetNames[j] + "." + PATH_PROPERTIES[target.path], + inputAccessor.array, + outputArray, + interpolation + ); + if (sampler.interpolation === "CUBICSPLINE") { + this._createCubicSplineTrackInterpolant(track); + } + tracks.push(track); + } + return tracks; + } + _getArrayFromAccessor(accessor) { + let outputArray = accessor.array; + if (accessor.normalized) { + const scale = getNormalizedComponentScale(outputArray.constructor); + const scaled = new Float32Array(outputArray.length); + for (let j = 0, jl = outputArray.length; j < jl; j++) { + scaled[j] = outputArray[j] * scale; + } + outputArray = scaled; + } + return outputArray; + } + _createCubicSplineTrackInterpolant(track) { + track.createInterpolant = /* @__PURE__ */ __name(function InterpolantFactoryMethodGLTFCubicSpline(result) { + const interpolantType = this instanceof QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant; + return new interpolantType(this.times, this.values, this.getValueSize() / 3, result); + }, "InterpolantFactoryMethodGLTFCubicSpline"); + track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true; + } +} +function computeBounds(geometry, primitiveDef, parser) { + const attributes = primitiveDef.attributes; + const box = new Box3(); + if (attributes.POSITION !== void 0) { + const accessor = parser.json.accessors[attributes.POSITION]; + const min = accessor.min; + const max2 = accessor.max; + if (min !== void 0 && max2 !== void 0) { + box.set( + new Vector3(min[0], min[1], min[2]), + new Vector3(max2[0], max2[1], max2[2]) + ); + if (accessor.normalized) { + const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType]); + box.min.multiplyScalar(boxScale); + box.max.multiplyScalar(boxScale); + } + } else { + console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."); + return; + } + } else { + return; + } + const targets = primitiveDef.targets; + if (targets !== void 0) { + const maxDisplacement = new Vector3(); + const vector = new Vector3(); + for (let i = 0, il = targets.length; i < il; i++) { + const target = targets[i]; + if (target.POSITION !== void 0) { + const accessor = parser.json.accessors[target.POSITION]; + const min = accessor.min; + const max2 = accessor.max; + if (min !== void 0 && max2 !== void 0) { + vector.setX(Math.max(Math.abs(min[0]), Math.abs(max2[0]))); + vector.setY(Math.max(Math.abs(min[1]), Math.abs(max2[1]))); + vector.setZ(Math.max(Math.abs(min[2]), Math.abs(max2[2]))); + if (accessor.normalized) { + const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType]); + vector.multiplyScalar(boxScale); + } + maxDisplacement.max(vector); + } else { + console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."); + } + } + } + box.expandByVector(maxDisplacement); + } + geometry.boundingBox = box; + const sphere = new Sphere(); + box.getCenter(sphere.center); + sphere.radius = box.min.distanceTo(box.max) / 2; + geometry.boundingSphere = sphere; +} +__name(computeBounds, "computeBounds"); +function addPrimitiveAttributes(geometry, primitiveDef, parser) { + const attributes = primitiveDef.attributes; + const pending = []; + function assignAttributeAccessor(accessorIndex, attributeName) { + return parser.getDependency("accessor", accessorIndex).then(function(accessor) { + geometry.setAttribute(attributeName, accessor); + }); + } + __name(assignAttributeAccessor, "assignAttributeAccessor"); + for (const gltfAttributeName in attributes) { + const threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase(); + if (threeAttributeName in geometry.attributes) continue; + pending.push(assignAttributeAccessor(attributes[gltfAttributeName], threeAttributeName)); + } + if (primitiveDef.indices !== void 0 && !geometry.index) { + const accessor = parser.getDependency("accessor", primitiveDef.indices).then(function(accessor2) { + geometry.setIndex(accessor2); + }); + pending.push(accessor); + } + if (ColorManagement.workingColorSpace !== LinearSRGBColorSpace && "COLOR_0" in attributes) { + console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ColorManagement.workingColorSpace}" not supported.`); + } + assignExtrasToUserData(geometry, primitiveDef); + computeBounds(geometry, primitiveDef, parser); + return Promise.all(pending).then(function() { + return primitiveDef.targets !== void 0 ? addMorphTargets(geometry, primitiveDef.targets, parser) : geometry; + }); +} +__name(addPrimitiveAttributes, "addPrimitiveAttributes"); +class MTLLoader extends Loader { + static { + __name(this, "MTLLoader"); + } + constructor(manager) { + super(manager); + } + /** + * Loads and parses a MTL asset from a URL. + * + * @param {String} url - URL to the MTL file. + * @param {Function} [onLoad] - Callback invoked with the loaded object. + * @param {Function} [onProgress] - Callback for download progress. + * @param {Function} [onError] - Callback for download errors. + * + * @see setPath setResourcePath + * + * @note In order for relative texture references to resolve correctly + * you must call setResourcePath() explicitly prior to load. + */ + load(url, onLoad, onProgress, onError) { + const scope = this; + const path = this.path === "" ? LoaderUtils.extractUrlBase(url) : this.path; + const loader = new FileLoader(this.manager); + loader.setPath(this.path); + loader.setRequestHeader(this.requestHeader); + loader.setWithCredentials(this.withCredentials); + loader.load(url, function(text) { + try { + onLoad(scope.parse(text, path)); + } catch (e) { + if (onError) { + onError(e); + } else { + console.error(e); + } + scope.manager.itemError(url); + } + }, onProgress, onError); + } + setMaterialOptions(value) { + this.materialOptions = value; + return this; + } + /** + * Parses a MTL file. + * + * @param {String} text - Content of MTL file + * @return {MaterialCreator} + * + * @see setPath setResourcePath + * + * @note In order for relative texture references to resolve correctly + * you must call setResourcePath() explicitly prior to parse. + */ + parse(text, path) { + const lines = text.split("\n"); + let info = {}; + const delimiter_pattern = /\s+/; + const materialsInfo = {}; + for (let i = 0; i < lines.length; i++) { + let line = lines[i]; + line = line.trim(); + if (line.length === 0 || line.charAt(0) === "#") { + continue; + } + const pos = line.indexOf(" "); + let key = pos >= 0 ? line.substring(0, pos) : line; + key = key.toLowerCase(); + let value = pos >= 0 ? line.substring(pos + 1) : ""; + value = value.trim(); + if (key === "newmtl") { + info = { name: value }; + materialsInfo[value] = info; + } else { + if (key === "ka" || key === "kd" || key === "ks" || key === "ke") { + const ss = value.split(delimiter_pattern, 3); + info[key] = [parseFloat(ss[0]), parseFloat(ss[1]), parseFloat(ss[2])]; + } else { + info[key] = value; + } + } + } + const materialCreator = new MaterialCreator(this.resourcePath || path, this.materialOptions); + materialCreator.setCrossOrigin(this.crossOrigin); + materialCreator.setManager(this.manager); + materialCreator.setMaterials(materialsInfo); + return materialCreator; + } +} +class MaterialCreator { + static { + __name(this, "MaterialCreator"); + } + constructor(baseUrl = "", options = {}) { + this.baseUrl = baseUrl; + this.options = options; + this.materialsInfo = {}; + this.materials = {}; + this.materialsArray = []; + this.nameLookup = {}; + this.crossOrigin = "anonymous"; + this.side = this.options.side !== void 0 ? this.options.side : FrontSide; + this.wrap = this.options.wrap !== void 0 ? this.options.wrap : RepeatWrapping; + } + setCrossOrigin(value) { + this.crossOrigin = value; + return this; + } + setManager(value) { + this.manager = value; + } + setMaterials(materialsInfo) { + this.materialsInfo = this.convert(materialsInfo); + this.materials = {}; + this.materialsArray = []; + this.nameLookup = {}; + } + convert(materialsInfo) { + if (!this.options) return materialsInfo; + const converted = {}; + for (const mn in materialsInfo) { + const mat = materialsInfo[mn]; + const covmat = {}; + converted[mn] = covmat; + for (const prop in mat) { + let save = true; + let value = mat[prop]; + const lprop = prop.toLowerCase(); + switch (lprop) { + case "kd": + case "ka": + case "ks": + if (this.options && this.options.normalizeRGB) { + value = [value[0] / 255, value[1] / 255, value[2] / 255]; + } + if (this.options && this.options.ignoreZeroRGBs) { + if (value[0] === 0 && value[1] === 0 && value[2] === 0) { + save = false; + } + } + break; + default: + break; + } + if (save) { + covmat[lprop] = value; + } + } + } + return converted; + } + preload() { + for (const mn in this.materialsInfo) { + this.create(mn); + } + } + getIndex(materialName) { + return this.nameLookup[materialName]; + } + getAsArray() { + let index = 0; + for (const mn in this.materialsInfo) { + this.materialsArray[index] = this.create(mn); + this.nameLookup[mn] = index; + index++; + } + return this.materialsArray; + } + create(materialName) { + if (this.materials[materialName] === void 0) { + this.createMaterial_(materialName); + } + return this.materials[materialName]; + } + createMaterial_(materialName) { + const scope = this; + const mat = this.materialsInfo[materialName]; + const params = { + name: materialName, + side: this.side + }; + function resolveURL(baseUrl, url) { + if (typeof url !== "string" || url === "") + return ""; + if (/^https?:\/\//i.test(url)) return url; + return baseUrl + url; + } + __name(resolveURL, "resolveURL"); + function setMapForType(mapType, value) { + if (params[mapType]) return; + const texParams = scope.getTextureParams(value, params); + const map = scope.loadTexture(resolveURL(scope.baseUrl, texParams.url)); + map.repeat.copy(texParams.scale); + map.offset.copy(texParams.offset); + map.wrapS = scope.wrap; + map.wrapT = scope.wrap; + if (mapType === "map" || mapType === "emissiveMap") { + map.colorSpace = SRGBColorSpace; + } + params[mapType] = map; + } + __name(setMapForType, "setMapForType"); + for (const prop in mat) { + const value = mat[prop]; + let n; + if (value === "") continue; + switch (prop.toLowerCase()) { + case "kd": + params.color = ColorManagement.toWorkingColorSpace(new Color().fromArray(value), SRGBColorSpace); + break; + case "ks": + params.specular = ColorManagement.toWorkingColorSpace(new Color().fromArray(value), SRGBColorSpace); + break; + case "ke": + params.emissive = ColorManagement.toWorkingColorSpace(new Color().fromArray(value), SRGBColorSpace); + break; + case "map_kd": + setMapForType("map", value); + break; + case "map_ks": + setMapForType("specularMap", value); + break; + case "map_ke": + setMapForType("emissiveMap", value); + break; + case "norm": + setMapForType("normalMap", value); + break; + case "map_bump": + case "bump": + setMapForType("bumpMap", value); + break; + case "map_d": + setMapForType("alphaMap", value); + params.transparent = true; + break; + case "ns": + params.shininess = parseFloat(value); + break; + case "d": + n = parseFloat(value); + if (n < 1) { + params.opacity = n; + params.transparent = true; + } + break; + case "tr": + n = parseFloat(value); + if (this.options && this.options.invertTrProperty) n = 1 - n; + if (n > 0) { + params.opacity = 1 - n; + params.transparent = true; + } + break; + default: + break; + } + } + this.materials[materialName] = new MeshPhongMaterial(params); + return this.materials[materialName]; + } + getTextureParams(value, matParams) { + const texParams = { + scale: new Vector2(1, 1), + offset: new Vector2(0, 0) + }; + const items = value.split(/\s+/); + let pos; + pos = items.indexOf("-bm"); + if (pos >= 0) { + matParams.bumpScale = parseFloat(items[pos + 1]); + items.splice(pos, 2); + } + pos = items.indexOf("-s"); + if (pos >= 0) { + texParams.scale.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2])); + items.splice(pos, 4); + } + pos = items.indexOf("-o"); + if (pos >= 0) { + texParams.offset.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2])); + items.splice(pos, 4); + } + texParams.url = items.join(" ").trim(); + return texParams; + } + loadTexture(url, mapping, onLoad, onProgress, onError) { + const manager = this.manager !== void 0 ? this.manager : DefaultLoadingManager; + let loader = manager.getHandler(url); + if (loader === null) { + loader = new TextureLoader(manager); + } + if (loader.setCrossOrigin) loader.setCrossOrigin(this.crossOrigin); + const texture = loader.load(url, onLoad, onProgress, onError); + if (mapping !== void 0) texture.mapping = mapping; + return texture; + } +} +const _object_pattern = /^[og]\s*(.+)?/; +const _material_library_pattern = /^mtllib /; +const _material_use_pattern = /^usemtl /; +const _map_use_pattern = /^usemap /; +const _face_vertex_data_separator_pattern = /\s+/; +const _vA = new Vector3(); +const _vB = new Vector3(); +const _vC = new Vector3(); +const _ab = new Vector3(); +const _cb = new Vector3(); +const _color = new Color(); +function ParserState() { + const state = { + objects: [], + object: {}, + vertices: [], + normals: [], + colors: [], + uvs: [], + materials: {}, + materialLibraries: [], + startObject: /* @__PURE__ */ __name(function(name, fromDeclaration) { + if (this.object && this.object.fromDeclaration === false) { + this.object.name = name; + this.object.fromDeclaration = fromDeclaration !== false; + return; + } + const previousMaterial = this.object && typeof this.object.currentMaterial === "function" ? this.object.currentMaterial() : void 0; + if (this.object && typeof this.object._finalize === "function") { + this.object._finalize(true); + } + this.object = { + name: name || "", + fromDeclaration: fromDeclaration !== false, + geometry: { + vertices: [], + normals: [], + colors: [], + uvs: [], + hasUVIndices: false + }, + materials: [], + smooth: true, + startMaterial: /* @__PURE__ */ __name(function(name2, libraries) { + const previous = this._finalize(false); + if (previous && (previous.inherited || previous.groupCount <= 0)) { + this.materials.splice(previous.index, 1); + } + const material = { + index: this.materials.length, + name: name2 || "", + mtllib: Array.isArray(libraries) && libraries.length > 0 ? libraries[libraries.length - 1] : "", + smooth: previous !== void 0 ? previous.smooth : this.smooth, + groupStart: previous !== void 0 ? previous.groupEnd : 0, + groupEnd: -1, + groupCount: -1, + inherited: false, + clone: /* @__PURE__ */ __name(function(index) { + const cloned = { + index: typeof index === "number" ? index : this.index, + name: this.name, + mtllib: this.mtllib, + smooth: this.smooth, + groupStart: 0, + groupEnd: -1, + groupCount: -1, + inherited: false + }; + cloned.clone = this.clone.bind(cloned); + return cloned; + }, "clone") + }; + this.materials.push(material); + return material; + }, "startMaterial"), + currentMaterial: /* @__PURE__ */ __name(function() { + if (this.materials.length > 0) { + return this.materials[this.materials.length - 1]; + } + return void 0; + }, "currentMaterial"), + _finalize: /* @__PURE__ */ __name(function(end) { + const lastMultiMaterial = this.currentMaterial(); + if (lastMultiMaterial && lastMultiMaterial.groupEnd === -1) { + lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3; + lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart; + lastMultiMaterial.inherited = false; + } + if (end && this.materials.length > 1) { + for (let mi = this.materials.length - 1; mi >= 0; mi--) { + if (this.materials[mi].groupCount <= 0) { + this.materials.splice(mi, 1); + } + } + } + if (end && this.materials.length === 0) { + this.materials.push({ + name: "", + smooth: this.smooth + }); + } + return lastMultiMaterial; + }, "_finalize") + }; + if (previousMaterial && previousMaterial.name && typeof previousMaterial.clone === "function") { + const declared = previousMaterial.clone(0); + declared.inherited = true; + this.object.materials.push(declared); + } + this.objects.push(this.object); + }, "startObject"), + finalize: /* @__PURE__ */ __name(function() { + if (this.object && typeof this.object._finalize === "function") { + this.object._finalize(true); + } + }, "finalize"), + parseVertexIndex: /* @__PURE__ */ __name(function(value, len) { + const index = parseInt(value, 10); + return (index >= 0 ? index - 1 : index + len / 3) * 3; + }, "parseVertexIndex"), + parseNormalIndex: /* @__PURE__ */ __name(function(value, len) { + const index = parseInt(value, 10); + return (index >= 0 ? index - 1 : index + len / 3) * 3; + }, "parseNormalIndex"), + parseUVIndex: /* @__PURE__ */ __name(function(value, len) { + const index = parseInt(value, 10); + return (index >= 0 ? index - 1 : index + len / 2) * 2; + }, "parseUVIndex"), + addVertex: /* @__PURE__ */ __name(function(a, b, c) { + const src = this.vertices; + const dst = this.object.geometry.vertices; + dst.push(src[a + 0], src[a + 1], src[a + 2]); + dst.push(src[b + 0], src[b + 1], src[b + 2]); + dst.push(src[c + 0], src[c + 1], src[c + 2]); + }, "addVertex"), + addVertexPoint: /* @__PURE__ */ __name(function(a) { + const src = this.vertices; + const dst = this.object.geometry.vertices; + dst.push(src[a + 0], src[a + 1], src[a + 2]); + }, "addVertexPoint"), + addVertexLine: /* @__PURE__ */ __name(function(a) { + const src = this.vertices; + const dst = this.object.geometry.vertices; + dst.push(src[a + 0], src[a + 1], src[a + 2]); + }, "addVertexLine"), + addNormal: /* @__PURE__ */ __name(function(a, b, c) { + const src = this.normals; + const dst = this.object.geometry.normals; + dst.push(src[a + 0], src[a + 1], src[a + 2]); + dst.push(src[b + 0], src[b + 1], src[b + 2]); + dst.push(src[c + 0], src[c + 1], src[c + 2]); + }, "addNormal"), + addFaceNormal: /* @__PURE__ */ __name(function(a, b, c) { + const src = this.vertices; + const dst = this.object.geometry.normals; + _vA.fromArray(src, a); + _vB.fromArray(src, b); + _vC.fromArray(src, c); + _cb.subVectors(_vC, _vB); + _ab.subVectors(_vA, _vB); + _cb.cross(_ab); + _cb.normalize(); + dst.push(_cb.x, _cb.y, _cb.z); + dst.push(_cb.x, _cb.y, _cb.z); + dst.push(_cb.x, _cb.y, _cb.z); + }, "addFaceNormal"), + addColor: /* @__PURE__ */ __name(function(a, b, c) { + const src = this.colors; + const dst = this.object.geometry.colors; + if (src[a] !== void 0) dst.push(src[a + 0], src[a + 1], src[a + 2]); + if (src[b] !== void 0) dst.push(src[b + 0], src[b + 1], src[b + 2]); + if (src[c] !== void 0) dst.push(src[c + 0], src[c + 1], src[c + 2]); + }, "addColor"), + addUV: /* @__PURE__ */ __name(function(a, b, c) { + const src = this.uvs; + const dst = this.object.geometry.uvs; + dst.push(src[a + 0], src[a + 1]); + dst.push(src[b + 0], src[b + 1]); + dst.push(src[c + 0], src[c + 1]); + }, "addUV"), + addDefaultUV: /* @__PURE__ */ __name(function() { + const dst = this.object.geometry.uvs; + dst.push(0, 0); + dst.push(0, 0); + dst.push(0, 0); + }, "addDefaultUV"), + addUVLine: /* @__PURE__ */ __name(function(a) { + const src = this.uvs; + const dst = this.object.geometry.uvs; + dst.push(src[a + 0], src[a + 1]); + }, "addUVLine"), + addFace: /* @__PURE__ */ __name(function(a, b, c, ua, ub, uc, na, nb, nc) { + const vLen = this.vertices.length; + let ia = this.parseVertexIndex(a, vLen); + let ib = this.parseVertexIndex(b, vLen); + let ic = this.parseVertexIndex(c, vLen); + this.addVertex(ia, ib, ic); + this.addColor(ia, ib, ic); + if (na !== void 0 && na !== "") { + const nLen = this.normals.length; + ia = this.parseNormalIndex(na, nLen); + ib = this.parseNormalIndex(nb, nLen); + ic = this.parseNormalIndex(nc, nLen); + this.addNormal(ia, ib, ic); + } else { + this.addFaceNormal(ia, ib, ic); + } + if (ua !== void 0 && ua !== "") { + const uvLen = this.uvs.length; + ia = this.parseUVIndex(ua, uvLen); + ib = this.parseUVIndex(ub, uvLen); + ic = this.parseUVIndex(uc, uvLen); + this.addUV(ia, ib, ic); + this.object.geometry.hasUVIndices = true; + } else { + this.addDefaultUV(); + } + }, "addFace"), + addPointGeometry: /* @__PURE__ */ __name(function(vertices) { + this.object.geometry.type = "Points"; + const vLen = this.vertices.length; + for (let vi = 0, l = vertices.length; vi < l; vi++) { + const index = this.parseVertexIndex(vertices[vi], vLen); + this.addVertexPoint(index); + this.addColor(index); + } + }, "addPointGeometry"), + addLineGeometry: /* @__PURE__ */ __name(function(vertices, uvs) { + this.object.geometry.type = "Line"; + const vLen = this.vertices.length; + const uvLen = this.uvs.length; + for (let vi = 0, l = vertices.length; vi < l; vi++) { + this.addVertexLine(this.parseVertexIndex(vertices[vi], vLen)); + } + for (let uvi = 0, l = uvs.length; uvi < l; uvi++) { + this.addUVLine(this.parseUVIndex(uvs[uvi], uvLen)); + } + }, "addLineGeometry") + }; + state.startObject("", false); + return state; +} +__name(ParserState, "ParserState"); +class OBJLoader extends Loader { + static { + __name(this, "OBJLoader"); + } + constructor(manager) { + super(manager); + this.materials = null; + } + load(url, onLoad, onProgress, onError) { + const scope = this; + const loader = new FileLoader(this.manager); + loader.setPath(this.path); + loader.setRequestHeader(this.requestHeader); + loader.setWithCredentials(this.withCredentials); + loader.load(url, function(text) { + try { + onLoad(scope.parse(text)); + } catch (e) { + if (onError) { + onError(e); + } else { + console.error(e); + } + scope.manager.itemError(url); + } + }, onProgress, onError); + } + setMaterials(materials) { + this.materials = materials; + return this; + } + parse(text) { + const state = new ParserState(); + if (text.indexOf("\r\n") !== -1) { + text = text.replace(/\r\n/g, "\n"); + } + if (text.indexOf("\\\n") !== -1) { + text = text.replace(/\\\n/g, ""); + } + const lines = text.split("\n"); + let result = []; + for (let i = 0, l = lines.length; i < l; i++) { + const line = lines[i].trimStart(); + if (line.length === 0) continue; + const lineFirstChar = line.charAt(0); + if (lineFirstChar === "#") continue; + if (lineFirstChar === "v") { + const data = line.split(_face_vertex_data_separator_pattern); + switch (data[0]) { + case "v": + state.vertices.push( + parseFloat(data[1]), + parseFloat(data[2]), + parseFloat(data[3]) + ); + if (data.length >= 7) { + _color.setRGB( + parseFloat(data[4]), + parseFloat(data[5]), + parseFloat(data[6]), + SRGBColorSpace + ); + state.colors.push(_color.r, _color.g, _color.b); + } else { + state.colors.push(void 0, void 0, void 0); + } + break; + case "vn": + state.normals.push( + parseFloat(data[1]), + parseFloat(data[2]), + parseFloat(data[3]) + ); + break; + case "vt": + state.uvs.push( + parseFloat(data[1]), + parseFloat(data[2]) + ); + break; + } + } else if (lineFirstChar === "f") { + const lineData = line.slice(1).trim(); + const vertexData = lineData.split(_face_vertex_data_separator_pattern); + const faceVertices = []; + for (let j = 0, jl = vertexData.length; j < jl; j++) { + const vertex2 = vertexData[j]; + if (vertex2.length > 0) { + const vertexParts = vertex2.split("/"); + faceVertices.push(vertexParts); + } + } + const v1 = faceVertices[0]; + for (let j = 1, jl = faceVertices.length - 1; j < jl; j++) { + const v2 = faceVertices[j]; + const v3 = faceVertices[j + 1]; + state.addFace( + v1[0], + v2[0], + v3[0], + v1[1], + v2[1], + v3[1], + v1[2], + v2[2], + v3[2] + ); + } + } else if (lineFirstChar === "l") { + const lineParts = line.substring(1).trim().split(" "); + let lineVertices = []; + const lineUVs = []; + if (line.indexOf("/") === -1) { + lineVertices = lineParts; + } else { + for (let li = 0, llen = lineParts.length; li < llen; li++) { + const parts = lineParts[li].split("/"); + if (parts[0] !== "") lineVertices.push(parts[0]); + if (parts[1] !== "") lineUVs.push(parts[1]); + } + } + state.addLineGeometry(lineVertices, lineUVs); + } else if (lineFirstChar === "p") { + const lineData = line.slice(1).trim(); + const pointData = lineData.split(" "); + state.addPointGeometry(pointData); + } else if ((result = _object_pattern.exec(line)) !== null) { + const name = (" " + result[0].slice(1).trim()).slice(1); + state.startObject(name); + } else if (_material_use_pattern.test(line)) { + state.object.startMaterial(line.substring(7).trim(), state.materialLibraries); + } else if (_material_library_pattern.test(line)) { + state.materialLibraries.push(line.substring(7).trim()); + } else if (_map_use_pattern.test(line)) { + console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'); + } else if (lineFirstChar === "s") { + result = line.split(" "); + if (result.length > 1) { + const value = result[1].trim().toLowerCase(); + state.object.smooth = value !== "0" && value !== "off"; + } else { + state.object.smooth = true; + } + const material = state.object.currentMaterial(); + if (material) material.smooth = state.object.smooth; + } else { + if (line === "\0") continue; + console.warn('THREE.OBJLoader: Unexpected line: "' + line + '"'); + } + } + state.finalize(); + const container = new Group(); + container.materialLibraries = [].concat(state.materialLibraries); + const hasPrimitives = !(state.objects.length === 1 && state.objects[0].geometry.vertices.length === 0); + if (hasPrimitives === true) { + for (let i = 0, l = state.objects.length; i < l; i++) { + const object = state.objects[i]; + const geometry = object.geometry; + const materials = object.materials; + const isLine = geometry.type === "Line"; + const isPoints = geometry.type === "Points"; + let hasVertexColors = false; + if (geometry.vertices.length === 0) continue; + const buffergeometry = new BufferGeometry(); + buffergeometry.setAttribute("position", new Float32BufferAttribute(geometry.vertices, 3)); + if (geometry.normals.length > 0) { + buffergeometry.setAttribute("normal", new Float32BufferAttribute(geometry.normals, 3)); + } + if (geometry.colors.length > 0) { + hasVertexColors = true; + buffergeometry.setAttribute("color", new Float32BufferAttribute(geometry.colors, 3)); + } + if (geometry.hasUVIndices === true) { + buffergeometry.setAttribute("uv", new Float32BufferAttribute(geometry.uvs, 2)); + } + const createdMaterials = []; + for (let mi = 0, miLen = materials.length; mi < miLen; mi++) { + const sourceMaterial = materials[mi]; + const materialHash = sourceMaterial.name + "_" + sourceMaterial.smooth + "_" + hasVertexColors; + let material = state.materials[materialHash]; + if (this.materials !== null) { + material = this.materials.create(sourceMaterial.name); + if (isLine && material && !(material instanceof LineBasicMaterial)) { + const materialLine = new LineBasicMaterial(); + Material.prototype.copy.call(materialLine, material); + materialLine.color.copy(material.color); + material = materialLine; + } else if (isPoints && material && !(material instanceof PointsMaterial)) { + const materialPoints = new PointsMaterial({ size: 10, sizeAttenuation: false }); + Material.prototype.copy.call(materialPoints, material); + materialPoints.color.copy(material.color); + materialPoints.map = material.map; + material = materialPoints; + } + } + if (material === void 0) { + if (isLine) { + material = new LineBasicMaterial(); + } else if (isPoints) { + material = new PointsMaterial({ size: 1, sizeAttenuation: false }); + } else { + material = new MeshPhongMaterial(); + } + material.name = sourceMaterial.name; + material.flatShading = sourceMaterial.smooth ? false : true; + material.vertexColors = hasVertexColors; + state.materials[materialHash] = material; + } + createdMaterials.push(material); + } + let mesh; + if (createdMaterials.length > 1) { + for (let mi = 0, miLen = materials.length; mi < miLen; mi++) { + const sourceMaterial = materials[mi]; + buffergeometry.addGroup(sourceMaterial.groupStart, sourceMaterial.groupCount, mi); + } + if (isLine) { + mesh = new LineSegments(buffergeometry, createdMaterials); + } else if (isPoints) { + mesh = new Points(buffergeometry, createdMaterials); + } else { + mesh = new Mesh(buffergeometry, createdMaterials); + } + } else { + if (isLine) { + mesh = new LineSegments(buffergeometry, createdMaterials[0]); + } else if (isPoints) { + mesh = new Points(buffergeometry, createdMaterials[0]); + } else { + mesh = new Mesh(buffergeometry, createdMaterials[0]); + } + } + mesh.name = object.name; + container.add(mesh); + } + } else { + if (state.vertices.length > 0) { + const material = new PointsMaterial({ size: 1, sizeAttenuation: false }); + const buffergeometry = new BufferGeometry(); + buffergeometry.setAttribute("position", new Float32BufferAttribute(state.vertices, 3)); + if (state.colors.length > 0 && state.colors[0] !== void 0) { + buffergeometry.setAttribute("color", new Float32BufferAttribute(state.colors, 3)); + material.vertexColors = true; + } + const points = new Points(buffergeometry, material); + container.add(points); + } + } + return container; + } +} class STLLoader extends Loader { static { __name(this, "STLLoader"); @@ -51077,7 +45746,27 @@ class STLLoader extends Loader { return isBinary(binData) ? parseBinary(binData) : parseASCII(ensureString(data)); } } -async function uploadFile(load3d, file2, fileInput) { +async function uploadTempImage(imageData, prefix) { + const blob = await fetch(imageData).then((r) => r.blob()); + const name = `${prefix}_${Date.now()}.png`; + const file2 = new File([blob], name); + const body = new FormData(); + body.append("image", file2); + body.append("subfolder", "threed"); + body.append("type", "temp"); + const resp = await api.fetchApi("/upload/image", { + method: "POST", + body + }); + if (resp.status !== 200) { + const err2 = `Error uploading temp image: ${resp.status} - ${resp.statusText}`; + useToastStore().addAlert(err2); + throw new Error(err2); + } + return await resp.json(); +} +__name(uploadTempImage, "uploadTempImage"); +async function uploadFile$1(load3d, file2, fileInput) { let uploadPath; try { const body = new FormData(); @@ -51093,7 +45782,7 @@ async function uploadFile(load3d, file2, fileInput) { if (data.subfolder) path = data.subfolder + "/" + path; uploadPath = path; const modelUrl = api.apiURL( - getResourceURL(...splitFilePath(path), "input") + getResourceURL$1(...splitFilePath$1(path), "input") ); await load3d.loadModel(modelUrl, file2.name); const fileExt = file2.name.split(".").pop()?.toLowerCase(); @@ -51126,7 +45815,7 @@ async function uploadFile(load3d, file2, fileInput) { } return uploadPath; } -__name(uploadFile, "uploadFile"); +__name(uploadFile$1, "uploadFile$1"); class Load3d { static { __name(this, "Load3d"); @@ -51174,7 +45863,7 @@ class Load3d { this.activeCamera = this.perspectiveCamera; this.perspectiveCamera.lookAt(0, 0, 0); this.orthographicCamera.lookAt(0, 0, 0); - this.renderer = new WebGLRenderer({ antialias: true }); + this.renderer = new WebGLRenderer({ alpha: true, antialias: true }); this.renderer.setSize(300, 300); this.renderer.setClearColor(2631720); const rendererDomElement = this.renderer.domElement; @@ -51216,6 +45905,13 @@ class Load3d { this.handleResize(); this.startAnimation(); } + setFOV(fov2) { + if (this.activeCamera === this.perspectiveCamera) { + this.perspectiveCamera.fov = fov2; + this.perspectiveCamera.updateProjectionMatrix(); + this.renderer.render(this.scene, this.activeCamera); + } + } getCameraState() { const currentType = this.getCurrentCameraType(); return { @@ -51655,10 +46351,14 @@ class Load3d { this.renderer.render(this.scene, this.activeCamera); }, "animate"); captureScene(width, height) { - return new Promise((resolve, reject) => { + return new Promise(async (resolve, reject) => { try { const originalWidth = this.renderer.domElement.width; const originalHeight = this.renderer.domElement.height; + const originalClearColor = this.renderer.getClearColor( + new Color() + ); + const originalClearAlpha = this.renderer.getClearAlpha(); this.renderer.setSize(width, height); if (this.activeCamera === this.perspectiveCamera) { this.perspectiveCamera.aspect = width / height; @@ -51673,10 +46373,14 @@ class Load3d { this.orthographicCamera.updateProjectionMatrix(); } this.renderer.render(this.scene, this.activeCamera); - const imageData = this.renderer.domElement.toDataURL("image/png"); + const sceneData = this.renderer.domElement.toDataURL("image/png"); + this.renderer.setClearColor(0, 0); + this.renderer.render(this.scene, this.activeCamera); + const maskData = this.renderer.domElement.toDataURL("image/png"); + this.renderer.setClearColor(originalClearColor, originalClearAlpha); this.renderer.setSize(originalWidth, originalHeight); this.handleResize(); - resolve(imageData); + resolve({ scene: sceneData, mask: maskData }); } catch (error) { reject(error); } @@ -51842,7 +46546,7 @@ class Load3dAnimation extends Load3d { this.renderer.render(this.scene, this.activeCamera); }, "animate"); } -function splitFilePath(path) { +function splitFilePath$1(path) { const folder_separator = path.lastIndexOf("/"); if (folder_separator === -1) { return ["", path]; @@ -51852,8 +46556,8 @@ function splitFilePath(path) { path.substring(folder_separator + 1) ]; } -__name(splitFilePath, "splitFilePath"); -function getResourceURL(subfolder, filename, type = "input") { +__name(splitFilePath$1, "splitFilePath$1"); +function getResourceURL$1(subfolder, filename, type = "input") { const params = [ "filename=" + encodeURIComponent(filename), "type=" + type, @@ -51862,7 +46566,7 @@ function getResourceURL(subfolder, filename, type = "input") { ].join("&"); return `/view?${params}`; } -__name(getResourceURL, "getResourceURL"); +__name(getResourceURL$1, "getResourceURL$1"); const load3dCSSCLASS = `display: flex; flex-direction: column; background: transparent; @@ -51873,14 +46577,14 @@ const load3dCanvasCSSCLASS = `display: flex; width: 100% !important; height: 100% !important;`; const containerToLoad3D = /* @__PURE__ */ new Map(); -function configureLoad3D(load3d, loadFolder, modelWidget, showGrid, cameraType, view, material, bgColor, lightIntensity, upDirection, cameraState, postModelUpdateFunc) { +function configureLoad3D(load3d, loadFolder, modelWidget, showGrid, cameraType, view, material, bgColor, lightIntensity, upDirection, fov2, cameraState, postModelUpdateFunc) { const createModelUpdateHandler = /* @__PURE__ */ __name(() => { let isFirstLoad = true; return async (value) => { if (!value) return; const filename = value; const modelUrl = api.apiURL( - getResourceURL(...splitFilePath(filename), loadFolder) + getResourceURL$1(...splitFilePath$1(filename), loadFolder) ); await load3d.loadModel(modelUrl, filename); load3d.setMaterialMode( @@ -51936,6 +46640,10 @@ function configureLoad3D(load3d, loadFolder, modelWidget, showGrid, cameraType, load3d.setUpDirection( upDirection.value ); + fov2.callback = (value) => { + load3d.setFOV(value); + }; + load3d.setFOV(fov2.value); } __name(configureLoad3D, "configureLoad3D"); app.registerExtension({ @@ -51975,7 +46683,7 @@ app.registerExtension({ const modelWidget = node.widgets?.find( (w) => w.name === "model_file" ); - const uploadPath = await uploadFile( + const uploadPath = await uploadFile$1( load3d, fileInput.files[0], fileInput @@ -52046,6 +46754,7 @@ app.registerExtension({ const upDirection = node.widgets.find( (w2) => w2.name === "up_direction" ); + const fov2 = node.widgets.find((w2) => w2.name === "fov"); let cameraState; try { const cameraInfo = node.properties["Camera Info"]; @@ -52067,31 +46776,25 @@ app.registerExtension({ bgColor, lightIntensity, upDirection, + fov2, cameraState ); const w = node.widgets.find((w2) => w2.name === "width"); const h = node.widgets.find((w2) => w2.name === "height"); sceneWidget.serializeValue = async () => { node.properties["Camera Info"] = JSON.stringify(load3d.getCameraState()); - const imageData = await load3d.captureScene(w.value, h.value); - const blob = await fetch(imageData).then((r) => r.blob()); - const name = `scene_${Date.now()}.png`; - const file2 = new File([blob], name); - const body = new FormData(); - body.append("image", file2); - body.append("subfolder", "threed"); - body.append("type", "temp"); - const resp = await api.fetchApi("/upload/image", { - method: "POST", - body - }); - if (resp.status !== 200) { - const err2 = `Error uploading scene capture: ${resp.status} - ${resp.statusText}`; - useToastStore().addAlert(err2); - throw new Error(err2); - } - const data = await resp.json(); - return `threed/${data.name} [temp]`; + const { scene: imageData, mask: maskData } = await load3d.captureScene( + w.value, + h.value + ); + const [data, dataMask] = await Promise.all([ + uploadTempImage(imageData, "scene"), + uploadTempImage(maskData, "scene_mask") + ]); + return { + image: `threed/${data.name} [temp]`, + mask: `threed/${dataMask.name} [temp]` + }; }; } }); @@ -52134,7 +46837,7 @@ app.registerExtension({ const modelWidget = node.widgets?.find( (w) => w.name === "model_file" ); - const uploadPath = await uploadFile( + const uploadPath = await uploadFile$1( load3d, fileInput.files[0], fileInput @@ -52258,6 +46961,7 @@ app.registerExtension({ load3d2.setAnimationSpeed(parseFloat(value)); } }; + const fov2 = node.widgets.find((w2) => w2.name === "fov"); let cameraState; try { const cameraInfo = node.properties["Camera Info"]; @@ -52279,6 +46983,7 @@ app.registerExtension({ bgColor, lightIntensity, upDirection, + fov2, cameraState, (load3d2) => { const animationLoad3d = load3d2; @@ -52296,31 +47001,31 @@ app.registerExtension({ const h = node.widgets.find((w2) => w2.name === "height"); sceneWidget.serializeValue = async () => { node.properties["Camera Info"] = JSON.stringify(load3d.getCameraState()); - load3d.toggleAnimation(false); - const imageData = await load3d.captureScene(w.value, h.value); - const blob = await fetch(imageData).then((r) => r.blob()); - const name = `scene_${Date.now()}.png`; - const file2 = new File([blob], name); - const body = new FormData(); - body.append("image", file2); - body.append("subfolder", "threed"); - body.append("type", "temp"); - const resp = await api.fetchApi("/upload/image", { - method: "POST", - body - }); - if (resp.status !== 200) { - const err2 = `Error uploading scene capture: ${resp.status} - ${resp.statusText}`; - useToastStore().addAlert(err2); - throw new Error(err2); - } - const data = await resp.json(); - return `threed/${data.name} [temp]`; + const { scene: imageData, mask: maskData } = await load3d.captureScene( + w.value, + h.value + ); + const [data, dataMask] = await Promise.all([ + uploadTempImage(imageData, "scene"), + uploadTempImage(maskData, "scene_mask") + ]); + return { + image: `threed/${data.name} [temp]`, + mask: `threed/${dataMask.name} [temp]` + }; }; } }); app.registerExtension({ name: "Comfy.Preview3D", + async beforeRegisterNodeDef(nodeType, nodeData) { + if ( + // @ts-expect-error ComfyNode + ["Preview3D"].includes(nodeType.comfyClass) + ) { + nodeData.input.required.image = ["PREVIEW_3D"]; + } + }, getCustomWidgets(app2) { return { PREVIEW_3D(node, inputName) { @@ -52389,18 +47094,6121 @@ app.registerExtension({ const upDirection = node.widgets.find( (w) => w.name === "up_direction" ); - configureLoad3D( - load3d, - "output", - modelWidget, - showGrid, - cameraType, - view, - material, - bgColor, - lightIntensity, - upDirection + const fov2 = node.widgets.find((w) => w.name === "fov"); + const onExecuted = node.onExecuted; + node.onExecuted = function(message) { + onExecuted?.apply(this, arguments); + let filePath = message.model_file[0]; + if (!filePath) { + const msg = "unable to get model file path."; + console.error(msg); + useToastStore().addAlert(msg); + } + modelWidget.value = filePath.replaceAll("\\", "/"); + configureLoad3D( + load3d, + "output", + modelWidget, + showGrid, + cameraType, + view, + material, + bgColor, + lightIntensity, + upDirection, + fov2 + ); + }; + } +}); +function dataURLToBlob(dataURL) { + const parts = dataURL.split(";base64,"); + const contentType = parts[0].split(":")[1]; + const byteString = atob(parts[1]); + const arrayBuffer = new ArrayBuffer(byteString.length); + const uint8Array = new Uint8Array(arrayBuffer); + for (let i = 0; i < byteString.length; i++) { + uint8Array[i] = byteString.charCodeAt(i); + } + return new Blob([arrayBuffer], { type: contentType }); +} +__name(dataURLToBlob, "dataURLToBlob"); +function loadedImageToBlob(image) { + const canvas = document.createElement("canvas"); + canvas.width = image.width; + canvas.height = image.height; + const ctx = canvas.getContext("2d"); + ctx.drawImage(image, 0, 0); + const dataURL = canvas.toDataURL("image/png", 1); + const blob = dataURLToBlob(dataURL); + return blob; +} +__name(loadedImageToBlob, "loadedImageToBlob"); +function loadImage(imagePath) { + return new Promise((resolve, reject) => { + const image = new Image(); + image.onload = function() { + resolve(image); + }; + image.src = imagePath; + }); +} +__name(loadImage, "loadImage"); +async function uploadMask(filepath, formData) { + await api.fetchApi("/upload/mask", { + method: "POST", + body: formData + }).then((response) => { + }).catch((error) => { + console.error("Error:", error); + }); + ComfyApp.clipspace.imgs[ComfyApp.clipspace["selectedIndex"]] = new Image(); + ComfyApp.clipspace.imgs[ComfyApp.clipspace["selectedIndex"]].src = api.apiURL( + "/view?" + new URLSearchParams(filepath).toString() + app.getPreviewFormatParam() + app.getRandParam() + ); + if (ComfyApp.clipspace.images) + ComfyApp.clipspace.images[ComfyApp.clipspace["selectedIndex"]] = filepath; + ClipspaceDialog.invalidatePreview(); +} +__name(uploadMask, "uploadMask"); +function prepare_mask(image, maskCanvas, maskCtx, maskColor) { + maskCtx.drawImage(image, 0, 0, maskCanvas.width, maskCanvas.height); + const maskData = maskCtx.getImageData( + 0, + 0, + maskCanvas.width, + maskCanvas.height + ); + for (let i = 0; i < maskData.data.length; i += 4) { + if (maskData.data[i + 3] == 255) maskData.data[i + 3] = 0; + else maskData.data[i + 3] = 255; + maskData.data[i] = maskColor.r; + maskData.data[i + 1] = maskColor.g; + maskData.data[i + 2] = maskColor.b; + } + maskCtx.globalCompositeOperation = "source-over"; + maskCtx.putImageData(maskData, 0, 0); +} +__name(prepare_mask, "prepare_mask"); +var PointerType = /* @__PURE__ */ ((PointerType2) => { + PointerType2["Arc"] = "arc"; + PointerType2["Rect"] = "rect"; + return PointerType2; +})(PointerType || {}); +var CompositionOperation$1 = /* @__PURE__ */ ((CompositionOperation2) => { + CompositionOperation2["SourceOver"] = "source-over"; + CompositionOperation2["DestinationOut"] = "destination-out"; + return CompositionOperation2; +})(CompositionOperation$1 || {}); +class MaskEditorDialogOld extends ComfyDialog { + static { + __name(this, "MaskEditorDialogOld"); + } + static instance = null; + static mousedown_x = null; + static mousedown_y = null; + brush; + maskCtx; + maskCanvas; + brush_size_slider; + brush_opacity_slider; + colorButton; + saveButton; + zoom_ratio; + pan_x; + pan_y; + imgCanvas; + last_display_style; + is_visible; + image; + handler_registered; + brush_slider_input; + cursorX; + cursorY; + mousedown_pan_x; + mousedown_pan_y; + last_pressure; + pointer_type; + brush_pointer_type_select; + static getInstance() { + if (!MaskEditorDialogOld.instance) { + MaskEditorDialogOld.instance = new MaskEditorDialogOld(); + } + return MaskEditorDialogOld.instance; + } + is_layout_created = false; + constructor() { + super(); + this.element = $el("div.comfy-modal", { parent: document.body }, [ + $el("div.comfy-modal-content", [...this.createButtons()]) + ]); + } + createButtons() { + return []; + } + createButton(name, callback) { + var button = document.createElement("button"); + button.style.pointerEvents = "auto"; + button.innerText = name; + button.addEventListener("click", callback); + return button; + } + createLeftButton(name, callback) { + var button = this.createButton(name, callback); + button.style.cssFloat = "left"; + button.style.marginRight = "4px"; + return button; + } + createRightButton(name, callback) { + var button = this.createButton(name, callback); + button.style.cssFloat = "right"; + button.style.marginLeft = "4px"; + return button; + } + createLeftSlider(self2, name, callback) { + const divElement = document.createElement("div"); + divElement.id = "maskeditor-slider"; + divElement.style.cssFloat = "left"; + divElement.style.fontFamily = "sans-serif"; + divElement.style.marginRight = "4px"; + divElement.style.color = "var(--input-text)"; + divElement.style.backgroundColor = "var(--comfy-input-bg)"; + divElement.style.borderRadius = "8px"; + divElement.style.borderColor = "var(--border-color)"; + divElement.style.borderStyle = "solid"; + divElement.style.fontSize = "15px"; + divElement.style.height = "25px"; + divElement.style.padding = "1px 6px"; + divElement.style.display = "flex"; + divElement.style.position = "relative"; + divElement.style.top = "2px"; + divElement.style.pointerEvents = "auto"; + self2.brush_slider_input = document.createElement("input"); + self2.brush_slider_input.setAttribute("type", "range"); + self2.brush_slider_input.setAttribute("min", "1"); + self2.brush_slider_input.setAttribute("max", "100"); + self2.brush_slider_input.setAttribute("value", "10"); + const labelElement = document.createElement("label"); + labelElement.textContent = name; + divElement.appendChild(labelElement); + divElement.appendChild(self2.brush_slider_input); + self2.brush_slider_input.addEventListener("change", callback); + return divElement; + } + createOpacitySlider(self2, name, callback) { + const divElement = document.createElement("div"); + divElement.id = "maskeditor-opacity-slider"; + divElement.style.cssFloat = "left"; + divElement.style.fontFamily = "sans-serif"; + divElement.style.marginRight = "4px"; + divElement.style.color = "var(--input-text)"; + divElement.style.backgroundColor = "var(--comfy-input-bg)"; + divElement.style.borderRadius = "8px"; + divElement.style.borderColor = "var(--border-color)"; + divElement.style.borderStyle = "solid"; + divElement.style.fontSize = "15px"; + divElement.style.height = "25px"; + divElement.style.padding = "1px 6px"; + divElement.style.display = "flex"; + divElement.style.position = "relative"; + divElement.style.top = "2px"; + divElement.style.pointerEvents = "auto"; + self2.opacity_slider_input = document.createElement("input"); + self2.opacity_slider_input.setAttribute("type", "range"); + self2.opacity_slider_input.setAttribute("min", "0.1"); + self2.opacity_slider_input.setAttribute("max", "1.0"); + self2.opacity_slider_input.setAttribute("step", "0.01"); + self2.opacity_slider_input.setAttribute("value", "0.7"); + const labelElement = document.createElement("label"); + labelElement.textContent = name; + divElement.appendChild(labelElement); + divElement.appendChild(self2.opacity_slider_input); + self2.opacity_slider_input.addEventListener("input", callback); + return divElement; + } + createPointerTypeSelect(self2) { + const divElement = document.createElement("div"); + divElement.id = "maskeditor-pointer-type"; + divElement.style.cssFloat = "left"; + divElement.style.fontFamily = "sans-serif"; + divElement.style.marginRight = "4px"; + divElement.style.color = "var(--input-text)"; + divElement.style.backgroundColor = "var(--comfy-input-bg)"; + divElement.style.borderRadius = "8px"; + divElement.style.borderColor = "var(--border-color)"; + divElement.style.borderStyle = "solid"; + divElement.style.fontSize = "15px"; + divElement.style.height = "25px"; + divElement.style.padding = "1px 6px"; + divElement.style.display = "flex"; + divElement.style.position = "relative"; + divElement.style.top = "2px"; + divElement.style.pointerEvents = "auto"; + const labelElement = document.createElement("label"); + labelElement.textContent = "Pointer Type:"; + const selectElement = document.createElement("select"); + selectElement.style.borderRadius = "0"; + selectElement.style.borderColor = "transparent"; + selectElement.style.borderStyle = "unset"; + selectElement.style.fontSize = "0.9em"; + const optionArc = document.createElement("option"); + optionArc.value = "arc"; + optionArc.text = "Circle"; + optionArc.selected = true; + const optionRect = document.createElement("option"); + optionRect.value = "rect"; + optionRect.text = "Square"; + selectElement.appendChild(optionArc); + selectElement.appendChild(optionRect); + selectElement.addEventListener("change", (event) => { + const target = event.target; + self2.pointer_type = target.value; + this.setBrushBorderRadius(self2); + }); + divElement.appendChild(labelElement); + divElement.appendChild(selectElement); + return divElement; + } + setBrushBorderRadius(self2) { + if (self2.pointer_type === "rect") { + this.brush.style.borderRadius = "0%"; + this.brush.style.MozBorderRadius = "0%"; + this.brush.style.WebkitBorderRadius = "0%"; + } else { + this.brush.style.borderRadius = "50%"; + this.brush.style.MozBorderRadius = "50%"; + this.brush.style.WebkitBorderRadius = "50%"; + } + } + setlayout(imgCanvas, maskCanvas) { + const self2 = this; + self2.pointer_type = "arc"; + var bottom_panel = document.createElement("div"); + bottom_panel.style.position = "absolute"; + bottom_panel.style.bottom = "0px"; + bottom_panel.style.left = "20px"; + bottom_panel.style.right = "20px"; + bottom_panel.style.height = "50px"; + bottom_panel.style.pointerEvents = "none"; + var brush = document.createElement("div"); + brush.id = "brush"; + brush.style.backgroundColor = "transparent"; + brush.style.outline = "1px dashed black"; + brush.style.boxShadow = "0 0 0 1px white"; + brush.style.position = "absolute"; + brush.style.zIndex = "8889"; + brush.style.pointerEvents = "none"; + this.brush = brush; + this.setBrushBorderRadius(self2); + this.element.appendChild(imgCanvas); + this.element.appendChild(maskCanvas); + this.element.appendChild(bottom_panel); + document.body.appendChild(brush); + var clearButton = this.createLeftButton("Clear", () => { + self2.maskCtx.clearRect( + 0, + 0, + self2.maskCanvas.width, + self2.maskCanvas.height + ); + }); + this.brush_size_slider = this.createLeftSlider( + self2, + "Thickness", + (event) => { + self2.brush_size = event.target.value; + self2.updateBrushPreview(self2); + } + ); + this.brush_opacity_slider = this.createOpacitySlider( + self2, + "Opacity", + (event) => { + self2.brush_opacity = event.target.value; + if (self2.brush_color_mode !== "negative") { + self2.maskCanvas.style.opacity = self2.brush_opacity.toString(); + } + } + ); + this.brush_pointer_type_select = this.createPointerTypeSelect(self2); + this.colorButton = this.createLeftButton(this.getColorButtonText(), () => { + if (self2.brush_color_mode === "black") { + self2.brush_color_mode = "white"; + } else if (self2.brush_color_mode === "white") { + self2.brush_color_mode = "negative"; + } else { + self2.brush_color_mode = "black"; + } + self2.updateWhenBrushColorModeChanged(); + }); + var cancelButton = this.createRightButton("Cancel", () => { + document.removeEventListener("keydown", MaskEditorDialogOld.handleKeyDown); + self2.close(); + }); + this.saveButton = this.createRightButton("Save", () => { + document.removeEventListener("keydown", MaskEditorDialogOld.handleKeyDown); + self2.save(); + }); + this.element.appendChild(imgCanvas); + this.element.appendChild(maskCanvas); + this.element.appendChild(bottom_panel); + bottom_panel.appendChild(clearButton); + bottom_panel.appendChild(this.saveButton); + bottom_panel.appendChild(cancelButton); + bottom_panel.appendChild(this.brush_size_slider); + bottom_panel.appendChild(this.brush_opacity_slider); + bottom_panel.appendChild(this.brush_pointer_type_select); + bottom_panel.appendChild(this.colorButton); + imgCanvas.style.position = "absolute"; + maskCanvas.style.position = "absolute"; + imgCanvas.style.top = "200"; + imgCanvas.style.left = "0"; + maskCanvas.style.top = imgCanvas.style.top; + maskCanvas.style.left = imgCanvas.style.left; + const maskCanvasStyle = this.getMaskCanvasStyle(); + maskCanvas.style.mixBlendMode = maskCanvasStyle.mixBlendMode; + maskCanvas.style.opacity = maskCanvasStyle.opacity.toString(); + } + async show() { + this.zoom_ratio = 1; + this.pan_x = 0; + this.pan_y = 0; + if (!this.is_layout_created) { + const imgCanvas = document.createElement("canvas"); + const maskCanvas = document.createElement("canvas"); + imgCanvas.id = "imageCanvas"; + maskCanvas.id = "maskCanvas"; + this.setlayout(imgCanvas, maskCanvas); + this.imgCanvas = imgCanvas; + this.maskCanvas = maskCanvas; + this.maskCtx = maskCanvas.getContext("2d", { willReadFrequently: true }); + this.setEventHandler(maskCanvas); + this.is_layout_created = true; + const self2 = this; + const observer = new MutationObserver(function(mutations) { + mutations.forEach(function(mutation) { + if (mutation.type === "attributes" && mutation.attributeName === "style") { + if (self2.last_display_style && self2.last_display_style != "none" && self2.element.style.display == "none") { + self2.brush.style.display = "none"; + ComfyApp.onClipspaceEditorClosed(); + } + self2.last_display_style = self2.element.style.display; + } + }); + }); + const config = { attributes: true }; + observer.observe(this.element, config); + } + document.addEventListener("keydown", MaskEditorDialogOld.handleKeyDown); + if (ComfyApp.clipspace_return_node) { + this.saveButton.innerText = "Save to node"; + } else { + this.saveButton.innerText = "Save"; + } + this.saveButton.disabled = false; + this.element.style.display = "block"; + this.element.style.width = "85%"; + this.element.style.margin = "0 7.5%"; + this.element.style.height = "100vh"; + this.element.style.top = "50%"; + this.element.style.left = "42%"; + this.element.style.zIndex = "8888"; + await this.setImages(this.imgCanvas); + this.is_visible = true; + } + isOpened() { + return this.element.style.display == "block"; + } + invalidateCanvas(orig_image, mask_image) { + this.imgCanvas.width = orig_image.width; + this.imgCanvas.height = orig_image.height; + this.maskCanvas.width = orig_image.width; + this.maskCanvas.height = orig_image.height; + let imgCtx = this.imgCanvas.getContext("2d", { willReadFrequently: true }); + let maskCtx = this.maskCanvas.getContext("2d", { + willReadFrequently: true + }); + imgCtx.drawImage(orig_image, 0, 0, orig_image.width, orig_image.height); + prepare_mask(mask_image, this.maskCanvas, maskCtx, this.getMaskColor()); + } + async setImages(imgCanvas) { + let self2 = this; + const imgCtx = imgCanvas.getContext("2d", { willReadFrequently: true }); + const maskCtx = this.maskCtx; + const maskCanvas = this.maskCanvas; + imgCtx.clearRect(0, 0, this.imgCanvas.width, this.imgCanvas.height); + maskCtx.clearRect(0, 0, this.maskCanvas.width, this.maskCanvas.height); + const filepath = ComfyApp.clipspace.images; + const alpha_url = new URL( + ComfyApp.clipspace.imgs[ComfyApp.clipspace["selectedIndex"]].src + ); + alpha_url.searchParams.delete("channel"); + alpha_url.searchParams.delete("preview"); + alpha_url.searchParams.set("channel", "a"); + let mask_image = await loadImage(alpha_url); + const rgb_url = new URL( + ComfyApp.clipspace.imgs[ComfyApp.clipspace["selectedIndex"]].src + ); + rgb_url.searchParams.delete("channel"); + rgb_url.searchParams.set("channel", "rgb"); + this.image = new Image(); + this.image.onload = function() { + maskCanvas.width = self2.image.width; + maskCanvas.height = self2.image.height; + self2.invalidateCanvas(self2.image, mask_image); + self2.initializeCanvasPanZoom(); + }; + this.image.src = rgb_url.toString(); + } + initializeCanvasPanZoom() { + let drawWidth = this.image.width; + let drawHeight = this.image.height; + let width = this.element.clientWidth; + let height = this.element.clientHeight; + if (this.image.width > width) { + drawWidth = width; + drawHeight = drawWidth / this.image.width * this.image.height; + } + if (drawHeight > height) { + drawHeight = height; + drawWidth = drawHeight / this.image.height * this.image.width; + } + this.zoom_ratio = drawWidth / this.image.width; + const canvasX = (width - drawWidth) / 2; + const canvasY = (height - drawHeight) / 2; + this.pan_x = canvasX; + this.pan_y = canvasY; + this.invalidatePanZoom(); + } + invalidatePanZoom() { + let raw_width = this.image.width * this.zoom_ratio; + let raw_height = this.image.height * this.zoom_ratio; + if (this.pan_x + raw_width < 10) { + this.pan_x = 10 - raw_width; + } + if (this.pan_y + raw_height < 10) { + this.pan_y = 10 - raw_height; + } + let width = `${raw_width}px`; + let height = `${raw_height}px`; + let left = `${this.pan_x}px`; + let top = `${this.pan_y}px`; + this.maskCanvas.style.width = width; + this.maskCanvas.style.height = height; + this.maskCanvas.style.left = left; + this.maskCanvas.style.top = top; + this.imgCanvas.style.width = width; + this.imgCanvas.style.height = height; + this.imgCanvas.style.left = left; + this.imgCanvas.style.top = top; + } + setEventHandler(maskCanvas) { + const self2 = this; + if (!this.handler_registered) { + maskCanvas.addEventListener("contextmenu", (event) => { + event.preventDefault(); + }); + this.element.addEventListener( + "wheel", + (event) => this.handleWheelEvent(self2, event) + ); + this.element.addEventListener( + "pointermove", + (event) => this.pointMoveEvent(self2, event) + ); + this.element.addEventListener( + "touchmove", + (event) => this.pointMoveEvent(self2, event) + ); + this.element.addEventListener("dragstart", (event) => { + if (event.ctrlKey) { + event.preventDefault(); + } + }); + maskCanvas.addEventListener( + "pointerdown", + (event) => this.handlePointerDown(self2, event) + ); + maskCanvas.addEventListener( + "pointermove", + (event) => this.draw_move(self2, event) + ); + maskCanvas.addEventListener( + "touchmove", + (event) => this.draw_move(self2, event) + ); + maskCanvas.addEventListener("pointerover", (event) => { + this.brush.style.display = "block"; + }); + maskCanvas.addEventListener("pointerleave", (event) => { + this.brush.style.display = "none"; + }); + document.addEventListener( + "pointerup", + MaskEditorDialogOld.handlePointerUp + ); + this.handler_registered = true; + } + } + getMaskCanvasStyle() { + if (this.brush_color_mode === "negative") { + return { + mixBlendMode: "difference", + opacity: "1" + }; + } else { + return { + mixBlendMode: "initial", + opacity: this.brush_opacity + }; + } + } + getMaskColor() { + if (this.brush_color_mode === "black") { + return { r: 0, g: 0, b: 0 }; + } + if (this.brush_color_mode === "white") { + return { r: 255, g: 255, b: 255 }; + } + if (this.brush_color_mode === "negative") { + return { r: 255, g: 255, b: 255 }; + } + return { r: 0, g: 0, b: 0 }; + } + getMaskFillStyle() { + const maskColor = this.getMaskColor(); + return "rgb(" + maskColor.r + "," + maskColor.g + "," + maskColor.b + ")"; + } + getColorButtonText() { + let colorCaption = "unknown"; + if (this.brush_color_mode === "black") { + colorCaption = "black"; + } else if (this.brush_color_mode === "white") { + colorCaption = "white"; + } else if (this.brush_color_mode === "negative") { + colorCaption = "negative"; + } + return "Color: " + colorCaption; + } + updateWhenBrushColorModeChanged() { + this.colorButton.innerText = this.getColorButtonText(); + const maskCanvasStyle = this.getMaskCanvasStyle(); + this.maskCanvas.style.mixBlendMode = maskCanvasStyle.mixBlendMode; + this.maskCanvas.style.opacity = maskCanvasStyle.opacity.toString(); + const maskColor = this.getMaskColor(); + const maskData = this.maskCtx.getImageData( + 0, + 0, + this.maskCanvas.width, + this.maskCanvas.height + ); + for (let i = 0; i < maskData.data.length; i += 4) { + maskData.data[i] = maskColor.r; + maskData.data[i + 1] = maskColor.g; + maskData.data[i + 2] = maskColor.b; + } + this.maskCtx.putImageData(maskData, 0, 0); + } + brush_opacity = 0.7; + brush_size = 10; + brush_color_mode = "black"; + drawing_mode = false; + lastx = -1; + lasty = -1; + lasttime = 0; + static handleKeyDown(event) { + const self2 = MaskEditorDialogOld.instance; + if (event.key === "]") { + self2.brush_size = Math.min(self2.brush_size + 2, 100); + self2.brush_slider_input.value = self2.brush_size; + } else if (event.key === "[") { + self2.brush_size = Math.max(self2.brush_size - 2, 1); + self2.brush_slider_input.value = self2.brush_size; + } else if (event.key === "Enter") { + self2.save(); + } + self2.updateBrushPreview(self2); + } + static handlePointerUp(event) { + event.preventDefault(); + this.mousedown_x = null; + this.mousedown_y = null; + MaskEditorDialogOld.instance.drawing_mode = false; + } + updateBrushPreview(self2) { + const brush = self2.brush; + var centerX = self2.cursorX; + var centerY = self2.cursorY; + brush.style.width = self2.brush_size * 2 * this.zoom_ratio + "px"; + brush.style.height = self2.brush_size * 2 * this.zoom_ratio + "px"; + brush.style.left = centerX - self2.brush_size * this.zoom_ratio + "px"; + brush.style.top = centerY - self2.brush_size * this.zoom_ratio + "px"; + } + handleWheelEvent(self2, event) { + event.preventDefault(); + if (event.ctrlKey) { + if (event.deltaY < 0) { + this.zoom_ratio = Math.min(10, this.zoom_ratio + 0.2); + } else { + this.zoom_ratio = Math.max(0.2, this.zoom_ratio - 0.2); + } + this.invalidatePanZoom(); + } else { + if (event.deltaY < 0) this.brush_size = Math.min(this.brush_size + 2, 100); + else this.brush_size = Math.max(this.brush_size - 2, 1); + this.brush_slider_input.value = this.brush_size.toString(); + this.updateBrushPreview(this); + } + } + pointMoveEvent(self2, event) { + this.cursorX = event.pageX; + this.cursorY = event.pageY; + self2.updateBrushPreview(self2); + if (event.ctrlKey) { + event.preventDefault(); + self2.pan_move(self2, event); + } + let left_button_down = window.TouchEvent && event instanceof TouchEvent || event.buttons == 1; + if (event.shiftKey && left_button_down) { + self2.drawing_mode = false; + const y = event.clientY; + let delta = (self2.zoom_lasty - y) * 5e-3; + self2.zoom_ratio = Math.max( + Math.min(10, self2.last_zoom_ratio - delta), + 0.2 + ); + this.invalidatePanZoom(); + return; + } + } + pan_move(self2, event) { + if (event.buttons == 1) { + if (MaskEditorDialogOld.mousedown_x) { + let deltaX = MaskEditorDialogOld.mousedown_x - event.clientX; + let deltaY = MaskEditorDialogOld.mousedown_y - event.clientY; + self2.pan_x = this.mousedown_pan_x - deltaX; + self2.pan_y = this.mousedown_pan_y - deltaY; + self2.invalidatePanZoom(); + } + } + } + draw_move(self2, event) { + if (event.ctrlKey || event.shiftKey) { + return; + } + event.preventDefault(); + this.cursorX = event.pageX; + this.cursorY = event.pageY; + self2.updateBrushPreview(self2); + let left_button_down = window.TouchEvent && event instanceof TouchEvent || event.buttons == 1; + let right_button_down = [2, 5, 32].includes(event.buttons); + if (!event.altKey && left_button_down) { + var diff = performance.now() - self2.lasttime; + const maskRect = self2.maskCanvas.getBoundingClientRect(); + var x = event.offsetX; + var y = event.offsetY; + if (event.offsetX == null) { + x = event.targetTouches[0].clientX - maskRect.left; + } + if (event.offsetY == null) { + y = event.targetTouches[0].clientY - maskRect.top; + } + x /= self2.zoom_ratio; + y /= self2.zoom_ratio; + var brush_size = this.brush_size; + if (event instanceof PointerEvent && event.pointerType == "pen") { + brush_size *= event.pressure; + this.last_pressure = event.pressure; + } else if (window.TouchEvent && event instanceof TouchEvent && diff < 20) { + brush_size *= this.last_pressure; + } else { + brush_size = this.brush_size; + } + if (diff > 20 && !this.drawing_mode) + requestAnimationFrame(() => { + self2.init_shape( + self2, + "source-over" + /* SourceOver */ + ); + self2.draw_shape(self2, x, y, brush_size); + self2.lastx = x; + self2.lasty = y; + }); + else + requestAnimationFrame(() => { + self2.init_shape( + self2, + "source-over" + /* SourceOver */ + ); + var dx = x - self2.lastx; + var dy = y - self2.lasty; + var distance = Math.sqrt(dx * dx + dy * dy); + var directionX = dx / distance; + var directionY = dy / distance; + for (var i = 0; i < distance; i += 5) { + var px2 = self2.lastx + directionX * i; + var py2 = self2.lasty + directionY * i; + self2.draw_shape(self2, px2, py2, brush_size); + } + self2.lastx = x; + self2.lasty = y; + }); + self2.lasttime = performance.now(); + } else if (event.altKey && left_button_down || right_button_down) { + const maskRect = self2.maskCanvas.getBoundingClientRect(); + const x2 = (event.offsetX || event.targetTouches[0].clientX - maskRect.left) / self2.zoom_ratio; + const y2 = (event.offsetY || event.targetTouches[0].clientY - maskRect.top) / self2.zoom_ratio; + var brush_size = this.brush_size; + if (event instanceof PointerEvent && event.pointerType == "pen") { + brush_size *= event.pressure; + this.last_pressure = event.pressure; + } else if (window.TouchEvent && event instanceof TouchEvent && diff < 20) { + brush_size *= this.last_pressure; + } else { + brush_size = this.brush_size; + } + if (diff > 20 && !this.drawing_mode) + requestAnimationFrame(() => { + self2.init_shape( + self2, + "destination-out" + /* DestinationOut */ + ); + self2.draw_shape(self2, x2, y2, brush_size); + self2.lastx = x2; + self2.lasty = y2; + }); + else + requestAnimationFrame(() => { + self2.init_shape( + self2, + "destination-out" + /* DestinationOut */ + ); + var dx = x2 - self2.lastx; + var dy = y2 - self2.lasty; + var distance = Math.sqrt(dx * dx + dy * dy); + var directionX = dx / distance; + var directionY = dy / distance; + for (var i = 0; i < distance; i += 5) { + var px2 = self2.lastx + directionX * i; + var py2 = self2.lasty + directionY * i; + self2.draw_shape(self2, px2, py2, brush_size); + } + self2.lastx = x2; + self2.lasty = y2; + }); + self2.lasttime = performance.now(); + } + } + handlePointerDown(self2, event) { + if (event.ctrlKey) { + if (event.buttons == 1) { + MaskEditorDialogOld.mousedown_x = event.clientX; + MaskEditorDialogOld.mousedown_y = event.clientY; + this.mousedown_pan_x = this.pan_x; + this.mousedown_pan_y = this.pan_y; + } + return; + } + var brush_size = this.brush_size; + if (event instanceof PointerEvent && event.pointerType == "pen") { + brush_size *= event.pressure; + this.last_pressure = event.pressure; + } + if ([0, 2, 5].includes(event.button)) { + self2.drawing_mode = true; + event.preventDefault(); + if (event.shiftKey) { + self2.zoom_lasty = event.clientY; + self2.last_zoom_ratio = self2.zoom_ratio; + return; + } + const maskRect = self2.maskCanvas.getBoundingClientRect(); + const x = (event.offsetX || event.targetTouches[0].clientX - maskRect.left) / self2.zoom_ratio; + const y = (event.offsetY || event.targetTouches[0].clientY - maskRect.top) / self2.zoom_ratio; + if (!event.altKey && event.button == 0) { + self2.init_shape( + self2, + "source-over" + /* SourceOver */ + ); + } else { + self2.init_shape( + self2, + "destination-out" + /* DestinationOut */ + ); + } + self2.draw_shape(self2, x, y, brush_size); + self2.lastx = x; + self2.lasty = y; + self2.lasttime = performance.now(); + } + } + init_shape(self2, compositionOperation) { + self2.maskCtx.beginPath(); + if (compositionOperation == "source-over") { + self2.maskCtx.fillStyle = this.getMaskFillStyle(); + self2.maskCtx.globalCompositeOperation = "source-over"; + } else if (compositionOperation == "destination-out") { + self2.maskCtx.globalCompositeOperation = "destination-out"; + } + } + draw_shape(self2, x, y, brush_size) { + if (self2.pointer_type === "rect") { + self2.maskCtx.rect( + x - brush_size, + y - brush_size, + brush_size * 2, + brush_size * 2 + ); + } else { + self2.maskCtx.arc(x, y, brush_size, 0, Math.PI * 2, false); + } + self2.maskCtx.fill(); + } + async save() { + const backupCanvas = document.createElement("canvas"); + const backupCtx = backupCanvas.getContext("2d", { + willReadFrequently: true + }); + backupCanvas.width = this.image.width; + backupCanvas.height = this.image.height; + backupCtx.clearRect(0, 0, backupCanvas.width, backupCanvas.height); + backupCtx.drawImage( + this.maskCanvas, + 0, + 0, + this.maskCanvas.width, + this.maskCanvas.height, + 0, + 0, + backupCanvas.width, + backupCanvas.height + ); + const backupData = backupCtx.getImageData( + 0, + 0, + backupCanvas.width, + backupCanvas.height + ); + for (let i = 0; i < backupData.data.length; i += 4) { + if (backupData.data[i + 3] == 255) backupData.data[i + 3] = 0; + else backupData.data[i + 3] = 255; + backupData.data[i] = 0; + backupData.data[i + 1] = 0; + backupData.data[i + 2] = 0; + } + backupCtx.globalCompositeOperation = "source-over"; + backupCtx.putImageData(backupData, 0, 0); + const formData = new FormData(); + const filename = "clipspace-mask-" + performance.now() + ".png"; + const item = { + filename, + subfolder: "clipspace", + type: "input" + }; + if (ComfyApp.clipspace.images) ComfyApp.clipspace.images[0] = item; + if (ComfyApp.clipspace.widgets) { + const index = ComfyApp.clipspace.widgets.findIndex( + (obj) => obj.name === "image" + ); + if (index >= 0) ComfyApp.clipspace.widgets[index].value = item; + } + const dataURL = backupCanvas.toDataURL(); + const blob = dataURLToBlob(dataURL); + let original_url = new URL(this.image.src); + const original_ref = { + filename: original_url.searchParams.get("filename") + }; + let original_subfolder = original_url.searchParams.get("subfolder"); + if (original_subfolder) original_ref.subfolder = original_subfolder; + let original_type = original_url.searchParams.get("type"); + if (original_type) original_ref.type = original_type; + formData.append("image", blob, filename); + formData.append("original_ref", JSON.stringify(original_ref)); + formData.append("type", "input"); + formData.append("subfolder", "clipspace"); + this.saveButton.innerText = "Saving..."; + this.saveButton.disabled = true; + await uploadMask(item, formData); + ComfyApp.onClipspaceEditorSave(); + this.close(); + } +} +window.comfyAPI = window.comfyAPI || {}; +window.comfyAPI.maskEditorOld = window.comfyAPI.maskEditorOld || {}; +window.comfyAPI.maskEditorOld.MaskEditorDialogOld = MaskEditorDialogOld; +var styles = ` + #maskEditorContainer { + display: fixed; + } + #maskEditor_brush { + position: absolute; + backgroundColor: transparent; + z-index: 8889; + pointer-events: none; + border-radius: 50%; + overflow: visible; + outline: 1px dashed black; + box-shadow: 0 0 0 1px white; + } + #maskEditor_brushPreviewGradient { + position: absolute; + width: 100%; + height: 100%; + border-radius: 50%; + display: none; + } + #maskEditor { + display: block; + width: 100%; + height: 100vh; + left: 0; + z-index: 8888; + position: fixed; + background: rgba(50,50,50,0.75); + backdrop-filter: blur(10px); + overflow: hidden; + user-select: none; + } + #maskEditor_sidePanelContainer { + height: 100%; + width: 220px; + z-index: 8888; + display: flex; + flex-direction: column; + } + #maskEditor_sidePanel { + background: var(--comfy-menu-bg); + height: 100%; + display: flex; + align-items: center; + overflow-y: hidden; + width: 220px; + } + #maskEditor_sidePanelShortcuts { + display: flex; + flex-direction: row; + width: 200px; + margin-top: 10px; + gap: 10px; + justify-content: center; + } + .maskEditor_sidePanelIconButton { + width: 40px; + height: 40px; + pointer-events: auto; + display: flex; + justify-content: center; + align-items: center; + transition: background-color 0.1s; + } + .maskEditor_sidePanelIconButton:hover { + background-color: rgba(0, 0, 0, 0.2); + } + #maskEditor_sidePanelBrushSettings { + display: flex; + flex-direction: column; + gap: 10px; + width: 200px; + padding: 10px; + } + .maskEditor_sidePanelTitle { + text-align: center; + font-size: 15px; + font-family: sans-serif; + color: var(--descrip-text); + margin-top: 10px; + } + #maskEditor_sidePanelBrushShapeContainer { + display: flex; + width: 180px; + height: 50px; + border: 1px solid var(--border-color); + pointer-events: auto; + background: rgba(0, 0, 0, 0.2); + } + #maskEditor_sidePanelBrushShapeCircle { + width: 35px; + height: 35px; + border-radius: 50%; + border: 1px solid var(--border-color); + pointer-events: auto; + transition: background 0.1s; + margin-left: 7.5px; + } + .maskEditor_sidePanelBrushRange { + width: 180px; + -webkit-appearance: none; + appearance: none; + background: transparent; + cursor: pointer; + } + .maskEditor_sidePanelBrushRange::-webkit-slider-thumb { + height: 20px; + width: 20px; + border-radius: 50%; + cursor: grab; + margin-top: -8px; + background: var(--p-surface-700); + border: 1px solid var(--border-color); + } + .maskEditor_sidePanelBrushRange::-moz-range-thumb { + height: 20px; + width: 20px; + border-radius: 50%; + cursor: grab; + background: var(--p-surface-800); + border: 1px solid var(--border-color); + } + .maskEditor_sidePanelBrushRange::-webkit-slider-runnable-track { + background: var(--p-surface-700); + height: 3px; + } + .maskEditor_sidePanelBrushRange::-moz-range-track { + background: var(--p-surface-700); + height: 3px; + } + + #maskEditor_sidePanelBrushShapeSquare { + width: 35px; + height: 35px; + margin: 5px; + border: 1px solid var(--border-color); + pointer-events: auto; + transition: background 0.1s; + } + + .maskEditor_brushShape_dark { + background: transparent; + } + + .maskEditor_brushShape_dark:hover { + background: var(--p-surface-900); + } + + .maskEditor_brushShape_light { + background: transparent; + } + + .maskEditor_brushShape_light:hover { + background: var(--comfy-menu-bg); + } + + #maskEditor_sidePanelImageLayerSettings { + display: flex; + flex-direction: column; + gap: 10px; + width: 200px; + align-items: center; + } + .maskEditor_sidePanelLayer { + display: flex; + width: 200px; + height: 50px; + } + .maskEditor_sidePanelLayerVisibilityContainer { + width: 50px; + height: 50px; + border-radius: 8px; + display: flex; + justify-content: center; + align-items: center; + } + .maskEditor_sidePanelVisibilityToggle { + width: 12px; + height: 12px; + border-radius: 50%; + pointer-events: auto; + } + .maskEditor_sidePanelLayerIconContainer { + width: 60px; + height: 50px; + border-radius: 8px; + display: flex; + justify-content: center; + align-items: center; + fill: var(--input-text); + } + .maskEditor_sidePanelLayerIconContainer svg { + width: 30px; + height: 30px; + } + #maskEditor_sidePanelMaskLayerBlendingContainer { + width: 80px; + height: 50px; + border-radius: 8px; + display: flex; + justify-content: center; + align-items: center; + } + #maskEditor_sidePanelMaskLayerBlendingSelect { + width: 80px; + height: 30px; + border: 1px solid var(--border-color); + background-color: rgba(0, 0, 0, 0.2); + color: var(--input-text); + font-family: sans-serif; + font-size: 15px; + pointer-events: auto; + transition: background-color border 0.1s; + } + #maskEditor_sidePanelClearCanvasButton:hover { + background-color: var(--p-overlaybadge-outline-color); + border: none; + } + #maskEditor_sidePanelClearCanvasButton { + width: 180px; + height: 30px; + border: none; + background: rgba(0, 0, 0, 0.2); + border: 1px solid var(--border-color); + color: var(--input-text); + font-family: sans-serif; + font-size: 15px; + pointer-events: auto; + transition: background-color 0.1s; + } + #maskEditor_sidePanelClearCanvasButton:hover { + background-color: var(--p-overlaybadge-outline-color); + } + #maskEditor_sidePanelHorizontalButtonContainer { + display: flex; + gap: 10px; + height: 40px; + } + .maskEditor_sidePanelBigButton { + width: 85px; + height: 30px; + border: none; + background: rgba(0, 0, 0, 0.2); + border: 1px solid var(--border-color); + color: var(--input-text); + font-family: sans-serif; + font-size: 15px; + pointer-events: auto; + transition: background-color border 0.1s; + } + .maskEditor_sidePanelBigButton:hover { + background-color: var(--p-overlaybadge-outline-color); + border: none; + } + #maskEditor_toolPanel { + height: 100%; + width: var(--sidebar-width); + z-index: 8888; + background: var(--comfy-menu-bg); + display: flex; + flex-direction: column; + } + .maskEditor_toolPanelContainer { + width: var(--sidebar-width); + height: var(--sidebar-width); + display: flex; + justify-content: center; + align-items: center; + position: relative; + transition: background-color 0.2s; + } + .maskEditor_toolPanelContainerSelected svg { + fill: var(--p-button-text-primary-color) !important; + } + .maskEditor_toolPanelContainerSelected .maskEditor_toolPanelIndicator { + display: block; + } + .maskEditor_toolPanelContainer svg { + width: 75%; + aspect-ratio: 1/1; + fill: var(--p-button-text-secondary-color); + } + + .maskEditor_toolPanelContainerDark:hover { + background-color: var(--p-surface-800); + } + + .maskEditor_toolPanelContainerLight:hover { + background-color: var(--p-surface-300); + } + + .maskEditor_toolPanelIndicator { + display: none; + height: 100%; + width: 4px; + position: absolute; + left: 0; + background: var(--p-button-text-primary-color); + } + #maskEditor_sidePanelPaintBucketSettings { + display: flex; + flex-direction: column; + gap: 10px; + width: 200px; + padding: 10px; + } + #canvasBackground { + background: white; + width: 100%; + height: 100%; + } + #maskEditor_sidePanelButtonsContainer { + display: flex; + flex-direction: column; + gap: 10px; + margin-top: 10px; + } + .maskEditor_sidePanelSeparator { + width: 200px; + height: 2px; + background: var(--border-color); + margin-top: 5px; + margin-bottom: 5px; + } + #maskEditor_pointerZone { + width: calc(100% - var(--sidebar-width) - 220px); + height: 100%; + } + #maskEditor_uiContainer { + width: 100%; + height: 100%; + position: absolute; + z-index: 8888; + display: flex; + flex-direction: column; + } + #maskEditorCanvasContainer { + position: absolute; + width: 1000px; + height: 667px; + left: 359px; + top: 280px; + } + #imageCanvas { + width: 100%; + height: 100%; + } + #maskCanvas { + width: 100%; + height: 100%; + } + #maskEditor_uiHorizontalContainer { + width: 100%; + height: 100%; + display: flex; + } + #maskEditor_topBar { + display: flex; + height: 44px; + align-items: center; + background: var(--comfy-menu-bg); + } + #maskEditor_topBarTitle { + margin: 0; + margin-left: 0.5rem; + margin-right: 0.5rem; + font-size: 1.2em; + } + #maskEditor_topBarButtonContainer { + display: flex; + gap: 10px; + margin-right: 0.5rem; + position: absolute; + right: 0; + width: 200px; + } + #maskEditor_topBarShortcutsContainer { + display: flex; + gap: 10px; + margin-left: 5px; + } + + .maskEditor_topPanelIconButton_dark { + width: 50px; + height: 30px; + pointer-events: auto; + display: flex; + justify-content: center; + align-items: center; + transition: background-color 0.1s; + background: var(--p-surface-800); + border: 1px solid var(--p-form-field-border-color); + border-radius: 10px; + } + + .maskEditor_topPanelIconButton_dark:hover { + background-color: var(--p-surface-900); + } + + .maskEditor_topPanelIconButton_dark svg { + width: 25px; + height: 25px; + pointer-events: none; + fill: var(--input-text); + } + + .maskEditor_topPanelIconButton_light { + width: 50px; + height: 30px; + pointer-events: auto; + display: flex; + justify-content: center; + align-items: center; + transition: background-color 0.1s; + background: var(--comfy-menu-bg); + border: 1px solid var(--p-form-field-border-color); + border-radius: 10px; + } + + .maskEditor_topPanelIconButton_light:hover { + background-color: var(--p-surface-300); + } + + .maskEditor_topPanelIconButton_light svg { + width: 25px; + height: 25px; + pointer-events: none; + fill: var(--input-text); + } + + .maskEditor_topPanelButton_dark { + height: 30px; + background: var(--p-surface-800); + border: 1px solid var(--p-form-field-border-color); + border-radius: 10px; + color: var(--input-text); + font-family: sans-serif; + pointer-events: auto; + transition: 0.1s; + width: 60px; + } + + .maskEditor_topPanelButton_dark:hover { + background-color: var(--p-surface-900); + } + + .maskEditor_topPanelButton_light { + height: 30px; + background: var(--comfy-menu-bg); + border: 1px solid var(--p-form-field-border-color); + border-radius: 10px; + color: var(--input-text); + font-family: sans-serif; + pointer-events: auto; + transition: 0.1s; + width: 60px; + } + + .maskEditor_topPanelButton_light:hover { + background-color: var(--p-surface-300); + } + + + #maskEditor_sidePanelColorSelectSettings { + flex-direction: column; + } + + .maskEditor_sidePanel_paintBucket_Container { + width: 180px; + display: flex; + flex-direction: column; + position: relative; + } + + .maskEditor_sidePanel_colorSelect_Container { + display: flex; + width: 180px; + align-items: center; + gap: 5px; + height: 30px; + } + + #maskEditor_sidePanelVisibilityToggle { + position: absolute; + right: 0; + } + + #maskEditor_sidePanelColorSelectMethodSelect { + position: absolute; + right: 0; + height: 30px; + border-radius: 0; + border: 1px solid var(--border-color); + background: rgba(0,0,0,0.2); + } + + #maskEditor_sidePanelVisibilityToggle { + position: absolute; + right: 0; + } + + .maskEditor_sidePanel_colorSelect_tolerance_container { + display: flex; + flex-direction: column; + gap: 10px; + margin-bottom: 10px; + } + + .maskEditor_sidePanelContainerColumn { + display: flex; + flex-direction: column; + gap: 12px; + } + + .maskEditor_sidePanelContainerRow { + display: flex; + flex-direction: row; + gap: 10px; + align-items: center; + min-height: 24px; + position: relative; + } + + .maskEditor_accent_bg_dark { + background: var(--p-surface-800); + } + + .maskEditor_accent_bg_very_dark { + background: var(--p-surface-900); + } + + .maskEditor_accent_bg_light { + background: var(--p-surface-300); + } + + .maskEditor_accent_bg_very_light { + background: var(--comfy-menu-bg); + } + + #maskEditor_paintBucketSettings { + display: none; + } + + #maskEditor_colorSelectSettings { + display: none; + } + + .maskEditor_sidePanelToggleContainer { + cursor: pointer; + display: inline-block; + position: absolute; + right: 0; + } + + .maskEditor_toggle_bg_dark { + background: var(--p-surface-700); + } + + .maskEditor_toggle_bg_light { + background: var(--p-surface-300); + } + + .maskEditor_sidePanelToggleSwitch { + display: inline-block; + border-radius: 16px; + width: 40px; + height: 24px; + position: relative; + vertical-align: middle; + transition: background 0.25s; + } + .maskEditor_sidePanelToggleSwitch:before, .maskEditor_sidePanelToggleSwitch:after { + content: ""; + } + .maskEditor_sidePanelToggleSwitch:before { + display: block; + background: linear-gradient(to bottom, #fff 0%, #eee 100%); + border-radius: 50%; + width: 16px; + height: 16px; + position: absolute; + top: 4px; + left: 4px; + transition: ease 0.2s; + } + .maskEditor_sidePanelToggleContainer:hover .maskEditor_sidePanelToggleSwitch:before { + background: linear-gradient(to bottom, #fff 0%, #fff 100%); + } + .maskEditor_sidePanelToggleCheckbox:checked + .maskEditor_sidePanelToggleSwitch { + background: var(--p-button-text-primary-color); + } + .maskEditor_sidePanelToggleCheckbox:checked + .maskEditor_toggle_bg_dark:before { + background: var(--p-surface-900); + } + .maskEditor_sidePanelToggleCheckbox:checked + .maskEditor_toggle_bg_light:before { + background: var(--comfy-menu-bg); + } + .maskEditor_sidePanelToggleCheckbox:checked + .maskEditor_sidePanelToggleSwitch:before { + left: 20px; + } + + .maskEditor_sidePanelToggleCheckbox { + position: absolute; + visibility: hidden; + } + + .maskEditor_sidePanelDropdown_dark { + border: 1px solid var(--p-form-field-border-color); + background: var(--p-surface-900); + height: 24px; + padding-left: 5px; + padding-right: 5px; + border-radius: 6px; + transition: background 0.1s; + } + + .maskEditor_sidePanelDropdown_dark option { + background: var(--p-surface-900); + } + + .maskEditor_sidePanelDropdown_dark:focus { + outline: 1px solid var(--p-button-text-primary-color); + } + + .maskEditor_sidePanelDropdown_dark option:hover { + background: white; + } + .maskEditor_sidePanelDropdown_dark option:active { + background: var(--p-highlight-background); + } + + .maskEditor_sidePanelDropdown_light { + border: 1px solid var(--p-form-field-border-color); + background: var(--comfy-menu-bg); + height: 24px; + padding-left: 5px; + padding-right: 5px; + border-radius: 6px; + transition: background 0.1s; + } + + .maskEditor_sidePanelDropdown_light option { + background: var(--comfy-menu-bg); + } + + .maskEditor_sidePanelDropdown_light:focus { + outline: 1px solid var(--p-surface-300); + } + + .maskEditor_sidePanelDropdown_light option:hover { + background: white; + } + .maskEditor_sidePanelDropdown_light option:active { + background: var(--p-surface-300); + } + + .maskEditor_layerRow { + height: 50px; + width: 200px; + border-radius: 10px; + } + + .maskEditor_sidePanelLayerPreviewContainer { + width: 40px; + height: 30px; + } + + .maskEditor_sidePanelLayerPreviewContainer > svg{ + width: 100%; + height: 100%; + object-fit: contain; + fill: var(--p-surface-100); + } + + #maskEditor_sidePanelImageLayerImage { + width: 100%; + height: 100%; + object-fit: contain; + } + + .maskEditor_sidePanelSubTitle { + text-align: left; + font-size: 12px; + font-family: sans-serif; + color: var(--descrip-text); + } + + .maskEditor_containerDropdown { + position: absolute; + right: 0; + } + + .maskEditor_sidePanelLayerCheckbox { + margin-left: 15px; + } + + .maskEditor_toolPanelZoomIndicator { + width: var(--sidebar-width); + height: var(--sidebar-width); + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 5px; + color: var(--p-button-text-secondary-color); + position: absolute; + bottom: 0; + transition: background-color 0.2s; + } + + #maskEditor_toolPanelDimensionsText { + font-size: 12px; + } + + #maskEditor_topBarSaveButton { + background: var(--p-primary-color) !important; + color: var(--p-button-primary-color) !important; + } + + #maskEditor_topBarSaveButton:hover { + background: var(--p-primary-hover-color) !important; + } + +`; +var styleSheet = document.createElement("style"); +styleSheet.type = "text/css"; +styleSheet.innerText = styles; +document.head.appendChild(styleSheet); +var BrushShape = /* @__PURE__ */ ((BrushShape2) => { + BrushShape2["Arc"] = "arc"; + BrushShape2["Rect"] = "rect"; + return BrushShape2; +})(BrushShape || {}); +var Tools = /* @__PURE__ */ ((Tools2) => { + Tools2["Pen"] = "pen"; + Tools2["Eraser"] = "eraser"; + Tools2["PaintBucket"] = "paintBucket"; + Tools2["ColorSelect"] = "colorSelect"; + return Tools2; +})(Tools || {}); +var CompositionOperation = /* @__PURE__ */ ((CompositionOperation2) => { + CompositionOperation2["SourceOver"] = "source-over"; + CompositionOperation2["DestinationOut"] = "destination-out"; + return CompositionOperation2; +})(CompositionOperation || {}); +var MaskBlendMode = /* @__PURE__ */ ((MaskBlendMode2) => { + MaskBlendMode2["Black"] = "black"; + MaskBlendMode2["White"] = "white"; + MaskBlendMode2["Negative"] = "negative"; + return MaskBlendMode2; +})(MaskBlendMode || {}); +var ColorComparisonMethod = /* @__PURE__ */ ((ColorComparisonMethod2) => { + ColorComparisonMethod2["Simple"] = "simple"; + ColorComparisonMethod2["HSL"] = "hsl"; + ColorComparisonMethod2["LAB"] = "lab"; + return ColorComparisonMethod2; +})(ColorComparisonMethod || {}); +class MaskEditorDialog extends ComfyDialog { + static { + __name(this, "MaskEditorDialog"); + } + static instance = null; + //new + uiManager; + toolManager; + panAndZoomManager; + brushTool; + paintBucketTool; + colorSelectTool; + canvasHistory; + messageBroker; + keyboardManager; + rootElement; + imageURL; + isLayoutCreated = false; + isOpen = false; + //variables needed? + last_display_style = null; + constructor() { + super(); + this.rootElement = $el( + "div.maskEditor_hidden", + { parent: document.body }, + [] + ); + this.element = this.rootElement; + } + static getInstance() { + if (!ComfyApp.clipspace || !ComfyApp.clipspace.imgs) { + throw new Error("No clipspace images found"); + } + const currentSrc = ComfyApp.clipspace.imgs[ComfyApp.clipspace["selectedIndex"]].src; + if (!MaskEditorDialog.instance || currentSrc !== MaskEditorDialog.instance.imageURL) { + MaskEditorDialog.instance = new MaskEditorDialog(); + } + return MaskEditorDialog.instance; + } + async show() { + this.cleanup(); + if (!this.isLayoutCreated) { + this.messageBroker = new MessageBroker(); + this.canvasHistory = new CanvasHistory(this, 20); + this.paintBucketTool = new PaintBucketTool(this); + this.brushTool = new BrushTool(this); + this.panAndZoomManager = new PanAndZoomManager(this); + this.toolManager = new ToolManager(this); + this.keyboardManager = new KeyboardManager(this); + this.uiManager = new UIManager(this.rootElement, this); + this.colorSelectTool = new ColorSelectTool(this); + const self2 = this; + const observer = new MutationObserver(function(mutations) { + mutations.forEach(function(mutation) { + if (mutation.type === "attributes" && mutation.attributeName === "style") { + if (self2.last_display_style && self2.last_display_style != "none" && self2.element.style.display == "none") { + ComfyApp.onClipspaceEditorClosed(); + } + self2.last_display_style = self2.element.style.display; + } + }); + }); + const config = { attributes: true }; + observer.observe(this.rootElement, config); + this.isLayoutCreated = true; + await this.uiManager.setlayout(); + } + this.rootElement.id = "maskEditor"; + this.rootElement.style.display = "flex"; + this.element.style.display = "flex"; + await this.uiManager.initUI(); + this.paintBucketTool.initPaintBucketTool(); + this.colorSelectTool.initColorSelectTool(); + await this.canvasHistory.saveInitialState(); + this.isOpen = true; + if (ComfyApp.clipspace && ComfyApp.clipspace.imgs) { + this.uiManager.setSidebarImage(); + } + this.keyboardManager.addListeners(); + } + cleanup() { + const maskEditors = document.querySelectorAll('[id^="maskEditor"]'); + maskEditors.forEach((element) => element.remove()); + const brushElements = document.querySelectorAll("#maskEditor_brush"); + brushElements.forEach((element) => element.remove()); + } + isOpened() { + return this.isOpen; + } + async save() { + const backupCanvas = document.createElement("canvas"); + const imageCanvas = this.uiManager.getImgCanvas(); + const maskCanvas = this.uiManager.getMaskCanvas(); + const image = this.uiManager.getImage(); + const backupCtx = backupCanvas.getContext("2d", { + willReadFrequently: true + }); + backupCanvas.width = imageCanvas.width; + backupCanvas.height = imageCanvas.height; + if (!backupCtx) { + return; + } + const maskImageLoaded = new Promise((resolve, reject) => { + const maskImage = new Image(); + maskImage.src = maskCanvas.toDataURL(); + maskImage.onload = () => { + resolve(); + }; + maskImage.onerror = (error) => { + reject(error); + }; + }); + try { + await maskImageLoaded; + } catch (error) { + console.error("Error loading mask image:", error); + return; + } + backupCtx.clearRect(0, 0, backupCanvas.width, backupCanvas.height); + backupCtx.drawImage( + maskCanvas, + 0, + 0, + maskCanvas.width, + maskCanvas.height, + 0, + 0, + backupCanvas.width, + backupCanvas.height + ); + let maskHasContent = false; + const maskData = backupCtx.getImageData( + 0, + 0, + backupCanvas.width, + backupCanvas.height + ); + for (let i = 0; i < maskData.data.length; i += 4) { + if (maskData.data[i + 3] !== 0) { + maskHasContent = true; + break; + } + } + const backupData = backupCtx.getImageData( + 0, + 0, + backupCanvas.width, + backupCanvas.height + ); + let backupHasContent = false; + for (let i = 0; i < backupData.data.length; i += 4) { + if (backupData.data[i + 3] !== 0) { + backupHasContent = true; + break; + } + } + if (maskHasContent && !backupHasContent) { + console.error("Mask appears to be empty"); + alert("Cannot save empty mask"); + return; + } + for (let i = 0; i < backupData.data.length; i += 4) { + const alpha = backupData.data[i + 3]; + backupData.data[i] = 0; + backupData.data[i + 1] = 0; + backupData.data[i + 2] = 0; + backupData.data[i + 3] = 255 - alpha; + } + backupCtx.globalCompositeOperation = "source-over"; + backupCtx.putImageData(backupData, 0, 0); + const formData = new FormData(); + const filename = "clipspace-mask-" + performance.now() + ".png"; + const item = { + filename, + subfolder: "clipspace", + type: "input" + }; + if (ComfyApp?.clipspace?.widgets?.length) { + const index = ComfyApp.clipspace.widgets.findIndex( + (obj) => obj?.name === "image" + ); + if (index >= 0 && item !== void 0) { + try { + ComfyApp.clipspace.widgets[index].value = item; + } catch (err2) { + console.warn("Failed to set widget value:", err2); + } + } + } + const dataURL = backupCanvas.toDataURL(); + const blob = this.dataURLToBlob(dataURL); + let original_url = new URL(image.src); + this.uiManager.setBrushOpacity(0); + const filenameRef = original_url.searchParams.get("filename"); + if (!filenameRef) { + throw new Error("filename parameter is required"); + } + const original_ref = { + filename: filenameRef + }; + let original_subfolder = original_url.searchParams.get("subfolder"); + if (original_subfolder) original_ref.subfolder = original_subfolder; + let original_type = original_url.searchParams.get("type"); + if (original_type) original_ref.type = original_type; + formData.append("image", blob, filename); + formData.append("original_ref", JSON.stringify(original_ref)); + formData.append("type", "input"); + formData.append("subfolder", "clipspace"); + this.uiManager.setSaveButtonText("Saving"); + this.uiManager.setSaveButtonEnabled(false); + this.keyboardManager.removeListeners(); + const maxRetries = 3; + let attempt = 0; + let success = false; + while (attempt < maxRetries && !success) { + try { + await this.uploadMask(item, formData); + success = true; + } catch (error) { + console.error(`Upload attempt ${attempt + 1} failed:`, error); + attempt++; + if (attempt < maxRetries) { + console.log("Retrying upload..."); + } else { + console.log("Max retries reached. Upload failed."); + } + } + } + if (success) { + ComfyApp.onClipspaceEditorSave(); + this.close(); + this.isOpen = false; + } else { + this.uiManager.setSaveButtonText("Save"); + this.uiManager.setSaveButtonEnabled(true); + this.keyboardManager.addListeners(); + } + } + getMessageBroker() { + return this.messageBroker; + } + // Helper function to convert a data URL to a Blob object + dataURLToBlob(dataURL) { + const parts = dataURL.split(";base64,"); + const contentType = parts[0].split(":")[1]; + const byteString = atob(parts[1]); + const arrayBuffer = new ArrayBuffer(byteString.length); + const uint8Array = new Uint8Array(arrayBuffer); + for (let i = 0; i < byteString.length; i++) { + uint8Array[i] = byteString.charCodeAt(i); + } + return new Blob([arrayBuffer], { type: contentType }); + } + async uploadMask(filepath, formData, retries = 3) { + if (retries <= 0) { + throw new Error("Max retries reached"); + return; + } + await api.fetchApi("/upload/mask", { + method: "POST", + body: formData + }).then((response) => { + if (!response.ok) { + console.log("Failed to upload mask:", response); + this.uploadMask(filepath, formData, 2); + } + }).catch((error) => { + console.error("Error:", error); + }); + try { + const selectedIndex = ComfyApp.clipspace?.selectedIndex; + if (ComfyApp.clipspace?.imgs && selectedIndex !== void 0) { + const newImage = new Image(); + newImage.src = api.apiURL( + "/view?" + new URLSearchParams(filepath).toString() + app.getPreviewFormatParam() + app.getRandParam() + ); + ComfyApp.clipspace.imgs[selectedIndex] = newImage; + if (ComfyApp.clipspace.images) { + ComfyApp.clipspace.images[selectedIndex] = filepath; + } + } + } catch (err2) { + console.warn("Failed to update clipspace image:", err2); + } + ClipspaceDialog.invalidatePreview(); + } +} +class CanvasHistory { + static { + __name(this, "CanvasHistory"); + } + maskEditor; + messageBroker; + canvas; + ctx; + states = []; + currentStateIndex = -1; + maxStates = 20; + initialized = false; + constructor(maskEditor, maxStates = 20) { + this.maskEditor = maskEditor; + this.messageBroker = maskEditor.getMessageBroker(); + this.maxStates = maxStates; + this.createListeners(); + } + async pullCanvas() { + this.canvas = await this.messageBroker.pull("maskCanvas"); + this.ctx = await this.messageBroker.pull("maskCtx"); + } + createListeners() { + this.messageBroker.subscribe("saveState", () => this.saveState()); + this.messageBroker.subscribe("undo", () => this.undo()); + this.messageBroker.subscribe("redo", () => this.redo()); + } + clearStates() { + this.states = []; + this.currentStateIndex = -1; + this.initialized = false; + } + async saveInitialState() { + await this.pullCanvas(); + if (!this.canvas.width || !this.canvas.height) { + requestAnimationFrame(() => this.saveInitialState()); + return; + } + this.clearStates(); + const state = this.ctx.getImageData( + 0, + 0, + this.canvas.width, + this.canvas.height + ); + this.states.push(state); + this.currentStateIndex = 0; + this.initialized = true; + } + saveState() { + if (!this.initialized || this.currentStateIndex === -1) { + this.saveInitialState(); + return; + } + this.states = this.states.slice(0, this.currentStateIndex + 1); + const state = this.ctx.getImageData( + 0, + 0, + this.canvas.width, + this.canvas.height + ); + this.states.push(state); + this.currentStateIndex++; + if (this.states.length > this.maxStates) { + this.states.shift(); + this.currentStateIndex--; + } + } + undo() { + if (this.states.length > 1 && this.currentStateIndex > 0) { + this.currentStateIndex--; + this.restoreState(this.states[this.currentStateIndex]); + } else { + alert("No more undo states available"); + } + } + redo() { + if (this.states.length > 1 && this.currentStateIndex < this.states.length - 1) { + this.currentStateIndex++; + this.restoreState(this.states[this.currentStateIndex]); + } else { + alert("No more redo states available"); + } + } + restoreState(state) { + if (state && this.initialized) { + this.ctx.putImageData(state, 0, 0); + } + } +} +class PaintBucketTool { + static { + __name(this, "PaintBucketTool"); + } + maskEditor; + messageBroker; + canvas; + ctx; + width = null; + height = null; + imageData = null; + data = null; + tolerance = 5; + constructor(maskEditor) { + this.maskEditor = maskEditor; + this.messageBroker = maskEditor.getMessageBroker(); + this.createListeners(); + this.addPullTopics(); + } + initPaintBucketTool() { + this.pullCanvas(); + } + async pullCanvas() { + this.canvas = await this.messageBroker.pull("maskCanvas"); + this.ctx = await this.messageBroker.pull("maskCtx"); + } + createListeners() { + this.messageBroker.subscribe( + "setPaintBucketTolerance", + (tolerance) => this.setTolerance(tolerance) + ); + this.messageBroker.subscribe( + "paintBucketFill", + (point) => this.floodFill(point) + ); + this.messageBroker.subscribe("invert", () => this.invertMask()); + } + addPullTopics() { + this.messageBroker.createPullTopic( + "getTolerance", + async () => this.tolerance + ); + } + getPixel(x, y) { + return this.data[(y * this.width + x) * 4 + 3]; + } + setPixel(x, y, alpha, color) { + const index = (y * this.width + x) * 4; + this.data[index] = color.r; + this.data[index + 1] = color.g; + this.data[index + 2] = color.b; + this.data[index + 3] = alpha; + } + shouldProcessPixel(currentAlpha, targetAlpha, tolerance, isFillMode) { + if (currentAlpha === -1) return false; + if (isFillMode) { + return currentAlpha !== 255 && Math.abs(currentAlpha - targetAlpha) <= tolerance; + } else { + return currentAlpha === 255 || Math.abs(currentAlpha - targetAlpha) <= tolerance; + } + } + async floodFill(point) { + let startX = Math.floor(point.x); + let startY = Math.floor(point.y); + this.width = this.canvas.width; + this.height = this.canvas.height; + if (startX < 0 || startX >= this.width || startY < 0 || startY >= this.height) { + return; + } + this.imageData = this.ctx.getImageData(0, 0, this.width, this.height); + this.data = this.imageData.data; + const targetAlpha = this.getPixel(startX, startY); + const isFillMode = targetAlpha !== 255; + if (targetAlpha === -1) return; + const maskColor = await this.messageBroker.pull("getMaskColor"); + const stack = []; + const visited = new Uint8Array(this.width * this.height); + if (this.shouldProcessPixel( + targetAlpha, + targetAlpha, + this.tolerance, + isFillMode + )) { + stack.push([startX, startY]); + } + while (stack.length > 0) { + const [x, y] = stack.pop(); + const visitedIndex = y * this.width + x; + if (visited[visitedIndex]) continue; + const currentAlpha = this.getPixel(x, y); + if (!this.shouldProcessPixel( + currentAlpha, + targetAlpha, + this.tolerance, + isFillMode + )) { + continue; + } + visited[visitedIndex] = 1; + this.setPixel(x, y, isFillMode ? 255 : 0, maskColor); + const checkNeighbor = /* @__PURE__ */ __name((nx, ny) => { + if (nx < 0 || nx >= this.width || ny < 0 || ny >= this.height) return; + if (!visited[ny * this.width + nx]) { + const alpha = this.getPixel(nx, ny); + if (this.shouldProcessPixel( + alpha, + targetAlpha, + this.tolerance, + isFillMode + )) { + stack.push([nx, ny]); + } + } + }, "checkNeighbor"); + checkNeighbor(x - 1, y); + checkNeighbor(x + 1, y); + checkNeighbor(x, y - 1); + checkNeighbor(x, y + 1); + } + this.ctx.putImageData(this.imageData, 0, 0); + this.imageData = null; + this.data = null; + } + setTolerance(tolerance) { + this.tolerance = tolerance; + } + getTolerance() { + return this.tolerance; + } + //invert mask + invertMask() { + const imageData = this.ctx.getImageData( + 0, + 0, + this.canvas.width, + this.canvas.height + ); + const data = imageData.data; + let maskR = 0, maskG = 0, maskB = 0; + for (let i = 0; i < data.length; i += 4) { + if (data[i + 3] > 0) { + maskR = data[i]; + maskG = data[i + 1]; + maskB = data[i + 2]; + break; + } + } + for (let i = 0; i < data.length; i += 4) { + const alpha = data[i + 3]; + data[i + 3] = 255 - alpha; + if (alpha === 0) { + data[i] = maskR; + data[i + 1] = maskG; + data[i + 2] = maskB; + } + } + this.ctx.putImageData(imageData, 0, 0); + this.messageBroker.publish("saveState"); + } +} +class ColorSelectTool { + static { + __name(this, "ColorSelectTool"); + } + maskEditor; + messageBroker; + width = null; + height = null; + canvas; + maskCTX; + imageCTX; + maskData = null; + imageData = null; + tolerance = 20; + livePreview = false; + lastPoint = null; + colorComparisonMethod = "simple"; + applyWholeImage = false; + maskBoundry = false; + maskTolerance = 0; + constructor(maskEditor) { + this.maskEditor = maskEditor; + this.messageBroker = maskEditor.getMessageBroker(); + this.createListeners(); + this.addPullTopics(); + } + async initColorSelectTool() { + await this.pullCanvas(); + } + async pullCanvas() { + this.canvas = await this.messageBroker.pull("imgCanvas"); + this.maskCTX = await this.messageBroker.pull("maskCtx"); + this.imageCTX = await this.messageBroker.pull("imageCtx"); + } + createListeners() { + this.messageBroker.subscribe( + "colorSelectFill", + (point) => this.fillColorSelection(point) + ); + this.messageBroker.subscribe( + "setColorSelectTolerance", + (tolerance) => this.setTolerance(tolerance) + ); + this.messageBroker.subscribe( + "setLivePreview", + (livePreview) => this.setLivePreview(livePreview) + ); + this.messageBroker.subscribe( + "setColorComparisonMethod", + (method) => this.setComparisonMethod(method) + ); + this.messageBroker.subscribe("clearLastPoint", () => this.clearLastPoint()); + this.messageBroker.subscribe( + "setWholeImage", + (applyWholeImage) => this.setApplyWholeImage(applyWholeImage) + ); + this.messageBroker.subscribe( + "setMaskBoundary", + (maskBoundry) => this.setMaskBoundary(maskBoundry) + ); + this.messageBroker.subscribe( + "setMaskTolerance", + (maskTolerance) => this.setMaskTolerance(maskTolerance) + ); + } + async addPullTopics() { + this.messageBroker.createPullTopic( + "getLivePreview", + async () => this.livePreview + ); + } + getPixel(x, y) { + const index = (y * this.width + x) * 4; + return { + r: this.imageData[index], + g: this.imageData[index + 1], + b: this.imageData[index + 2] + }; + } + getMaskAlpha(x, y) { + return this.maskData[(y * this.width + x) * 4 + 3]; + } + isPixelInRange(pixel, target) { + switch (this.colorComparisonMethod) { + case "simple": + return this.isPixelInRangeSimple(pixel, target); + case "hsl": + return this.isPixelInRangeHSL(pixel, target); + case "lab": + return this.isPixelInRangeLab(pixel, target); + default: + return this.isPixelInRangeSimple(pixel, target); + } + } + isPixelInRangeSimple(pixel, target) { + const distance = Math.sqrt( + Math.pow(pixel.r - target.r, 2) + Math.pow(pixel.g - target.g, 2) + Math.pow(pixel.b - target.b, 2) + ); + return distance <= this.tolerance; + } + isPixelInRangeHSL(pixel, target) { + const pixelHSL = this.rgbToHSL(pixel.r, pixel.g, pixel.b); + const targetHSL = this.rgbToHSL(target.r, target.g, target.b); + const hueDiff = Math.abs(pixelHSL.h - targetHSL.h); + const satDiff = Math.abs(pixelHSL.s - targetHSL.s); + const lightDiff = Math.abs(pixelHSL.l - targetHSL.l); + const distance = Math.sqrt( + Math.pow(hueDiff / 360 * 255, 2) + Math.pow(satDiff / 100 * 255, 2) + Math.pow(lightDiff / 100 * 255, 2) + ); + return distance <= this.tolerance; + } + rgbToHSL(r, g, b) { + r /= 255; + g /= 255; + b /= 255; + const max2 = Math.max(r, g, b); + const min = Math.min(r, g, b); + let h = 0, s = 0, l = (max2 + min) / 2; + if (max2 !== min) { + const d = max2 - min; + s = l > 0.5 ? d / (2 - max2 - min) : d / (max2 + min); + switch (max2) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: h * 360, + s: s * 100, + l: l * 100 + }; + } + isPixelInRangeLab(pixel, target) { + const pixelLab = this.rgbToLab(pixel); + const targetLab = this.rgbToLab(target); + const deltaE = Math.sqrt( + Math.pow(pixelLab.l - targetLab.l, 2) + Math.pow(pixelLab.a - targetLab.a, 2) + Math.pow(pixelLab.b - targetLab.b, 2) + ); + const normalizedDeltaE = deltaE / 100 * 255; + return normalizedDeltaE <= this.tolerance; + } + rgbToLab(rgb) { + let r = rgb.r / 255; + let g = rgb.g / 255; + let b = rgb.b / 255; + r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92; + g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92; + b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92; + r *= 100; + g *= 100; + b *= 100; + const x = r * 0.4124 + g * 0.3576 + b * 0.1805; + const y = r * 0.2126 + g * 0.7152 + b * 0.0722; + const z = r * 0.0193 + g * 0.1192 + b * 0.9505; + const xn = 95.047; + const yn = 100; + const zn = 108.883; + const xyz = [x / xn, y / yn, z / zn]; + for (let i = 0; i < xyz.length; i++) { + xyz[i] = xyz[i] > 8856e-6 ? Math.pow(xyz[i], 1 / 3) : 7.787 * xyz[i] + 16 / 116; + } + return { + l: 116 * xyz[1] - 16, + a: 500 * (xyz[0] - xyz[1]), + b: 200 * (xyz[1] - xyz[2]) + }; + } + setPixel(x, y, alpha, color) { + const index = (y * this.width + x) * 4; + this.maskData[index] = color.r; + this.maskData[index + 1] = color.g; + this.maskData[index + 2] = color.b; + this.maskData[index + 3] = alpha; + } + async fillColorSelection(point) { + this.width = this.canvas.width; + this.height = this.canvas.height; + this.lastPoint = point; + const maskData = this.maskCTX.getImageData(0, 0, this.width, this.height); + this.maskData = maskData.data; + this.imageData = this.imageCTX.getImageData( + 0, + 0, + this.width, + this.height + ).data; + if (this.applyWholeImage) { + const targetPixel = this.getPixel( + Math.floor(point.x), + Math.floor(point.y) + ); + const maskColor = await this.messageBroker.pull("getMaskColor"); + const width = this.width; + const height = this.height; + const CHUNK_SIZE = 1e4; + for (let i = 0; i < width * height; i += CHUNK_SIZE) { + const endIndex = Math.min(i + CHUNK_SIZE, width * height); + for (let pixelIndex = i; pixelIndex < endIndex; pixelIndex++) { + const x = pixelIndex % width; + const y = Math.floor(pixelIndex / width); + if (this.isPixelInRange(this.getPixel(x, y), targetPixel)) { + this.setPixel(x, y, 255, maskColor); + } + } + await new Promise((resolve) => setTimeout(resolve, 0)); + } + } else { + let startX = Math.floor(point.x); + let startY = Math.floor(point.y); + if (startX < 0 || startX >= this.width || startY < 0 || startY >= this.height) { + return; + } + const pixel = this.getPixel(startX, startY); + const stack = []; + const visited = new Uint8Array(this.width * this.height); + stack.push([startX, startY]); + const maskColor = await this.messageBroker.pull("getMaskColor"); + while (stack.length > 0) { + const [x, y] = stack.pop(); + const visitedIndex = y * this.width + x; + if (visited[visitedIndex] || !this.isPixelInRange(this.getPixel(x, y), pixel)) { + continue; + } + visited[visitedIndex] = 1; + this.setPixel(x, y, 255, maskColor); + if (x > 0 && !visited[y * this.width + (x - 1)] && this.isPixelInRange(this.getPixel(x - 1, y), pixel)) { + if (!this.maskBoundry || 255 - this.getMaskAlpha(x - 1, y) > this.maskTolerance) { + stack.push([x - 1, y]); + } + } + if (x < this.width - 1 && !visited[y * this.width + (x + 1)] && this.isPixelInRange(this.getPixel(x + 1, y), pixel)) { + if (!this.maskBoundry || 255 - this.getMaskAlpha(x + 1, y) > this.maskTolerance) { + stack.push([x + 1, y]); + } + } + if (y > 0 && !visited[(y - 1) * this.width + x] && this.isPixelInRange(this.getPixel(x, y - 1), pixel)) { + if (!this.maskBoundry || 255 - this.getMaskAlpha(x, y - 1) > this.maskTolerance) { + stack.push([x, y - 1]); + } + } + if (y < this.height - 1 && !visited[(y + 1) * this.width + x] && this.isPixelInRange(this.getPixel(x, y + 1), pixel)) { + if (!this.maskBoundry || 255 - this.getMaskAlpha(x, y + 1) > this.maskTolerance) { + stack.push([x, y + 1]); + } + } + } + } + this.maskCTX.putImageData(maskData, 0, 0); + this.messageBroker.publish("saveState"); + this.maskData = null; + this.imageData = null; + } + setTolerance(tolerance) { + this.tolerance = tolerance; + if (this.lastPoint && this.livePreview) { + this.messageBroker.publish("undo"); + this.fillColorSelection(this.lastPoint); + } + } + setLivePreview(livePreview) { + this.livePreview = livePreview; + } + setComparisonMethod(method) { + this.colorComparisonMethod = method; + if (this.lastPoint && this.livePreview) { + this.messageBroker.publish("undo"); + this.fillColorSelection(this.lastPoint); + } + } + clearLastPoint() { + this.lastPoint = null; + } + setApplyWholeImage(applyWholeImage) { + this.applyWholeImage = applyWholeImage; + } + setMaskBoundary(maskBoundry) { + this.maskBoundry = maskBoundry; + } + setMaskTolerance(maskTolerance) { + this.maskTolerance = maskTolerance; + } +} +class BrushTool { + static { + __name(this, "BrushTool"); + } + brushSettings; + //this saves the current brush settings + maskBlendMode; + isDrawing = false; + isDrawingLine = false; + lineStartPoint = null; + smoothingPrecision = 10; + smoothingCordsArray = []; + smoothingLastDrawTime; + maskCtx = null; + initialDraw = true; + brushStrokeCanvas = null; + brushStrokeCtx = null; + //brush adjustment + isBrushAdjusting = false; + brushPreviewGradient = null; + initialPoint = null; + useDominantAxis = false; + brushAdjustmentSpeed = 1; + maskEditor; + messageBroker; + constructor(maskEditor) { + this.maskEditor = maskEditor; + this.messageBroker = maskEditor.getMessageBroker(); + this.createListeners(); + this.addPullTopics(); + this.useDominantAxis = app.extensionManager.setting.get( + "Comfy.MaskEditor.UseDominantAxis" + ); + this.brushAdjustmentSpeed = app.extensionManager.setting.get( + "Comfy.MaskEditor.BrushAdjustmentSpeed" + ); + this.brushSettings = { + size: 10, + opacity: 100, + hardness: 1, + type: "arc" + /* Arc */ + }; + this.maskBlendMode = "black"; + } + createListeners() { + this.messageBroker.subscribe( + "setBrushSize", + (size) => this.setBrushSize(size) + ); + this.messageBroker.subscribe( + "setBrushOpacity", + (opacity) => this.setBrushOpacity(opacity) + ); + this.messageBroker.subscribe( + "setBrushHardness", + (hardness) => this.setBrushHardness(hardness) + ); + this.messageBroker.subscribe( + "setBrushShape", + (type) => this.setBrushType(type) + ); + this.messageBroker.subscribe( + "setBrushSmoothingPrecision", + (precision) => this.setBrushSmoothingPrecision(precision) + ); + this.messageBroker.subscribe( + "brushAdjustmentStart", + (event) => this.startBrushAdjustment(event) + ); + this.messageBroker.subscribe( + "brushAdjustment", + (event) => this.handleBrushAdjustment(event) + ); + this.messageBroker.subscribe( + "drawStart", + (event) => this.startDrawing(event) + ); + this.messageBroker.subscribe( + "draw", + (event) => this.handleDrawing(event) + ); + this.messageBroker.subscribe( + "drawEnd", + (event) => this.drawEnd(event) + ); + } + addPullTopics() { + this.messageBroker.createPullTopic( + "brushSize", + async () => this.brushSettings.size + ); + this.messageBroker.createPullTopic( + "brushOpacity", + async () => this.brushSettings.opacity + ); + this.messageBroker.createPullTopic( + "brushHardness", + async () => this.brushSettings.hardness + ); + this.messageBroker.createPullTopic( + "brushType", + async () => this.brushSettings.type + ); + this.messageBroker.createPullTopic( + "maskBlendMode", + async () => this.maskBlendMode + ); + this.messageBroker.createPullTopic( + "brushSettings", + async () => this.brushSettings + ); + } + async createBrushStrokeCanvas() { + if (this.brushStrokeCanvas !== null) { + return; + } + const maskCanvas = await this.messageBroker.pull("maskCanvas"); + const canvas = document.createElement("canvas"); + canvas.width = maskCanvas.width; + canvas.height = maskCanvas.height; + this.brushStrokeCanvas = canvas; + this.brushStrokeCtx = canvas.getContext("2d"); + } + async startDrawing(event) { + this.isDrawing = true; + let compositionOp; + let currentTool = await this.messageBroker.pull("currentTool"); + let coords = { x: event.offsetX, y: event.offsetY }; + let coords_canvas = await this.messageBroker.pull("screenToCanvas", coords); + await this.createBrushStrokeCanvas(); + if (currentTool === "eraser" || event.buttons == 2) { + compositionOp = "destination-out"; + } else { + compositionOp = "source-over"; + } + if (event.shiftKey && this.lineStartPoint) { + this.isDrawingLine = true; + this.drawLine(this.lineStartPoint, coords_canvas, compositionOp); + } else { + this.isDrawingLine = false; + this.init_shape(compositionOp); + this.draw_shape(coords_canvas); + } + this.lineStartPoint = coords_canvas; + this.smoothingCordsArray = [coords_canvas]; + this.smoothingLastDrawTime = /* @__PURE__ */ new Date(); + } + async handleDrawing(event) { + var diff = performance.now() - this.smoothingLastDrawTime.getTime(); + let coords = { x: event.offsetX, y: event.offsetY }; + let coords_canvas = await this.messageBroker.pull("screenToCanvas", coords); + let currentTool = await this.messageBroker.pull("currentTool"); + if (diff > 20 && !this.isDrawing) + requestAnimationFrame(() => { + this.init_shape( + "source-over" + /* SourceOver */ + ); + this.draw_shape(coords_canvas); + this.smoothingCordsArray.push(coords_canvas); + }); + else + requestAnimationFrame(() => { + if (currentTool === "eraser" || event.buttons == 2) { + this.init_shape( + "destination-out" + /* DestinationOut */ + ); + } else { + this.init_shape( + "source-over" + /* SourceOver */ + ); + } + this.drawWithBetterSmoothing(coords_canvas); + }); + this.smoothingLastDrawTime = /* @__PURE__ */ new Date(); + } + async drawEnd(event) { + const coords = { x: event.offsetX, y: event.offsetY }; + const coords_canvas = await this.messageBroker.pull( + "screenToCanvas", + coords + ); + if (this.isDrawing) { + this.isDrawing = false; + this.messageBroker.publish("saveState"); + this.lineStartPoint = coords_canvas; + this.initialDraw = true; + } + } + drawWithBetterSmoothing(point) { + if (!this.smoothingCordsArray) { + this.smoothingCordsArray = []; + } + const opacityConstant = 1 / (1 + Math.exp(3)); + const interpolatedOpacity = 1 / (1 + Math.exp(-6 * (this.brushSettings.opacity - 0.5))) - opacityConstant; + this.smoothingCordsArray.push(point); + const POINTS_NR = 5; + if (this.smoothingCordsArray.length < POINTS_NR) { + return; + } + let totalLength = 0; + const points = this.smoothingCordsArray; + const len = points.length - 1; + let dx, dy; + for (let i = 0; i < len; i++) { + dx = points[i + 1].x - points[i].x; + dy = points[i + 1].y - points[i].y; + totalLength += Math.sqrt(dx * dx + dy * dy); + } + const distanceBetweenPoints = this.brushSettings.size / this.smoothingPrecision * 6; + const stepNr = Math.ceil(totalLength / distanceBetweenPoints); + let interpolatedPoints = points; + if (stepNr > 0) { + interpolatedPoints = this.generateEquidistantPoints( + this.smoothingCordsArray, + distanceBetweenPoints + // Distance between interpolated points + ); + } + if (!this.initialDraw) { + const spliceIndex = interpolatedPoints.findIndex( + (point2) => point2.x === this.smoothingCordsArray[2].x && point2.y === this.smoothingCordsArray[2].y + ); + if (spliceIndex !== -1) { + interpolatedPoints = interpolatedPoints.slice(spliceIndex + 1); + } + } + for (const point2 of interpolatedPoints) { + this.draw_shape(point2, interpolatedOpacity); + } + if (!this.initialDraw) { + this.smoothingCordsArray = this.smoothingCordsArray.slice(2); + } else { + this.initialDraw = false; + } + } + async drawLine(p1, p2, compositionOp) { + const brush_size = await this.messageBroker.pull("brushSize"); + const distance = Math.sqrt((p2.x - p1.x) ** 2 + (p2.y - p1.y) ** 2); + const steps = Math.ceil( + distance / (brush_size / this.smoothingPrecision * 4) + ); + const interpolatedOpacity = 1 / (1 + Math.exp(-6 * (this.brushSettings.opacity - 0.5))) - 1 / (1 + Math.exp(3)); + this.init_shape(compositionOp); + for (let i = 0; i <= steps; i++) { + const t2 = i / steps; + const x = p1.x + (p2.x - p1.x) * t2; + const y = p1.y + (p2.y - p1.y) * t2; + const point = { x, y }; + this.draw_shape(point, interpolatedOpacity); + } + } + //brush adjustment + async startBrushAdjustment(event) { + event.preventDefault(); + const coords = { x: event.offsetX, y: event.offsetY }; + let coords_canvas = await this.messageBroker.pull("screenToCanvas", coords); + this.messageBroker.publish("setBrushPreviewGradientVisibility", true); + this.initialPoint = coords_canvas; + this.isBrushAdjusting = true; + return; + } + async handleBrushAdjustment(event) { + const coords = { x: event.offsetX, y: event.offsetY }; + const brushDeadZone = 5; + let coords_canvas = await this.messageBroker.pull("screenToCanvas", coords); + const delta_x = coords_canvas.x - this.initialPoint.x; + const delta_y = coords_canvas.y - this.initialPoint.y; + const effectiveDeltaX = Math.abs(delta_x) < brushDeadZone ? 0 : delta_x; + const effectiveDeltaY = Math.abs(delta_y) < brushDeadZone ? 0 : delta_y; + let finalDeltaX = effectiveDeltaX; + let finalDeltaY = effectiveDeltaY; + console.log(this.useDominantAxis); + if (this.useDominantAxis) { + const ratio = Math.abs(effectiveDeltaX) / Math.abs(effectiveDeltaY); + const threshold = 2; + if (ratio > threshold) { + finalDeltaY = 0; + } else if (ratio < 1 / threshold) { + finalDeltaX = 0; + } + } + const cappedDeltaX = Math.max(-100, Math.min(100, finalDeltaX)); + const cappedDeltaY = Math.max(-100, Math.min(100, finalDeltaY)); + const sizeDelta = cappedDeltaX / 40; + const hardnessDelta = cappedDeltaY / 800; + const newSize = Math.max( + 1, + Math.min( + 100, + this.brushSettings.size + cappedDeltaX / 35 * this.brushAdjustmentSpeed + ) + ); + const newHardness = Math.max( + 0, + Math.min( + 1, + this.brushSettings.hardness - cappedDeltaY / 4e3 * this.brushAdjustmentSpeed + ) + ); + this.brushSettings.size = newSize; + this.brushSettings.hardness = newHardness; + this.messageBroker.publish("updateBrushPreview"); + } + //helper functions + async draw_shape(point, overrideOpacity) { + const brushSettings = this.brushSettings; + const maskCtx = this.maskCtx || await this.messageBroker.pull("maskCtx"); + const brushType = await this.messageBroker.pull("brushType"); + const maskColor = await this.messageBroker.pull("getMaskColor"); + const size = brushSettings.size; + const sliderOpacity = brushSettings.opacity; + const opacity = overrideOpacity == void 0 ? sliderOpacity : overrideOpacity; + const hardness = brushSettings.hardness; + const x = point.x; + const y = point.y; + const extendedSize = size * (2 - hardness); + let gradient = maskCtx.createRadialGradient(x, y, 0, x, y, extendedSize); + const isErasing = maskCtx.globalCompositeOperation === "destination-out"; + if (hardness === 1) { + console.log(sliderOpacity, opacity); + gradient.addColorStop( + 0, + isErasing ? `rgba(255, 255, 255, ${opacity})` : `rgba(${maskColor.r}, ${maskColor.g}, ${maskColor.b}, ${opacity})` + ); + gradient.addColorStop( + 1, + isErasing ? `rgba(255, 255, 255, ${opacity})` : `rgba(${maskColor.r}, ${maskColor.g}, ${maskColor.b}, ${opacity})` + ); + } else { + let softness = 1 - hardness; + let innerStop = Math.max(0, hardness - softness); + let outerStop = size / extendedSize; + if (isErasing) { + gradient.addColorStop(0, `rgba(255, 255, 255, ${opacity})`); + gradient.addColorStop(innerStop, `rgba(255, 255, 255, ${opacity})`); + gradient.addColorStop(outerStop, `rgba(255, 255, 255, ${opacity / 2})`); + gradient.addColorStop(1, `rgba(255, 255, 255, 0)`); + } else { + gradient.addColorStop( + 0, + `rgba(${maskColor.r}, ${maskColor.g}, ${maskColor.b}, ${opacity})` + ); + gradient.addColorStop( + innerStop, + `rgba(${maskColor.r}, ${maskColor.g}, ${maskColor.b}, ${opacity})` + ); + gradient.addColorStop( + outerStop, + `rgba(${maskColor.r}, ${maskColor.g}, ${maskColor.b}, ${opacity / 2})` + ); + gradient.addColorStop( + 1, + `rgba(${maskColor.r}, ${maskColor.g}, ${maskColor.b}, 0)` + ); + } + } + maskCtx.fillStyle = gradient; + maskCtx.beginPath(); + if (brushType === "rect") { + maskCtx.rect( + x - extendedSize, + y - extendedSize, + extendedSize * 2, + extendedSize * 2 + ); + } else { + maskCtx.arc(x, y, extendedSize, 0, Math.PI * 2, false); + } + maskCtx.fill(); + } + async init_shape(compositionOperation) { + const maskBlendMode = await this.messageBroker.pull("maskBlendMode"); + const maskCtx = this.maskCtx || await this.messageBroker.pull("maskCtx"); + maskCtx.beginPath(); + if (compositionOperation == "source-over") { + maskCtx.fillStyle = maskBlendMode; + maskCtx.globalCompositeOperation = "source-over"; + } else if (compositionOperation == "destination-out") { + maskCtx.globalCompositeOperation = "destination-out"; + } + } + calculateCubicSplinePoints(points, numSegments = 10) { + const result = []; + const xCoords = points.map((p) => p.x); + const yCoords = points.map((p) => p.y); + const xDerivatives = this.calculateSplineCoefficients(xCoords); + const yDerivatives = this.calculateSplineCoefficients(yCoords); + for (let i = 0; i < points.length - 1; i++) { + const p0 = points[i]; + const p1 = points[i + 1]; + const d0x = xDerivatives[i]; + const d1x = xDerivatives[i + 1]; + const d0y = yDerivatives[i]; + const d1y = yDerivatives[i + 1]; + for (let t2 = 0; t2 <= numSegments; t2++) { + const t_normalized = t2 / numSegments; + const h00 = 2 * t_normalized ** 3 - 3 * t_normalized ** 2 + 1; + const h10 = t_normalized ** 3 - 2 * t_normalized ** 2 + t_normalized; + const h01 = -2 * t_normalized ** 3 + 3 * t_normalized ** 2; + const h11 = t_normalized ** 3 - t_normalized ** 2; + const x = h00 * p0.x + h10 * d0x + h01 * p1.x + h11 * d1x; + const y = h00 * p0.y + h10 * d0y + h01 * p1.y + h11 * d1y; + result.push({ x, y }); + } + } + return result; + } + generateEvenlyDistributedPoints(splinePoints, numPoints) { + const distances = [0]; + for (let i = 1; i < splinePoints.length; i++) { + const dx = splinePoints[i].x - splinePoints[i - 1].x; + const dy = splinePoints[i].y - splinePoints[i - 1].y; + const dist = Math.hypot(dx, dy); + distances.push(distances[i - 1] + dist); + } + const totalLength = distances[distances.length - 1]; + const interval = totalLength / (numPoints - 1); + const result = []; + let currentIndex = 0; + for (let i = 0; i < numPoints; i++) { + const targetDistance = i * interval; + while (currentIndex < distances.length - 1 && distances[currentIndex + 1] < targetDistance) { + currentIndex++; + } + const t2 = (targetDistance - distances[currentIndex]) / (distances[currentIndex + 1] - distances[currentIndex]); + const x = splinePoints[currentIndex].x + t2 * (splinePoints[currentIndex + 1].x - splinePoints[currentIndex].x); + const y = splinePoints[currentIndex].y + t2 * (splinePoints[currentIndex + 1].y - splinePoints[currentIndex].y); + result.push({ x, y }); + } + return result; + } + generateEquidistantPoints(points, distance) { + const result = []; + const cumulativeDistances = [0]; + for (let i = 1; i < points.length; i++) { + const dx = points[i].x - points[i - 1].x; + const dy = points[i].y - points[i - 1].y; + const dist = Math.hypot(dx, dy); + cumulativeDistances[i] = cumulativeDistances[i - 1] + dist; + } + const totalLength = cumulativeDistances[cumulativeDistances.length - 1]; + const numPoints = Math.floor(totalLength / distance); + for (let i = 0; i <= numPoints; i++) { + const targetDistance = i * distance; + let idx = 0; + while (idx < cumulativeDistances.length - 1 && cumulativeDistances[idx + 1] < targetDistance) { + idx++; + } + if (idx >= points.length - 1) { + result.push(points[points.length - 1]); + continue; + } + const d0 = cumulativeDistances[idx]; + const d1 = cumulativeDistances[idx + 1]; + const t2 = (targetDistance - d0) / (d1 - d0); + const x = points[idx].x + t2 * (points[idx + 1].x - points[idx].x); + const y = points[idx].y + t2 * (points[idx + 1].y - points[idx].y); + result.push({ x, y }); + } + return result; + } + calculateSplineCoefficients(values) { + const n = values.length - 1; + const matrix = new Array(n + 1).fill(0).map(() => new Array(n + 1).fill(0)); + const rhs = new Array(n + 1).fill(0); + for (let i = 1; i < n; i++) { + matrix[i][i - 1] = 1; + matrix[i][i] = 4; + matrix[i][i + 1] = 1; + rhs[i] = 3 * (values[i + 1] - values[i - 1]); + } + matrix[0][0] = 2; + matrix[0][1] = 1; + matrix[n][n - 1] = 1; + matrix[n][n] = 2; + rhs[0] = 3 * (values[1] - values[0]); + rhs[n] = 3 * (values[n] - values[n - 1]); + for (let i = 1; i <= n; i++) { + const m = matrix[i][i - 1] / matrix[i - 1][i - 1]; + matrix[i][i] -= m * matrix[i - 1][i]; + rhs[i] -= m * rhs[i - 1]; + } + const solution = new Array(n + 1); + solution[n] = rhs[n] / matrix[n][n]; + for (let i = n - 1; i >= 0; i--) { + solution[i] = (rhs[i] - matrix[i][i + 1] * solution[i + 1]) / matrix[i][i]; + } + return solution; + } + setBrushSize(size) { + this.brushSettings.size = size; + } + setBrushOpacity(opacity) { + this.brushSettings.opacity = opacity; + } + setBrushHardness(hardness) { + this.brushSettings.hardness = hardness; + } + setBrushType(type) { + this.brushSettings.type = type; + } + setBrushSmoothingPrecision(precision) { + this.smoothingPrecision = precision; + } +} +class UIManager { + static { + __name(this, "UIManager"); + } + rootElement; + brush; + brushPreviewGradient; + maskCtx; + imageCtx; + maskCanvas; + imgCanvas; + brushSettingsHTML; + paintBucketSettingsHTML; + colorSelectSettingsHTML; + maskOpacitySlider; + brushHardnessSlider; + brushSizeSlider; + brushOpacitySlider; + sidebarImage; + saveButton; + toolPanel; + sidePanel; + pointerZone; + canvasBackground; + canvasContainer; + image; + imageURL; + darkMode = true; + maskEditor; + messageBroker; + mask_opacity = 1; + maskBlendMode = "black"; + zoomTextHTML; + dimensionsTextHTML; + constructor(rootElement, maskEditor) { + this.rootElement = rootElement; + this.maskEditor = maskEditor; + this.messageBroker = maskEditor.getMessageBroker(); + this.addListeners(); + this.addPullTopics(); + } + addListeners() { + this.messageBroker.subscribe( + "updateBrushPreview", + async () => this.updateBrushPreview() + ); + this.messageBroker.subscribe( + "paintBucketCursor", + (isPaintBucket) => this.handlePaintBucketCursor(isPaintBucket) + ); + this.messageBroker.subscribe( + "panCursor", + (isPan) => this.handlePanCursor(isPan) + ); + this.messageBroker.subscribe( + "setBrushVisibility", + (isVisible) => this.setBrushVisibility(isVisible) + ); + this.messageBroker.subscribe( + "setBrushPreviewGradientVisibility", + (isVisible) => this.setBrushPreviewGradientVisibility(isVisible) + ); + this.messageBroker.subscribe("updateCursor", () => this.updateCursor()); + this.messageBroker.subscribe( + "setZoomText", + (text) => this.setZoomText(text) + ); + } + addPullTopics() { + this.messageBroker.createPullTopic( + "maskCanvas", + async () => this.maskCanvas + ); + this.messageBroker.createPullTopic("maskCtx", async () => this.maskCtx); + this.messageBroker.createPullTopic("imageCtx", async () => this.imageCtx); + this.messageBroker.createPullTopic("imgCanvas", async () => this.imgCanvas); + this.messageBroker.createPullTopic( + "screenToCanvas", + async (coords) => this.screenToCanvas(coords) + ); + this.messageBroker.createPullTopic( + "getCanvasContainer", + async () => this.canvasContainer + ); + this.messageBroker.createPullTopic( + "getMaskColor", + async () => this.getMaskColor() + ); + } + async setlayout() { + this.detectLightMode(); + var user_ui = await this.createUI(); + var canvasContainer = this.createBackgroundUI(); + var brush = await this.createBrush(); + await this.setBrushBorderRadius(); + this.setBrushOpacity(1); + this.rootElement.appendChild(canvasContainer); + this.rootElement.appendChild(user_ui); + document.body.appendChild(brush); + } + async createUI() { + var ui_container = document.createElement("div"); + ui_container.id = "maskEditor_uiContainer"; + var top_bar = await this.createTopBar(); + var ui_horizontal_container = document.createElement("div"); + ui_horizontal_container.id = "maskEditor_uiHorizontalContainer"; + var side_panel_container = await this.createSidePanel(); + var pointer_zone = this.createPointerZone(); + var tool_panel = this.createToolPanel(); + ui_horizontal_container.appendChild(tool_panel); + ui_horizontal_container.appendChild(pointer_zone); + ui_horizontal_container.appendChild(side_panel_container); + ui_container.appendChild(top_bar); + ui_container.appendChild(ui_horizontal_container); + return ui_container; + } + createBackgroundUI() { + const canvasContainer = document.createElement("div"); + canvasContainer.id = "maskEditorCanvasContainer"; + const imgCanvas = document.createElement("canvas"); + imgCanvas.id = "imageCanvas"; + const maskCanvas = document.createElement("canvas"); + maskCanvas.id = "maskCanvas"; + const canvas_background = document.createElement("div"); + canvas_background.id = "canvasBackground"; + canvasContainer.appendChild(imgCanvas); + canvasContainer.appendChild(maskCanvas); + canvasContainer.appendChild(canvas_background); + this.imgCanvas = imgCanvas; + this.maskCanvas = maskCanvas; + this.canvasContainer = canvasContainer; + this.canvasBackground = canvas_background; + let maskCtx = maskCanvas.getContext("2d", { willReadFrequently: true }); + if (maskCtx) { + this.maskCtx = maskCtx; + } + let imgCtx = imgCanvas.getContext("2d", { willReadFrequently: true }); + if (imgCtx) { + this.imageCtx = imgCtx; + } + this.setEventHandler(); + this.imgCanvas.style.position = "absolute"; + this.maskCanvas.style.position = "absolute"; + this.imgCanvas.style.top = "200"; + this.imgCanvas.style.left = "0"; + this.maskCanvas.style.top = this.imgCanvas.style.top; + this.maskCanvas.style.left = this.imgCanvas.style.left; + const maskCanvasStyle = this.getMaskCanvasStyle(); + this.maskCanvas.style.mixBlendMode = maskCanvasStyle.mixBlendMode; + this.maskCanvas.style.opacity = maskCanvasStyle.opacity.toString(); + return canvasContainer; + } + async setBrushBorderRadius() { + const brushSettings = await this.messageBroker.pull("brushSettings"); + if (brushSettings.type === "rect") { + this.brush.style.borderRadius = "0%"; + this.brush.style.MozBorderRadius = "0%"; + this.brush.style.WebkitBorderRadius = "0%"; + } else { + this.brush.style.borderRadius = "50%"; + this.brush.style.MozBorderRadius = "50%"; + this.brush.style.WebkitBorderRadius = "50%"; + } + } + async initUI() { + this.saveButton.innerText = "Save"; + this.saveButton.disabled = false; + await this.setImages(this.imgCanvas); + } + async createSidePanel() { + const side_panel = this.createContainer(true); + side_panel.id = "maskEditor_sidePanel"; + const brush_settings = await this.createBrushSettings(); + brush_settings.id = "maskEditor_brushSettings"; + this.brushSettingsHTML = brush_settings; + const paint_bucket_settings = await this.createPaintBucketSettings(); + paint_bucket_settings.id = "maskEditor_paintBucketSettings"; + this.paintBucketSettingsHTML = paint_bucket_settings; + const color_select_settings = await this.createColorSelectSettings(); + color_select_settings.id = "maskEditor_colorSelectSettings"; + this.colorSelectSettingsHTML = color_select_settings; + const image_layer_settings = await this.createImageLayerSettings(); + const separator = this.createSeparator(); + side_panel.appendChild(brush_settings); + side_panel.appendChild(paint_bucket_settings); + side_panel.appendChild(color_select_settings); + side_panel.appendChild(separator); + side_panel.appendChild(image_layer_settings); + return side_panel; + } + async createBrushSettings() { + const shapeColor = this.darkMode ? "maskEditor_brushShape_dark" : "maskEditor_brushShape_light"; + const brush_settings_container = this.createContainer(true); + const brush_settings_title = this.createHeadline("Brush Settings"); + const brush_shape_outer_container = this.createContainer(true); + const brush_shape_title = this.createContainerTitle("Brush Shape"); + const brush_shape_container = this.createContainer(false); + const accentColor = this.darkMode ? "maskEditor_accent_bg_dark" : "maskEditor_accent_bg_light"; + brush_shape_container.classList.add(accentColor); + brush_shape_container.classList.add("maskEditor_layerRow"); + const circle_shape = document.createElement("div"); + circle_shape.id = "maskEditor_sidePanelBrushShapeCircle"; + circle_shape.classList.add(shapeColor); + circle_shape.style.background = "var(--p-button-text-primary-color)"; + circle_shape.addEventListener("click", () => { + this.messageBroker.publish( + "setBrushShape", + "arc" + /* Arc */ + ); + this.setBrushBorderRadius(); + circle_shape.style.background = "var(--p-button-text-primary-color)"; + square_shape.style.background = ""; + }); + const square_shape = document.createElement("div"); + square_shape.id = "maskEditor_sidePanelBrushShapeSquare"; + square_shape.classList.add(shapeColor); + square_shape.style.background = ""; + square_shape.addEventListener("click", () => { + this.messageBroker.publish( + "setBrushShape", + "rect" + /* Rect */ + ); + this.setBrushBorderRadius(); + square_shape.style.background = "var(--p-button-text-primary-color)"; + circle_shape.style.background = ""; + }); + brush_shape_container.appendChild(circle_shape); + brush_shape_container.appendChild(square_shape); + brush_shape_outer_container.appendChild(brush_shape_title); + brush_shape_outer_container.appendChild(brush_shape_container); + const thicknesSliderObj = this.createSlider( + "Thickness", + 1, + 100, + 1, + 10, + (event, value) => { + this.messageBroker.publish("setBrushSize", parseInt(value)); + this.updateBrushPreview(); + } + ); + this.brushSizeSlider = thicknesSliderObj.slider; + const opacitySliderObj = this.createSlider( + "Opacity", + 0, + 1, + 0.01, + 0.7, + (event, value) => { + this.messageBroker.publish("setBrushOpacity", parseFloat(value)); + this.updateBrushPreview(); + } + ); + this.brushOpacitySlider = opacitySliderObj.slider; + const hardnessSliderObj = this.createSlider( + "Hardness", + 0, + 1, + 0.01, + 1, + (event, value) => { + this.messageBroker.publish("setBrushHardness", parseFloat(value)); + this.updateBrushPreview(); + } + ); + this.brushHardnessSlider = hardnessSliderObj.slider; + const brushSmoothingPrecisionSliderObj = this.createSlider( + "Smoothing Precision", + 1, + 100, + 1, + 10, + (event, value) => { + this.messageBroker.publish( + "setBrushSmoothingPrecision", + parseInt(value) + ); + } + ); + brush_settings_container.appendChild(brush_settings_title); + brush_settings_container.appendChild(brush_shape_outer_container); + brush_settings_container.appendChild(thicknesSliderObj.container); + brush_settings_container.appendChild(opacitySliderObj.container); + brush_settings_container.appendChild(hardnessSliderObj.container); + brush_settings_container.appendChild( + brushSmoothingPrecisionSliderObj.container + ); + return brush_settings_container; + } + async createPaintBucketSettings() { + const paint_bucket_settings_container = this.createContainer(true); + const paint_bucket_settings_title = this.createHeadline( + "Paint Bucket Settings" + ); + const tolerance = await this.messageBroker.pull("getTolerance"); + const paintBucketToleranceSliderObj = this.createSlider( + "Tolerance", + 0, + 255, + 1, + tolerance, + (event, value) => { + this.messageBroker.publish("setPaintBucketTolerance", parseInt(value)); + } + ); + paint_bucket_settings_container.appendChild(paint_bucket_settings_title); + paint_bucket_settings_container.appendChild( + paintBucketToleranceSliderObj.container + ); + return paint_bucket_settings_container; + } + async createColorSelectSettings() { + const color_select_settings_container = this.createContainer(true); + const color_select_settings_title = this.createHeadline( + "Color Select Settings" + ); + var tolerance = await this.messageBroker.pull("getTolerance"); + const colorSelectToleranceSliderObj = this.createSlider( + "Tolerance", + 0, + 255, + 1, + tolerance, + (event, value) => { + this.messageBroker.publish("setColorSelectTolerance", parseInt(value)); + } + ); + const livePreviewToggle = this.createToggle( + "Live Preview", + (event, value) => { + this.messageBroker.publish("setLivePreview", value); + } + ); + const wholeImageToggle = this.createToggle( + "Apply to Whole Image", + (event, value) => { + this.messageBroker.publish("setWholeImage", value); + } + ); + const methodOptions = Object.values(ColorComparisonMethod); + const methodSelect = this.createDropdown( + "Method", + methodOptions, + (event, value) => { + this.messageBroker.publish("setColorComparisonMethod", value); + } + ); + const maskBoundaryToggle = this.createToggle( + "Stop at mask", + (event, value) => { + this.messageBroker.publish("setMaskBoundary", value); + } + ); + const maskToleranceSliderObj = this.createSlider( + "Mask Tolerance", + 0, + 255, + 1, + 0, + (event, value) => { + this.messageBroker.publish("setMaskTolerance", parseInt(value)); + } + ); + color_select_settings_container.appendChild(color_select_settings_title); + color_select_settings_container.appendChild( + colorSelectToleranceSliderObj.container + ); + color_select_settings_container.appendChild(livePreviewToggle); + color_select_settings_container.appendChild(wholeImageToggle); + color_select_settings_container.appendChild(methodSelect); + color_select_settings_container.appendChild(maskBoundaryToggle); + color_select_settings_container.appendChild( + maskToleranceSliderObj.container + ); + return color_select_settings_container; + } + async createImageLayerSettings() { + const accentColor = this.darkMode ? "maskEditor_accent_bg_dark" : "maskEditor_accent_bg_light"; + const image_layer_settings_container = this.createContainer(true); + const image_layer_settings_title = this.createHeadline("Layers"); + const mask_layer_title = this.createContainerTitle("Mask Layer"); + const mask_layer_container = this.createContainer(false); + mask_layer_container.classList.add(accentColor); + mask_layer_container.classList.add("maskEditor_layerRow"); + const mask_layer_visibility_checkbox = document.createElement("input"); + mask_layer_visibility_checkbox.setAttribute("type", "checkbox"); + mask_layer_visibility_checkbox.checked = true; + mask_layer_visibility_checkbox.classList.add( + "maskEditor_sidePanelLayerCheckbox" + ); + mask_layer_visibility_checkbox.addEventListener("change", (event) => { + if (!event.target.checked) { + this.maskCanvas.style.opacity = "0"; + } else { + this.maskCanvas.style.opacity = String(this.mask_opacity); + } + }); + var mask_layer_image_container = document.createElement("div"); + mask_layer_image_container.classList.add( + "maskEditor_sidePanelLayerPreviewContainer" + ); + mask_layer_image_container.innerHTML = ' '; + var blending_options = ["black", "white", "negative"]; + const sidePanelDropdownAccent = this.darkMode ? "maskEditor_sidePanelDropdown_dark" : "maskEditor_sidePanelDropdown_light"; + var mask_layer_dropdown = document.createElement("select"); + mask_layer_dropdown.classList.add(sidePanelDropdownAccent); + mask_layer_dropdown.classList.add(sidePanelDropdownAccent); + blending_options.forEach((option) => { + var option_element = document.createElement("option"); + option_element.value = option; + option_element.innerText = option; + mask_layer_dropdown.appendChild(option_element); + if (option == this.maskBlendMode) { + option_element.selected = true; + } + }); + mask_layer_dropdown.addEventListener("change", (event) => { + const selectedValue = event.target.value; + this.maskBlendMode = selectedValue; + this.updateMaskColor(); + }); + mask_layer_container.appendChild(mask_layer_visibility_checkbox); + mask_layer_container.appendChild(mask_layer_image_container); + mask_layer_container.appendChild(mask_layer_dropdown); + const mask_layer_opacity_sliderObj = this.createSlider( + "Mask Opacity", + 0, + 1, + 0.01, + this.mask_opacity, + (event, value) => { + this.mask_opacity = parseFloat(value); + this.maskCanvas.style.opacity = String(this.mask_opacity); + if (this.mask_opacity == 0) { + mask_layer_visibility_checkbox.checked = false; + } else { + mask_layer_visibility_checkbox.checked = true; + } + } + ); + this.maskOpacitySlider = mask_layer_opacity_sliderObj.slider; + const image_layer_title = this.createContainerTitle("Image Layer"); + const image_layer_container = this.createContainer(false); + image_layer_container.classList.add(accentColor); + image_layer_container.classList.add("maskEditor_layerRow"); + const image_layer_visibility_checkbox = document.createElement("input"); + image_layer_visibility_checkbox.setAttribute("type", "checkbox"); + image_layer_visibility_checkbox.classList.add( + "maskEditor_sidePanelLayerCheckbox" + ); + image_layer_visibility_checkbox.checked = true; + image_layer_visibility_checkbox.addEventListener("change", (event) => { + if (!event.target.checked) { + this.imgCanvas.style.opacity = "0"; + } else { + this.imgCanvas.style.opacity = "1"; + } + }); + const image_layer_image_container = document.createElement("div"); + image_layer_image_container.classList.add( + "maskEditor_sidePanelLayerPreviewContainer" + ); + const image_layer_image = document.createElement("img"); + image_layer_image.id = "maskEditor_sidePanelImageLayerImage"; + image_layer_image.src = ComfyApp.clipspace?.imgs?.[ComfyApp.clipspace?.selectedIndex ?? 0]?.src ?? ""; + this.sidebarImage = image_layer_image; + image_layer_image_container.appendChild(image_layer_image); + image_layer_container.appendChild(image_layer_visibility_checkbox); + image_layer_container.appendChild(image_layer_image_container); + image_layer_settings_container.appendChild(image_layer_settings_title); + image_layer_settings_container.appendChild(mask_layer_title); + image_layer_settings_container.appendChild(mask_layer_container); + image_layer_settings_container.appendChild( + mask_layer_opacity_sliderObj.container + ); + image_layer_settings_container.appendChild(image_layer_title); + image_layer_settings_container.appendChild(image_layer_container); + return image_layer_settings_container; + } + createHeadline(title) { + var headline = document.createElement("h3"); + headline.classList.add("maskEditor_sidePanelTitle"); + headline.innerText = title; + return headline; + } + createContainer(flexDirection) { + var container = document.createElement("div"); + if (flexDirection) { + container.classList.add("maskEditor_sidePanelContainerColumn"); + } else { + container.classList.add("maskEditor_sidePanelContainerRow"); + } + return container; + } + createContainerTitle(title) { + var container_title = document.createElement("span"); + container_title.classList.add("maskEditor_sidePanelSubTitle"); + container_title.innerText = title; + return container_title; + } + createSlider(title, min, max2, step, value, callback) { + var slider_container = this.createContainer(true); + var slider_title = this.createContainerTitle(title); + var slider = document.createElement("input"); + slider.classList.add("maskEditor_sidePanelBrushRange"); + slider.setAttribute("type", "range"); + slider.setAttribute("min", String(min)); + slider.setAttribute("max", String(max2)); + slider.setAttribute("step", String(step)); + slider.setAttribute("value", String(value)); + slider.addEventListener("input", (event) => { + callback(event, event.target.value); + }); + slider_container.appendChild(slider_title); + slider_container.appendChild(slider); + return { container: slider_container, slider }; + } + createToggle(title, callback) { + var outer_Container = this.createContainer(false); + var toggle_title = this.createContainerTitle(title); + var toggle_container = document.createElement("label"); + toggle_container.classList.add("maskEditor_sidePanelToggleContainer"); + var toggle_checkbox = document.createElement("input"); + toggle_checkbox.setAttribute("type", "checkbox"); + toggle_checkbox.classList.add("maskEditor_sidePanelToggleCheckbox"); + toggle_checkbox.addEventListener("change", (event) => { + callback(event, event.target.checked); + }); + var toggleAccentColor = this.darkMode ? "maskEditor_toggle_bg_dark" : "maskEditor_toggle_bg_light"; + var toggle_switch = document.createElement("div"); + toggle_switch.classList.add("maskEditor_sidePanelToggleSwitch"); + toggle_switch.classList.add(toggleAccentColor); + toggle_container.appendChild(toggle_checkbox); + toggle_container.appendChild(toggle_switch); + outer_Container.appendChild(toggle_title); + outer_Container.appendChild(toggle_container); + return outer_Container; + } + createDropdown(title, options, callback) { + const sidePanelDropdownAccent = this.darkMode ? "maskEditor_sidePanelDropdown_dark" : "maskEditor_sidePanelDropdown_light"; + var dropdown_container = this.createContainer(false); + var dropdown_title = this.createContainerTitle(title); + var dropdown = document.createElement("select"); + dropdown.classList.add(sidePanelDropdownAccent); + dropdown.classList.add("maskEditor_containerDropdown"); + options.forEach((option) => { + var option_element = document.createElement("option"); + option_element.value = option; + option_element.innerText = option; + dropdown.appendChild(option_element); + }); + dropdown.addEventListener("change", (event) => { + callback(event, event.target.value); + }); + dropdown_container.appendChild(dropdown_title); + dropdown_container.appendChild(dropdown); + return dropdown_container; + } + createSeparator() { + var separator = document.createElement("div"); + separator.classList.add("maskEditor_sidePanelSeparator"); + return separator; + } + //---------------- + async createTopBar() { + const buttonAccentColor = this.darkMode ? "maskEditor_topPanelButton_dark" : "maskEditor_topPanelButton_light"; + const iconButtonAccentColor = this.darkMode ? "maskEditor_topPanelIconButton_dark" : "maskEditor_topPanelIconButton_light"; + var top_bar = document.createElement("div"); + top_bar.id = "maskEditor_topBar"; + var top_bar_title_container = document.createElement("div"); + top_bar_title_container.id = "maskEditor_topBarTitleContainer"; + var top_bar_title = document.createElement("h1"); + top_bar_title.id = "maskEditor_topBarTitle"; + top_bar_title.innerText = "ComfyUI"; + top_bar_title_container.appendChild(top_bar_title); + var top_bar_shortcuts_container = document.createElement("div"); + top_bar_shortcuts_container.id = "maskEditor_topBarShortcutsContainer"; + var top_bar_undo_button = document.createElement("div"); + top_bar_undo_button.id = "maskEditor_topBarUndoButton"; + top_bar_undo_button.classList.add(iconButtonAccentColor); + top_bar_undo_button.innerHTML = ' '; + top_bar_undo_button.addEventListener("click", () => { + this.messageBroker.publish("undo"); + }); + var top_bar_redo_button = document.createElement("div"); + top_bar_redo_button.id = "maskEditor_topBarRedoButton"; + top_bar_redo_button.classList.add(iconButtonAccentColor); + top_bar_redo_button.innerHTML = ' '; + top_bar_redo_button.addEventListener("click", () => { + this.messageBroker.publish("redo"); + }); + var top_bar_invert_button = document.createElement("button"); + top_bar_invert_button.id = "maskEditor_topBarInvertButton"; + top_bar_invert_button.classList.add(buttonAccentColor); + top_bar_invert_button.innerText = "Invert"; + top_bar_invert_button.addEventListener("click", () => { + this.messageBroker.publish("invert"); + }); + var top_bar_clear_button = document.createElement("button"); + top_bar_clear_button.id = "maskEditor_topBarClearButton"; + top_bar_clear_button.classList.add(buttonAccentColor); + top_bar_clear_button.innerText = "Clear"; + top_bar_clear_button.addEventListener("click", () => { + this.maskCtx.clearRect( + 0, + 0, + this.maskCanvas.width, + this.maskCanvas.height + ); + this.messageBroker.publish("saveState"); + }); + var top_bar_save_button = document.createElement("button"); + top_bar_save_button.id = "maskEditor_topBarSaveButton"; + top_bar_save_button.classList.add(buttonAccentColor); + top_bar_save_button.innerText = "Save"; + this.saveButton = top_bar_save_button; + top_bar_save_button.addEventListener("click", () => { + this.maskEditor.save(); + }); + var top_bar_cancel_button = document.createElement("button"); + top_bar_cancel_button.id = "maskEditor_topBarCancelButton"; + top_bar_cancel_button.classList.add(buttonAccentColor); + top_bar_cancel_button.innerText = "Cancel"; + top_bar_cancel_button.addEventListener("click", () => { + this.maskEditor.close(); + }); + top_bar_shortcuts_container.appendChild(top_bar_undo_button); + top_bar_shortcuts_container.appendChild(top_bar_redo_button); + top_bar_shortcuts_container.appendChild(top_bar_invert_button); + top_bar_shortcuts_container.appendChild(top_bar_clear_button); + top_bar_shortcuts_container.appendChild(top_bar_save_button); + top_bar_shortcuts_container.appendChild(top_bar_cancel_button); + top_bar.appendChild(top_bar_title_container); + top_bar.appendChild(top_bar_shortcuts_container); + return top_bar; + } + createToolPanel() { + var tool_panel = document.createElement("div"); + tool_panel.id = "maskEditor_toolPanel"; + this.toolPanel = tool_panel; + var toolPanelHoverAccent = this.darkMode ? "maskEditor_toolPanelContainerDark" : "maskEditor_toolPanelContainerLight"; + var toolElements = []; + var toolPanel_brushToolContainer = document.createElement("div"); + toolPanel_brushToolContainer.classList.add("maskEditor_toolPanelContainer"); + toolPanel_brushToolContainer.classList.add( + "maskEditor_toolPanelContainerSelected" + ); + toolPanel_brushToolContainer.classList.add(toolPanelHoverAccent); + toolPanel_brushToolContainer.innerHTML = ` + + + + + `; + toolElements.push(toolPanel_brushToolContainer); + toolPanel_brushToolContainer.addEventListener("click", () => { + this.messageBroker.publish( + "setTool", + "pen" + /* Pen */ + ); + for (let toolElement of toolElements) { + if (toolElement != toolPanel_brushToolContainer) { + toolElement.classList.remove("maskEditor_toolPanelContainerSelected"); + } else { + toolElement.classList.add("maskEditor_toolPanelContainerSelected"); + this.brushSettingsHTML.style.display = "flex"; + this.colorSelectSettingsHTML.style.display = "none"; + this.paintBucketSettingsHTML.style.display = "none"; + } + } + this.messageBroker.publish( + "setTool", + "pen" + /* Pen */ + ); + this.pointerZone.style.cursor = "none"; + }); + var toolPanel_brushToolIndicator = document.createElement("div"); + toolPanel_brushToolIndicator.classList.add("maskEditor_toolPanelIndicator"); + toolPanel_brushToolContainer.appendChild(toolPanel_brushToolIndicator); + var toolPanel_eraserToolContainer = document.createElement("div"); + toolPanel_eraserToolContainer.classList.add("maskEditor_toolPanelContainer"); + toolPanel_eraserToolContainer.classList.add(toolPanelHoverAccent); + toolPanel_eraserToolContainer.innerHTML = ` + + + + + + + + `; + toolElements.push(toolPanel_eraserToolContainer); + toolPanel_eraserToolContainer.addEventListener("click", () => { + this.messageBroker.publish( + "setTool", + "eraser" + /* Eraser */ + ); + for (let toolElement of toolElements) { + if (toolElement != toolPanel_eraserToolContainer) { + toolElement.classList.remove("maskEditor_toolPanelContainerSelected"); + } else { + toolElement.classList.add("maskEditor_toolPanelContainerSelected"); + this.brushSettingsHTML.style.display = "flex"; + this.colorSelectSettingsHTML.style.display = "none"; + this.paintBucketSettingsHTML.style.display = "none"; + } + } + this.messageBroker.publish( + "setTool", + "eraser" + /* Eraser */ + ); + this.pointerZone.style.cursor = "none"; + }); + var toolPanel_eraserToolIndicator = document.createElement("div"); + toolPanel_eraserToolIndicator.classList.add("maskEditor_toolPanelIndicator"); + toolPanel_eraserToolContainer.appendChild(toolPanel_eraserToolIndicator); + var toolPanel_paintBucketToolContainer = document.createElement("div"); + toolPanel_paintBucketToolContainer.classList.add( + "maskEditor_toolPanelContainer" + ); + toolPanel_paintBucketToolContainer.classList.add(toolPanelHoverAccent); + toolPanel_paintBucketToolContainer.innerHTML = ` + + + + + + `; + toolElements.push(toolPanel_paintBucketToolContainer); + toolPanel_paintBucketToolContainer.addEventListener("click", () => { + this.messageBroker.publish( + "setTool", + "paintBucket" + /* PaintBucket */ + ); + for (let toolElement of toolElements) { + if (toolElement != toolPanel_paintBucketToolContainer) { + toolElement.classList.remove("maskEditor_toolPanelContainerSelected"); + } else { + toolElement.classList.add("maskEditor_toolPanelContainerSelected"); + this.brushSettingsHTML.style.display = "none"; + this.colorSelectSettingsHTML.style.display = "none"; + this.paintBucketSettingsHTML.style.display = "flex"; + } + } + this.messageBroker.publish( + "setTool", + "paintBucket" + /* PaintBucket */ + ); + this.pointerZone.style.cursor = "url('/cursor/paintBucket.png') 30 25, auto"; + this.brush.style.opacity = "0"; + }); + var toolPanel_paintBucketToolIndicator = document.createElement("div"); + toolPanel_paintBucketToolIndicator.classList.add( + "maskEditor_toolPanelIndicator" + ); + toolPanel_paintBucketToolContainer.appendChild( + toolPanel_paintBucketToolIndicator + ); + var toolPanel_colorSelectToolContainer = document.createElement("div"); + toolPanel_colorSelectToolContainer.classList.add( + "maskEditor_toolPanelContainer" + ); + toolPanel_colorSelectToolContainer.classList.add(toolPanelHoverAccent); + toolPanel_colorSelectToolContainer.innerHTML = ` + + + + `; + toolElements.push(toolPanel_colorSelectToolContainer); + toolPanel_colorSelectToolContainer.addEventListener("click", () => { + this.messageBroker.publish("setTool", "colorSelect"); + for (let toolElement of toolElements) { + if (toolElement != toolPanel_colorSelectToolContainer) { + toolElement.classList.remove("maskEditor_toolPanelContainerSelected"); + } else { + toolElement.classList.add("maskEditor_toolPanelContainerSelected"); + this.brushSettingsHTML.style.display = "none"; + this.paintBucketSettingsHTML.style.display = "none"; + this.colorSelectSettingsHTML.style.display = "flex"; + } + } + this.messageBroker.publish( + "setTool", + "colorSelect" + /* ColorSelect */ + ); + this.pointerZone.style.cursor = "url('/cursor/colorSelect.png') 15 25, auto"; + this.brush.style.opacity = "0"; + }); + var toolPanel_colorSelectToolIndicator = document.createElement("div"); + toolPanel_colorSelectToolIndicator.classList.add( + "maskEditor_toolPanelIndicator" + ); + toolPanel_colorSelectToolContainer.appendChild( + toolPanel_colorSelectToolIndicator + ); + var toolPanel_zoomIndicator = document.createElement("div"); + toolPanel_zoomIndicator.classList.add("maskEditor_toolPanelZoomIndicator"); + toolPanel_zoomIndicator.classList.add(toolPanelHoverAccent); + var toolPanel_zoomText = document.createElement("span"); + toolPanel_zoomText.id = "maskEditor_toolPanelZoomText"; + toolPanel_zoomText.innerText = "100%"; + this.zoomTextHTML = toolPanel_zoomText; + var toolPanel_DimensionsText = document.createElement("span"); + toolPanel_DimensionsText.id = "maskEditor_toolPanelDimensionsText"; + toolPanel_DimensionsText.innerText = " "; + this.dimensionsTextHTML = toolPanel_DimensionsText; + toolPanel_zoomIndicator.appendChild(toolPanel_zoomText); + toolPanel_zoomIndicator.appendChild(toolPanel_DimensionsText); + toolPanel_zoomIndicator.addEventListener("click", () => { + this.messageBroker.publish("resetZoom"); + }); + tool_panel.appendChild(toolPanel_brushToolContainer); + tool_panel.appendChild(toolPanel_eraserToolContainer); + tool_panel.appendChild(toolPanel_paintBucketToolContainer); + tool_panel.appendChild(toolPanel_colorSelectToolContainer); + tool_panel.appendChild(toolPanel_zoomIndicator); + return tool_panel; + } + createPointerZone() { + const pointer_zone = document.createElement("div"); + pointer_zone.id = "maskEditor_pointerZone"; + this.pointerZone = pointer_zone; + pointer_zone.addEventListener("pointerdown", (event) => { + this.messageBroker.publish("pointerDown", event); + }); + pointer_zone.addEventListener("pointermove", (event) => { + this.messageBroker.publish("pointerMove", event); + }); + pointer_zone.addEventListener("pointerup", (event) => { + this.messageBroker.publish("pointerUp", event); + }); + pointer_zone.addEventListener("pointerleave", (event) => { + this.brush.style.opacity = "0"; + this.pointerZone.style.cursor = ""; + }); + pointer_zone.addEventListener("touchstart", (event) => { + this.messageBroker.publish("handleTouchStart", event); + }); + pointer_zone.addEventListener("touchmove", (event) => { + this.messageBroker.publish("handleTouchMove", event); + }); + pointer_zone.addEventListener("touchend", (event) => { + this.messageBroker.publish("handleTouchEnd", event); + }); + pointer_zone.addEventListener( + "wheel", + (event) => this.messageBroker.publish("wheel", event) + ); + pointer_zone.addEventListener( + "pointerenter", + async (event) => { + this.updateCursor(); + } + ); + return pointer_zone; + } + async screenToCanvas(clientPoint) { + const zoomRatio = await this.messageBroker.pull("zoomRatio"); + const canvasRect = this.maskCanvas.getBoundingClientRect(); + const offsetX = clientPoint.x - canvasRect.left + this.toolPanel.clientWidth; + const offsetY = clientPoint.y - canvasRect.top + 44; + const x = offsetX / zoomRatio; + const y = offsetY / zoomRatio; + return { x, y }; + } + setEventHandler() { + this.maskCanvas.addEventListener("contextmenu", (event) => { + event.preventDefault(); + }); + this.rootElement.addEventListener("contextmenu", (event) => { + event.preventDefault(); + }); + this.rootElement.addEventListener("dragstart", (event) => { + if (event.ctrlKey) { + event.preventDefault(); + } + }); + } + async createBrush() { + var brush = document.createElement("div"); + const brushSettings = await this.messageBroker.pull("brushSettings"); + brush.id = "maskEditor_brush"; + var brush_preview_gradient = document.createElement("div"); + brush_preview_gradient.id = "maskEditor_brushPreviewGradient"; + brush.appendChild(brush_preview_gradient); + this.brush = brush; + this.brushPreviewGradient = brush_preview_gradient; + return brush; + } + async setImages(imgCanvas) { + const imgCtx = imgCanvas.getContext("2d", { willReadFrequently: true }); + const maskCtx = this.maskCtx; + const maskCanvas = this.maskCanvas; + imgCtx.clearRect(0, 0, this.imgCanvas.width, this.imgCanvas.height); + maskCtx.clearRect(0, 0, this.maskCanvas.width, this.maskCanvas.height); + const alpha_url = new URL( + ComfyApp.clipspace?.imgs?.[ComfyApp.clipspace?.selectedIndex ?? 0]?.src ?? "" + ); + alpha_url.searchParams.delete("channel"); + alpha_url.searchParams.delete("preview"); + alpha_url.searchParams.set("channel", "a"); + let mask_image = await this.loadImage(alpha_url); + if (!ComfyApp.clipspace?.imgs?.[ComfyApp.clipspace?.selectedIndex ?? 0]?.src) { + throw new Error( + "Unable to access image source - clipspace or image is null" + ); + } + const rgb_url = new URL( + ComfyApp.clipspace.imgs[ComfyApp.clipspace.selectedIndex].src + ); + this.imageURL = rgb_url; + console.log(rgb_url); + rgb_url.searchParams.delete("channel"); + rgb_url.searchParams.set("channel", "rgb"); + this.image = new Image(); + this.image = await new Promise((resolve, reject) => { + const img = new Image(); + img.onload = () => resolve(img); + img.onerror = reject; + img.src = rgb_url.toString(); + }); + maskCanvas.width = this.image.width; + maskCanvas.height = this.image.height; + this.dimensionsTextHTML.innerText = `${this.image.width}x${this.image.height}`; + await this.invalidateCanvas(this.image, mask_image); + this.messageBroker.publish("initZoomPan", [this.image, this.rootElement]); + } + async invalidateCanvas(orig_image, mask_image) { + this.imgCanvas.width = orig_image.width; + this.imgCanvas.height = orig_image.height; + this.maskCanvas.width = orig_image.width; + this.maskCanvas.height = orig_image.height; + let imgCtx = this.imgCanvas.getContext("2d", { willReadFrequently: true }); + let maskCtx = this.maskCanvas.getContext("2d", { + willReadFrequently: true + }); + imgCtx.drawImage(orig_image, 0, 0, orig_image.width, orig_image.height); + await this.prepare_mask( + mask_image, + this.maskCanvas, + maskCtx, + await this.getMaskColor() + ); + } + async prepare_mask(image, maskCanvas, maskCtx, maskColor) { + maskCtx.drawImage(image, 0, 0, maskCanvas.width, maskCanvas.height); + const maskData = maskCtx.getImageData( + 0, + 0, + maskCanvas.width, + maskCanvas.height + ); + for (let i = 0; i < maskData.data.length; i += 4) { + const alpha = maskData.data[i + 3]; + maskData.data[i] = maskColor.r; + maskData.data[i + 1] = maskColor.g; + maskData.data[i + 2] = maskColor.b; + maskData.data[i + 3] = 255 - alpha; + } + maskCtx.globalCompositeOperation = "source-over"; + maskCtx.putImageData(maskData, 0, 0); + } + async updateMaskColor() { + const maskCanvasStyle = this.getMaskCanvasStyle(); + this.maskCanvas.style.mixBlendMode = maskCanvasStyle.mixBlendMode; + this.maskCanvas.style.opacity = maskCanvasStyle.opacity.toString(); + const maskColor = await this.getMaskColor(); + this.maskCtx.fillStyle = `rgb(${maskColor.r}, ${maskColor.g}, ${maskColor.b})`; + this.setCanvasBackground(); + const maskData = this.maskCtx.getImageData( + 0, + 0, + this.maskCanvas.width, + this.maskCanvas.height + ); + for (let i = 0; i < maskData.data.length; i += 4) { + maskData.data[i] = maskColor.r; + maskData.data[i + 1] = maskColor.g; + maskData.data[i + 2] = maskColor.b; + } + this.maskCtx.putImageData(maskData, 0, 0); + } + getMaskCanvasStyle() { + if (this.maskBlendMode === "negative") { + return { + mixBlendMode: "difference", + opacity: "1" + }; + } else { + return { + mixBlendMode: "initial", + opacity: this.mask_opacity + }; + } + } + detectLightMode() { + this.darkMode = document.body.classList.contains("dark-theme"); + } + loadImage(imagePath) { + return new Promise((resolve, reject) => { + const image = new Image(); + image.onload = function() { + resolve(image); + }; + image.onerror = function(error) { + reject(error); + }; + image.src = imagePath.href; + }); + } + async updateBrushPreview() { + const cursorPoint = await this.messageBroker.pull("cursorPoint"); + const pan_offset = await this.messageBroker.pull("panOffset"); + const brushSettings = await this.messageBroker.pull("brushSettings"); + const zoom_ratio = await this.messageBroker.pull("zoomRatio"); + const centerX = cursorPoint.x + pan_offset.x; + const centerY = cursorPoint.y + pan_offset.y; + const brush = this.brush; + const hardness = brushSettings.hardness; + const extendedSize = brushSettings.size * (2 - hardness) * 2 * zoom_ratio; + this.brushSizeSlider.value = String(brushSettings.size); + this.brushHardnessSlider.value = String(hardness); + brush.style.width = extendedSize + "px"; + brush.style.height = extendedSize + "px"; + brush.style.left = centerX - extendedSize / 2 + "px"; + brush.style.top = centerY - extendedSize / 2 + "px"; + if (hardness === 1) { + this.brushPreviewGradient.style.background = "rgba(255, 0, 0, 0.5)"; + return; + } + const opacityStop = hardness / 4 + 0.25; + this.brushPreviewGradient.style.background = ` + radial-gradient( + circle, + rgba(255, 0, 0, 0.5) 0%, + rgba(255, 0, 0, ${opacityStop}) ${hardness * 100}%, + rgba(255, 0, 0, 0) 100% + ) + `; + } + getMaskBlendMode() { + return this.maskBlendMode; + } + setSidebarImage() { + this.sidebarImage.src = this.imageURL.href; + } + async getMaskColor() { + if (this.maskBlendMode === "black") { + return { r: 0, g: 0, b: 0 }; + } + if (this.maskBlendMode === "white") { + return { r: 255, g: 255, b: 255 }; + } + if (this.maskBlendMode === "negative") { + return { r: 255, g: 255, b: 255 }; + } + return { r: 0, g: 0, b: 0 }; + } + async getMaskFillStyle() { + const maskColor = await this.getMaskColor(); + return "rgb(" + maskColor.r + "," + maskColor.g + "," + maskColor.b + ")"; + } + async setCanvasBackground() { + if (this.maskBlendMode === "white") { + this.canvasBackground.style.background = "black"; + } else { + this.canvasBackground.style.background = "white"; + } + } + getMaskCanvas() { + return this.maskCanvas; + } + getImgCanvas() { + return this.imgCanvas; + } + getImage() { + return this.image; + } + setBrushOpacity(opacity) { + this.brush.style.opacity = String(opacity); + } + setSaveButtonEnabled(enabled) { + this.saveButton.disabled = !enabled; + } + setSaveButtonText(text) { + this.saveButton.innerText = text; + } + handlePaintBucketCursor(isPaintBucket) { + if (isPaintBucket) { + this.pointerZone.style.cursor = "url('/cursor/paintBucket.png') 30 25, auto"; + } else { + this.pointerZone.style.cursor = "none"; + } + } + handlePanCursor(isPanning) { + if (isPanning) { + this.pointerZone.style.cursor = "grabbing"; + } else { + this.pointerZone.style.cursor = "none"; + } + } + setBrushVisibility(visible) { + this.brush.style.opacity = visible ? "1" : "0"; + } + setBrushPreviewGradientVisibility(visible) { + this.brushPreviewGradient.style.display = visible ? "block" : "none"; + } + async updateCursor() { + const currentTool = await this.messageBroker.pull("currentTool"); + if (currentTool === "paintBucket") { + this.pointerZone.style.cursor = "url('/cursor/paintBucket.png') 30 25, auto"; + this.setBrushOpacity(0); + } else if (currentTool === "colorSelect") { + this.pointerZone.style.cursor = "url('/cursor/colorSelect.png') 15 25, auto"; + this.setBrushOpacity(0); + } else { + this.pointerZone.style.cursor = "none"; + this.setBrushOpacity(1); + } + this.updateBrushPreview(); + this.setBrushPreviewGradientVisibility(false); + } + setZoomText(zoomText) { + this.zoomTextHTML.innerText = zoomText; + } + setDimensionsText(dimensionsText) { + this.dimensionsTextHTML.innerText = dimensionsText; + } +} +class ToolManager { + static { + __name(this, "ToolManager"); + } + maskEditor; + messageBroker; + mouseDownPoint = null; + currentTool = "pen"; + isAdjustingBrush = false; + // is user adjusting brush size or hardness with alt + right mouse button + constructor(maskEditor) { + this.maskEditor = maskEditor; + this.messageBroker = maskEditor.getMessageBroker(); + this.addListeners(); + this.addPullTopics(); + } + addListeners() { + this.messageBroker.subscribe("setTool", async (tool) => { + this.setTool(tool); + }); + this.messageBroker.subscribe("pointerDown", async (event) => { + this.handlePointerDown(event); + }); + this.messageBroker.subscribe("pointerMove", async (event) => { + this.handlePointerMove(event); + }); + this.messageBroker.subscribe("pointerUp", async (event) => { + this.handlePointerUp(event); + }); + this.messageBroker.subscribe("wheel", async (event) => { + this.handleWheelEvent(event); + }); + } + async addPullTopics() { + this.messageBroker.createPullTopic( + "currentTool", + async () => this.getCurrentTool() + ); + } + //tools + setTool(tool) { + this.currentTool = tool; + if (tool != "colorSelect") { + this.messageBroker.publish("clearLastPoint"); + } + } + getCurrentTool() { + return this.currentTool; + } + async handlePointerDown(event) { + event.preventDefault(); + if (event.pointerType == "touch") return; + var isSpacePressed = await this.messageBroker.pull("isKeyPressed", " "); + if (event.buttons === 4 || event.buttons === 1 && isSpacePressed) { + this.messageBroker.publish("panStart", event); + this.messageBroker.publish("setBrushVisibility", false); + return; + } + if (this.currentTool === "paintBucket" && event.button === 0) { + const offset = { x: event.offsetX, y: event.offsetY }; + const coords_canvas = await this.messageBroker.pull( + "screenToCanvas", + offset + ); + this.messageBroker.publish("paintBucketFill", coords_canvas); + this.messageBroker.publish("saveState"); + return; + } + if (this.currentTool === "colorSelect" && event.button === 0) { + const offset = { x: event.offsetX, y: event.offsetY }; + const coords_canvas = await this.messageBroker.pull( + "screenToCanvas", + offset + ); + this.messageBroker.publish("colorSelectFill", coords_canvas); + return; + } + if (event.altKey && event.button === 2) { + this.isAdjustingBrush = true; + this.messageBroker.publish("brushAdjustmentStart", event); + return; + } + var isDrawingTool = [ + "pen", + "eraser" + /* Eraser */ + ].includes(this.currentTool); + if ([0, 2].includes(event.button) && isDrawingTool) { + this.messageBroker.publish("drawStart", event); + return; + } + } + async handlePointerMove(event) { + event.preventDefault(); + if (event.pointerType == "touch") return; + const newCursorPoint = { x: event.clientX, y: event.clientY }; + this.messageBroker.publish("cursorPoint", newCursorPoint); + var isSpacePressed = await this.messageBroker.pull("isKeyPressed", " "); + this.messageBroker.publish("updateBrushPreview"); + if (event.buttons === 4 || event.buttons === 1 && isSpacePressed) { + this.messageBroker.publish("panMove", event); + return; + } + var isDrawingTool = [ + "pen", + "eraser" + /* Eraser */ + ].includes(this.currentTool); + if (!isDrawingTool) return; + if (this.isAdjustingBrush && (this.currentTool === "pen" || this.currentTool === "eraser") && event.altKey && event.buttons === 2) { + this.messageBroker.publish("brushAdjustment", event); + return; + } + if (event.buttons == 1 || event.buttons == 2) { + this.messageBroker.publish("draw", event); + return; + } + } + handlePointerUp(event) { + this.messageBroker.publish("panCursor", false); + if (event.pointerType === "touch") return; + this.messageBroker.publish("updateCursor"); + this.isAdjustingBrush = false; + this.messageBroker.publish("drawEnd", event); + this.mouseDownPoint = null; + } + handleWheelEvent(event) { + this.messageBroker.publish("zoom", event); + const newCursorPoint = { x: event.clientX, y: event.clientY }; + this.messageBroker.publish("cursorPoint", newCursorPoint); + } +} +class PanAndZoomManager { + static { + __name(this, "PanAndZoomManager"); + } + maskEditor; + messageBroker; + DOUBLE_TAP_DELAY = 300; + lastTwoFingerTap = 0; + isTouchZooming = false; + lastTouchZoomDistance = 0; + lastTouchMidPoint = { x: 0, y: 0 }; + lastTouchPoint = { x: 0, y: 0 }; + zoom_ratio = 1; + interpolatedZoomRatio = 1; + pan_offset = { x: 0, y: 0 }; + mouseDownPoint = null; + initialPan = { x: 0, y: 0 }; + canvasContainer = null; + maskCanvas = null; + rootElement = null; + image = null; + imageRootWidth = 0; + imageRootHeight = 0; + cursorPoint = { x: 0, y: 0 }; + constructor(maskEditor) { + this.maskEditor = maskEditor; + this.messageBroker = maskEditor.getMessageBroker(); + this.addListeners(); + this.addPullTopics(); + } + addListeners() { + this.messageBroker.subscribe( + "initZoomPan", + async (args) => { + await this.initializeCanvasPanZoom(args[0], args[1]); + } + ); + this.messageBroker.subscribe("panStart", async (event) => { + this.handlePanStart(event); + }); + this.messageBroker.subscribe("panMove", async (event) => { + this.handlePanMove(event); + }); + this.messageBroker.subscribe("zoom", async (event) => { + this.zoom(event); + }); + this.messageBroker.subscribe("cursorPoint", async (point) => { + this.updateCursorPosition(point); + }); + this.messageBroker.subscribe( + "handleTouchStart", + async (event) => { + this.handleTouchStart(event); + } + ); + this.messageBroker.subscribe( + "handleTouchMove", + async (event) => { + this.handleTouchMove(event); + } + ); + this.messageBroker.subscribe( + "handleTouchEnd", + async (event) => { + this.handleTouchEnd(event); + } + ); + this.messageBroker.subscribe("resetZoom", async () => { + if (this.interpolatedZoomRatio === 1) return; + await this.smoothResetView(); + }); + } + addPullTopics() { + this.messageBroker.createPullTopic( + "cursorPoint", + async () => this.cursorPoint + ); + this.messageBroker.createPullTopic("zoomRatio", async () => this.zoom_ratio); + this.messageBroker.createPullTopic("panOffset", async () => this.pan_offset); + } + handleTouchStart(event) { + event.preventDefault(); + if (event.touches[0].touchType === "stylus") return; + this.messageBroker.publish("setBrushVisibility", false); + if (event.touches.length === 2) { + const currentTime = (/* @__PURE__ */ new Date()).getTime(); + const tapTimeDiff = currentTime - this.lastTwoFingerTap; + if (tapTimeDiff < this.DOUBLE_TAP_DELAY) { + this.handleDoubleTap(); + this.lastTwoFingerTap = 0; + } else { + this.lastTwoFingerTap = currentTime; + this.isTouchZooming = true; + this.lastTouchZoomDistance = this.getTouchDistance(event.touches); + const midpoint = this.getTouchMidpoint(event.touches); + this.lastTouchMidPoint = midpoint; + } + } else if (event.touches.length === 1) { + this.lastTouchPoint = { + x: event.touches[0].clientX, + y: event.touches[0].clientY + }; + } + } + async handleTouchMove(event) { + event.preventDefault(); + if (event.touches[0].touchType === "stylus") return; + this.lastTwoFingerTap = 0; + if (this.isTouchZooming && event.touches.length === 2) { + const newDistance = this.getTouchDistance(event.touches); + const zoomFactor = newDistance / this.lastTouchZoomDistance; + const oldZoom = this.zoom_ratio; + this.zoom_ratio = Math.max( + 0.2, + Math.min(10, this.zoom_ratio * zoomFactor) + ); + const newZoom = this.zoom_ratio; + const midpoint = this.getTouchMidpoint(event.touches); + if (this.lastTouchMidPoint) { + const deltaX = midpoint.x - this.lastTouchMidPoint.x; + const deltaY = midpoint.y - this.lastTouchMidPoint.y; + this.pan_offset.x += deltaX; + this.pan_offset.y += deltaY; + } + if (this.maskCanvas === null) { + this.maskCanvas = await this.messageBroker.pull("maskCanvas"); + } + const rect = this.maskCanvas.getBoundingClientRect(); + const touchX = midpoint.x - rect.left; + const touchY = midpoint.y - rect.top; + const scaleFactor = newZoom / oldZoom; + this.pan_offset.x += touchX - touchX * scaleFactor; + this.pan_offset.y += touchY - touchY * scaleFactor; + this.invalidatePanZoom(); + this.lastTouchZoomDistance = newDistance; + this.lastTouchMidPoint = midpoint; + } else if (event.touches.length === 1) { + this.handleSingleTouchPan(event.touches[0]); + } + } + handleTouchEnd(event) { + event.preventDefault(); + if (event.touches.length === 0 && event.touches[0].touchType === "stylus") { + return; + } + this.isTouchZooming = false; + this.lastTouchMidPoint = { x: 0, y: 0 }; + if (event.touches.length === 0) { + this.lastTouchPoint = { x: 0, y: 0 }; + } else if (event.touches.length === 1) { + this.lastTouchPoint = { + x: event.touches[0].clientX, + y: event.touches[0].clientY + }; + } + } + getTouchDistance(touches) { + const dx = touches[0].clientX - touches[1].clientX; + const dy = touches[0].clientY - touches[1].clientY; + return Math.sqrt(dx * dx + dy * dy); + } + getTouchMidpoint(touches) { + return { + x: (touches[0].clientX + touches[1].clientX) / 2, + y: (touches[0].clientY + touches[1].clientY) / 2 + }; + } + async handleSingleTouchPan(touch) { + if (this.lastTouchPoint === null) { + this.lastTouchPoint = { x: touch.clientX, y: touch.clientY }; + return; + } + const deltaX = touch.clientX - this.lastTouchPoint.x; + const deltaY = touch.clientY - this.lastTouchPoint.y; + this.pan_offset.x += deltaX; + this.pan_offset.y += deltaY; + await this.invalidatePanZoom(); + this.lastTouchPoint = { x: touch.clientX, y: touch.clientY }; + } + updateCursorPosition(clientPoint) { + var cursorX = clientPoint.x - this.pan_offset.x; + var cursorY = clientPoint.y - this.pan_offset.y; + this.cursorPoint = { x: cursorX, y: cursorY }; + } + //prob redundant + handleDoubleTap() { + this.messageBroker.publish("undo"); + } + async zoom(event) { + const cursorPoint = { x: event.clientX, y: event.clientY }; + const oldZoom = this.zoom_ratio; + const zoomFactor = event.deltaY < 0 ? 1.1 : 0.9; + this.zoom_ratio = Math.max( + 0.2, + Math.min(10, this.zoom_ratio * zoomFactor) + ); + const newZoom = this.zoom_ratio; + const maskCanvas = await this.messageBroker.pull("maskCanvas"); + const rect = maskCanvas.getBoundingClientRect(); + const mouseX = cursorPoint.x - rect.left; + const mouseY = cursorPoint.y - rect.top; + console.log(oldZoom, newZoom); + const scaleFactor = newZoom / oldZoom; + this.pan_offset.x += mouseX - mouseX * scaleFactor; + this.pan_offset.y += mouseY - mouseY * scaleFactor; + await this.invalidatePanZoom(); + const newImageWidth = maskCanvas.clientWidth; + const zoomRatio = newImageWidth / this.imageRootWidth; + this.interpolatedZoomRatio = zoomRatio; + this.messageBroker.publish("setZoomText", `${Math.round(zoomRatio * 100)}%`); + this.updateCursorPosition(cursorPoint); + requestAnimationFrame(() => { + this.messageBroker.publish("updateBrushPreview"); + }); + } + async smoothResetView(duration = 500) { + const startZoom = this.zoom_ratio; + const startPan = { ...this.pan_offset }; + const sidePanelWidth = 220; + const toolPanelWidth = 64; + const topBarHeight = 44; + const availableWidth = this.rootElement.clientWidth - sidePanelWidth - toolPanelWidth; + const availableHeight = this.rootElement.clientHeight - topBarHeight; + const zoomRatioWidth = availableWidth / this.image.width; + const zoomRatioHeight = availableHeight / this.image.height; + const targetZoom = Math.min(zoomRatioWidth, zoomRatioHeight); + const aspectRatio = this.image.width / this.image.height; + let finalWidth = 0; + let finalHeight = 0; + const targetPan = { x: toolPanelWidth, y: topBarHeight }; + if (zoomRatioHeight > zoomRatioWidth) { + finalWidth = availableWidth; + finalHeight = finalWidth / aspectRatio; + targetPan.y = (availableHeight - finalHeight) / 2 + topBarHeight; + } else { + finalHeight = availableHeight; + finalWidth = finalHeight * aspectRatio; + targetPan.x = (availableWidth - finalWidth) / 2 + toolPanelWidth; + } + const startTime = performance.now(); + const animate = /* @__PURE__ */ __name((currentTime) => { + const elapsed = currentTime - startTime; + const progress = Math.min(elapsed / duration, 1); + const eased = 1 - Math.pow(1 - progress, 3); + const currentZoom = startZoom + (targetZoom - startZoom) * eased; + this.zoom_ratio = currentZoom; + this.pan_offset.x = startPan.x + (targetPan.x - startPan.x) * eased; + this.pan_offset.y = startPan.y + (targetPan.y - startPan.y) * eased; + this.invalidatePanZoom(); + const interpolatedZoomRatio = startZoom + (1 - startZoom) * eased; + this.messageBroker.publish( + "setZoomText", + `${Math.round(interpolatedZoomRatio * 100)}%` + ); + if (progress < 1) { + requestAnimationFrame(animate); + } + }, "animate"); + requestAnimationFrame(animate); + this.interpolatedZoomRatio = 1; + } + async initializeCanvasPanZoom(image, rootElement) { + let sidePanelWidth = 220; + const toolPanelWidth = 64; + let topBarHeight = 44; + this.rootElement = rootElement; + let availableWidth = rootElement.clientWidth - sidePanelWidth - toolPanelWidth; + let availableHeight = rootElement.clientHeight - topBarHeight; + let zoomRatioWidth = availableWidth / image.width; + let zoomRatioHeight = availableHeight / image.height; + let aspectRatio = image.width / image.height; + let finalWidth = 0; + let finalHeight = 0; + let pan_offset = { x: toolPanelWidth, y: topBarHeight }; + if (zoomRatioHeight > zoomRatioWidth) { + finalWidth = availableWidth; + finalHeight = finalWidth / aspectRatio; + pan_offset.y = (availableHeight - finalHeight) / 2 + topBarHeight; + } else { + finalHeight = availableHeight; + finalWidth = finalHeight * aspectRatio; + pan_offset.x = (availableWidth - finalWidth) / 2 + toolPanelWidth; + } + if (this.image === null) { + this.image = image; + } + this.imageRootWidth = finalWidth; + this.imageRootHeight = finalHeight; + this.zoom_ratio = Math.min(zoomRatioWidth, zoomRatioHeight); + this.pan_offset = pan_offset; + await this.invalidatePanZoom(); + } + async invalidatePanZoom() { + if (!this.image?.width || !this.image?.height || !this.pan_offset || !this.zoom_ratio) { + console.warn("Missing required properties for pan/zoom"); + return; + } + const raw_width = this.image.width * this.zoom_ratio; + const raw_height = this.image.height * this.zoom_ratio; + this.canvasContainer ??= await this.messageBroker?.pull("getCanvasContainer"); + if (!this.canvasContainer) return; + Object.assign(this.canvasContainer.style, { + width: `${raw_width}px`, + height: `${raw_height}px`, + left: `${this.pan_offset.x}px`, + top: `${this.pan_offset.y}px` + }); + } + handlePanStart(event) { + let coords_canvas = this.messageBroker.pull("screenToCanvas", { + x: event.offsetX, + y: event.offsetY + }); + this.mouseDownPoint = { x: event.clientX, y: event.clientY }; + this.messageBroker.publish("panCursor", true); + this.initialPan = this.pan_offset; + return; + } + handlePanMove(event) { + if (this.mouseDownPoint === null) throw new Error("mouseDownPoint is null"); + let deltaX = this.mouseDownPoint.x - event.clientX; + let deltaY = this.mouseDownPoint.y - event.clientY; + let pan_x = this.initialPan.x - deltaX; + let pan_y = this.initialPan.y - deltaY; + this.pan_offset = { x: pan_x, y: pan_y }; + this.invalidatePanZoom(); + } +} +class MessageBroker { + static { + __name(this, "MessageBroker"); + } + pushTopics = {}; + pullTopics = {}; + constructor() { + this.registerListeners(); + } + // Push + registerListeners() { + this.createPushTopic("panStart"); + this.createPushTopic("paintBucketFill"); + this.createPushTopic("saveState"); + this.createPushTopic("brushAdjustmentStart"); + this.createPushTopic("drawStart"); + this.createPushTopic("panMove"); + this.createPushTopic("updateBrushPreview"); + this.createPushTopic("brushAdjustment"); + this.createPushTopic("draw"); + this.createPushTopic("paintBucketCursor"); + this.createPushTopic("panCursor"); + this.createPushTopic("drawEnd"); + this.createPushTopic("zoom"); + this.createPushTopic("undo"); + this.createPushTopic("redo"); + this.createPushTopic("cursorPoint"); + this.createPushTopic("panOffset"); + this.createPushTopic("zoomRatio"); + this.createPushTopic("getMaskCanvas"); + this.createPushTopic("getCanvasContainer"); + this.createPushTopic("screenToCanvas"); + this.createPushTopic("isKeyPressed"); + this.createPushTopic("isCombinationPressed"); + this.createPushTopic("setPaintBucketTolerance"); + this.createPushTopic("setBrushSize"); + this.createPushTopic("setBrushHardness"); + this.createPushTopic("setBrushOpacity"); + this.createPushTopic("setBrushShape"); + this.createPushTopic("initZoomPan"); + this.createPushTopic("setTool"); + this.createPushTopic("pointerDown"); + this.createPushTopic("pointerMove"); + this.createPushTopic("pointerUp"); + this.createPushTopic("wheel"); + this.createPushTopic("initPaintBucketTool"); + this.createPushTopic("setBrushVisibility"); + this.createPushTopic("setBrushPreviewGradientVisibility"); + this.createPushTopic("handleTouchStart"); + this.createPushTopic("handleTouchMove"); + this.createPushTopic("handleTouchEnd"); + this.createPushTopic("colorSelectFill"); + this.createPushTopic("setColorSelectTolerance"); + this.createPushTopic("setLivePreview"); + this.createPushTopic("updateCursor"); + this.createPushTopic("setColorComparisonMethod"); + this.createPushTopic("clearLastPoint"); + this.createPushTopic("setWholeImage"); + this.createPushTopic("setMaskBoundary"); + this.createPushTopic("setMaskTolerance"); + this.createPushTopic("setBrushSmoothingPrecision"); + this.createPushTopic("setZoomText"); + this.createPushTopic("resetZoom"); + this.createPushTopic("invert"); + } + /** + * Creates a new push topic (listener is notified) + * + * @param {string} topicName - The name of the topic to create. + * @throws {Error} If the topic already exists. + */ + createPushTopic(topicName) { + if (this.topicExists(this.pushTopics, topicName)) { + throw new Error("Topic already exists"); + } + this.pushTopics[topicName] = []; + } + /** + * Subscribe a callback function to the given topic. + * + * @param {string} topicName - The name of the topic to subscribe to. + * @param {Callback} callback - The callback function to be subscribed. + * @throws {Error} If the topic does not exist. + */ + subscribe(topicName, callback) { + if (!this.topicExists(this.pushTopics, topicName)) { + throw new Error(`Topic "${topicName}" does not exist!`); + } + this.pushTopics[topicName].push(callback); + } + /** + * Removes a callback function from the list of subscribers for a given topic. + * + * @param {string} topicName - The name of the topic to unsubscribe from. + * @param {Callback} callback - The callback function to remove from the subscribers list. + * @throws {Error} If the topic does not exist in the list of topics. + */ + unsubscribe(topicName, callback) { + if (!this.topicExists(this.pushTopics, topicName)) { + throw new Error("Topic does not exist"); + } + const index = this.pushTopics[topicName].indexOf(callback); + if (index > -1) { + this.pushTopics[topicName].splice(index, 1); + } + } + /** + * Publishes data to a specified topic with variable number of arguments. + * @param {string} topicName - The name of the topic to publish to. + * @param {...any[]} args - Variable number of arguments to pass to subscribers + * @throws {Error} If the specified topic does not exist. + */ + publish(topicName, ...args) { + if (!this.topicExists(this.pushTopics, topicName)) { + throw new Error(`Topic "${topicName}" does not exist!`); + } + this.pushTopics[topicName].forEach((callback) => { + callback(...args); + }); + } + // Pull + /** + * Creates a new pull topic (listener must request data) + * + * @param {string} topicName - The name of the topic to create. + * @param {() => Promise} callBack - The callback function to be called when data is requested. + * @throws {Error} If the topic already exists. + */ + createPullTopic(topicName, callBack) { + if (this.topicExists(this.pullTopics, topicName)) { + throw new Error("Topic already exists"); + } + this.pullTopics[topicName] = callBack; + } + /** + * Requests data from a specified pull topic. + * @param {string} topicName - The name of the topic to request data from. + * @returns {Promise} - The data from the pull topic. + * @throws {Error} If the specified topic does not exist. + */ + async pull(topicName, data) { + if (!this.topicExists(this.pullTopics, topicName)) { + throw new Error("Topic does not exist"); + } + const callBack = this.pullTopics[topicName]; + try { + const result = await callBack(data); + return result; + } catch (error) { + console.error(`Error pulling data from topic "${topicName}":`, error); + throw error; + } + } + // Helper Methods + /** + * Checks if a topic exists in the given topics object. + * @param {Record} topics - The topics object to check. + * @param {string} topicName - The name of the topic to check. + * @returns {boolean} - True if the topic exists, false otherwise. + */ + topicExists(topics, topicName) { + return topics.hasOwnProperty(topicName); + } +} +class KeyboardManager { + static { + __name(this, "KeyboardManager"); + } + keysDown = []; + maskEditor; + messageBroker; + constructor(maskEditor) { + this.maskEditor = maskEditor; + this.messageBroker = maskEditor.getMessageBroker(); + this.addPullTopics(); + } + addPullTopics() { + this.messageBroker.createPullTopic( + "isKeyPressed", + (key) => Promise.resolve(this.isKeyDown(key)) + ); + } + addListeners() { + document.addEventListener("keydown", (event) => this.handleKeyDown(event)); + document.addEventListener("keyup", (event) => this.handleKeyUp(event)); + window.addEventListener("blur", () => this.clearKeys()); + } + removeListeners() { + document.removeEventListener( + "keydown", + (event) => this.handleKeyDown(event) + ); + document.removeEventListener("keyup", (event) => this.handleKeyUp(event)); + } + clearKeys() { + this.keysDown = []; + } + handleKeyDown(event) { + if (!this.keysDown.includes(event.key)) { + this.keysDown.push(event.key); + } + } + handleKeyUp(event) { + this.keysDown = this.keysDown.filter((key) => key !== event.key); + } + isKeyDown(key) { + return this.keysDown.includes(key); + } + // combinations + undoCombinationPressed() { + const combination = ["ctrl", "z"]; + const keysDownLower = this.keysDown.map((key) => key.toLowerCase()); + const result = combination.every((key) => keysDownLower.includes(key)); + if (result) this.messageBroker.publish("undo"); + return result; + } + redoCombinationPressed() { + const combination = ["ctrl", "shift", "z"]; + const keysDownLower = this.keysDown.map((key) => key.toLowerCase()); + const result = combination.every((key) => keysDownLower.includes(key)); + if (result) this.messageBroker.publish("redo"); + return result; + } +} +app.registerExtension({ + name: "Comfy.MaskEditor", + settings: [ + { + id: "Comfy.MaskEditor.UseNewEditor", + category: ["Mask Editor", "NewEditor"], + name: "Use new mask editor", + tooltip: "Switch to the new mask editor interface", + type: "boolean", + defaultValue: true, + experimental: true + }, + { + id: "Comfy.MaskEditor.BrushAdjustmentSpeed", + category: ["Mask Editor", "BrushAdjustment", "Sensitivity"], + name: "Brush adjustment speed multiplier", + tooltip: "Controls how quickly the brush size and hardness change when adjusting. Higher values mean faster changes.", + experimental: true, + type: "slider", + attrs: { + min: 0.1, + max: 2, + step: 0.1 + }, + defaultValue: 1, + versionAdded: "1.0.0" + }, + { + id: "Comfy.MaskEditor.UseDominantAxis", + category: ["Mask Editor", "BrushAdjustment", "UseDominantAxis"], + name: "Lock brush adjustment to dominant axis", + tooltip: "When enabled, brush adjustments will only affect size OR hardness based on which direction you move more", + type: "boolean", + defaultValue: true, + experimental: true + } + ], + init(app2) { + function openMaskEditor() { + const useNewEditor = app2.extensionManager.setting.get( + "Comfy.MaskEditor.UseNewEditor" + ); + if (useNewEditor) { + const dlg = MaskEditorDialog.getInstance(); + if (dlg?.isOpened && !dlg.isOpened()) { + dlg.show(); + } + } else { + const dlg = MaskEditorDialogOld.getInstance(); + if (dlg?.isOpened && !dlg.isOpened()) { + dlg.show(); + } + } + } + __name(openMaskEditor, "openMaskEditor"); + ; + ComfyApp.open_maskeditor = openMaskEditor; + const context_predicate = /* @__PURE__ */ __name(() => { + return !!(ComfyApp.clipspace && ComfyApp.clipspace.imgs && ComfyApp.clipspace.imgs.length > 0); + }, "context_predicate"); + ClipspaceDialog.registerButton( + "MaskEditor", + context_predicate, + openMaskEditor ); } }); -//# sourceMappingURL=index-p6KSJ2Zq.js.map +const id = "Comfy.NodeTemplates"; +const file = "comfy.templates.json"; +class ManageTemplates extends ComfyDialog { + static { + __name(this, "ManageTemplates"); + } + templates; + draggedEl; + saveVisualCue; + emptyImg; + importInput; + constructor() { + super(); + this.load().then((v) => { + this.templates = v; + }); + this.element.classList.add("comfy-manage-templates"); + this.draggedEl = null; + this.saveVisualCue = null; + this.emptyImg = new Image(); + this.emptyImg.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="; + this.importInput = $el("input", { + type: "file", + accept: ".json", + multiple: true, + style: { display: "none" }, + parent: document.body, + onchange: /* @__PURE__ */ __name(() => this.importAll(), "onchange") + }); + } + createButtons() { + const btns = super.createButtons(); + btns[0].textContent = "Close"; + btns[0].onclick = (e) => { + clearTimeout(this.saveVisualCue); + this.close(); + }; + btns.unshift( + $el("button", { + type: "button", + textContent: "Export", + onclick: /* @__PURE__ */ __name(() => this.exportAll(), "onclick") + }) + ); + btns.unshift( + $el("button", { + type: "button", + textContent: "Import", + onclick: /* @__PURE__ */ __name(() => { + this.importInput.click(); + }, "onclick") + }) + ); + return btns; + } + async load() { + let templates = []; + const res = await api.getUserData(file); + if (res.status === 200) { + try { + templates = await res.json(); + } catch (error) { + } + } else if (res.status !== 404) { + console.error(res.status + " " + res.statusText); + } + return templates ?? []; + } + async store() { + const templates = JSON.stringify(this.templates, void 0, 4); + try { + await api.storeUserData(file, templates, { stringify: false }); + } catch (error) { + console.error(error); + useToastStore().addAlert(error.message); + } + } + async importAll() { + for (const file2 of this.importInput.files) { + if (file2.type === "application/json" || file2.name.endsWith(".json")) { + const reader = new FileReader(); + reader.onload = async () => { + const importFile = JSON.parse(reader.result); + if (importFile?.templates) { + for (const template of importFile.templates) { + if (template?.name && template?.data) { + this.templates.push(template); + } + } + await this.store(); + } + }; + await reader.readAsText(file2); + } + } + this.importInput.value = null; + this.close(); + } + exportAll() { + if (this.templates.length == 0) { + useToastStore().addAlert("No templates to export."); + return; + } + const json = JSON.stringify({ templates: this.templates }, null, 2); + const blob = new Blob([json], { type: "application/json" }); + const url = URL.createObjectURL(blob); + const a = $el("a", { + href: url, + download: "node_templates.json", + style: { display: "none" }, + parent: document.body + }); + a.click(); + setTimeout(function() { + a.remove(); + window.URL.revokeObjectURL(url); + }, 0); + } + show() { + super.show( + $el( + "div", + {}, + this.templates.flatMap((t2, i) => { + let nameInput; + return [ + $el( + "div", + { + dataset: { id: i.toString() }, + className: "templateManagerRow", + style: { + display: "grid", + gridTemplateColumns: "1fr auto", + border: "1px dashed transparent", + gap: "5px", + backgroundColor: "var(--comfy-menu-bg)" + }, + ondragstart: /* @__PURE__ */ __name((e) => { + this.draggedEl = e.currentTarget; + e.currentTarget.style.opacity = "0.6"; + e.currentTarget.style.border = "1px dashed yellow"; + e.dataTransfer.effectAllowed = "move"; + e.dataTransfer.setDragImage(this.emptyImg, 0, 0); + }, "ondragstart"), + ondragend: /* @__PURE__ */ __name((e) => { + e.target.style.opacity = "1"; + e.currentTarget.style.border = "1px dashed transparent"; + e.currentTarget.removeAttribute("draggable"); + this.element.querySelectorAll(".templateManagerRow").forEach((el, i2) => { + var prev_i = Number.parseInt(el.dataset.id); + if (el == this.draggedEl && prev_i != i2) { + this.templates.splice( + i2, + 0, + this.templates.splice(prev_i, 1)[0] + ); + } + el.dataset.id = i2.toString(); + }); + this.store(); + }, "ondragend"), + ondragover: /* @__PURE__ */ __name((e) => { + e.preventDefault(); + if (e.currentTarget == this.draggedEl) return; + let rect = e.currentTarget.getBoundingClientRect(); + if (e.clientY > rect.top + rect.height / 2) { + e.currentTarget.parentNode.insertBefore( + this.draggedEl, + e.currentTarget.nextSibling + ); + } else { + e.currentTarget.parentNode.insertBefore( + this.draggedEl, + e.currentTarget + ); + } + }, "ondragover") + }, + [ + $el( + "label", + { + textContent: "Name: ", + style: { + cursor: "grab" + }, + onmousedown: /* @__PURE__ */ __name((e) => { + if (e.target.localName == "label") + e.currentTarget.parentNode.draggable = "true"; + }, "onmousedown") + }, + [ + $el("input", { + value: t2.name, + dataset: { name: t2.name }, + style: { + transitionProperty: "background-color", + transitionDuration: "0s" + }, + onchange: /* @__PURE__ */ __name((e) => { + clearTimeout(this.saveVisualCue); + var el = e.target; + var row = el.parentNode.parentNode; + this.templates[row.dataset.id].name = el.value.trim() || "untitled"; + this.store(); + el.style.backgroundColor = "rgb(40, 95, 40)"; + el.style.transitionDuration = "0s"; + this.saveVisualCue = setTimeout(function() { + el.style.transitionDuration = ".7s"; + el.style.backgroundColor = "var(--comfy-input-bg)"; + }, 15); + }, "onchange"), + onkeypress: /* @__PURE__ */ __name((e) => { + var el = e.target; + clearTimeout(this.saveVisualCue); + el.style.transitionDuration = "0s"; + el.style.backgroundColor = "var(--comfy-input-bg)"; + }, "onkeypress"), + $: /* @__PURE__ */ __name((el) => nameInput = el, "$") + }) + ] + ), + $el("div", {}, [ + $el("button", { + textContent: "Export", + style: { + fontSize: "12px", + fontWeight: "normal" + }, + onclick: /* @__PURE__ */ __name((e) => { + const json = JSON.stringify({ templates: [t2] }, null, 2); + const blob = new Blob([json], { + type: "application/json" + }); + const url = URL.createObjectURL(blob); + const a = $el("a", { + href: url, + download: (nameInput.value || t2.name) + ".json", + style: { display: "none" }, + parent: document.body + }); + a.click(); + setTimeout(function() { + a.remove(); + window.URL.revokeObjectURL(url); + }, 0); + }, "onclick") + }), + $el("button", { + textContent: "Delete", + style: { + fontSize: "12px", + color: "red", + fontWeight: "normal" + }, + onclick: /* @__PURE__ */ __name((e) => { + const item = e.target.parentNode.parentNode; + item.parentNode.removeChild(item); + this.templates.splice(item.dataset.id * 1, 1); + this.store(); + var that = this; + setTimeout(function() { + that.element.querySelectorAll(".templateManagerRow").forEach((el, i2) => { + el.dataset.id = i2.toString(); + }); + }, 0); + }, "onclick") + }) + ]) + ] + ) + ]; + }) + ) + ); + } +} +app.registerExtension({ + name: id, + setup() { + const manage = new ManageTemplates(); + const clipboardAction = /* @__PURE__ */ __name(async (cb) => { + const old = localStorage.getItem("litegrapheditor_clipboard"); + await cb(); + localStorage.setItem("litegrapheditor_clipboard", old); + }, "clipboardAction"); + const orig = LGraphCanvas.prototype.getCanvasMenuOptions; + LGraphCanvas.prototype.getCanvasMenuOptions = function() { + const options = orig.apply(this, arguments); + options.push(null); + options.push({ + content: `Save Selected as Template`, + disabled: !Object.keys(app.canvas.selected_nodes || {}).length, + callback: /* @__PURE__ */ __name(async () => { + const name = await useDialogService().prompt({ + title: t("nodeTemplates.saveAsTemplate"), + message: t("nodeTemplates.enterName"), + defaultValue: "" + }); + if (!name?.trim()) return; + clipboardAction(() => { + app.canvas.copyToClipboard(); + let data = localStorage.getItem("litegrapheditor_clipboard"); + data = JSON.parse(data); + const nodeIds = Object.keys(app.canvas.selected_nodes); + for (let i = 0; i < nodeIds.length; i++) { + const node = app.graph.getNodeById(nodeIds[i]); + const nodeData = node?.constructor.nodeData; + let groupData = GroupNodeHandler.getGroupData(node); + if (groupData) { + groupData = groupData.nodeData; + if (!data.groupNodes) { + data.groupNodes = {}; + } + data.groupNodes[nodeData.name] = groupData; + data.nodes[i].type = nodeData.name; + } + } + manage.templates.push({ + name, + data: JSON.stringify(data) + }); + manage.store(); + }); + }, "callback") + }); + const subItems = manage.templates.map((t2) => { + return { + content: t2.name, + callback: /* @__PURE__ */ __name(() => { + clipboardAction(async () => { + const data = JSON.parse(t2.data); + await GroupNodeConfig.registerFromWorkflow(data.groupNodes, {}); + if (!data.reroutes) { + deserialiseAndCreate(t2.data, app.canvas); + } else { + localStorage.setItem("litegrapheditor_clipboard", t2.data); + app.canvas.pasteFromClipboard(); + } + }); + }, "callback") + }; + }); + subItems.push(null, { + content: "Manage", + callback: /* @__PURE__ */ __name(() => manage.show(), "callback") + }); + options.push({ + content: "Node Templates", + submenu: { + options: subItems + } + }); + return options; + }; + } +}); +app.registerExtension({ + name: "Comfy.NoteNode", + registerCustomNodes() { + class NoteNode extends LGraphNode { + static { + __name(this, "NoteNode"); + } + static category; + color = LGraphCanvas.node_colors.yellow.color; + bgcolor = LGraphCanvas.node_colors.yellow.bgcolor; + groupcolor = LGraphCanvas.node_colors.yellow.groupcolor; + isVirtualNode; + collapsable; + title_mode; + constructor(title) { + super(title); + if (!this.properties) { + this.properties = { text: "" }; + } + ComfyWidgets.STRING( + // Should we extends LGraphNode? Yesss + this, + "", + ["", { default: this.properties.text, multiline: true }], + app + ); + this.serialize_widgets = true; + this.isVirtualNode = true; + } + } + LiteGraph.registerNodeType( + "Note", + Object.assign(NoteNode, { + title_mode: LiteGraph.NORMAL_TITLE, + title: "Note", + collapsable: true + }) + ); + NoteNode.category = "utils"; + class MarkdownNoteNode extends LGraphNode { + static { + __name(this, "MarkdownNoteNode"); + } + static title = "Markdown Note"; + color = LGraphCanvas.node_colors.yellow.color; + bgcolor = LGraphCanvas.node_colors.yellow.bgcolor; + groupcolor = LGraphCanvas.node_colors.yellow.groupcolor; + constructor(title) { + super(title); + if (!this.properties) { + this.properties = { text: "" }; + } + ComfyWidgets.MARKDOWN( + this, + "", + ["", { default: this.properties.text }], + app + ); + this.serialize_widgets = true; + this.isVirtualNode = true; + } + } + LiteGraph.registerNodeType("MarkdownNote", MarkdownNoteNode); + MarkdownNoteNode.category = "utils"; + } +}); +app.registerExtension({ + name: "Comfy.RerouteNode", + registerCustomNodes(app2) { + class RerouteNode extends LGraphNode { + static { + __name(this, "RerouteNode"); + } + static category; + static defaultVisibility = false; + constructor(title) { + super(title); + if (!this.properties) { + this.properties = {}; + } + this.properties.showOutputText = RerouteNode.defaultVisibility; + this.properties.horizontal = false; + this.addInput("", "*"); + this.addOutput(this.properties.showOutputText ? "*" : "", "*"); + this.onAfterGraphConfigured = function() { + requestAnimationFrame(() => { + this.onConnectionsChange(LiteGraph.INPUT, null, true, null); + }); + }; + this.onConnectionsChange = (type, index, connected, link_info) => { + if (app2.configuringGraph) return; + this.applyOrientation(); + if (connected && type === LiteGraph.OUTPUT) { + const types = new Set( + this.outputs[0].links.map((l) => app2.graph.links[l].type).filter((t2) => t2 !== "*") + ); + if (types.size > 1) { + const linksToDisconnect = []; + for (let i = 0; i < this.outputs[0].links.length - 1; i++) { + const linkId = this.outputs[0].links[i]; + const link = app2.graph.links[linkId]; + linksToDisconnect.push(link); + } + for (const link of linksToDisconnect) { + const node = app2.graph.getNodeById(link.target_id); + node.disconnectInput(link.target_slot); + } + } + } + let currentNode = this; + let updateNodes = []; + let inputType = null; + let inputNode = null; + while (currentNode) { + updateNodes.unshift(currentNode); + const linkId = currentNode.inputs[0].link; + if (linkId !== null) { + const link = app2.graph.links[linkId]; + if (!link) return; + const node = app2.graph.getNodeById(link.origin_id); + const type2 = node.constructor.type; + if (type2 === "Reroute") { + if (node === this) { + currentNode.disconnectInput(link.target_slot); + currentNode = null; + } else { + currentNode = node; + } + } else { + inputNode = currentNode; + inputType = node.outputs[link.origin_slot]?.type ?? null; + break; + } + } else { + currentNode = null; + break; + } + } + const nodes = [this]; + let outputType = null; + while (nodes.length) { + currentNode = nodes.pop(); + const outputs = (currentNode.outputs ? currentNode.outputs[0].links : []) || []; + if (outputs.length) { + for (const linkId of outputs) { + const link = app2.graph.links[linkId]; + if (!link) continue; + const node = app2.graph.getNodeById(link.target_id); + const type2 = node.constructor.type; + if (type2 === "Reroute") { + nodes.push(node); + updateNodes.push(node); + } else { + const nodeOutType = node.inputs && node.inputs[link?.target_slot] && node.inputs[link.target_slot].type ? node.inputs[link.target_slot].type : null; + if (inputType && !LiteGraph.isValidConnection(inputType, nodeOutType)) { + node.disconnectInput(link.target_slot); + } else { + outputType = nodeOutType; + } + } + } + } else { + } + } + const displayType = inputType || outputType || "*"; + const color = LGraphCanvas.link_type_colors[displayType]; + let widgetConfig; + let targetWidget; + let widgetType; + for (const node of updateNodes) { + node.outputs[0].type = inputType || "*"; + node.__outputType = displayType; + node.outputs[0].name = node.properties.showOutputText ? displayType : ""; + node.size = node.computeSize(); + node.applyOrientation(); + for (const l of node.outputs[0].links || []) { + const link = app2.graph.links[l]; + if (link) { + link.color = color; + if (app2.configuringGraph) continue; + const targetNode = app2.graph.getNodeById(link.target_id); + const targetInput = targetNode.inputs?.[link.target_slot]; + if (targetInput?.widget) { + const config = getWidgetConfig(targetInput); + if (!widgetConfig) { + widgetConfig = config[1] ?? {}; + widgetType = config[0]; + } + if (!targetWidget) { + targetWidget = targetNode.widgets?.find( + (w) => w.name === targetInput.widget.name + ); + } + const merged = mergeIfValid(targetInput, [ + config[0], + widgetConfig + ]); + if (merged.customConfig) { + widgetConfig = merged.customConfig; + } + } + } + } + } + for (const node of updateNodes) { + if (widgetConfig && outputType) { + node.inputs[0].widget = { name: "value" }; + setWidgetConfig( + node.inputs[0], + [widgetType ?? displayType, widgetConfig], + targetWidget + ); + } else { + setWidgetConfig(node.inputs[0], null); + } + } + if (inputNode) { + const link = app2.graph.links[inputNode.inputs[0].link]; + if (link) { + link.color = color; + } + } + }; + this.clone = function() { + const cloned = RerouteNode.prototype.clone.apply(this); + cloned.removeOutput(0); + cloned.addOutput(this.properties.showOutputText ? "*" : "", "*"); + cloned.size = cloned.computeSize(); + return cloned; + }; + this.isVirtualNode = true; + } + getExtraMenuOptions(_, options) { + options.unshift( + { + content: (this.properties.showOutputText ? "Hide" : "Show") + " Type", + callback: /* @__PURE__ */ __name(() => { + this.properties.showOutputText = !this.properties.showOutputText; + if (this.properties.showOutputText) { + this.outputs[0].name = this.__outputType || this.outputs[0].type; + } else { + this.outputs[0].name = ""; + } + this.size = this.computeSize(); + this.applyOrientation(); + app2.graph.setDirtyCanvas(true, true); + }, "callback") + }, + { + content: (RerouteNode.defaultVisibility ? "Hide" : "Show") + " Type By Default", + callback: /* @__PURE__ */ __name(() => { + RerouteNode.setDefaultTextVisibility( + !RerouteNode.defaultVisibility + ); + }, "callback") + }, + { + // naming is inverted with respect to LiteGraphNode.horizontal + // LiteGraphNode.horizontal == true means that + // each slot in the inputs and outputs are laid out horizontally, + // which is the opposite of the visual orientation of the inputs and outputs as a node + content: "Set " + (this.properties.horizontal ? "Horizontal" : "Vertical"), + callback: /* @__PURE__ */ __name(() => { + this.properties.horizontal = !this.properties.horizontal; + this.applyOrientation(); + }, "callback") + } + ); + return []; + } + applyOrientation() { + this.horizontal = this.properties.horizontal; + if (this.horizontal) { + this.inputs[0].pos = [this.size[0] / 2, 0]; + } else { + delete this.inputs[0].pos; + } + app2.graph.setDirtyCanvas(true, true); + } + computeSize() { + return [ + this.properties.showOutputText && this.outputs && this.outputs.length ? Math.max( + 75, + LiteGraph.NODE_TEXT_SIZE * this.outputs[0].name.length * 0.6 + 40 + ) : 75, + 26 + ]; + } + static setDefaultTextVisibility(visible) { + RerouteNode.defaultVisibility = visible; + if (visible) { + localStorage["Comfy.RerouteNode.DefaultVisibility"] = "true"; + } else { + delete localStorage["Comfy.RerouteNode.DefaultVisibility"]; + } + } + } + RerouteNode.setDefaultTextVisibility( + !!localStorage["Comfy.RerouteNode.DefaultVisibility"] + ); + LiteGraph.registerNodeType( + "Reroute", + Object.assign(RerouteNode, { + title_mode: LiteGraph.NO_TITLE, + title: "Reroute", + collapsable: false + }) + ); + RerouteNode.category = "utils"; + } +}); +app.registerExtension({ + name: "Comfy.SaveImageExtraOutput", + async beforeRegisterNodeDef(nodeType, nodeData, app2) { + if (nodeData.name === "SaveImage" || nodeData.name === "SaveAnimatedWEBP") { + const onNodeCreated = nodeType.prototype.onNodeCreated; + nodeType.prototype.onNodeCreated = function() { + const r = onNodeCreated ? onNodeCreated.apply(this, arguments) : void 0; + const widget = this.widgets.find((w) => w.name === "filename_prefix"); + widget.serializeValue = () => { + return applyTextReplacements(app2, widget.value); + }; + return r; + }; + } else { + const onNodeCreated = nodeType.prototype.onNodeCreated; + nodeType.prototype.onNodeCreated = function() { + const r = onNodeCreated ? onNodeCreated.apply(this, arguments) : void 0; + if (!this.properties || !("Node name for S&R" in this.properties)) { + this.addProperty("Node name for S&R", this.constructor.type, "string"); + } + return r; + }; + } + } +}); +let touchZooming; +let touchCount = 0; +app.registerExtension({ + name: "Comfy.SimpleTouchSupport", + setup() { + let touchDist; + let touchTime; + let lastTouch; + let lastScale; + function getMultiTouchPos(e) { + return Math.hypot( + e.touches[0].clientX - e.touches[1].clientX, + e.touches[0].clientY - e.touches[1].clientY + ); + } + __name(getMultiTouchPos, "getMultiTouchPos"); + function getMultiTouchCenter(e) { + return { + clientX: (e.touches[0].clientX + e.touches[1].clientX) / 2, + clientY: (e.touches[0].clientY + e.touches[1].clientY) / 2 + }; + } + __name(getMultiTouchCenter, "getMultiTouchCenter"); + app.canvasEl.parentElement.addEventListener( + "touchstart", + (e) => { + touchCount++; + lastTouch = null; + lastScale = null; + if (e.touches?.length === 1) { + touchTime = /* @__PURE__ */ new Date(); + lastTouch = e.touches[0]; + } else { + touchTime = null; + if (e.touches?.length === 2) { + lastScale = app.canvas.ds.scale; + lastTouch = getMultiTouchCenter(e); + touchDist = getMultiTouchPos(e); + app.canvas.pointer.isDown = false; + } + } + }, + true + ); + app.canvasEl.parentElement.addEventListener("touchend", (e) => { + touchCount--; + if (e.touches?.length !== 1) touchZooming = false; + if (touchTime && !e.touches?.length) { + if ((/* @__PURE__ */ new Date()).getTime() - touchTime > 600) { + if (e.target === app.canvasEl) { + app.canvasEl.dispatchEvent( + new PointerEvent("pointerdown", { + button: 2, + clientX: e.changedTouches[0].clientX, + clientY: e.changedTouches[0].clientY + }) + ); + e.preventDefault(); + } + } + touchTime = null; + } + }); + app.canvasEl.parentElement.addEventListener( + "touchmove", + (e) => { + touchTime = null; + if (e.touches?.length === 2 && lastTouch && !e.ctrlKey && !e.shiftKey) { + e.preventDefault(); + app.canvas.pointer.isDown = false; + touchZooming = true; + LiteGraph.closeAllContextMenus(window); + app.canvas.search_box?.close(); + const newTouchDist = getMultiTouchPos(e); + const center = getMultiTouchCenter(e); + let scale = lastScale * newTouchDist / touchDist; + const newX = (center.clientX - lastTouch.clientX) / scale; + const newY = (center.clientY - lastTouch.clientY) / scale; + if (scale < app.canvas.ds.min_scale) { + scale = app.canvas.ds.min_scale; + } else if (scale > app.canvas.ds.max_scale) { + scale = app.canvas.ds.max_scale; + } + const oldScale = app.canvas.ds.scale; + app.canvas.ds.scale = scale; + if (Math.abs(app.canvas.ds.scale - 1) < 0.01) { + app.canvas.ds.scale = 1; + } + const newScale = app.canvas.ds.scale; + const convertScaleToOffset = /* @__PURE__ */ __name((scale2) => [ + center.clientX / scale2 - app.canvas.ds.offset[0], + center.clientY / scale2 - app.canvas.ds.offset[1] + ], "convertScaleToOffset"); + var oldCenter = convertScaleToOffset(oldScale); + var newCenter = convertScaleToOffset(newScale); + app.canvas.ds.offset[0] += newX + newCenter[0] - oldCenter[0]; + app.canvas.ds.offset[1] += newY + newCenter[1] - oldCenter[1]; + lastTouch.clientX = center.clientX; + lastTouch.clientY = center.clientY; + app.canvas.setDirty(true, true); + } + }, + true + ); + } +}); +const processMouseDown = LGraphCanvas.prototype.processMouseDown; +LGraphCanvas.prototype.processMouseDown = function(e) { + if (touchZooming || touchCount) { + return; + } + app.canvas.pointer.isDown = false; + return processMouseDown.apply(this, arguments); +}; +const processMouseMove = LGraphCanvas.prototype.processMouseMove; +LGraphCanvas.prototype.processMouseMove = function(e) { + if (touchZooming || touchCount > 1) { + return; + } + return processMouseMove.apply(this, arguments); +}; +app.registerExtension({ + name: "Comfy.SlotDefaults", + suggestionsNumber: null, + init() { + LiteGraph.search_filter_enabled = true; + LiteGraph.middle_click_slot_add_default_node = true; + this.suggestionsNumber = app.ui.settings.addSetting({ + id: "Comfy.NodeSuggestions.number", + category: ["Comfy", "Node Search Box", "NodeSuggestions"], + name: "Number of nodes suggestions", + tooltip: "Only for litegraph searchbox/context menu", + type: "slider", + attrs: { + min: 1, + max: 100, + step: 1 + }, + defaultValue: 5, + onChange: /* @__PURE__ */ __name((newVal, oldVal) => { + this.setDefaults(newVal); + }, "onChange") + }); + }, + slot_types_default_out: {}, + slot_types_default_in: {}, + async beforeRegisterNodeDef(nodeType, nodeData, app2) { + var nodeId = nodeData.name; + const inputs = nodeData["input"]?.["required"]; + for (const inputKey in inputs) { + var input = inputs[inputKey]; + if (typeof input[0] !== "string") continue; + var type = input[0]; + if (type in ComfyWidgets) { + var customProperties = input[1]; + if (!customProperties?.forceInput) continue; + } + if (!(type in this.slot_types_default_out)) { + this.slot_types_default_out[type] = ["Reroute"]; + } + if (this.slot_types_default_out[type].includes(nodeId)) continue; + this.slot_types_default_out[type].push(nodeId); + const lowerType = type.toLocaleLowerCase(); + if (!(lowerType in LiteGraph.registered_slot_in_types)) { + LiteGraph.registered_slot_in_types[lowerType] = { nodes: [] }; + } + LiteGraph.registered_slot_in_types[lowerType].nodes.push( + // @ts-expect-error ComfyNode + nodeType.comfyClass + ); + } + var outputs = nodeData["output"] ?? []; + for (const el of outputs) { + const type2 = el; + if (!(type2 in this.slot_types_default_in)) { + this.slot_types_default_in[type2] = ["Reroute"]; + } + this.slot_types_default_in[type2].push(nodeId); + if (!(type2 in LiteGraph.registered_slot_out_types)) { + LiteGraph.registered_slot_out_types[type2] = { nodes: [] }; + } + LiteGraph.registered_slot_out_types[type2].nodes.push(nodeType.comfyClass); + if (!LiteGraph.slot_types_out.includes(type2)) { + LiteGraph.slot_types_out.push(type2); + } + } + var maxNum = this.suggestionsNumber.value; + this.setDefaults(maxNum); + }, + setDefaults(maxNum) { + LiteGraph.slot_types_default_out = {}; + LiteGraph.slot_types_default_in = {}; + for (const type in this.slot_types_default_out) { + LiteGraph.slot_types_default_out[type] = this.slot_types_default_out[type].slice(0, maxNum); + } + for (const type in this.slot_types_default_in) { + LiteGraph.slot_types_default_in[type] = this.slot_types_default_in[type].slice(0, maxNum); + } + } +}); +function splitFilePath(path) { + const folder_separator = path.lastIndexOf("/"); + if (folder_separator === -1) { + return ["", path]; + } + return [ + path.substring(0, folder_separator), + path.substring(folder_separator + 1) + ]; +} +__name(splitFilePath, "splitFilePath"); +function getResourceURL(subfolder, filename, type = "input") { + const params = [ + "filename=" + encodeURIComponent(filename), + "type=" + type, + "subfolder=" + subfolder, + app.getRandParam().substring(1) + ].join("&"); + return `/view?${params}`; +} +__name(getResourceURL, "getResourceURL"); +async function uploadFile(audioWidget, audioUIWidget, file2, updateNode, pasted = false) { + try { + const body = new FormData(); + body.append("image", file2); + if (pasted) body.append("subfolder", "pasted"); + const resp = await api.fetchApi("/upload/image", { + method: "POST", + body + }); + if (resp.status === 200) { + const data = await resp.json(); + let path = data.name; + if (data.subfolder) path = data.subfolder + "/" + path; + if (!audioWidget.options.values.includes(path)) { + audioWidget.options.values.push(path); + } + if (updateNode) { + audioUIWidget.element.src = api.apiURL( + getResourceURL(...splitFilePath(path)) + ); + audioWidget.value = path; + } + } else { + useToastStore().addAlert(resp.status + " - " + resp.statusText); + } + } catch (error) { + useToastStore().addAlert(error); + } +} +__name(uploadFile, "uploadFile"); +app.registerExtension({ + name: "Comfy.AudioWidget", + async beforeRegisterNodeDef(nodeType, nodeData) { + if ( + // @ts-expect-error ComfyNode + ["LoadAudio", "SaveAudio", "PreviewAudio"].includes(nodeType.comfyClass) + ) { + nodeData.input.required.audioUI = ["AUDIO_UI"]; + } + }, + getCustomWidgets() { + return { + AUDIO_UI(node, inputName) { + const audio = document.createElement("audio"); + audio.controls = true; + audio.classList.add("comfy-audio"); + audio.setAttribute("name", "media"); + const audioUIWidget = node.addDOMWidget( + inputName, + /* name=*/ + "audioUI", + audio, + { + serialize: false + } + ); + const isOutputNode = node.constructor.nodeData.output_node; + if (isOutputNode) { + audioUIWidget.element.classList.add("empty-audio-widget"); + const onExecuted = node.onExecuted; + node.onExecuted = function(message) { + onExecuted?.apply(this, arguments); + const audios = message.audio; + if (!audios) return; + const audio2 = audios[0]; + audioUIWidget.element.src = api.apiURL( + getResourceURL(audio2.subfolder, audio2.filename, audio2.type) + ); + audioUIWidget.element.classList.remove("empty-audio-widget"); + }; + } + return { widget: audioUIWidget }; + } + }; + }, + onNodeOutputsUpdated(nodeOutputs) { + for (const [nodeId, output] of Object.entries(nodeOutputs)) { + const node = app.graph.getNodeById(nodeId); + if ("audio" in output) { + const audioUIWidget = node.widgets.find( + (w) => w.name === "audioUI" + ); + const audio = output.audio[0]; + audioUIWidget.element.src = api.apiURL( + getResourceURL(audio.subfolder, audio.filename, audio.type) + ); + audioUIWidget.element.classList.remove("empty-audio-widget"); + } + } + } +}); +app.registerExtension({ + name: "Comfy.UploadAudio", + async beforeRegisterNodeDef(nodeType, nodeData) { + if (nodeData?.input?.required?.audio?.[1]?.audio_upload === true) { + nodeData.input.required.upload = ["AUDIOUPLOAD"]; + } + }, + getCustomWidgets() { + return { + AUDIOUPLOAD(node, inputName) { + const audioWidget = node.widgets.find( + (w) => w.name === "audio" + ); + const audioUIWidget = node.widgets.find( + (w) => w.name === "audioUI" + ); + const onAudioWidgetUpdate = /* @__PURE__ */ __name(() => { + audioUIWidget.element.src = api.apiURL( + getResourceURL(...splitFilePath(audioWidget.value)) + ); + }, "onAudioWidgetUpdate"); + if (audioWidget.value) { + onAudioWidgetUpdate(); + } + audioWidget.callback = onAudioWidgetUpdate; + const onGraphConfigured = node.onGraphConfigured; + node.onGraphConfigured = function() { + onGraphConfigured?.apply(this, arguments); + if (audioWidget.value) { + onAudioWidgetUpdate(); + } + }; + const fileInput = document.createElement("input"); + fileInput.type = "file"; + fileInput.accept = "audio/*"; + fileInput.style.display = "none"; + fileInput.onchange = () => { + if (fileInput.files.length) { + uploadFile(audioWidget, audioUIWidget, fileInput.files[0], true); + } + }; + const uploadWidget = node.addWidget( + "button", + inputName, + /* value=*/ + "", + () => { + fileInput.click(); + }, + { serialize: false } + ); + uploadWidget.label = "choose file to upload"; + return { widget: uploadWidget }; + } + }; + } +}); +app.registerExtension({ + name: "Comfy.UploadImage", + beforeRegisterNodeDef(nodeType, nodeData) { + if (nodeData?.input?.required?.image?.[1]?.image_upload === true) { + nodeData.input.required.upload = ["IMAGEUPLOAD"]; + } + } +}); +const WEBCAM_READY = Symbol(); +app.registerExtension({ + name: "Comfy.WebcamCapture", + getCustomWidgets(app2) { + return { + WEBCAM(node, inputName) { + let res; + node[WEBCAM_READY] = new Promise((resolve) => res = resolve); + const container = document.createElement("div"); + container.style.background = "rgba(0,0,0,0.25)"; + container.style.textAlign = "center"; + const video = document.createElement("video"); + video.style.height = video.style.width = "100%"; + const loadVideo = /* @__PURE__ */ __name(async () => { + try { + const stream = await navigator.mediaDevices.getUserMedia({ + video: true, + audio: false + }); + container.replaceChildren(video); + setTimeout(() => res(video), 500); + video.addEventListener("loadedmetadata", () => res(video), false); + video.srcObject = stream; + video.play(); + } catch (error) { + const label = document.createElement("div"); + label.style.color = "red"; + label.style.overflow = "auto"; + label.style.maxHeight = "100%"; + label.style.whiteSpace = "pre-wrap"; + if (window.isSecureContext) { + label.textContent = "Unable to load webcam, please ensure access is granted:\n" + error.message; + } else { + label.textContent = "Unable to load webcam. A secure context is required, if you are not accessing ComfyUI on localhost (127.0.0.1) you will have to enable TLS (https)\n\n" + error.message; + } + container.replaceChildren(label); + } + }, "loadVideo"); + loadVideo(); + return { widget: node.addDOMWidget(inputName, "WEBCAM", container) }; + } + }; + }, + nodeCreated(node) { + if (node.type, node.constructor.comfyClass !== "WebcamCapture") return; + let video; + const camera = node.widgets.find((w2) => w2.name === "image"); + const w = node.widgets.find((w2) => w2.name === "width"); + const h = node.widgets.find((w2) => w2.name === "height"); + const captureOnQueue = node.widgets.find( + (w2) => w2.name === "capture_on_queue" + ); + const canvas = document.createElement("canvas"); + const capture = /* @__PURE__ */ __name(() => { + canvas.width = w.value; + canvas.height = h.value; + const ctx = canvas.getContext("2d"); + ctx.drawImage(video, 0, 0, w.value, h.value); + const data = canvas.toDataURL("image/png"); + const img = new Image(); + img.onload = () => { + node.imgs = [img]; + app.graph.setDirtyCanvas(true); + requestAnimationFrame(() => { + node.setSizeForImage?.(); + }); + }; + img.src = data; + }, "capture"); + const btn = node.addWidget( + "button", + "waiting for camera...", + "capture", + capture + ); + btn.disabled = true; + btn.serializeValue = () => void 0; + camera.serializeValue = async () => { + if (captureOnQueue.value) { + capture(); + } else if (!node.imgs?.length) { + const err2 = `No webcam image captured`; + useToastStore().addAlert(err2); + throw new Error(err2); + } + const blob = await new Promise((r) => canvas.toBlob(r)); + const name = `${+/* @__PURE__ */ new Date()}.png`; + const file2 = new File([blob], name); + const body = new FormData(); + body.append("image", file2); + body.append("subfolder", "webcam"); + body.append("type", "temp"); + const resp = await api.fetchApi("/upload/image", { + method: "POST", + body + }); + if (resp.status !== 200) { + const err2 = `Error uploading camera image: ${resp.status} - ${resp.statusText}`; + useToastStore().addAlert(err2); + throw new Error(err2); + } + return `webcam/${name} [temp]`; + }; + node[WEBCAM_READY].then((v) => { + video = v; + if (!w.value) { + w.value = video.videoWidth || 640; + h.value = video.videoHeight || 480; + } + btn.disabled = false; + btn.label = "capture"; + }); + } +}); +//# sourceMappingURL=index-5Sv744Dr.js.map diff --git a/web/assets/index-B7ycxfFq.js b/web/assets/index-B7ycxfFq.js new file mode 100644 index 00000000..2cfff2fa --- /dev/null +++ b/web/assets/index-B7ycxfFq.js @@ -0,0 +1,27 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { ct as script$1, H as createBaseVNode, o as openBlock, f as createElementBlock, D as mergeProps } from "./index-C4Fk50Nx.js"; +var script = { + name: "PlusIcon", + "extends": script$1 +}; +var _hoisted_1 = /* @__PURE__ */ createBaseVNode("path", { + d: "M7.67742 6.32258V0.677419C7.67742 0.497757 7.60605 0.325452 7.47901 0.198411C7.35197 0.0713707 7.17966 0 7 0C6.82034 0 6.64803 0.0713707 6.52099 0.198411C6.39395 0.325452 6.32258 0.497757 6.32258 0.677419V6.32258H0.677419C0.497757 6.32258 0.325452 6.39395 0.198411 6.52099C0.0713707 6.64803 0 6.82034 0 7C0 7.17966 0.0713707 7.35197 0.198411 7.47901C0.325452 7.60605 0.497757 7.67742 0.677419 7.67742H6.32258V13.3226C6.32492 13.5015 6.39704 13.6725 6.52358 13.799C6.65012 13.9255 6.82106 13.9977 7 14C7.17966 14 7.35197 13.9286 7.47901 13.8016C7.60605 13.6745 7.67742 13.5022 7.67742 13.3226V7.67742H13.3226C13.5022 7.67742 13.6745 7.60605 13.8016 7.47901C13.9286 7.35197 14 7.17966 14 7C13.9977 6.82106 13.9255 6.65012 13.799 6.52358C13.6725 6.39704 13.5015 6.32492 13.3226 6.32258H7.67742Z", + fill: "currentColor" +}, null, -1); +var _hoisted_2 = [_hoisted_1]; +function render(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("svg", mergeProps({ + width: "14", + height: "14", + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, _ctx.pti()), _hoisted_2, 16); +} +__name(render, "render"); +script.render = render; +export { + script as s +}; +//# sourceMappingURL=index-B7ycxfFq.js.map diff --git a/web/assets/index-DIU5yZe9.js b/web/assets/index-C4Fk50Nx.js similarity index 69% rename from web/assets/index-DIU5yZe9.js rename to web/assets/index-C4Fk50Nx.js index 256357f3..0da0e4c9 100644 --- a/web/assets/index-DIU5yZe9.js +++ b/web/assets/index-C4Fk50Nx.js @@ -1,13 +1,13 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./KeybindingPanel-DC2AxNNa.js","./index-D3u7l7ha.js","./index-d698Brhb.js","./KeybindingPanel-C3wT8hYZ.css","./ExtensionPanel-ByeZ01RF.js","./ServerConfigPanel-CvXC1Xmx.js","./serverConfigStore-DYv7_Nld.js","./index-p6KSJ2Zq.js","./widgetInputs-Bvm3AgOa.js","./index-BRhY6FpL.css","./GraphView-BWxgNrh6.js","./GraphView-B3TpSwhZ.css","./ServerStartView-BvuHEhuL.js","./ServerStartView-BHqjjHcl.css","./InstallView-DbHtR5YG.js","./InstallView-8N2LdZUx.css","./WelcomeView-Db7ZDfZo.js","./WelcomeView-BD34JMsC.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-DswvqURL.js","./index-hdfnBvYs.js","./index-B7ycxfFq.js","./index-lMQBwSDj.js","./keybindingService-D48fkLBy.js","./serverConfigStore-BawYAb1j.js","./GraphView-CIRWBKTm.css","./UserSelectView-2l9Kbchu.js","./BaseViewTemplate-CsEJhGbv.js","./ServerStartView-CiO_acWT.js","./ServerStartView-CnyN4Ib6.css","./InstallView-AV2llYNm.js","./InstallView-CwQdoH-C.css","./WelcomeView-CB7Th_kO.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-CRaD8u74.js","./NotSupportedView-bFzHmqNj.css","./DownloadGitView-DP1MIWYX.js","./ManualConfigurationView-BA4Vtud8.js","./ManualConfigurationView-B6ecEClB.css","./KeybindingPanel-CxaJ1IiJ.js","./index-CK0rrCYF.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-CxijYN47.js","./ServerConfigPanel-TLv4HMGK.js","./index-5Sv744Dr.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); var __defProp2 = Object.defineProperty; -var __name = (target, value3) => __defProp2(target, "name", { value: value3, configurable: true }); +var __name = (target, value4) => __defProp2(target, "name", { value: value4, configurable: true }); (/* @__PURE__ */ __name(function polyfill() { const relList = document.createElement("link").relList; if (relList && relList.supports && relList.supports("modulepreload")) { return; } - for (const link of document.querySelectorAll('link[rel="modulepreload"]')) { - processPreload(link); + for (const link2 of document.querySelectorAll('link[rel="modulepreload"]')) { + processPreload(link2); } new MutationObserver((mutations) => { for (const mutation of mutations) { @@ -20,48411 +20,50 @@ var __name = (target, value3) => __defProp2(target, "name", { value: value3, con } } }).observe(document, { childList: true, subtree: true }); - function getFetchOpts(link) { + function getFetchOpts(link2) { const fetchOpts = {}; - if (link.integrity) fetchOpts.integrity = link.integrity; - if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy; - if (link.crossOrigin === "use-credentials") + if (link2.integrity) fetchOpts.integrity = link2.integrity; + if (link2.referrerPolicy) fetchOpts.referrerPolicy = link2.referrerPolicy; + if (link2.crossOrigin === "use-credentials") fetchOpts.credentials = "include"; - else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit"; + else if (link2.crossOrigin === "anonymous") fetchOpts.credentials = "omit"; else fetchOpts.credentials = "same-origin"; return fetchOpts; } __name(getFetchOpts, "getFetchOpts"); - function processPreload(link) { - if (link.ep) + function processPreload(link2) { + if (link2.ep) return; - link.ep = true; - const fetchOpts = getFetchOpts(link); - fetch(link.href, fetchOpts); + link2.ep = true; + const fetchOpts = getFetchOpts(link2); + fetch(link2.href, fetchOpts); } __name(processPreload, "processPreload"); }, "polyfill"))(); -/** -* @vue/shared v3.4.31 -* (c) 2018-present Yuxi (Evan) You and Vue contributors -* @license MIT -**/ -/*! #__NO_SIDE_EFFECTS__ */ -// @__NO_SIDE_EFFECTS__ -function makeMap(str, expectsLowerCase) { - const set2 = new Set(str.split(",")); - return expectsLowerCase ? (val) => set2.has(val.toLowerCase()) : (val) => set2.has(val); -} -__name(makeMap, "makeMap"); -const EMPTY_OBJ = false ? Object.freeze({}) : {}; -const EMPTY_ARR = false ? Object.freeze([]) : []; -const NOOP = /* @__PURE__ */ __name(() => { -}, "NOOP"); -const NO = /* @__PURE__ */ __name(() => false, "NO"); -const isOn = /* @__PURE__ */ __name((key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter -(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97), "isOn"); -const isModelListener = /* @__PURE__ */ __name((key) => key.startsWith("onUpdate:"), "isModelListener"); -const extend$1 = Object.assign; -const remove$1 = /* @__PURE__ */ __name((arr, el) => { - const i = arr.indexOf(el); - if (i > -1) { - arr.splice(i, 1); - } -}, "remove$1"); -const hasOwnProperty$3 = Object.prototype.hasOwnProperty; -const hasOwn$3 = /* @__PURE__ */ __name((val, key) => hasOwnProperty$3.call(val, key), "hasOwn$3"); -const isArray$5 = Array.isArray; -const isMap = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Map]", "isMap"); -const isSet = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Set]", "isSet"); -const isDate$3 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Date]", "isDate$3"); -const isRegExp$2 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object RegExp]", "isRegExp$2"); -const isFunction$3 = /* @__PURE__ */ __name((val) => typeof val === "function", "isFunction$3"); -const isString$5 = /* @__PURE__ */ __name((val) => typeof val === "string", "isString$5"); -const isSymbol$1 = /* @__PURE__ */ __name((val) => typeof val === "symbol", "isSymbol$1"); -const isObject$6 = /* @__PURE__ */ __name((val) => val !== null && typeof val === "object", "isObject$6"); -const isPromise$1 = /* @__PURE__ */ __name((val) => { - return (isObject$6(val) || isFunction$3(val)) && isFunction$3(val.then) && isFunction$3(val.catch); -}, "isPromise$1"); -const objectToString$1 = Object.prototype.toString; -const toTypeString$1 = /* @__PURE__ */ __name((value3) => objectToString$1.call(value3), "toTypeString$1"); -const toRawType = /* @__PURE__ */ __name((value3) => { - return toTypeString$1(value3).slice(8, -1); -}, "toRawType"); -const isPlainObject$3 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Object]", "isPlainObject$3"); -const isIntegerKey = /* @__PURE__ */ __name((key) => isString$5(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key, "isIntegerKey"); -const isReservedProp = /* @__PURE__ */ makeMap( - // the leading comma is intentional so empty string "" is also included - ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" -); -const isBuiltInDirective = /* @__PURE__ */ makeMap( - "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" -); -const cacheStringFunction$1 = /* @__PURE__ */ __name((fn) => { - const cache2 = /* @__PURE__ */ Object.create(null); - return (str) => { - const hit = cache2[str]; - return hit || (cache2[str] = fn(str)); - }; -}, "cacheStringFunction$1"); -const camelizeRE$1 = /-(\w)/g; -const camelize$1 = cacheStringFunction$1((str) => { - return str.replace(camelizeRE$1, (_2, c) => c ? c.toUpperCase() : ""); -}); -const hyphenateRE$1 = /\B([A-Z])/g; -const hyphenate$1 = cacheStringFunction$1( - (str) => str.replace(hyphenateRE$1, "-$1").toLowerCase() -); -const capitalize$1 = cacheStringFunction$1((str) => { - return str.charAt(0).toUpperCase() + str.slice(1); -}); -const toHandlerKey = cacheStringFunction$1((str) => { - const s = str ? `on${capitalize$1(str)}` : ``; - return s; -}); -const hasChanged = /* @__PURE__ */ __name((value3, oldValue2) => !Object.is(value3, oldValue2), "hasChanged"); -const invokeArrayFns = /* @__PURE__ */ __name((fns, ...arg) => { - for (let i = 0; i < fns.length; i++) { - fns[i](...arg); - } -}, "invokeArrayFns"); -const def = /* @__PURE__ */ __name((obj, key, value3, writable = false) => { - Object.defineProperty(obj, key, { - configurable: true, - enumerable: false, - writable, - value: value3 - }); -}, "def"); -const looseToNumber = /* @__PURE__ */ __name((val) => { - const n = parseFloat(val); - return isNaN(n) ? val : n; -}, "looseToNumber"); -const toNumber = /* @__PURE__ */ __name((val) => { - const n = isString$5(val) ? Number(val) : NaN; - return isNaN(n) ? val : n; -}, "toNumber"); -let _globalThis$1; -const getGlobalThis$1 = /* @__PURE__ */ __name(() => { - return _globalThis$1 || (_globalThis$1 = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); -}, "getGlobalThis$1"); -const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/; -function genPropsAccessExp(name) { - return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`; -} -__name(genPropsAccessExp, "genPropsAccessExp"); -const PatchFlags = { - "TEXT": 1, - "1": "TEXT", - "CLASS": 2, - "2": "CLASS", - "STYLE": 4, - "4": "STYLE", - "PROPS": 8, - "8": "PROPS", - "FULL_PROPS": 16, - "16": "FULL_PROPS", - "NEED_HYDRATION": 32, - "32": "NEED_HYDRATION", - "STABLE_FRAGMENT": 64, - "64": "STABLE_FRAGMENT", - "KEYED_FRAGMENT": 128, - "128": "KEYED_FRAGMENT", - "UNKEYED_FRAGMENT": 256, - "256": "UNKEYED_FRAGMENT", - "NEED_PATCH": 512, - "512": "NEED_PATCH", - "DYNAMIC_SLOTS": 1024, - "1024": "DYNAMIC_SLOTS", - "DEV_ROOT_FRAGMENT": 2048, - "2048": "DEV_ROOT_FRAGMENT", - "HOISTED": -1, - "-1": "HOISTED", - "BAIL": -2, - "-2": "BAIL" -}; -const PatchFlagNames = { - [1]: `TEXT`, - [2]: `CLASS`, - [4]: `STYLE`, - [8]: `PROPS`, - [16]: `FULL_PROPS`, - [32]: `NEED_HYDRATION`, - [64]: `STABLE_FRAGMENT`, - [128]: `KEYED_FRAGMENT`, - [256]: `UNKEYED_FRAGMENT`, - [512]: `NEED_PATCH`, - [1024]: `DYNAMIC_SLOTS`, - [2048]: `DEV_ROOT_FRAGMENT`, - [-1]: `HOISTED`, - [-2]: `BAIL` -}; -const ShapeFlags = { - "ELEMENT": 1, - "1": "ELEMENT", - "FUNCTIONAL_COMPONENT": 2, - "2": "FUNCTIONAL_COMPONENT", - "STATEFUL_COMPONENT": 4, - "4": "STATEFUL_COMPONENT", - "TEXT_CHILDREN": 8, - "8": "TEXT_CHILDREN", - "ARRAY_CHILDREN": 16, - "16": "ARRAY_CHILDREN", - "SLOTS_CHILDREN": 32, - "32": "SLOTS_CHILDREN", - "TELEPORT": 64, - "64": "TELEPORT", - "SUSPENSE": 128, - "128": "SUSPENSE", - "COMPONENT_SHOULD_KEEP_ALIVE": 256, - "256": "COMPONENT_SHOULD_KEEP_ALIVE", - "COMPONENT_KEPT_ALIVE": 512, - "512": "COMPONENT_KEPT_ALIVE", - "COMPONENT": 6, - "6": "COMPONENT" -}; -const SlotFlags = { - "STABLE": 1, - "1": "STABLE", - "DYNAMIC": 2, - "2": "DYNAMIC", - "FORWARDED": 3, - "3": "FORWARDED" -}; -const slotFlagsText = { - [1]: "STABLE", - [2]: "DYNAMIC", - [3]: "FORWARDED" -}; -const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error"; -const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); -const isGloballyWhitelisted = isGloballyAllowed; -const range = 2; -function generateCodeFrame$1(source, start2 = 0, end = source.length) { - start2 = Math.max(0, Math.min(start2, source.length)); - end = Math.max(0, Math.min(end, source.length)); - if (start2 > end) return ""; - let lines = source.split(/(\r?\n)/); - const newlineSequences = lines.filter((_2, idx) => idx % 2 === 1); - lines = lines.filter((_2, idx) => idx % 2 === 0); - let count = 0; - const res = []; - for (let i = 0; i < lines.length; i++) { - count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); - if (count >= start2) { - for (let j = i - range; j <= i + range || end > count; j++) { - if (j < 0 || j >= lines.length) continue; - const line = j + 1; - res.push( - `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` - ); - const lineLength = lines[j].length; - const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; - if (j === i) { - const pad = start2 - (count - (lineLength + newLineSeqLength)); - const length = Math.max( - 1, - end > count ? lineLength - pad : end - start2 - ); - res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); - } else if (j > i) { - if (end > count) { - const length = Math.max(Math.min(end - count, lineLength), 1); - res.push(` | ` + "^".repeat(length)); - } - count += lineLength + newLineSeqLength; - } - } - break; - } - } - return res.join("\n"); -} -__name(generateCodeFrame$1, "generateCodeFrame$1"); -function normalizeStyle(value3) { - if (isArray$5(value3)) { - const res = {}; - for (let i = 0; i < value3.length; i++) { - const item2 = value3[i]; - const normalized = isString$5(item2) ? parseStringStyle(item2) : normalizeStyle(item2); - if (normalized) { - for (const key in normalized) { - res[key] = normalized[key]; - } - } - } - return res; - } else if (isString$5(value3) || isObject$6(value3)) { - return value3; - } -} -__name(normalizeStyle, "normalizeStyle"); -const listDelimiterRE = /;(?![^(]*\))/g; -const propertyDelimiterRE = /:([^]+)/; -const styleCommentRE = /\/\*[^]*?\*\//g; -function parseStringStyle(cssText) { - const ret = {}; - cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item2) => { - if (item2) { - const tmp = item2.split(propertyDelimiterRE); - tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); - } - }); - return ret; -} -__name(parseStringStyle, "parseStringStyle"); -function stringifyStyle(styles) { - let ret = ""; - if (!styles || isString$5(styles)) { - return ret; - } - for (const key in styles) { - const value3 = styles[key]; - if (isString$5(value3) || typeof value3 === "number") { - const normalizedKey = key.startsWith(`--`) ? key : hyphenate$1(key); - ret += `${normalizedKey}:${value3};`; - } - } - return ret; -} -__name(stringifyStyle, "stringifyStyle"); -function normalizeClass(value3) { - let res = ""; - if (isString$5(value3)) { - res = value3; - } else if (isArray$5(value3)) { - for (let i = 0; i < value3.length; i++) { - const normalized = normalizeClass(value3[i]); - if (normalized) { - res += normalized + " "; - } - } - } else if (isObject$6(value3)) { - for (const name in value3) { - if (value3[name]) { - res += name + " "; - } - } - } - return res.trim(); -} -__name(normalizeClass, "normalizeClass"); -function normalizeProps(props) { - if (!props) return null; - let { class: klass, style } = props; - if (klass && !isString$5(klass)) { - props.class = normalizeClass(klass); - } - if (style) { - props.style = normalizeStyle(style); - } - return props; -} -__name(normalizeProps, "normalizeProps"); -const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"; -const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"; -const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics"; -const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"; -const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); -const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); -const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); -const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); -const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; -const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); -const isBooleanAttr = /* @__PURE__ */ makeMap( - specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` -); -function includeBooleanAttr(value3) { - return !!value3 || value3 === ""; -} -__name(includeBooleanAttr, "includeBooleanAttr"); -const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/; -const attrValidationCache = {}; -function isSSRSafeAttrName(name) { - if (attrValidationCache.hasOwnProperty(name)) { - return attrValidationCache[name]; - } - const isUnsafe = unsafeAttrCharRE.test(name); - if (isUnsafe) { - console.error(`unsafe attribute name: ${name}`); - } - return attrValidationCache[name] = !isUnsafe; -} -__name(isSSRSafeAttrName, "isSSRSafeAttrName"); -const propsToAttrMap = { - acceptCharset: "accept-charset", - className: "class", - htmlFor: "for", - httpEquiv: "http-equiv" -}; -const isKnownHtmlAttr = /* @__PURE__ */ makeMap( - `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap` -); -const isKnownSvgAttr = /* @__PURE__ */ makeMap( - `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` -); -function isRenderableAttrValue(value3) { - if (value3 == null) { - return false; - } - const type = typeof value3; - return type === "string" || type === "number" || type === "boolean"; -} -__name(isRenderableAttrValue, "isRenderableAttrValue"); -const escapeRE = /["'&<>]/; -function escapeHtml$1(string) { - const str = "" + string; - const match = escapeRE.exec(str); - if (!match) { - return str; - } - let html = ""; - let escaped; - let index2; - let lastIndex = 0; - for (index2 = match.index; index2 < str.length; index2++) { - switch (str.charCodeAt(index2)) { - case 34: - escaped = """; - break; - case 38: - escaped = "&"; - break; - case 39: - escaped = "'"; - break; - case 60: - escaped = "<"; - break; - case 62: - escaped = ">"; - break; - default: - continue; - } - if (lastIndex !== index2) { - html += str.slice(lastIndex, index2); - } - lastIndex = index2 + 1; - html += escaped; - } - return lastIndex !== index2 ? html + str.slice(lastIndex, index2) : html; -} -__name(escapeHtml$1, "escapeHtml$1"); -const commentStripRE = /^-?>||--!>| looseEqual(item2, val)); -} -__name(looseIndexOf, "looseIndexOf"); -const isRef$1 = /* @__PURE__ */ __name((val) => { - return !!(val && val.__v_isRef === true); -}, "isRef$1"); -const toDisplayString$1 = /* @__PURE__ */ __name((val) => { - return isString$5(val) ? val : val == null ? "" : isArray$5(val) || isObject$6(val) && (val.toString === objectToString$1 || !isFunction$3(val.toString)) ? isRef$1(val) ? toDisplayString$1(val.value) : JSON.stringify(val, replacer, 2) : String(val); -}, "toDisplayString$1"); -const replacer = /* @__PURE__ */ __name((_key, val) => { - if (isRef$1(val)) { - return replacer(_key, val.value); - } else if (isMap(val)) { - return { - [`Map(${val.size})`]: [...val.entries()].reduce( - (entries, [key, val2], i) => { - entries[stringifySymbol(key, i) + " =>"] = val2; - return entries; - }, - {} - ) - }; - } else if (isSet(val)) { - return { - [`Set(${val.size})`]: [...val.values()].map((v2) => stringifySymbol(v2)) - }; - } else if (isSymbol$1(val)) { - return stringifySymbol(val); - } else if (isObject$6(val) && !isArray$5(val) && !isPlainObject$3(val)) { - return String(val); - } - return val; -}, "replacer"); -const stringifySymbol = /* @__PURE__ */ __name((v2, i = "") => { - var _a; - return ( - // Symbol.description in es2019+ so we need to cast here to pass - // the lib: es2016 check - isSymbol$1(v2) ? `Symbol(${(_a = v2.description) != null ? _a : i})` : v2 - ); -}, "stringifySymbol"); -/** -* @vue/reactivity v3.4.31 -* (c) 2018-present Yuxi (Evan) You and Vue contributors -* @license MIT -**/ -function warn$3(msg, ...args) { - console.warn(`[Vue warn] ${msg}`, ...args); -} -__name(warn$3, "warn$3"); -let activeEffectScope; -class EffectScope { - static { - __name(this, "EffectScope"); - } - constructor(detached = false) { - this.detached = detached; - this._active = true; - this.effects = []; - this.cleanups = []; - this.parent = activeEffectScope; - if (!detached && activeEffectScope) { - this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( - this - ) - 1; - } - } - get active() { - return this._active; - } - run(fn) { - if (this._active) { - const currentEffectScope = activeEffectScope; - try { - activeEffectScope = this; - return fn(); - } finally { - activeEffectScope = currentEffectScope; - } - } else if (false) { - warn$3(`cannot run an inactive effect scope.`); - } - } - /** - * This should only be called on non-detached scopes - * @internal - */ - on() { - activeEffectScope = this; - } - /** - * This should only be called on non-detached scopes - * @internal - */ - off() { - activeEffectScope = this.parent; - } - stop(fromParent) { - if (this._active) { - let i, l; - for (i = 0, l = this.effects.length; i < l; i++) { - this.effects[i].stop(); - } - for (i = 0, l = this.cleanups.length; i < l; i++) { - this.cleanups[i](); - } - if (this.scopes) { - for (i = 0, l = this.scopes.length; i < l; i++) { - this.scopes[i].stop(true); - } - } - if (!this.detached && this.parent && !fromParent) { - const last = this.parent.scopes.pop(); - if (last && last !== this) { - this.parent.scopes[this.index] = last; - last.index = this.index; - } - } - this.parent = void 0; - this._active = false; - } - } -} -function effectScope(detached) { - return new EffectScope(detached); -} -__name(effectScope, "effectScope"); -function recordEffectScope(effect2, scope = activeEffectScope) { - if (scope && scope.active) { - scope.effects.push(effect2); - } -} -__name(recordEffectScope, "recordEffectScope"); -function getCurrentScope() { - return activeEffectScope; -} -__name(getCurrentScope, "getCurrentScope"); -function onScopeDispose(fn) { - if (activeEffectScope) { - activeEffectScope.cleanups.push(fn); - } else if (false) { - warn$3( - `onScopeDispose() is called when there is no active effect scope to be associated with.` - ); - } -} -__name(onScopeDispose, "onScopeDispose"); -let activeEffect; -class ReactiveEffect { - static { - __name(this, "ReactiveEffect"); - } - constructor(fn, trigger2, scheduler, scope) { - this.fn = fn; - this.trigger = trigger2; - this.scheduler = scheduler; - this.active = true; - this.deps = []; - this._dirtyLevel = 4; - this._trackId = 0; - this._runnings = 0; - this._shouldSchedule = false; - this._depsLength = 0; - recordEffectScope(this, scope); - } - get dirty() { - if (this._dirtyLevel === 2 || this._dirtyLevel === 3) { - this._dirtyLevel = 1; - pauseTracking(); - for (let i = 0; i < this._depsLength; i++) { - const dep = this.deps[i]; - if (dep.computed) { - triggerComputed(dep.computed); - if (this._dirtyLevel >= 4) { - break; - } - } - } - if (this._dirtyLevel === 1) { - this._dirtyLevel = 0; - } - resetTracking(); - } - return this._dirtyLevel >= 4; - } - set dirty(v2) { - this._dirtyLevel = v2 ? 4 : 0; - } - run() { - this._dirtyLevel = 0; - if (!this.active) { - return this.fn(); - } - let lastShouldTrack = shouldTrack; - let lastEffect = activeEffect; - try { - shouldTrack = true; - activeEffect = this; - this._runnings++; - preCleanupEffect(this); - return this.fn(); - } finally { - postCleanupEffect(this); - this._runnings--; - activeEffect = lastEffect; - shouldTrack = lastShouldTrack; - } - } - stop() { - if (this.active) { - preCleanupEffect(this); - postCleanupEffect(this); - this.onStop && this.onStop(); - this.active = false; - } - } -} -function triggerComputed(computed2) { - return computed2.value; -} -__name(triggerComputed, "triggerComputed"); -function preCleanupEffect(effect2) { - effect2._trackId++; - effect2._depsLength = 0; -} -__name(preCleanupEffect, "preCleanupEffect"); -function postCleanupEffect(effect2) { - if (effect2.deps.length > effect2._depsLength) { - for (let i = effect2._depsLength; i < effect2.deps.length; i++) { - cleanupDepEffect(effect2.deps[i], effect2); - } - effect2.deps.length = effect2._depsLength; - } -} -__name(postCleanupEffect, "postCleanupEffect"); -function cleanupDepEffect(dep, effect2) { - const trackId = dep.get(effect2); - if (trackId !== void 0 && effect2._trackId !== trackId) { - dep.delete(effect2); - if (dep.size === 0) { - dep.cleanup(); - } - } -} -__name(cleanupDepEffect, "cleanupDepEffect"); -function effect(fn, options3) { - if (fn.effect instanceof ReactiveEffect) { - fn = fn.effect.fn; - } - const _effect = new ReactiveEffect(fn, NOOP, () => { - if (_effect.dirty) { - _effect.run(); - } - }); - if (options3) { - extend$1(_effect, options3); - if (options3.scope) recordEffectScope(_effect, options3.scope); - } - if (!options3 || !options3.lazy) { - _effect.run(); - } - const runner = _effect.run.bind(_effect); - runner.effect = _effect; - return runner; -} -__name(effect, "effect"); -function stop(runner) { - runner.effect.stop(); -} -__name(stop, "stop"); -let shouldTrack = true; -let pauseScheduleStack = 0; -const trackStack = []; -function pauseTracking() { - trackStack.push(shouldTrack); - shouldTrack = false; -} -__name(pauseTracking, "pauseTracking"); -function enableTracking() { - trackStack.push(shouldTrack); - shouldTrack = true; -} -__name(enableTracking, "enableTracking"); -function resetTracking() { - const last = trackStack.pop(); - shouldTrack = last === void 0 ? true : last; -} -__name(resetTracking, "resetTracking"); -function pauseScheduling() { - pauseScheduleStack++; -} -__name(pauseScheduling, "pauseScheduling"); -function resetScheduling() { - pauseScheduleStack--; - while (!pauseScheduleStack && queueEffectSchedulers.length) { - queueEffectSchedulers.shift()(); - } -} -__name(resetScheduling, "resetScheduling"); -function trackEffect(effect2, dep, debuggerEventExtraInfo) { - var _a; - if (dep.get(effect2) !== effect2._trackId) { - dep.set(effect2, effect2._trackId); - const oldDep = effect2.deps[effect2._depsLength]; - if (oldDep !== dep) { - if (oldDep) { - cleanupDepEffect(oldDep, effect2); - } - effect2.deps[effect2._depsLength++] = dep; - } else { - effect2._depsLength++; - } - if (false) { - (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend$1({ effect: effect2 }, debuggerEventExtraInfo)); - } - } -} -__name(trackEffect, "trackEffect"); -const queueEffectSchedulers = []; -function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) { - var _a; - pauseScheduling(); - for (const effect2 of dep.keys()) { - let tracking; - if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { - effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0); - effect2._dirtyLevel = dirtyLevel; - } - if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { - if (false) { - (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend$1({ effect: effect2 }, debuggerEventExtraInfo)); - } - effect2.trigger(); - if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) { - effect2._shouldSchedule = false; - if (effect2.scheduler) { - queueEffectSchedulers.push(effect2.scheduler); - } - } - } - } - resetScheduling(); -} -__name(triggerEffects, "triggerEffects"); -const createDep = /* @__PURE__ */ __name((cleanup, computed2) => { - const dep = /* @__PURE__ */ new Map(); - dep.cleanup = cleanup; - dep.computed = computed2; - return dep; -}, "createDep"); -const targetMap = /* @__PURE__ */ new WeakMap(); -const ITERATE_KEY = Symbol(false ? "iterate" : ""); -const MAP_KEY_ITERATE_KEY = Symbol(false ? "Map key iterate" : ""); -function track(target, type, key) { - if (shouldTrack && activeEffect) { - let depsMap = targetMap.get(target); - if (!depsMap) { - targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); - } - let dep = depsMap.get(key); - if (!dep) { - depsMap.set(key, dep = createDep(() => depsMap.delete(key))); - } - trackEffect( - activeEffect, - dep, - false ? { - target, - type, - key - } : void 0 - ); - } -} -__name(track, "track"); -function trigger(target, type, key, newValue2, oldValue2, oldTarget) { - const depsMap = targetMap.get(target); - if (!depsMap) { - return; - } - let deps = []; - if (type === "clear") { - deps = [...depsMap.values()]; - } else if (key === "length" && isArray$5(target)) { - const newLength = Number(newValue2); - depsMap.forEach((dep, key2) => { - if (key2 === "length" || !isSymbol$1(key2) && key2 >= newLength) { - deps.push(dep); - } - }); - } else { - if (key !== void 0) { - deps.push(depsMap.get(key)); - } - switch (type) { - case "add": - if (!isArray$5(target)) { - deps.push(depsMap.get(ITERATE_KEY)); - if (isMap(target)) { - deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); - } - } else if (isIntegerKey(key)) { - deps.push(depsMap.get("length")); - } - break; - case "delete": - if (!isArray$5(target)) { - deps.push(depsMap.get(ITERATE_KEY)); - if (isMap(target)) { - deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); - } - } - break; - case "set": - if (isMap(target)) { - deps.push(depsMap.get(ITERATE_KEY)); - } - break; - } - } - pauseScheduling(); - for (const dep of deps) { - if (dep) { - triggerEffects( - dep, - 4, - false ? { - target, - type, - key, - newValue: newValue2, - oldValue: oldValue2, - oldTarget - } : void 0 - ); - } - } - resetScheduling(); -} -__name(trigger, "trigger"); -function getDepFromReactive(object, key) { - const depsMap = targetMap.get(object); - return depsMap && depsMap.get(key); -} -__name(getDepFromReactive, "getDepFromReactive"); -const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); -const builtInSymbols = new Set( - /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol$1) -); -const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations(); -function createArrayInstrumentations() { - const instrumentations = {}; - ["includes", "indexOf", "lastIndexOf"].forEach((key) => { - instrumentations[key] = function(...args) { - const arr = toRaw(this); - for (let i = 0, l = this.length; i < l; i++) { - track(arr, "get", i + ""); - } - const res = arr[key](...args); - if (res === -1 || res === false) { - return arr[key](...args.map(toRaw)); - } else { - return res; - } - }; - }); - ["push", "pop", "shift", "unshift", "splice"].forEach((key) => { - instrumentations[key] = function(...args) { - pauseTracking(); - pauseScheduling(); - const res = toRaw(this)[key].apply(this, args); - resetScheduling(); - resetTracking(); - return res; - }; - }); - return instrumentations; -} -__name(createArrayInstrumentations, "createArrayInstrumentations"); -function hasOwnProperty$2(key) { - if (!isSymbol$1(key)) key = String(key); - const obj = toRaw(this); - track(obj, "has", key); - return obj.hasOwnProperty(key); -} -__name(hasOwnProperty$2, "hasOwnProperty$2"); -class BaseReactiveHandler { - static { - __name(this, "BaseReactiveHandler"); - } - constructor(_isReadonly = false, _isShallow = false) { - this._isReadonly = _isReadonly; - this._isShallow = _isShallow; - } - get(target, key, receiver) { - const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow; - if (key === "__v_isReactive") { - return !isReadonly2; - } else if (key === "__v_isReadonly") { - return isReadonly2; - } else if (key === "__v_isShallow") { - return isShallow2; - } else if (key === "__v_raw") { - if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype - // this means the reciever is a user proxy of the reactive proxy - Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) { - return target; - } - return; - } - const targetIsArray = isArray$5(target); - if (!isReadonly2) { - if (targetIsArray && hasOwn$3(arrayInstrumentations, key)) { - return Reflect.get(arrayInstrumentations, key, receiver); - } - if (key === "hasOwnProperty") { - return hasOwnProperty$2; - } - } - const res = Reflect.get(target, key, receiver); - if (isSymbol$1(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { - return res; - } - if (!isReadonly2) { - track(target, "get", key); - } - if (isShallow2) { - return res; - } - if (isRef(res)) { - return targetIsArray && isIntegerKey(key) ? res : res.value; - } - if (isObject$6(res)) { - return isReadonly2 ? readonly(res) : reactive(res); - } - return res; - } -} -class MutableReactiveHandler extends BaseReactiveHandler { - static { - __name(this, "MutableReactiveHandler"); - } - constructor(isShallow2 = false) { - super(false, isShallow2); - } - set(target, key, value3, receiver) { - let oldValue2 = target[key]; - if (!this._isShallow) { - const isOldValueReadonly = isReadonly(oldValue2); - if (!isShallow(value3) && !isReadonly(value3)) { - oldValue2 = toRaw(oldValue2); - value3 = toRaw(value3); - } - if (!isArray$5(target) && isRef(oldValue2) && !isRef(value3)) { - if (isOldValueReadonly) { - return false; - } else { - oldValue2.value = value3; - return true; - } - } - } - const hadKey = isArray$5(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn$3(target, key); - const result = Reflect.set(target, key, value3, receiver); - if (target === toRaw(receiver)) { - if (!hadKey) { - trigger(target, "add", key, value3); - } else if (hasChanged(value3, oldValue2)) { - trigger(target, "set", key, value3, oldValue2); - } - } - return result; - } - deleteProperty(target, key) { - const hadKey = hasOwn$3(target, key); - const oldValue2 = target[key]; - const result = Reflect.deleteProperty(target, key); - if (result && hadKey) { - trigger(target, "delete", key, void 0, oldValue2); - } - return result; - } - has(target, key) { - const result = Reflect.has(target, key); - if (!isSymbol$1(key) || !builtInSymbols.has(key)) { - track(target, "has", key); - } - return result; - } - ownKeys(target) { - track( - target, - "iterate", - isArray$5(target) ? "length" : ITERATE_KEY - ); - return Reflect.ownKeys(target); - } -} -class ReadonlyReactiveHandler extends BaseReactiveHandler { - static { - __name(this, "ReadonlyReactiveHandler"); - } - constructor(isShallow2 = false) { - super(true, isShallow2); - } - set(target, key) { - if (false) { - warn$3( - `Set operation on key "${String(key)}" failed: target is readonly.`, - target - ); - } - return true; - } - deleteProperty(target, key) { - if (false) { - warn$3( - `Delete operation on key "${String(key)}" failed: target is readonly.`, - target - ); - } - return true; - } -} -const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); -const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); -const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler( - true -); -const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true); -const toShallow = /* @__PURE__ */ __name((value3) => value3, "toShallow"); -const getProto = /* @__PURE__ */ __name((v2) => Reflect.getPrototypeOf(v2), "getProto"); -function get$3(target, key, isReadonly2 = false, isShallow2 = false) { - target = target["__v_raw"]; - const rawTarget = toRaw(target); - const rawKey = toRaw(key); - if (!isReadonly2) { - if (hasChanged(key, rawKey)) { - track(rawTarget, "get", key); - } - track(rawTarget, "get", rawKey); - } - const { has: has2 } = getProto(rawTarget); - const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive$1; - if (has2.call(rawTarget, key)) { - return wrap(target.get(key)); - } else if (has2.call(rawTarget, rawKey)) { - return wrap(target.get(rawKey)); - } else if (target !== rawTarget) { - target.get(key); - } -} -__name(get$3, "get$3"); -function has(key, isReadonly2 = false) { - const target = this["__v_raw"]; - const rawTarget = toRaw(target); - const rawKey = toRaw(key); - if (!isReadonly2) { - if (hasChanged(key, rawKey)) { - track(rawTarget, "has", key); - } - track(rawTarget, "has", rawKey); - } - return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); -} -__name(has, "has"); -function size(target, isReadonly2 = false) { - target = target["__v_raw"]; - !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY); - return Reflect.get(target, "size", target); -} -__name(size, "size"); -function add(value3) { - value3 = toRaw(value3); - const target = toRaw(this); - const proto = getProto(target); - const hadKey = proto.has.call(target, value3); - if (!hadKey) { - target.add(value3); - trigger(target, "add", value3, value3); - } - return this; -} -__name(add, "add"); -function set$4(key, value3) { - value3 = toRaw(value3); - const target = toRaw(this); - const { has: has2, get: get2 } = getProto(target); - let hadKey = has2.call(target, key); - if (!hadKey) { - key = toRaw(key); - hadKey = has2.call(target, key); - } else if (false) { - checkIdentityKeys(target, has2, key); - } - const oldValue2 = get2.call(target, key); - target.set(key, value3); - if (!hadKey) { - trigger(target, "add", key, value3); - } else if (hasChanged(value3, oldValue2)) { - trigger(target, "set", key, value3, oldValue2); - } - return this; -} -__name(set$4, "set$4"); -function deleteEntry(key) { - const target = toRaw(this); - const { has: has2, get: get2 } = getProto(target); - let hadKey = has2.call(target, key); - if (!hadKey) { - key = toRaw(key); - hadKey = has2.call(target, key); - } else if (false) { - checkIdentityKeys(target, has2, key); - } - const oldValue2 = get2 ? get2.call(target, key) : void 0; - const result = target.delete(key); - if (hadKey) { - trigger(target, "delete", key, void 0, oldValue2); - } - return result; -} -__name(deleteEntry, "deleteEntry"); -function clear() { - const target = toRaw(this); - const hadItems = target.size !== 0; - const oldTarget = false ? isMap(target) ? new Map(target) : new Set(target) : void 0; - const result = target.clear(); - if (hadItems) { - trigger(target, "clear", void 0, void 0, oldTarget); - } - return result; -} -__name(clear, "clear"); -function createForEach(isReadonly2, isShallow2) { - return /* @__PURE__ */ __name(function forEach2(callback, thisArg) { - const observed = this; - const target = observed["__v_raw"]; - const rawTarget = toRaw(target); - const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive$1; - !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY); - return target.forEach((value3, key) => { - return callback.call(thisArg, wrap(value3), wrap(key), observed); - }); - }, "forEach"); -} -__name(createForEach, "createForEach"); -function createIterableMethod(method, isReadonly2, isShallow2) { - return function(...args) { - const target = this["__v_raw"]; - const rawTarget = toRaw(target); - const targetIsMap = isMap(rawTarget); - const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; - const isKeyOnly = method === "keys" && targetIsMap; - const innerIterator = target[method](...args); - const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive$1; - !isReadonly2 && track( - rawTarget, - "iterate", - isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY - ); - return { - // iterator protocol - next() { - const { value: value3, done } = innerIterator.next(); - return done ? { value: value3, done } : { - value: isPair ? [wrap(value3[0]), wrap(value3[1])] : wrap(value3), - done - }; - }, - // iterable protocol - [Symbol.iterator]() { - return this; - } - }; - }; -} -__name(createIterableMethod, "createIterableMethod"); -function createReadonlyMethod(type) { - return function(...args) { - if (false) { - const key = args[0] ? `on key "${args[0]}" ` : ``; - warn$3( - `${capitalize$1(type)} operation ${key}failed: target is readonly.`, - toRaw(this) - ); - } - return type === "delete" ? false : type === "clear" ? void 0 : this; - }; -} -__name(createReadonlyMethod, "createReadonlyMethod"); -function createInstrumentations() { - const mutableInstrumentations2 = { - get(key) { - return get$3(this, key); - }, - get size() { - return size(this); - }, - has, - add, - set: set$4, - delete: deleteEntry, - clear, - forEach: createForEach(false, false) - }; - const shallowInstrumentations2 = { - get(key) { - return get$3(this, key, false, true); - }, - get size() { - return size(this); - }, - has, - add, - set: set$4, - delete: deleteEntry, - clear, - forEach: createForEach(false, true) - }; - const readonlyInstrumentations2 = { - get(key) { - return get$3(this, key, true); - }, - get size() { - return size(this, true); - }, - has(key) { - return has.call(this, key, true); - }, - add: createReadonlyMethod("add"), - set: createReadonlyMethod("set"), - delete: createReadonlyMethod("delete"), - clear: createReadonlyMethod("clear"), - forEach: createForEach(true, false) - }; - const shallowReadonlyInstrumentations2 = { - get(key) { - return get$3(this, key, true, true); - }, - get size() { - return size(this, true); - }, - has(key) { - return has.call(this, key, true); - }, - add: createReadonlyMethod("add"), - set: createReadonlyMethod("set"), - delete: createReadonlyMethod("delete"), - clear: createReadonlyMethod("clear"), - forEach: createForEach(true, true) - }; - const iteratorMethods = [ - "keys", - "values", - "entries", - Symbol.iterator - ]; - iteratorMethods.forEach((method) => { - mutableInstrumentations2[method] = createIterableMethod(method, false, false); - readonlyInstrumentations2[method] = createIterableMethod(method, true, false); - shallowInstrumentations2[method] = createIterableMethod(method, false, true); - shallowReadonlyInstrumentations2[method] = createIterableMethod( - method, - true, - true - ); - }); - return [ - mutableInstrumentations2, - readonlyInstrumentations2, - shallowInstrumentations2, - shallowReadonlyInstrumentations2 - ]; -} -__name(createInstrumentations, "createInstrumentations"); -const [ - mutableInstrumentations, - readonlyInstrumentations, - shallowInstrumentations, - shallowReadonlyInstrumentations -] = /* @__PURE__ */ createInstrumentations(); -function createInstrumentationGetter(isReadonly2, shallow) { - const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations; - return (target, key, receiver) => { - if (key === "__v_isReactive") { - return !isReadonly2; - } else if (key === "__v_isReadonly") { - return isReadonly2; - } else if (key === "__v_raw") { - return target; - } - return Reflect.get( - hasOwn$3(instrumentations, key) && key in target ? instrumentations : target, - key, - receiver - ); - }; -} -__name(createInstrumentationGetter, "createInstrumentationGetter"); -const mutableCollectionHandlers = { - get: /* @__PURE__ */ createInstrumentationGetter(false, false) -}; -const shallowCollectionHandlers = { - get: /* @__PURE__ */ createInstrumentationGetter(false, true) -}; -const readonlyCollectionHandlers = { - get: /* @__PURE__ */ createInstrumentationGetter(true, false) -}; -const shallowReadonlyCollectionHandlers = { - get: /* @__PURE__ */ createInstrumentationGetter(true, true) -}; -function checkIdentityKeys(target, has2, key) { - const rawKey = toRaw(key); - if (rawKey !== key && has2.call(target, rawKey)) { - const type = toRawType(target); - warn$3( - `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.` - ); - } -} -__name(checkIdentityKeys, "checkIdentityKeys"); -const reactiveMap = /* @__PURE__ */ new WeakMap(); -const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); -const readonlyMap = /* @__PURE__ */ new WeakMap(); -const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); -function targetTypeMap(rawType) { - switch (rawType) { - case "Object": - case "Array": - return 1; - case "Map": - case "Set": - case "WeakMap": - case "WeakSet": - return 2; - default: - return 0; - } -} -__name(targetTypeMap, "targetTypeMap"); -function getTargetType(value3) { - return value3["__v_skip"] || !Object.isExtensible(value3) ? 0 : targetTypeMap(toRawType(value3)); -} -__name(getTargetType, "getTargetType"); -function reactive(target) { - if (isReadonly(target)) { - return target; - } - return createReactiveObject( - target, - false, - mutableHandlers, - mutableCollectionHandlers, - reactiveMap - ); -} -__name(reactive, "reactive"); -function shallowReactive(target) { - return createReactiveObject( - target, - false, - shallowReactiveHandlers, - shallowCollectionHandlers, - shallowReactiveMap - ); -} -__name(shallowReactive, "shallowReactive"); -function readonly(target) { - return createReactiveObject( - target, - true, - readonlyHandlers, - readonlyCollectionHandlers, - readonlyMap - ); -} -__name(readonly, "readonly"); -function shallowReadonly(target) { - return createReactiveObject( - target, - true, - shallowReadonlyHandlers, - shallowReadonlyCollectionHandlers, - shallowReadonlyMap - ); -} -__name(shallowReadonly, "shallowReadonly"); -function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { - if (!isObject$6(target)) { - if (false) { - warn$3( - `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String( - target - )}` - ); - } - return target; - } - if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { - return target; - } - const existingProxy = proxyMap.get(target); - if (existingProxy) { - return existingProxy; - } - const targetType = getTargetType(target); - if (targetType === 0) { - return target; - } - const proxy = new Proxy( - target, - targetType === 2 ? collectionHandlers : baseHandlers - ); - proxyMap.set(target, proxy); - return proxy; -} -__name(createReactiveObject, "createReactiveObject"); -function isReactive(value3) { - if (isReadonly(value3)) { - return isReactive(value3["__v_raw"]); - } - return !!(value3 && value3["__v_isReactive"]); -} -__name(isReactive, "isReactive"); -function isReadonly(value3) { - return !!(value3 && value3["__v_isReadonly"]); -} -__name(isReadonly, "isReadonly"); -function isShallow(value3) { - return !!(value3 && value3["__v_isShallow"]); -} -__name(isShallow, "isShallow"); -function isProxy(value3) { - return value3 ? !!value3["__v_raw"] : false; -} -__name(isProxy, "isProxy"); -function toRaw(observed) { - const raw = observed && observed["__v_raw"]; - return raw ? toRaw(raw) : observed; -} -__name(toRaw, "toRaw"); -function markRaw(value3) { - if (Object.isExtensible(value3)) { - def(value3, "__v_skip", true); - } - return value3; -} -__name(markRaw, "markRaw"); -const toReactive$1 = /* @__PURE__ */ __name((value3) => isObject$6(value3) ? reactive(value3) : value3, "toReactive$1"); -const toReadonly = /* @__PURE__ */ __name((value3) => isObject$6(value3) ? readonly(value3) : value3, "toReadonly"); -const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`; -class ComputedRefImpl { - static { - __name(this, "ComputedRefImpl"); - } - constructor(getter, _setter, isReadonly2, isSSR) { - this.getter = getter; - this._setter = _setter; - this.dep = void 0; - this.__v_isRef = true; - this["__v_isReadonly"] = false; - this.effect = new ReactiveEffect( - () => getter(this._value), - () => triggerRefValue( - this, - this.effect._dirtyLevel === 2 ? 2 : 3 - ) - ); - this.effect.computed = this; - this.effect.active = this._cacheable = !isSSR; - this["__v_isReadonly"] = isReadonly2; - } - get value() { - const self2 = toRaw(this); - if ((!self2._cacheable || self2.effect.dirty) && hasChanged(self2._value, self2._value = self2.effect.run())) { - triggerRefValue(self2, 4); - } - trackRefValue(self2); - if (self2.effect._dirtyLevel >= 2) { - if (false) { - warn$3(COMPUTED_SIDE_EFFECT_WARN, ` - -getter: `, this.getter); - } - triggerRefValue(self2, 2); - } - return self2._value; - } - set value(newValue2) { - this._setter(newValue2); - } - // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x - get _dirty() { - return this.effect.dirty; - } - set _dirty(v2) { - this.effect.dirty = v2; - } - // #endregion -} -function computed$1(getterOrOptions, debugOptions, isSSR = false) { - let getter; - let setter; - const onlyGetter = isFunction$3(getterOrOptions); - if (onlyGetter) { - getter = getterOrOptions; - setter = false ? () => { - warn$3("Write operation failed: computed value is readonly"); - } : NOOP; - } else { - getter = getterOrOptions.get; - setter = getterOrOptions.set; - } - const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR); - if (false) { - cRef.effect.onTrack = debugOptions.onTrack; - cRef.effect.onTrigger = debugOptions.onTrigger; - } - return cRef; -} -__name(computed$1, "computed$1"); -function trackRefValue(ref2) { - var _a; - if (shouldTrack && activeEffect) { - ref2 = toRaw(ref2); - trackEffect( - activeEffect, - (_a = ref2.dep) != null ? _a : ref2.dep = createDep( - () => ref2.dep = void 0, - ref2 instanceof ComputedRefImpl ? ref2 : void 0 - ), - false ? { - target: ref2, - type: "get", - key: "value" - } : void 0 - ); - } -} -__name(trackRefValue, "trackRefValue"); -function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) { - ref2 = toRaw(ref2); - const dep = ref2.dep; - if (dep) { - triggerEffects( - dep, - dirtyLevel, - false ? { - target: ref2, - type: "set", - key: "value", - newValue: newVal, - oldValue: oldVal - } : void 0 - ); - } -} -__name(triggerRefValue, "triggerRefValue"); -function isRef(r) { - return !!(r && r.__v_isRef === true); -} -__name(isRef, "isRef"); -function ref(value3) { - return createRef(value3, false); -} -__name(ref, "ref"); -function shallowRef(value3) { - return createRef(value3, true); -} -__name(shallowRef, "shallowRef"); -function createRef(rawValue, shallow) { - if (isRef(rawValue)) { - return rawValue; - } - return new RefImpl(rawValue, shallow); -} -__name(createRef, "createRef"); -class RefImpl { - static { - __name(this, "RefImpl"); - } - constructor(value3, __v_isShallow) { - this.__v_isShallow = __v_isShallow; - this.dep = void 0; - this.__v_isRef = true; - this._rawValue = __v_isShallow ? value3 : toRaw(value3); - this._value = __v_isShallow ? value3 : toReactive$1(value3); - } - get value() { - trackRefValue(this); - return this._value; - } - set value(newVal) { - const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal); - newVal = useDirectValue ? newVal : toRaw(newVal); - if (hasChanged(newVal, this._rawValue)) { - const oldVal = this._rawValue; - this._rawValue = newVal; - this._value = useDirectValue ? newVal : toReactive$1(newVal); - triggerRefValue(this, 4, newVal, oldVal); - } - } -} -function triggerRef(ref2) { - triggerRefValue(ref2, 4, false ? ref2.value : void 0); -} -__name(triggerRef, "triggerRef"); -function unref(ref2) { - return isRef(ref2) ? ref2.value : ref2; -} -__name(unref, "unref"); -function toValue$2(source) { - return isFunction$3(source) ? source() : unref(source); -} -__name(toValue$2, "toValue$2"); -const shallowUnwrapHandlers = { - get: /* @__PURE__ */ __name((target, key, receiver) => unref(Reflect.get(target, key, receiver)), "get"), - set: /* @__PURE__ */ __name((target, key, value3, receiver) => { - const oldValue2 = target[key]; - if (isRef(oldValue2) && !isRef(value3)) { - oldValue2.value = value3; - return true; - } else { - return Reflect.set(target, key, value3, receiver); - } - }, "set") -}; -function proxyRefs(objectWithRefs) { - return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); -} -__name(proxyRefs, "proxyRefs"); -class CustomRefImpl { - static { - __name(this, "CustomRefImpl"); - } - constructor(factory) { - this.dep = void 0; - this.__v_isRef = true; - const { get: get2, set: set2 } = factory( - () => trackRefValue(this), - () => triggerRefValue(this) - ); - this._get = get2; - this._set = set2; - } - get value() { - return this._get(); - } - set value(newVal) { - this._set(newVal); - } -} -function customRef(factory) { - return new CustomRefImpl(factory); -} -__name(customRef, "customRef"); -function toRefs$1(object) { - if (false) { - warn$3(`toRefs() expects a reactive object but received a plain one.`); - } - const ret = isArray$5(object) ? new Array(object.length) : {}; - for (const key in object) { - ret[key] = propertyToRef(object, key); - } - return ret; -} -__name(toRefs$1, "toRefs$1"); -class ObjectRefImpl { - static { - __name(this, "ObjectRefImpl"); - } - constructor(_object, _key, _defaultValue) { - this._object = _object; - this._key = _key; - this._defaultValue = _defaultValue; - this.__v_isRef = true; - } - get value() { - const val = this._object[this._key]; - return val === void 0 ? this._defaultValue : val; - } - set value(newVal) { - this._object[this._key] = newVal; - } - get dep() { - return getDepFromReactive(toRaw(this._object), this._key); - } -} -class GetterRefImpl { - static { - __name(this, "GetterRefImpl"); - } - constructor(_getter) { - this._getter = _getter; - this.__v_isRef = true; - this.__v_isReadonly = true; - } - get value() { - return this._getter(); - } -} -function toRef$1(source, key, defaultValue) { - if (isRef(source)) { - return source; - } else if (isFunction$3(source)) { - return new GetterRefImpl(source); - } else if (isObject$6(source) && arguments.length > 1) { - return propertyToRef(source, key, defaultValue); - } else { - return ref(source); - } -} -__name(toRef$1, "toRef$1"); -function propertyToRef(source, key, defaultValue) { - const val = source[key]; - return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue); -} -__name(propertyToRef, "propertyToRef"); -const deferredComputed = computed$1; -const TrackOpTypes = { - "GET": "get", - "HAS": "has", - "ITERATE": "iterate" -}; -const TriggerOpTypes = { - "SET": "set", - "ADD": "add", - "DELETE": "delete", - "CLEAR": "clear" -}; -const ReactiveFlags = { - "SKIP": "__v_skip", - "IS_REACTIVE": "__v_isReactive", - "IS_READONLY": "__v_isReadonly", - "IS_SHALLOW": "__v_isShallow", - "RAW": "__v_raw" -}; -/** -* @vue/runtime-core v3.4.31 -* (c) 2018-present Yuxi (Evan) You and Vue contributors -* @license MIT -**/ -const stack = []; -function pushWarningContext(vnode) { - stack.push(vnode); -} -__name(pushWarningContext, "pushWarningContext"); -function popWarningContext() { - stack.pop(); -} -__name(popWarningContext, "popWarningContext"); -function warn$1$1(msg, ...args) { - pauseTracking(); - const instance = stack.length ? stack[stack.length - 1].component : null; - const appWarnHandler = instance && instance.appContext.config.warnHandler; - const trace = getComponentTrace(); - if (appWarnHandler) { - callWithErrorHandling( - appWarnHandler, - instance, - 11, - [ - // eslint-disable-next-line no-restricted-syntax - msg + args.map((a) => { - var _a, _b; - return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a); - }).join(""), - instance && instance.proxy, - trace.map( - ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>` - ).join("\n"), - trace - ] - ); - } else { - const warnArgs = [`[Vue warn]: ${msg}`, ...args]; - if (trace.length && // avoid spamming console during tests - true) { - warnArgs.push(` -`, ...formatTrace(trace)); - } - console.warn(...warnArgs); - } - resetTracking(); -} -__name(warn$1$1, "warn$1$1"); -function getComponentTrace() { - let currentVNode = stack[stack.length - 1]; - if (!currentVNode) { - return []; - } - const normalizedStack = []; - while (currentVNode) { - const last = normalizedStack[0]; - if (last && last.vnode === currentVNode) { - last.recurseCount++; - } else { - normalizedStack.push({ - vnode: currentVNode, - recurseCount: 0 - }); - } - const parentInstance = currentVNode.component && currentVNode.component.parent; - currentVNode = parentInstance && parentInstance.vnode; - } - return normalizedStack; -} -__name(getComponentTrace, "getComponentTrace"); -function formatTrace(trace) { - const logs = []; - trace.forEach((entry, i) => { - logs.push(...i === 0 ? [] : [` -`], ...formatTraceEntry(entry)); - }); - return logs; -} -__name(formatTrace, "formatTrace"); -function formatTraceEntry({ vnode, recurseCount }) { - const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``; - const isRoot = vnode.component ? vnode.component.parent == null : false; - const open2 = ` at <${formatComponentName( - vnode.component, - vnode.type, - isRoot - )}`; - const close4 = `>` + postfix; - return vnode.props ? [open2, ...formatProps(vnode.props), close4] : [open2 + close4]; -} -__name(formatTraceEntry, "formatTraceEntry"); -function formatProps(props) { - const res = []; - const keys2 = Object.keys(props); - keys2.slice(0, 3).forEach((key) => { - res.push(...formatProp(key, props[key])); - }); - if (keys2.length > 3) { - res.push(` ...`); - } - return res; -} -__name(formatProps, "formatProps"); -function formatProp(key, value3, raw) { - if (isString$5(value3)) { - value3 = JSON.stringify(value3); - return raw ? value3 : [`${key}=${value3}`]; - } else if (typeof value3 === "number" || typeof value3 === "boolean" || value3 == null) { - return raw ? value3 : [`${key}=${value3}`]; - } else if (isRef(value3)) { - value3 = formatProp(key, toRaw(value3.value), true); - return raw ? value3 : [`${key}=Ref<`, value3, `>`]; - } else if (isFunction$3(value3)) { - return [`${key}=fn${value3.name ? `<${value3.name}>` : ``}`]; - } else { - value3 = toRaw(value3); - return raw ? value3 : [`${key}=`, value3]; - } -} -__name(formatProp, "formatProp"); -function assertNumber(val, type) { - if (true) return; - if (val === void 0) { - return; - } else if (typeof val !== "number") { - warn$1$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`); - } else if (isNaN(val)) { - warn$1$1(`${type} is NaN - the duration expression might be incorrect.`); - } -} -__name(assertNumber, "assertNumber"); -const ErrorCodes = { - "SETUP_FUNCTION": 0, - "0": "SETUP_FUNCTION", - "RENDER_FUNCTION": 1, - "1": "RENDER_FUNCTION", - "WATCH_GETTER": 2, - "2": "WATCH_GETTER", - "WATCH_CALLBACK": 3, - "3": "WATCH_CALLBACK", - "WATCH_CLEANUP": 4, - "4": "WATCH_CLEANUP", - "NATIVE_EVENT_HANDLER": 5, - "5": "NATIVE_EVENT_HANDLER", - "COMPONENT_EVENT_HANDLER": 6, - "6": "COMPONENT_EVENT_HANDLER", - "VNODE_HOOK": 7, - "7": "VNODE_HOOK", - "DIRECTIVE_HOOK": 8, - "8": "DIRECTIVE_HOOK", - "TRANSITION_HOOK": 9, - "9": "TRANSITION_HOOK", - "APP_ERROR_HANDLER": 10, - "10": "APP_ERROR_HANDLER", - "APP_WARN_HANDLER": 11, - "11": "APP_WARN_HANDLER", - "FUNCTION_REF": 12, - "12": "FUNCTION_REF", - "ASYNC_COMPONENT_LOADER": 13, - "13": "ASYNC_COMPONENT_LOADER", - "SCHEDULER": 14, - "14": "SCHEDULER" -}; -const ErrorTypeStrings$1 = { - ["sp"]: "serverPrefetch hook", - ["bc"]: "beforeCreate hook", - ["c"]: "created hook", - ["bm"]: "beforeMount hook", - ["m"]: "mounted hook", - ["bu"]: "beforeUpdate hook", - ["u"]: "updated", - ["bum"]: "beforeUnmount hook", - ["um"]: "unmounted hook", - ["a"]: "activated hook", - ["da"]: "deactivated hook", - ["ec"]: "errorCaptured hook", - ["rtc"]: "renderTracked hook", - ["rtg"]: "renderTriggered hook", - [0]: "setup function", - [1]: "render function", - [2]: "watcher getter", - [3]: "watcher callback", - [4]: "watcher cleanup function", - [5]: "native event handler", - [6]: "component event handler", - [7]: "vnode hook", - [8]: "directive hook", - [9]: "transition hook", - [10]: "app errorHandler", - [11]: "app warnHandler", - [12]: "ref function", - [13]: "async component loader", - [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ." -}; -function callWithErrorHandling(fn, instance, type, args) { - try { - return args ? fn(...args) : fn(); - } catch (err) { - handleError(err, instance, type); - } -} -__name(callWithErrorHandling, "callWithErrorHandling"); -function callWithAsyncErrorHandling(fn, instance, type, args) { - if (isFunction$3(fn)) { - const res = callWithErrorHandling(fn, instance, type, args); - if (res && isPromise$1(res)) { - res.catch((err) => { - handleError(err, instance, type); - }); - } - return res; - } - if (isArray$5(fn)) { - const values = []; - for (let i = 0; i < fn.length; i++) { - values.push(callWithAsyncErrorHandling(fn[i], instance, type, args)); - } - return values; - } else if (false) { - warn$1$1( - `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}` - ); - } -} -__name(callWithAsyncErrorHandling, "callWithAsyncErrorHandling"); -function handleError(err, instance, type, throwInDev = true) { - const contextVNode = instance ? instance.vnode : null; - if (instance) { - let cur = instance.parent; - const exposedInstance = instance.proxy; - const errorInfo = false ? ErrorTypeStrings$1[type] : `https://vuejs.org/error-reference/#runtime-${type}`; - while (cur) { - const errorCapturedHooks = cur.ec; - if (errorCapturedHooks) { - for (let i = 0; i < errorCapturedHooks.length; i++) { - if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) { - return; - } - } - } - cur = cur.parent; - } - const appErrorHandler = instance.appContext.config.errorHandler; - if (appErrorHandler) { - pauseTracking(); - callWithErrorHandling( - appErrorHandler, - null, - 10, - [err, exposedInstance, errorInfo] - ); - resetTracking(); - return; - } - } - logError(err, type, contextVNode, throwInDev); -} -__name(handleError, "handleError"); -function logError(err, type, contextVNode, throwInDev = true) { - if (false) { - const info = ErrorTypeStrings$1[type]; - if (contextVNode) { - pushWarningContext(contextVNode); - } - warn$1$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`); - if (contextVNode) { - popWarningContext(); - } - if (throwInDev) { - throw err; - } else { - console.error(err); - } - } else { - console.error(err); - } -} -__name(logError, "logError"); -let isFlushing = false; -let isFlushPending = false; -const queue = []; -let flushIndex = 0; -const pendingPostFlushCbs = []; -let activePostFlushCbs = null; -let postFlushIndex = 0; -const resolvedPromise = /* @__PURE__ */ Promise.resolve(); -let currentFlushPromise = null; -const RECURSION_LIMIT = 100; -function nextTick(fn) { - const p2 = currentFlushPromise || resolvedPromise; - return fn ? p2.then(this ? fn.bind(this) : fn) : p2; -} -__name(nextTick, "nextTick"); -function findInsertionIndex$1(id3) { - let start2 = flushIndex + 1; - let end = queue.length; - while (start2 < end) { - const middle = start2 + end >>> 1; - const middleJob = queue[middle]; - const middleJobId = getId(middleJob); - if (middleJobId < id3 || middleJobId === id3 && middleJob.pre) { - start2 = middle + 1; - } else { - end = middle; - } - } - return start2; -} -__name(findInsertionIndex$1, "findInsertionIndex$1"); -function queueJob(job) { - if (!queue.length || !queue.includes( - job, - isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex - )) { - if (job.id == null) { - queue.push(job); - } else { - queue.splice(findInsertionIndex$1(job.id), 0, job); - } - queueFlush(); - } -} -__name(queueJob, "queueJob"); -function queueFlush() { - if (!isFlushing && !isFlushPending) { - isFlushPending = true; - currentFlushPromise = resolvedPromise.then(flushJobs); - } -} -__name(queueFlush, "queueFlush"); -function invalidateJob(job) { - const i = queue.indexOf(job); - if (i > flushIndex) { - queue.splice(i, 1); - } -} -__name(invalidateJob, "invalidateJob"); -function queuePostFlushCb(cb) { - if (!isArray$5(cb)) { - if (!activePostFlushCbs || !activePostFlushCbs.includes( - cb, - cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex - )) { - pendingPostFlushCbs.push(cb); - } - } else { - pendingPostFlushCbs.push(...cb); - } - queueFlush(); -} -__name(queuePostFlushCb, "queuePostFlushCb"); -function flushPreFlushCbs(instance, seen2, i = isFlushing ? flushIndex + 1 : 0) { - if (false) { - seen2 = seen2 || /* @__PURE__ */ new Map(); - } - for (; i < queue.length; i++) { - const cb = queue[i]; - if (cb && cb.pre) { - if (instance && cb.id !== instance.uid) { - continue; - } - if (false) { - continue; - } - queue.splice(i, 1); - i--; - cb(); - } - } -} -__name(flushPreFlushCbs, "flushPreFlushCbs"); -function flushPostFlushCbs(seen2) { - if (pendingPostFlushCbs.length) { - const deduped = [...new Set(pendingPostFlushCbs)].sort( - (a, b) => getId(a) - getId(b) - ); - pendingPostFlushCbs.length = 0; - if (activePostFlushCbs) { - activePostFlushCbs.push(...deduped); - return; - } - activePostFlushCbs = deduped; - if (false) { - seen2 = seen2 || /* @__PURE__ */ new Map(); - } - for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) { - const cb = activePostFlushCbs[postFlushIndex]; - if (false) { - continue; - } - if (cb.active !== false) cb(); - } - activePostFlushCbs = null; - postFlushIndex = 0; - } -} -__name(flushPostFlushCbs, "flushPostFlushCbs"); -const getId = /* @__PURE__ */ __name((job) => job.id == null ? Infinity : job.id, "getId"); -const comparator = /* @__PURE__ */ __name((a, b) => { - const diff2 = getId(a) - getId(b); - if (diff2 === 0) { - if (a.pre && !b.pre) return -1; - if (b.pre && !a.pre) return 1; - } - return diff2; -}, "comparator"); -function flushJobs(seen2) { - isFlushPending = false; - isFlushing = true; - if (false) { - seen2 = seen2 || /* @__PURE__ */ new Map(); - } - queue.sort(comparator); - const check = false ? (job) => checkRecursiveUpdates(seen2, job) : NOOP; - try { - for (flushIndex = 0; flushIndex < queue.length; flushIndex++) { - const job = queue[flushIndex]; - if (job && job.active !== false) { - if (false) { - continue; - } - callWithErrorHandling(job, null, 14); - } - } - } finally { - flushIndex = 0; - queue.length = 0; - flushPostFlushCbs(seen2); - isFlushing = false; - currentFlushPromise = null; - if (queue.length || pendingPostFlushCbs.length) { - flushJobs(seen2); - } - } -} -__name(flushJobs, "flushJobs"); -function checkRecursiveUpdates(seen2, fn) { - if (!seen2.has(fn)) { - seen2.set(fn, 1); - } else { - const count = seen2.get(fn); - if (count > RECURSION_LIMIT) { - const instance = fn.ownerInstance; - const componentName = instance && getComponentName(instance.type); - handleError( - `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`, - null, - 10 - ); - return true; - } else { - seen2.set(fn, count + 1); - } - } -} -__name(checkRecursiveUpdates, "checkRecursiveUpdates"); -let isHmrUpdating = false; -const hmrDirtyComponents = /* @__PURE__ */ new Set(); -if (false) { - getGlobalThis$1().__VUE_HMR_RUNTIME__ = { - createRecord: tryWrap(createRecord), - rerender: tryWrap(rerender), - reload: tryWrap(reload) - }; -} -const map = /* @__PURE__ */ new Map(); -function registerHMR(instance) { - const id3 = instance.type.__hmrId; - let record = map.get(id3); - if (!record) { - createRecord(id3, instance.type); - record = map.get(id3); - } - record.instances.add(instance); -} -__name(registerHMR, "registerHMR"); -function unregisterHMR(instance) { - map.get(instance.type.__hmrId).instances.delete(instance); -} -__name(unregisterHMR, "unregisterHMR"); -function createRecord(id3, initialDef) { - if (map.has(id3)) { - return false; - } - map.set(id3, { - initialDef: normalizeClassComponent(initialDef), - instances: /* @__PURE__ */ new Set() - }); - return true; -} -__name(createRecord, "createRecord"); -function normalizeClassComponent(component) { - return isClassComponent(component) ? component.__vccOpts : component; -} -__name(normalizeClassComponent, "normalizeClassComponent"); -function rerender(id3, newRender) { - const record = map.get(id3); - if (!record) { - return; - } - record.initialDef.render = newRender; - [...record.instances].forEach((instance) => { - if (newRender) { - instance.render = newRender; - normalizeClassComponent(instance.type).render = newRender; - } - instance.renderCache = []; - isHmrUpdating = true; - instance.effect.dirty = true; - instance.update(); - isHmrUpdating = false; - }); -} -__name(rerender, "rerender"); -function reload(id3, newComp) { - const record = map.get(id3); - if (!record) return; - newComp = normalizeClassComponent(newComp); - updateComponentDef(record.initialDef, newComp); - const instances = [...record.instances]; - for (const instance of instances) { - const oldComp = normalizeClassComponent(instance.type); - if (!hmrDirtyComponents.has(oldComp)) { - if (oldComp !== record.initialDef) { - updateComponentDef(oldComp, newComp); - } - hmrDirtyComponents.add(oldComp); - } - instance.appContext.propsCache.delete(instance.type); - instance.appContext.emitsCache.delete(instance.type); - instance.appContext.optionsCache.delete(instance.type); - if (instance.ceReload) { - hmrDirtyComponents.add(oldComp); - instance.ceReload(newComp.styles); - hmrDirtyComponents.delete(oldComp); - } else if (instance.parent) { - instance.parent.effect.dirty = true; - queueJob(() => { - instance.parent.update(); - hmrDirtyComponents.delete(oldComp); - }); - } else if (instance.appContext.reload) { - instance.appContext.reload(); - } else if (typeof window !== "undefined") { - window.location.reload(); - } else { - console.warn( - "[HMR] Root or manually mounted instance modified. Full reload required." - ); - } - } - queuePostFlushCb(() => { - for (const instance of instances) { - hmrDirtyComponents.delete( - normalizeClassComponent(instance.type) - ); - } - }); -} -__name(reload, "reload"); -function updateComponentDef(oldComp, newComp) { - extend$1(oldComp, newComp); - for (const key in oldComp) { - if (key !== "__file" && !(key in newComp)) { - delete oldComp[key]; - } - } -} -__name(updateComponentDef, "updateComponentDef"); -function tryWrap(fn) { - return (id3, arg) => { - try { - return fn(id3, arg); - } catch (e2) { - console.error(e2); - console.warn( - `[HMR] Something went wrong during Vue component hot-reload. Full reload required.` - ); - } - }; -} -__name(tryWrap, "tryWrap"); -let devtools$1; -let buffer = []; -let devtoolsNotInstalled = false; -function emit$1(event, ...args) { - if (devtools$1) { - devtools$1.emit(event, ...args); - } else if (!devtoolsNotInstalled) { - buffer.push({ event, args }); - } -} -__name(emit$1, "emit$1"); -function setDevtoolsHook$1(hook, target) { - var _a, _b; - devtools$1 = hook; - if (devtools$1) { - devtools$1.enabled = true; - buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args)); - buffer = []; - } else if ( - // handle late devtools injection - only do this if we are in an actual - // browser environment to avoid the timer handle stalling test runner exit - // (#4815) - typeof window !== "undefined" && // some envs mock window but not fully - window.HTMLElement && // also exclude jsdom - // eslint-disable-next-line no-restricted-syntax - !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom")) - ) { - const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []; - replay.push((newHook) => { - setDevtoolsHook$1(newHook, target); - }); - setTimeout(() => { - if (!devtools$1) { - target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null; - devtoolsNotInstalled = true; - buffer = []; - } - }, 3e3); - } else { - devtoolsNotInstalled = true; - buffer = []; - } -} -__name(setDevtoolsHook$1, "setDevtoolsHook$1"); -function devtoolsInitApp(app2, version2) { - emit$1("app:init", app2, version2, { - Fragment, - Text: Text$1, - Comment, - Static - }); -} -__name(devtoolsInitApp, "devtoolsInitApp"); -function devtoolsUnmountApp(app2) { - emit$1("app:unmount", app2); -} -__name(devtoolsUnmountApp, "devtoolsUnmountApp"); -const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook( - "component:added" - /* COMPONENT_ADDED */ -); -const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook( - "component:updated" - /* COMPONENT_UPDATED */ -); -const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook( - "component:removed" - /* COMPONENT_REMOVED */ -); -const devtoolsComponentRemoved = /* @__PURE__ */ __name((component) => { - if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered - !devtools$1.cleanupBuffer(component)) { - _devtoolsComponentRemoved(component); - } -}, "devtoolsComponentRemoved"); -/*! #__NO_SIDE_EFFECTS__ */ -// @__NO_SIDE_EFFECTS__ -function createDevtoolsComponentHook(hook) { - return (component) => { - emit$1( - hook, - component.appContext.app, - component.uid, - component.parent ? component.parent.uid : void 0, - component - ); - }; -} -__name(createDevtoolsComponentHook, "createDevtoolsComponentHook"); -const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook( - "perf:start" - /* PERFORMANCE_START */ -); -const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook( - "perf:end" - /* PERFORMANCE_END */ -); -function createDevtoolsPerformanceHook(hook) { - return (component, type, time) => { - emit$1(hook, component.appContext.app, component.uid, component, type, time); - }; -} -__name(createDevtoolsPerformanceHook, "createDevtoolsPerformanceHook"); -function devtoolsComponentEmit(component, event, params) { - emit$1( - "component:emit", - component.appContext.app, - component, - event, - params - ); -} -__name(devtoolsComponentEmit, "devtoolsComponentEmit"); -function emit(instance, event, ...rawArgs) { - if (instance.isUnmounted) return; - const props = instance.vnode.props || EMPTY_OBJ; - if (false) { - const { - emitsOptions, - propsOptions: [propsOptions] - } = instance; - if (emitsOptions) { - if (!(event in emitsOptions) && true) { - if (!propsOptions || !(toHandlerKey(event) in propsOptions)) { - warn$1$1( - `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.` - ); - } - } else { - const validator3 = emitsOptions[event]; - if (isFunction$3(validator3)) { - const isValid2 = validator3(...rawArgs); - if (!isValid2) { - warn$1$1( - `Invalid event arguments: event validation failed for event "${event}".` - ); - } - } - } - } - } - let args = rawArgs; - const isModelListener2 = event.startsWith("update:"); - const modelArg = isModelListener2 && event.slice(7); - if (modelArg && modelArg in props) { - const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`; - const { number: number2, trim: trim2 } = props[modifiersKey] || EMPTY_OBJ; - if (trim2) { - args = rawArgs.map((a) => isString$5(a) ? a.trim() : a); - } - if (number2) { - args = rawArgs.map(looseToNumber); - } - } - if (false) { - devtoolsComponentEmit(instance, event, args); - } - if (false) { - const lowerCaseEvent = event.toLowerCase(); - if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) { - warn$1$1( - `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName( - instance, - instance.type - )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate$1( - event - )}" instead of "${event}".` - ); - } - } - let handlerName; - let handler6 = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249) - props[handlerName = toHandlerKey(camelize$1(event))]; - if (!handler6 && isModelListener2) { - handler6 = props[handlerName = toHandlerKey(hyphenate$1(event))]; - } - if (handler6) { - callWithAsyncErrorHandling( - handler6, - instance, - 6, - args - ); - } - const onceHandler = props[handlerName + `Once`]; - if (onceHandler) { - if (!instance.emitted) { - instance.emitted = {}; - } else if (instance.emitted[handlerName]) { - return; - } - instance.emitted[handlerName] = true; - callWithAsyncErrorHandling( - onceHandler, - instance, - 6, - args - ); - } -} -__name(emit, "emit"); -function normalizeEmitsOptions(comp, appContext, asMixin = false) { - const cache2 = appContext.emitsCache; - const cached = cache2.get(comp); - if (cached !== void 0) { - return cached; - } - const raw = comp.emits; - let normalized = {}; - let hasExtends = false; - if (!isFunction$3(comp)) { - const extendEmits = /* @__PURE__ */ __name((raw2) => { - const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); - if (normalizedFromExtend) { - hasExtends = true; - extend$1(normalized, normalizedFromExtend); - } - }, "extendEmits"); - if (!asMixin && appContext.mixins.length) { - appContext.mixins.forEach(extendEmits); - } - if (comp.extends) { - extendEmits(comp.extends); - } - if (comp.mixins) { - comp.mixins.forEach(extendEmits); - } - } - if (!raw && !hasExtends) { - if (isObject$6(comp)) { - cache2.set(comp, null); - } - return null; - } - if (isArray$5(raw)) { - raw.forEach((key) => normalized[key] = null); - } else { - extend$1(normalized, raw); - } - if (isObject$6(comp)) { - cache2.set(comp, normalized); - } - return normalized; -} -__name(normalizeEmitsOptions, "normalizeEmitsOptions"); -function isEmitListener(options3, key) { - if (!options3 || !isOn(key)) { - return false; - } - key = key.slice(2).replace(/Once$/, ""); - return hasOwn$3(options3, key[0].toLowerCase() + key.slice(1)) || hasOwn$3(options3, hyphenate$1(key)) || hasOwn$3(options3, key); -} -__name(isEmitListener, "isEmitListener"); -let currentRenderingInstance = null; -let currentScopeId = null; -function setCurrentRenderingInstance(instance) { - const prev2 = currentRenderingInstance; - currentRenderingInstance = instance; - currentScopeId = instance && instance.type.__scopeId || null; - return prev2; -} -__name(setCurrentRenderingInstance, "setCurrentRenderingInstance"); -function pushScopeId(id3) { - currentScopeId = id3; -} -__name(pushScopeId, "pushScopeId"); -function popScopeId() { - currentScopeId = null; -} -__name(popScopeId, "popScopeId"); -const withScopeId = /* @__PURE__ */ __name((_id2) => withCtx, "withScopeId"); -function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) { - if (!ctx) return fn; - if (fn._n) { - return fn; - } - const renderFnWithContext = /* @__PURE__ */ __name((...args) => { - if (renderFnWithContext._d) { - setBlockTracking(-1); - } - const prevInstance = setCurrentRenderingInstance(ctx); - let res; - try { - res = fn(...args); - } finally { - setCurrentRenderingInstance(prevInstance); - if (renderFnWithContext._d) { - setBlockTracking(1); - } - } - if (false) { - devtoolsComponentUpdated(ctx); - } - return res; - }, "renderFnWithContext"); - renderFnWithContext._n = true; - renderFnWithContext._c = true; - renderFnWithContext._d = true; - return renderFnWithContext; -} -__name(withCtx, "withCtx"); -let accessedAttrs = false; -function markAttrsAccessed() { - accessedAttrs = true; -} -__name(markAttrsAccessed, "markAttrsAccessed"); -function renderComponentRoot(instance) { - const { - type: Component, - vnode, - proxy, - withProxy, - propsOptions: [propsOptions], - slots, - attrs: attrs3, - emit: emit2, - render: render2, - renderCache, - props, - data: data23, - setupState, - ctx, - inheritAttrs - } = instance; - const prev2 = setCurrentRenderingInstance(instance); - let result; - let fallthroughAttrs; - if (false) { - accessedAttrs = false; - } - try { - if (vnode.shapeFlag & 4) { - const proxyToUse = withProxy || proxy; - const thisProxy = false ? new Proxy(proxyToUse, { - get(target, key, receiver) { - warn$1$1( - `Property '${String( - key - )}' was accessed via 'this'. Avoid using 'this' in templates.` - ); - return Reflect.get(target, key, receiver); - } - }) : proxyToUse; - result = normalizeVNode( - render2.call( - thisProxy, - proxyToUse, - renderCache, - false ? shallowReadonly(props) : props, - setupState, - data23, - ctx - ) - ); - fallthroughAttrs = attrs3; - } else { - const render22 = Component; - if (false) { - markAttrsAccessed(); - } - result = normalizeVNode( - render22.length > 1 ? render22( - false ? shallowReadonly(props) : props, - false ? { - get attrs() { - markAttrsAccessed(); - return shallowReadonly(attrs3); - }, - slots, - emit: emit2 - } : { attrs: attrs3, slots, emit: emit2 } - ) : render22( - false ? shallowReadonly(props) : props, - null - ) - ); - fallthroughAttrs = Component.props ? attrs3 : getFunctionalFallthrough(attrs3); - } - } catch (err) { - blockStack.length = 0; - handleError(err, instance, 1); - result = createVNode(Comment); - } - let root23 = result; - let setRoot = void 0; - if (false) { - [root23, setRoot] = getChildRoot(result); - } - if (fallthroughAttrs && inheritAttrs !== false) { - const keys2 = Object.keys(fallthroughAttrs); - const { shapeFlag } = root23; - if (keys2.length) { - if (shapeFlag & (1 | 6)) { - if (propsOptions && keys2.some(isModelListener)) { - fallthroughAttrs = filterModelListeners( - fallthroughAttrs, - propsOptions - ); - } - root23 = cloneVNode(root23, fallthroughAttrs, false, true); - } else if (false) { - const allAttrs = Object.keys(attrs3); - const eventAttrs = []; - const extraAttrs = []; - for (let i = 0, l = allAttrs.length; i < l; i++) { - const key = allAttrs[i]; - if (isOn(key)) { - if (!isModelListener(key)) { - eventAttrs.push(key[2].toLowerCase() + key.slice(3)); - } - } else { - extraAttrs.push(key); - } - } - if (extraAttrs.length) { - warn$1$1( - `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.` - ); - } - if (eventAttrs.length) { - warn$1$1( - `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.` - ); - } - } - } - } - if (vnode.dirs) { - if (false) { - warn$1$1( - `Runtime directive used on component with non-element root node. The directives will not function as intended.` - ); - } - root23 = cloneVNode(root23, null, false, true); - root23.dirs = root23.dirs ? root23.dirs.concat(vnode.dirs) : vnode.dirs; - } - if (vnode.transition) { - if (false) { - warn$1$1( - `Component inside renders non-element root node that cannot be animated.` - ); - } - root23.transition = vnode.transition; - } - if (false) { - setRoot(root23); - } else { - result = root23; - } - setCurrentRenderingInstance(prev2); - return result; -} -__name(renderComponentRoot, "renderComponentRoot"); -const getChildRoot = /* @__PURE__ */ __name((vnode) => { - const rawChildren = vnode.children; - const dynamicChildren = vnode.dynamicChildren; - const childRoot = filterSingleRoot(rawChildren, false); - if (!childRoot) { - return [vnode, void 0]; - } else if (false) { - return getChildRoot(childRoot); - } - const index2 = rawChildren.indexOf(childRoot); - const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1; - const setRoot = /* @__PURE__ */ __name((updatedRoot) => { - rawChildren[index2] = updatedRoot; - if (dynamicChildren) { - if (dynamicIndex > -1) { - dynamicChildren[dynamicIndex] = updatedRoot; - } else if (updatedRoot.patchFlag > 0) { - vnode.dynamicChildren = [...dynamicChildren, updatedRoot]; - } - } - }, "setRoot"); - return [normalizeVNode(childRoot), setRoot]; -}, "getChildRoot"); -function filterSingleRoot(children, recurse = true) { - let singleRoot; - for (let i = 0; i < children.length; i++) { - const child = children[i]; - if (isVNode$1(child)) { - if (child.type !== Comment || child.children === "v-if") { - if (singleRoot) { - return; - } else { - singleRoot = child; - if (false) { - return filterSingleRoot(singleRoot.children); - } - } - } - } else { - return; - } - } - return singleRoot; -} -__name(filterSingleRoot, "filterSingleRoot"); -const getFunctionalFallthrough = /* @__PURE__ */ __name((attrs3) => { - let res; - for (const key in attrs3) { - if (key === "class" || key === "style" || isOn(key)) { - (res || (res = {}))[key] = attrs3[key]; - } - } - return res; -}, "getFunctionalFallthrough"); -const filterModelListeners = /* @__PURE__ */ __name((attrs3, props) => { - const res = {}; - for (const key in attrs3) { - if (!isModelListener(key) || !(key.slice(9) in props)) { - res[key] = attrs3[key]; - } - } - return res; -}, "filterModelListeners"); -const isElementRoot = /* @__PURE__ */ __name((vnode) => { - return vnode.shapeFlag & (6 | 1) || vnode.type === Comment; -}, "isElementRoot"); -function shouldUpdateComponent(prevVNode, nextVNode, optimized) { - const { props: prevProps, children: prevChildren, component } = prevVNode; - const { props: nextProps, children: nextChildren, patchFlag } = nextVNode; - const emits = component.emitsOptions; - if (false) { - return true; - } - if (nextVNode.dirs || nextVNode.transition) { - return true; - } - if (optimized && patchFlag >= 0) { - if (patchFlag & 1024) { - return true; - } - if (patchFlag & 16) { - if (!prevProps) { - return !!nextProps; - } - return hasPropsChanged(prevProps, nextProps, emits); - } else if (patchFlag & 8) { - const dynamicProps = nextVNode.dynamicProps; - for (let i = 0; i < dynamicProps.length; i++) { - const key = dynamicProps[i]; - if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) { - return true; - } - } - } - } else { - if (prevChildren || nextChildren) { - if (!nextChildren || !nextChildren.$stable) { - return true; - } - } - if (prevProps === nextProps) { - return false; - } - if (!prevProps) { - return !!nextProps; - } - if (!nextProps) { - return true; - } - return hasPropsChanged(prevProps, nextProps, emits); - } - return false; -} -__name(shouldUpdateComponent, "shouldUpdateComponent"); -function hasPropsChanged(prevProps, nextProps, emitsOptions) { - const nextKeys = Object.keys(nextProps); - if (nextKeys.length !== Object.keys(prevProps).length) { - return true; - } - for (let i = 0; i < nextKeys.length; i++) { - const key = nextKeys[i]; - if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) { - return true; - } - } - return false; -} -__name(hasPropsChanged, "hasPropsChanged"); -function updateHOCHostEl({ vnode, parent }, el) { - while (parent) { - const root23 = parent.subTree; - if (root23.suspense && root23.suspense.activeBranch === vnode) { - root23.el = vnode.el; - } - if (root23 === vnode) { - (vnode = parent.vnode).el = el; - parent = parent.parent; - } else { - break; - } - } -} -__name(updateHOCHostEl, "updateHOCHostEl"); -const COMPONENTS = "components"; -const DIRECTIVES = "directives"; -function resolveComponent(name, maybeSelfReference) { - return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name; -} -__name(resolveComponent, "resolveComponent"); -const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc"); -function resolveDynamicComponent(component) { - if (isString$5(component)) { - return resolveAsset(COMPONENTS, component, false) || component; - } else { - return component || NULL_DYNAMIC_COMPONENT; - } -} -__name(resolveDynamicComponent, "resolveDynamicComponent"); -function resolveDirective(name) { - return resolveAsset(DIRECTIVES, name); -} -__name(resolveDirective, "resolveDirective"); -function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) { - const instance = currentRenderingInstance || currentInstance; - if (instance) { - const Component = instance.type; - if (type === COMPONENTS) { - const selfName = getComponentName( - Component, - false - ); - if (selfName && (selfName === name || selfName === camelize$1(name) || selfName === capitalize$1(camelize$1(name)))) { - return Component; - } - } - const res = ( - // local registration - // check instance[type] first which is resolved for options API - resolve$1(instance[type] || Component[type], name) || // global registration - resolve$1(instance.appContext[type], name) - ); - if (!res && maybeSelfReference) { - return Component; - } - if (false) { - const extra = type === COMPONENTS ? ` -If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``; - warn$1$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`); - } - return res; - } else if (false) { - warn$1$1( - `resolve${capitalize$1(type.slice(0, -1))} can only be used in render() or setup().` - ); - } -} -__name(resolveAsset, "resolveAsset"); -function resolve$1(registry, name) { - return registry && (registry[name] || registry[camelize$1(name)] || registry[capitalize$1(camelize$1(name))]); -} -__name(resolve$1, "resolve$1"); -const isSuspense = /* @__PURE__ */ __name((type) => type.__isSuspense, "isSuspense"); -let suspenseId = 0; -const SuspenseImpl = { - name: "Suspense", - // In order to make Suspense tree-shakable, we need to avoid importing it - // directly in the renderer. The renderer checks for the __isSuspense flag - // on a vnode's type and calls the `process` method, passing in renderer - // internals. - __isSuspense: true, - process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { - if (n1 == null) { - mountSuspense( - n2, - container, - anchor, - parentComponent, - parentSuspense, - namespace, - slotScopeIds, - optimized, - rendererInternals - ); - } else { - if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) { - n2.suspense = n1.suspense; - n2.suspense.vnode = n2; - n2.el = n1.el; - return; - } - patchSuspense( - n1, - n2, - container, - anchor, - parentComponent, - namespace, - slotScopeIds, - optimized, - rendererInternals - ); - } - }, - hydrate: hydrateSuspense, - normalize: normalizeSuspenseChildren -}; -const Suspense = SuspenseImpl; -function triggerEvent(vnode, name) { - const eventListener = vnode.props && vnode.props[name]; - if (isFunction$3(eventListener)) { - eventListener(); - } -} -__name(triggerEvent, "triggerEvent"); -function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) { - const { - p: patch2, - o: { createElement: createElement2 } - } = rendererInternals; - const hiddenContainer = createElement2("div"); - const suspense = vnode.suspense = createSuspenseBoundary( - vnode, - parentSuspense, - parentComponent, - container, - hiddenContainer, - anchor, - namespace, - slotScopeIds, - optimized, - rendererInternals - ); - patch2( - null, - suspense.pendingBranch = vnode.ssContent, - hiddenContainer, - null, - parentComponent, - suspense, - namespace, - slotScopeIds - ); - if (suspense.deps > 0) { - triggerEvent(vnode, "onPending"); - triggerEvent(vnode, "onFallback"); - patch2( - null, - vnode.ssFallback, - container, - anchor, - parentComponent, - null, - // fallback tree will not have suspense context - namespace, - slotScopeIds - ); - setActiveBranch(suspense, vnode.ssFallback); - } else { - suspense.resolve(false, true); - } -} -__name(mountSuspense, "mountSuspense"); -function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch2, um: unmount, o: { createElement: createElement2 } }) { - const suspense = n2.suspense = n1.suspense; - suspense.vnode = n2; - n2.el = n1.el; - const newBranch = n2.ssContent; - const newFallback = n2.ssFallback; - const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense; - if (pendingBranch) { - suspense.pendingBranch = newBranch; - if (isSameVNodeType(newBranch, pendingBranch)) { - patch2( - pendingBranch, - newBranch, - suspense.hiddenContainer, - null, - parentComponent, - suspense, - namespace, - slotScopeIds, - optimized - ); - if (suspense.deps <= 0) { - suspense.resolve(); - } else if (isInFallback) { - if (!isHydrating) { - patch2( - activeBranch, - newFallback, - container, - anchor, - parentComponent, - null, - // fallback tree will not have suspense context - namespace, - slotScopeIds, - optimized - ); - setActiveBranch(suspense, newFallback); - } - } - } else { - suspense.pendingId = suspenseId++; - if (isHydrating) { - suspense.isHydrating = false; - suspense.activeBranch = pendingBranch; - } else { - unmount(pendingBranch, parentComponent, suspense); - } - suspense.deps = 0; - suspense.effects.length = 0; - suspense.hiddenContainer = createElement2("div"); - if (isInFallback) { - patch2( - null, - newBranch, - suspense.hiddenContainer, - null, - parentComponent, - suspense, - namespace, - slotScopeIds, - optimized - ); - if (suspense.deps <= 0) { - suspense.resolve(); - } else { - patch2( - activeBranch, - newFallback, - container, - anchor, - parentComponent, - null, - // fallback tree will not have suspense context - namespace, - slotScopeIds, - optimized - ); - setActiveBranch(suspense, newFallback); - } - } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { - patch2( - activeBranch, - newBranch, - container, - anchor, - parentComponent, - suspense, - namespace, - slotScopeIds, - optimized - ); - suspense.resolve(true); - } else { - patch2( - null, - newBranch, - suspense.hiddenContainer, - null, - parentComponent, - suspense, - namespace, - slotScopeIds, - optimized - ); - if (suspense.deps <= 0) { - suspense.resolve(); - } - } - } - } else { - if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { - patch2( - activeBranch, - newBranch, - container, - anchor, - parentComponent, - suspense, - namespace, - slotScopeIds, - optimized - ); - setActiveBranch(suspense, newBranch); - } else { - triggerEvent(n2, "onPending"); - suspense.pendingBranch = newBranch; - if (newBranch.shapeFlag & 512) { - suspense.pendingId = newBranch.component.suspenseId; - } else { - suspense.pendingId = suspenseId++; - } - patch2( - null, - newBranch, - suspense.hiddenContainer, - null, - parentComponent, - suspense, - namespace, - slotScopeIds, - optimized - ); - if (suspense.deps <= 0) { - suspense.resolve(); - } else { - const { timeout, pendingId } = suspense; - if (timeout > 0) { - setTimeout(() => { - if (suspense.pendingId === pendingId) { - suspense.fallback(newFallback); - } - }, timeout); - } else if (timeout === 0) { - suspense.fallback(newFallback); - } - } - } - } -} -__name(patchSuspense, "patchSuspense"); -let hasWarned$1 = false; -function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) { - if (false) { - hasWarned$1 = true; - console[console.info ? "info" : "log"]( - ` is an experimental feature and its API will likely change.` - ); - } - const { - p: patch2, - m: move, - um: unmount, - n: next2, - o: { parentNode, remove: remove22 } - } = rendererInternals; - let parentSuspenseId; - const isSuspensible = isVNodeSuspensible(vnode); - if (isSuspensible) { - if (parentSuspense && parentSuspense.pendingBranch) { - parentSuspenseId = parentSuspense.pendingId; - parentSuspense.deps++; - } - } - const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0; - if (false) { - assertNumber(timeout, `Suspense timeout`); - } - const initialAnchor = anchor; - const suspense = { - vnode, - parent: parentSuspense, - parentComponent, - namespace, - container, - hiddenContainer, - deps: 0, - pendingId: suspenseId++, - timeout: typeof timeout === "number" ? timeout : -1, - activeBranch: null, - pendingBranch: null, - isInFallback: !isHydrating, - isHydrating, - isUnmounted: false, - effects: [], - resolve(resume = false, sync = false) { - if (false) { - if (!resume && !suspense.pendingBranch) { - throw new Error( - `suspense.resolve() is called without a pending branch.` - ); - } - if (suspense.isUnmounted) { - throw new Error( - `suspense.resolve() is called on an already unmounted suspense boundary.` - ); - } - } - const { - vnode: vnode2, - activeBranch, - pendingBranch, - pendingId, - effects, - parentComponent: parentComponent2, - container: container2 - } = suspense; - let delayEnter = false; - if (suspense.isHydrating) { - suspense.isHydrating = false; - } else if (!resume) { - delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in"; - if (delayEnter) { - activeBranch.transition.afterLeave = () => { - if (pendingId === suspense.pendingId) { - move( - pendingBranch, - container2, - anchor === initialAnchor ? next2(activeBranch) : anchor, - 0 - ); - queuePostFlushCb(effects); - } - }; - } - if (activeBranch) { - if (parentNode(activeBranch.el) !== suspense.hiddenContainer) { - anchor = next2(activeBranch); - } - unmount(activeBranch, parentComponent2, suspense, true); - } - if (!delayEnter) { - move(pendingBranch, container2, anchor, 0); - } - } - setActiveBranch(suspense, pendingBranch); - suspense.pendingBranch = null; - suspense.isInFallback = false; - let parent = suspense.parent; - let hasUnresolvedAncestor = false; - while (parent) { - if (parent.pendingBranch) { - parent.effects.push(...effects); - hasUnresolvedAncestor = true; - break; - } - parent = parent.parent; - } - if (!hasUnresolvedAncestor && !delayEnter) { - queuePostFlushCb(effects); - } - suspense.effects = []; - if (isSuspensible) { - if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) { - parentSuspense.deps--; - if (parentSuspense.deps === 0 && !sync) { - parentSuspense.resolve(); - } - } - } - triggerEvent(vnode2, "onResolve"); - }, - fallback(fallbackVNode) { - if (!suspense.pendingBranch) { - return; - } - const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense; - triggerEvent(vnode2, "onFallback"); - const anchor2 = next2(activeBranch); - const mountFallback = /* @__PURE__ */ __name(() => { - if (!suspense.isInFallback) { - return; - } - patch2( - null, - fallbackVNode, - container2, - anchor2, - parentComponent2, - null, - // fallback tree will not have suspense context - namespace2, - slotScopeIds, - optimized - ); - setActiveBranch(suspense, fallbackVNode); - }, "mountFallback"); - const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in"; - if (delayEnter) { - activeBranch.transition.afterLeave = mountFallback; - } - suspense.isInFallback = true; - unmount( - activeBranch, - parentComponent2, - null, - // no suspense so unmount hooks fire now - true - // shouldRemove - ); - if (!delayEnter) { - mountFallback(); - } - }, - move(container2, anchor2, type) { - suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type); - suspense.container = container2; - }, - next() { - return suspense.activeBranch && next2(suspense.activeBranch); - }, - registerDep(instance, setupRenderEffect, optimized2) { - const isInPendingSuspense = !!suspense.pendingBranch; - if (isInPendingSuspense) { - suspense.deps++; - } - const hydratedEl = instance.vnode.el; - instance.asyncDep.catch((err) => { - handleError(err, instance, 0); - }).then((asyncSetupResult) => { - if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) { - return; - } - instance.asyncResolved = true; - const { vnode: vnode2 } = instance; - if (false) { - pushWarningContext(vnode2); - } - handleSetupResult(instance, asyncSetupResult, false); - if (hydratedEl) { - vnode2.el = hydratedEl; - } - const placeholder = !hydratedEl && instance.subTree.el; - setupRenderEffect( - instance, - vnode2, - // component may have been moved before resolve. - // if this is not a hydration, instance.subTree will be the comment - // placeholder. - parentNode(hydratedEl || instance.subTree.el), - // anchor will not be used if this is hydration, so only need to - // consider the comment placeholder case. - hydratedEl ? null : next2(instance.subTree), - suspense, - namespace, - optimized2 - ); - if (placeholder) { - remove22(placeholder); - } - updateHOCHostEl(instance, vnode2.el); - if (false) { - popWarningContext(); - } - if (isInPendingSuspense && --suspense.deps === 0) { - suspense.resolve(); - } - }); - }, - unmount(parentSuspense2, doRemove) { - suspense.isUnmounted = true; - if (suspense.activeBranch) { - unmount( - suspense.activeBranch, - parentComponent, - parentSuspense2, - doRemove - ); - } - if (suspense.pendingBranch) { - unmount( - suspense.pendingBranch, - parentComponent, - parentSuspense2, - doRemove - ); - } - } - }; - return suspense; -} -__name(createSuspenseBoundary, "createSuspenseBoundary"); -function hydrateSuspense(node3, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) { - const suspense = vnode.suspense = createSuspenseBoundary( - vnode, - parentSuspense, - parentComponent, - node3.parentNode, - // eslint-disable-next-line no-restricted-globals - document.createElement("div"), - null, - namespace, - slotScopeIds, - optimized, - rendererInternals, - true - ); - const result = hydrateNode( - node3, - suspense.pendingBranch = vnode.ssContent, - parentComponent, - suspense, - slotScopeIds, - optimized - ); - if (suspense.deps === 0) { - suspense.resolve(false, true); - } - return result; -} -__name(hydrateSuspense, "hydrateSuspense"); -function normalizeSuspenseChildren(vnode) { - const { shapeFlag, children } = vnode; - const isSlotChildren = shapeFlag & 32; - vnode.ssContent = normalizeSuspenseSlot( - isSlotChildren ? children.default : children - ); - vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); -} -__name(normalizeSuspenseChildren, "normalizeSuspenseChildren"); -function normalizeSuspenseSlot(s) { - let block2; - if (isFunction$3(s)) { - const trackBlock = isBlockTreeEnabled && s._c; - if (trackBlock) { - s._d = false; - openBlock(); - } - s = s(); - if (trackBlock) { - s._d = true; - block2 = currentBlock; - closeBlock(); - } - } - if (isArray$5(s)) { - const singleChild = filterSingleRoot(s); - if (false) { - warn$1$1(` slots expect a single root node.`); - } - s = singleChild; - } - s = normalizeVNode(s); - if (block2 && !s.dynamicChildren) { - s.dynamicChildren = block2.filter((c) => c !== s); - } - return s; -} -__name(normalizeSuspenseSlot, "normalizeSuspenseSlot"); -function queueEffectWithSuspense(fn, suspense) { - if (suspense && suspense.pendingBranch) { - if (isArray$5(fn)) { - suspense.effects.push(...fn); - } else { - suspense.effects.push(fn); - } - } else { - queuePostFlushCb(fn); - } -} -__name(queueEffectWithSuspense, "queueEffectWithSuspense"); -function setActiveBranch(suspense, branch) { - suspense.activeBranch = branch; - const { vnode, parentComponent } = suspense; - let el = branch.el; - while (!el && branch.component) { - branch = branch.component.subTree; - el = branch.el; - } - vnode.el = el; - if (parentComponent && parentComponent.subTree === vnode) { - parentComponent.vnode.el = el; - updateHOCHostEl(parentComponent, el); - } -} -__name(setActiveBranch, "setActiveBranch"); -function isVNodeSuspensible(vnode) { - const suspensible = vnode.props && vnode.props.suspensible; - return suspensible != null && suspensible !== false; -} -__name(isVNodeSuspensible, "isVNodeSuspensible"); -function injectHook(type, hook, target = currentInstance, prepend = false) { - if (target) { - const hooks = target[type] || (target[type] = []); - const wrappedHook = hook.__weh || (hook.__weh = (...args) => { - pauseTracking(); - const reset = setCurrentInstance(target); - const res = callWithAsyncErrorHandling(hook, target, type, args); - reset(); - resetTracking(); - return res; - }); - if (prepend) { - hooks.unshift(wrappedHook); - } else { - hooks.push(wrappedHook); - } - return wrappedHook; - } else if (false) { - const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, "")); - warn$1$1( - `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` - ); - } -} -__name(injectHook, "injectHook"); -const createHook = /* @__PURE__ */ __name((lifecycle2) => (hook, target = currentInstance) => { - if (!isInSSRComponentSetup || lifecycle2 === "sp") { - injectHook(lifecycle2, (...args) => hook(...args), target); - } -}, "createHook"); -const onBeforeMount = createHook("bm"); -const onMounted = createHook("m"); -const onBeforeUpdate = createHook("bu"); -const onUpdated = createHook("u"); -const onBeforeUnmount = createHook("bum"); -const onUnmounted = createHook("um"); -const onServerPrefetch = createHook("sp"); -const onRenderTriggered = createHook( - "rtg" -); -const onRenderTracked = createHook( - "rtc" -); -function onErrorCaptured(hook, target = currentInstance) { - injectHook("ec", hook, target); -} -__name(onErrorCaptured, "onErrorCaptured"); -function validateDirectiveName(name) { - if (isBuiltInDirective(name)) { - warn$1$1("Do not use built-in directive ids as custom directive id: " + name); - } -} -__name(validateDirectiveName, "validateDirectiveName"); -function withDirectives(vnode, directives) { - if (currentRenderingInstance === null) { - return vnode; - } - const instance = getComponentPublicInstance(currentRenderingInstance); - const bindings = vnode.dirs || (vnode.dirs = []); - for (let i = 0; i < directives.length; i++) { - let [dir, value3, arg, modifiers = EMPTY_OBJ] = directives[i]; - if (dir) { - if (isFunction$3(dir)) { - dir = { - mounted: dir, - updated: dir - }; - } - if (dir.deep) { - traverse(value3); - } - bindings.push({ - dir, - instance, - value: value3, - oldValue: void 0, - arg, - modifiers - }); - } - } - return vnode; -} -__name(withDirectives, "withDirectives"); -function invokeDirectiveHook(vnode, prevVNode, instance, name) { - const bindings = vnode.dirs; - const oldBindings = prevVNode && prevVNode.dirs; - for (let i = 0; i < bindings.length; i++) { - const binding = bindings[i]; - if (oldBindings) { - binding.oldValue = oldBindings[i].value; - } - let hook = binding.dir[name]; - if (hook) { - pauseTracking(); - callWithAsyncErrorHandling(hook, instance, 8, [ - vnode.el, - binding, - vnode, - prevVNode - ]); - resetTracking(); - } - } -} -__name(invokeDirectiveHook, "invokeDirectiveHook"); -function renderList(source, renderItem, cache2, index2) { - let ret; - const cached = cache2 && cache2[index2]; - if (isArray$5(source) || isString$5(source)) { - ret = new Array(source.length); - for (let i = 0, l = source.length; i < l; i++) { - ret[i] = renderItem(source[i], i, void 0, cached && cached[i]); - } - } else if (typeof source === "number") { - if (false) { - warn$1$1(`The v-for range expect an integer value but got ${source}.`); - } - ret = new Array(source); - for (let i = 0; i < source; i++) { - ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]); - } - } else if (isObject$6(source)) { - if (source[Symbol.iterator]) { - ret = Array.from( - source, - (item2, i) => renderItem(item2, i, void 0, cached && cached[i]) - ); - } else { - const keys2 = Object.keys(source); - ret = new Array(keys2.length); - for (let i = 0, l = keys2.length; i < l; i++) { - const key = keys2[i]; - ret[i] = renderItem(source[key], key, i, cached && cached[i]); - } - } - } else { - ret = []; - } - if (cache2) { - cache2[index2] = ret; - } - return ret; -} -__name(renderList, "renderList"); -function createSlots(slots, dynamicSlots) { - for (let i = 0; i < dynamicSlots.length; i++) { - const slot = dynamicSlots[i]; - if (isArray$5(slot)) { - for (let j = 0; j < slot.length; j++) { - slots[slot[j].name] = slot[j].fn; - } - } else if (slot) { - slots[slot.name] = slot.key ? (...args) => { - const res = slot.fn(...args); - if (res) res.key = slot.key; - return res; - } : slot.fn; - } - } - return slots; -} -__name(createSlots, "createSlots"); -/*! #__NO_SIDE_EFFECTS__ */ -// @__NO_SIDE_EFFECTS__ -function defineComponent(options3, extraOptions) { - return isFunction$3(options3) ? ( - // #8326: extend call and options.name access are considered side-effects - // by Rollup, so we have to wrap it in a pure-annotated IIFE. - /* @__PURE__ */ (() => extend$1({ name: options3.name }, extraOptions, { setup: options3 }))() - ) : options3; -} -__name(defineComponent, "defineComponent"); -const isAsyncWrapper = /* @__PURE__ */ __name((i) => !!i.type.__asyncLoader, "isAsyncWrapper"); -/*! #__NO_SIDE_EFFECTS__ */ -// @__NO_SIDE_EFFECTS__ -function defineAsyncComponent(source) { - if (isFunction$3(source)) { - source = { loader: source }; - } - const { - loader, - loadingComponent, - errorComponent, - delay = 200, - timeout, - // undefined = never times out - suspensible = true, - onError: userOnError - } = source; - let pendingRequest = null; - let resolvedComp; - let retries = 0; - const retry = /* @__PURE__ */ __name(() => { - retries++; - pendingRequest = null; - return load2(); - }, "retry"); - const load2 = /* @__PURE__ */ __name(() => { - let thisRequest; - return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => { - err = err instanceof Error ? err : new Error(String(err)); - if (userOnError) { - return new Promise((resolve2, reject3) => { - const userRetry = /* @__PURE__ */ __name(() => resolve2(retry()), "userRetry"); - const userFail = /* @__PURE__ */ __name(() => reject3(err), "userFail"); - userOnError(err, userRetry, userFail, retries + 1); - }); - } else { - throw err; - } - }).then((comp) => { - if (thisRequest !== pendingRequest && pendingRequest) { - return pendingRequest; - } - if (false) { - warn$1$1( - `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.` - ); - } - if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) { - comp = comp.default; - } - if (false) { - throw new Error(`Invalid async component load result: ${comp}`); - } - resolvedComp = comp; - return comp; - })); - }, "load"); - return /* @__PURE__ */ defineComponent({ - name: "AsyncComponentWrapper", - __asyncLoader: load2, - get __asyncResolved() { - return resolvedComp; - }, - setup() { - const instance = currentInstance; - if (resolvedComp) { - return () => createInnerComp(resolvedComp, instance); - } - const onError = /* @__PURE__ */ __name((err) => { - pendingRequest = null; - handleError( - err, - instance, - 13, - !errorComponent - ); - }, "onError"); - if (suspensible && instance.suspense || isInSSRComponentSetup) { - return load2().then((comp) => { - return () => createInnerComp(comp, instance); - }).catch((err) => { - onError(err); - return () => errorComponent ? createVNode(errorComponent, { - error: err - }) : null; - }); - } - const loaded = ref(false); - const error = ref(); - const delayed = ref(!!delay); - if (delay) { - setTimeout(() => { - delayed.value = false; - }, delay); - } - if (timeout != null) { - setTimeout(() => { - if (!loaded.value && !error.value) { - const err = new Error( - `Async component timed out after ${timeout}ms.` - ); - onError(err); - error.value = err; - } - }, timeout); - } - load2().then(() => { - loaded.value = true; - if (instance.parent && isKeepAlive(instance.parent.vnode)) { - instance.parent.effect.dirty = true; - queueJob(instance.parent.update); - } - }).catch((err) => { - onError(err); - error.value = err; - }); - return () => { - if (loaded.value && resolvedComp) { - return createInnerComp(resolvedComp, instance); - } else if (error.value && errorComponent) { - return createVNode(errorComponent, { - error: error.value - }); - } else if (loadingComponent && !delayed.value) { - return createVNode(loadingComponent); - } - }; - } - }); -} -__name(defineAsyncComponent, "defineAsyncComponent"); -function createInnerComp(comp, parent) { - const { ref: ref22, props, children, ce } = parent.vnode; - const vnode = createVNode(comp, props, children); - vnode.ref = ref22; - vnode.ce = ce; - delete parent.vnode.ce; - return vnode; -} -__name(createInnerComp, "createInnerComp"); -function renderSlot(slots, name, props = {}, fallback, noSlotted) { - if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) { - if (name !== "default") props.name = name; - return createVNode("slot", props, fallback && fallback()); - } - let slot = slots[name]; - if (false) { - warn$1$1( - `SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.` - ); - slot = /* @__PURE__ */ __name(() => [], "slot"); - } - if (slot && slot._c) { - slot._d = false; - } - openBlock(); - const validSlotContent = slot && ensureValidVNode(slot(props)); - const rendered = createBlock( - Fragment, - { - key: props.key || // slot content array of a dynamic conditional slot may have a branch - // key attached in the `createSlots` helper, respect that - validSlotContent && validSlotContent.key || `_${name}` - }, - validSlotContent || (fallback ? fallback() : []), - validSlotContent && slots._ === 1 ? 64 : -2 - ); - if (!noSlotted && rendered.scopeId) { - rendered.slotScopeIds = [rendered.scopeId + "-s"]; - } - if (slot && slot._c) { - slot._d = true; - } - return rendered; -} -__name(renderSlot, "renderSlot"); -function ensureValidVNode(vnodes) { - return vnodes.some((child) => { - if (!isVNode$1(child)) return true; - if (child.type === Comment) return false; - if (child.type === Fragment && !ensureValidVNode(child.children)) - return false; - return true; - }) ? vnodes : null; -} -__name(ensureValidVNode, "ensureValidVNode"); -function toHandlers(obj, preserveCaseIfNecessary) { - const ret = {}; - if (false) { - warn$1$1(`v-on with no argument expects an object value.`); - return ret; - } - for (const key in obj) { - ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key]; - } - return ret; -} -__name(toHandlers, "toHandlers"); -const getPublicInstance = /* @__PURE__ */ __name((i) => { - if (!i) return null; - if (isStatefulComponent(i)) return getComponentPublicInstance(i); - return getPublicInstance(i.parent); -}, "getPublicInstance"); -const publicPropertiesMap = ( - // Move PURE marker to new line to workaround compiler discarding it - // due to type annotation - /* @__PURE__ */ extend$1(/* @__PURE__ */ Object.create(null), { - $: /* @__PURE__ */ __name((i) => i, "$"), - $el: /* @__PURE__ */ __name((i) => i.vnode.el, "$el"), - $data: /* @__PURE__ */ __name((i) => i.data, "$data"), - $props: /* @__PURE__ */ __name((i) => false ? shallowReadonly(i.props) : i.props, "$props"), - $attrs: /* @__PURE__ */ __name((i) => false ? shallowReadonly(i.attrs) : i.attrs, "$attrs"), - $slots: /* @__PURE__ */ __name((i) => false ? shallowReadonly(i.slots) : i.slots, "$slots"), - $refs: /* @__PURE__ */ __name((i) => false ? shallowReadonly(i.refs) : i.refs, "$refs"), - $parent: /* @__PURE__ */ __name((i) => getPublicInstance(i.parent), "$parent"), - $root: /* @__PURE__ */ __name((i) => getPublicInstance(i.root), "$root"), - $emit: /* @__PURE__ */ __name((i) => i.emit, "$emit"), - $options: /* @__PURE__ */ __name((i) => true ? resolveMergedOptions(i) : i.type, "$options"), - $forceUpdate: /* @__PURE__ */ __name((i) => i.f || (i.f = () => { - i.effect.dirty = true; - queueJob(i.update); - }), "$forceUpdate"), - $nextTick: /* @__PURE__ */ __name((i) => i.n || (i.n = nextTick.bind(i.proxy)), "$nextTick"), - $watch: /* @__PURE__ */ __name((i) => true ? instanceWatch.bind(i) : NOOP, "$watch") - }) -); -const isReservedPrefix = /* @__PURE__ */ __name((key) => key === "_" || key === "$", "isReservedPrefix"); -const hasSetupBinding = /* @__PURE__ */ __name((state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn$3(state, key), "hasSetupBinding"); -const PublicInstanceProxyHandlers = { - get({ _: instance }, key) { - if (key === "__v_skip") { - return true; - } - const { ctx, setupState, data: data23, props, accessCache, type, appContext } = instance; - if (false) { - return true; - } - let normalizedProps; - if (key[0] !== "$") { - const n = accessCache[key]; - if (n !== void 0) { - switch (n) { - case 1: - return setupState[key]; - case 2: - return data23[key]; - case 4: - return ctx[key]; - case 3: - return props[key]; - } - } else if (hasSetupBinding(setupState, key)) { - accessCache[key] = 1; - return setupState[key]; - } else if (data23 !== EMPTY_OBJ && hasOwn$3(data23, key)) { - accessCache[key] = 2; - return data23[key]; - } else if ( - // only cache other properties when instance has declared (thus stable) - // props - (normalizedProps = instance.propsOptions[0]) && hasOwn$3(normalizedProps, key) - ) { - accessCache[key] = 3; - return props[key]; - } else if (ctx !== EMPTY_OBJ && hasOwn$3(ctx, key)) { - accessCache[key] = 4; - return ctx[key]; - } else if (shouldCacheAccess) { - accessCache[key] = 0; - } - } - const publicGetter = publicPropertiesMap[key]; - let cssModule, globalProperties; - if (publicGetter) { - if (key === "$attrs") { - track(instance.attrs, "get", ""); - } else if (false) { - track(instance, "get", key); - } - return publicGetter(instance); - } else if ( - // css module (injected by vue-loader) - (cssModule = type.__cssModules) && (cssModule = cssModule[key]) - ) { - return cssModule; - } else if (ctx !== EMPTY_OBJ && hasOwn$3(ctx, key)) { - accessCache[key] = 4; - return ctx[key]; - } else if ( - // global properties - globalProperties = appContext.config.globalProperties, hasOwn$3(globalProperties, key) - ) { - { - return globalProperties[key]; - } - } else if (false) { - if (data23 !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn$3(data23, key)) { - warn$1$1( - `Property ${JSON.stringify( - key - )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.` - ); - } else if (instance === currentRenderingInstance) { - warn$1$1( - `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.` - ); - } - } - }, - set({ _: instance }, key, value3) { - const { data: data23, setupState, ctx } = instance; - if (hasSetupBinding(setupState, key)) { - setupState[key] = value3; - return true; - } else if (false) { - warn$1$1(`Cannot mutate \n\n\n","\n\n\n\n\n","import { onMounted, ref } from 'vue'\n\nexport function useDownload(url: string, fileName?: string) {\n const fileSize = ref(null)\n\n const fetchFileSize = async (): Promise => {\n try {\n const response = await fetch(url, { method: 'HEAD' })\n if (!response.ok) throw new Error('Failed to fetch file size')\n\n const size = response.headers.get('content-length')\n if (size) {\n return parseInt(size)\n } else {\n console.error('\"content-length\" header not found')\n return null\n }\n } catch (e) {\n console.error('Error fetching file size:', e)\n return null\n }\n }\n\n /**\n * Trigger browser download\n */\n const triggerBrowserDownload = () => {\n const link = document.createElement('a')\n link.href = url\n link.download = fileName || url.split('/').pop() || 'download'\n link.target = '_blank' // Opens in new tab if download attribute is not supported\n link.rel = 'noopener noreferrer' // Security best practice for _blank links\n link.click()\n }\n\n onMounted(async () => {\n fileSize.value = await fetchFileSize()\n })\n\n return {\n triggerBrowserDownload,\n fileSize\n }\n}\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-progressbar {\\n position: relative;\\n overflow: hidden;\\n height: \".concat(dt('progressbar.height'), \";\\n background: \").concat(dt('progressbar.background'), \";\\n border-radius: \").concat(dt('progressbar.border.radius'), \";\\n}\\n\\n.p-progressbar-value {\\n margin: 0;\\n background: \").concat(dt('progressbar.value.background'), \";\\n}\\n\\n.p-progressbar-label {\\n color: \").concat(dt('progressbar.label.color'), \";\\n font-size: \").concat(dt('progressbar.label.font.size'), \";\\n font-weight: \").concat(dt('progressbar.label.font.weight'), \";\\n}\\n\\n.p-progressbar-determinate .p-progressbar-value {\\n height: 100%;\\n width: 0%;\\n position: absolute;\\n display: none;\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n overflow: hidden;\\n transition: width 1s ease-in-out;\\n}\\n\\n.p-progressbar-determinate .p-progressbar-label {\\n display: inline-flex;\\n}\\n\\n.p-progressbar-indeterminate .p-progressbar-value::before {\\n content: \\\"\\\";\\n position: absolute;\\n background: inherit;\\n top: 0;\\n left: 0;\\n bottom: 0;\\n will-change: left, right;\\n animation: p-progressbar-indeterminate-anim 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;\\n}\\n\\n.p-progressbar-indeterminate .p-progressbar-value::after {\\n content: \\\"\\\";\\n position: absolute;\\n background: inherit;\\n top: 0;\\n left: 0;\\n bottom: 0;\\n will-change: left, right;\\n animation: p-progressbar-indeterminate-anim-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;\\n animation-delay: 1.15s;\\n}\\n\\n@-webkit-keyframes p-progressbar-indeterminate-anim {\\n 0% {\\n left: -35%;\\n right: 100%;\\n }\\n 60% {\\n left: 100%;\\n right: -90%;\\n }\\n 100% {\\n left: 100%;\\n right: -90%;\\n }\\n}\\n@keyframes p-progressbar-indeterminate-anim {\\n 0% {\\n left: -35%;\\n right: 100%;\\n }\\n 60% {\\n left: 100%;\\n right: -90%;\\n }\\n 100% {\\n left: 100%;\\n right: -90%;\\n }\\n}\\n@-webkit-keyframes p-progressbar-indeterminate-anim-short {\\n 0% {\\n left: -200%;\\n right: 100%;\\n }\\n 60% {\\n left: 107%;\\n right: -8%;\\n }\\n 100% {\\n left: 107%;\\n right: -8%;\\n }\\n}\\n@keyframes p-progressbar-indeterminate-anim-short {\\n 0% {\\n left: -200%;\\n right: 100%;\\n }\\n 60% {\\n left: 107%;\\n right: -8%;\\n }\\n 100% {\\n left: 107%;\\n right: -8%;\\n }\\n}\\n\");\n};\nvar classes = {\n root: function root(_ref2) {\n var instance = _ref2.instance;\n return ['p-progressbar p-component', {\n 'p-progressbar-determinate': instance.determinate,\n 'p-progressbar-indeterminate': instance.indeterminate\n }];\n },\n value: 'p-progressbar-value',\n label: 'p-progressbar-label'\n};\nvar ProgressBarStyle = BaseStyle.extend({\n name: 'progressbar',\n theme: theme,\n classes: classes\n});\n\nexport { ProgressBarStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseComponent from '@primevue/core/basecomponent';\nimport ProgressBarStyle from 'primevue/progressbar/style';\nimport { openBlock, createElementBlock, mergeProps, renderSlot, createTextVNode, toDisplayString, createCommentVNode } from 'vue';\n\nvar script$1 = {\n name: 'BaseProgressBar',\n \"extends\": BaseComponent,\n props: {\n value: {\n type: Number,\n \"default\": null\n },\n mode: {\n type: String,\n \"default\": 'determinate'\n },\n showValue: {\n type: Boolean,\n \"default\": true\n }\n },\n style: ProgressBarStyle,\n provide: function provide() {\n return {\n $pcProgressBar: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'ProgressBar',\n \"extends\": script$1,\n inheritAttrs: false,\n computed: {\n progressStyle: function progressStyle() {\n return {\n width: this.value + '%',\n display: 'flex'\n };\n },\n indeterminate: function indeterminate() {\n return this.mode === 'indeterminate';\n },\n determinate: function determinate() {\n return this.mode === 'determinate';\n }\n }\n};\n\nvar _hoisted_1 = [\"aria-valuenow\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", mergeProps({\n role: \"progressbar\",\n \"class\": _ctx.cx('root'),\n \"aria-valuemin\": \"0\",\n \"aria-valuenow\": _ctx.value,\n \"aria-valuemax\": \"100\"\n }, _ctx.ptmi('root')), [$options.determinate ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('value'),\n style: $options.progressStyle\n }, _ctx.ptm('value')), [_ctx.value != null && _ctx.value !== 0 && _ctx.showValue ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('label')\n }, _ctx.ptm('label')), [renderSlot(_ctx.$slots, \"default\", {}, function () {\n return [createTextVNode(toDisplayString(_ctx.value + '%'), 1)];\n })], 16)) : createCommentVNode(\"\", true)], 16)) : $options.indeterminate ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 1,\n \"class\": _ctx.cx('value')\n }, _ctx.ptm('value')), null, 16)) : createCommentVNode(\"\", true)], 16, _hoisted_1);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","export function formatCamelCase(str: string): string {\n // Check if the string is camel case\n const isCamelCase = /^([A-Z][a-z]*)+$/.test(str)\n\n if (!isCamelCase) {\n return str // Return original string if not camel case\n }\n\n // Split the string into words, keeping acronyms together\n const words = str.split(/(?=[A-Z][a-z])|\\d+/)\n\n // Process each word\n const processedWords = words.map((word) => {\n // If the word is all uppercase and longer than one character, it's likely an acronym\n if (word.length > 1 && word === word.toUpperCase()) {\n return word // Keep acronyms as is\n }\n // For other words, ensure the first letter is capitalized\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n\n // Join the words with spaces\n return processedWords.join(' ')\n}\n\nexport function appendJsonExt(path: string) {\n if (!path.toLowerCase().endsWith('.json')) {\n path += '.json'\n }\n return path\n}\n\nexport function trimJsonExt(path?: string) {\n return path?.replace(/\\.json$/, '')\n}\n\nexport function highlightQuery(text: string, query: string) {\n if (!query) return text\n const regex = new RegExp(`(${query})`, 'gi')\n return text.replace(regex, '$1')\n}\n\nexport function formatNumberWithSuffix(\n num: number,\n {\n precision = 1,\n roundToInt = false\n }: { precision?: number; roundToInt?: boolean } = {}\n): string {\n const suffixes = ['', 'k', 'm', 'b', 't']\n const absNum = Math.abs(num)\n\n if (absNum < 1000) {\n return roundToInt ? Math.round(num).toString() : num.toFixed(precision)\n }\n\n const exp = Math.min(Math.floor(Math.log10(absNum) / 3), suffixes.length - 1)\n const formattedNum = (num / Math.pow(1000, exp)).toFixed(precision)\n\n return `${formattedNum}${suffixes[exp]}`\n}\n\nexport function formatSize(value?: number) {\n if (value === null || value === undefined) {\n return '-'\n }\n\n const bytes = value\n if (bytes === 0) return '0 B'\n const k = 1024\n const sizes = ['B', 'KB', 'MB', 'GB']\n const i = Math.floor(Math.log(bytes) / Math.log(k))\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`\n}\n\n/**\n * Finds the common directory prefix between two paths\n * @example\n * findCommonPrefix('a/b/c', 'a/b/d') // returns 'a/b'\n * findCommonPrefix('x/y/z', 'a/b/c') // returns ''\n * findCommonPrefix('a/b/c', 'a/b/c/d') // returns 'a/b/c'\n */\nexport function findCommonPrefix(path1: string, path2: string): string {\n const parts1 = path1.split('/')\n const parts2 = path2.split('/')\n\n const commonParts: string[] = []\n for (let i = 0; i < Math.min(parts1.length, parts2.length); i++) {\n if (parts1[i] === parts2[i]) {\n commonParts.push(parts1[i])\n } else {\n break\n }\n }\n return commonParts.join('/')\n}\n\n/**\n * Returns various filename components.\n * Example:\n * - fullFilename: 'file.txt'\n * - filename: 'file'\n * - suffix: 'txt'\n */\nexport function getFilenameDetails(fullFilename: string) {\n if (fullFilename.includes('.')) {\n return {\n filename: fullFilename.split('.').slice(0, -1).join('.'),\n suffix: fullFilename.split('.').pop() ?? null\n }\n } else {\n return { filename: fullFilename, suffix: null }\n }\n}\n\n/**\n * Returns various path components.\n * Example:\n * - path: 'dir/file.txt'\n * - directory: 'dir'\n * - fullFilename: 'file.txt'\n * - filename: 'file'\n * - suffix: 'txt'\n */\nexport function getPathDetails(path: string) {\n const directory = path.split('/').slice(0, -1).join('/')\n const fullFilename = path.split('/').pop() ?? path\n return { directory, fullFilename, ...getFilenameDetails(fullFilename) }\n}\n\n/**\n * Normalizes a string to be used as an i18n key.\n * Replaces dots with underscores.\n */\nexport function normalizeI18nKey(key: string) {\n return key.replace(/\\./g, '_')\n}\n","import { ElectronAPI } from '@comfyorg/comfyui-electron-types'\n\nexport function isElectron() {\n return 'electronAPI' in window && window['electronAPI'] !== undefined\n}\n\nexport function electronAPI() {\n return (window as any)['electronAPI'] as ElectronAPI\n}\n\ntype NativeContextOptions = Parameters[0]\nexport function showNativeMenu(options?: NativeContextOptions) {\n electronAPI()?.showContextMenu(options)\n}\n","const IPC_CHANNELS = {\n LOADING_PROGRESS: \"loading-progress\",\n IS_PACKAGED: \"is-packaged\",\n RENDERER_READY: \"renderer-ready\",\n RESTART_APP: \"restart-app\",\n REINSTALL: \"reinstall\",\n LOG_MESSAGE: \"log-message\",\n OPEN_DIALOG: \"open-dialog\",\n DOWNLOAD_PROGRESS: \"download-progress\",\n START_DOWNLOAD: \"start-download\",\n PAUSE_DOWNLOAD: \"pause-download\",\n RESUME_DOWNLOAD: \"resume-download\",\n CANCEL_DOWNLOAD: \"cancel-download\",\n DELETE_MODEL: \"delete-model\",\n GET_ALL_DOWNLOADS: \"get-all-downloads\",\n GET_ELECTRON_VERSION: \"get-electron-version\",\n SEND_ERROR_TO_SENTRY: \"send-error-to-sentry\",\n GET_BASE_PATH: \"get-base-path\",\n GET_MODEL_CONFIG_PATH: \"get-model-config-path\",\n OPEN_PATH: \"open-path\",\n OPEN_LOGS_PATH: \"open-logs-path\",\n OPEN_DEV_TOOLS: \"open-dev-tools\",\n TERMINAL_WRITE: \"execute-terminal-command\",\n TERMINAL_RESIZE: \"resize-terminal\",\n TERMINAL_RESTORE: \"restore-terminal\",\n TERMINAL_ON_OUTPUT: \"terminal-output\",\n IS_FIRST_TIME_SETUP: \"is-first-time-setup\",\n GET_SYSTEM_PATHS: \"get-system-paths\",\n VALIDATE_INSTALL_PATH: \"validate-install-path\",\n VALIDATE_COMFYUI_SOURCE: \"validate-comfyui-source\",\n SHOW_DIRECTORY_PICKER: \"show-directory-picker\",\n INSTALL_COMFYUI: \"install-comfyui\",\n SHOW_CONTEXT_MENU: \"show-context-menu\"\n};\nvar ProgressStatus = /* @__PURE__ */ ((ProgressStatus2) => {\n ProgressStatus2[\"INITIAL_STATE\"] = \"initial-state\";\n ProgressStatus2[\"PYTHON_SETUP\"] = \"python-setup\";\n ProgressStatus2[\"STARTING_SERVER\"] = \"starting-server\";\n ProgressStatus2[\"READY\"] = \"ready\";\n ProgressStatus2[\"ERROR\"] = \"error\";\n return ProgressStatus2;\n})(ProgressStatus || {});\nconst ProgressMessages = {\n [\n \"initial-state\"\n /* INITIAL_STATE */\n ]: \"Loading...\",\n [\n \"python-setup\"\n /* PYTHON_SETUP */\n ]: \"Setting up Python Environment...\",\n [\n \"starting-server\"\n /* STARTING_SERVER */\n ]: \"Starting ComfyUI server...\",\n [\n \"ready\"\n /* READY */\n ]: \"Finishing...\",\n [\n \"error\"\n /* ERROR */\n ]: \"Was not able to start ComfyUI. Please check the logs for more details. You can open it from the Help menu. Please report issues to: https://forum.comfy.org\"\n};\nconst ELECTRON_BRIDGE_API = \"electronAPI\";\nconst SENTRY_URL_ENDPOINT = \"https://942cadba58d247c9cab96f45221aa813@o4507954455314432.ingest.us.sentry.io/4508007940685824\";\nconst MigrationItems = [\n {\n id: \"user_files\",\n label: \"User Files\",\n description: \"Settings and user-created workflows\"\n },\n {\n id: \"models\",\n label: \"Models\",\n description: \"Reference model files from existing ComfyUI installations. (No copy)\"\n }\n // TODO: Decide whether we want to auto-migrate custom nodes, and install their dependencies.\n // huchenlei: This is a very essential thing for migration experience.\n // {\n // id: 'custom_nodes',\n // label: 'Custom Nodes',\n // description: 'Reference custom node files from existing ComfyUI installations. (No copy)',\n // },\n];\nconst DEFAULT_SERVER_ARGS = {\n /** The host to use for the ComfyUI server. */\n host: \"127.0.0.1\",\n /** The port to use for the ComfyUI server. */\n port: 8e3,\n // Extra arguments to pass to the ComfyUI server.\n extraServerArgs: {}\n};\nvar DownloadStatus = /* @__PURE__ */ ((DownloadStatus2) => {\n DownloadStatus2[\"PENDING\"] = \"pending\";\n DownloadStatus2[\"IN_PROGRESS\"] = \"in_progress\";\n DownloadStatus2[\"COMPLETED\"] = \"completed\";\n DownloadStatus2[\"PAUSED\"] = \"paused\";\n DownloadStatus2[\"ERROR\"] = \"error\";\n DownloadStatus2[\"CANCELLED\"] = \"cancelled\";\n return DownloadStatus2;\n})(DownloadStatus || {});\nexport {\n DEFAULT_SERVER_ARGS,\n DownloadStatus,\n ELECTRON_BRIDGE_API,\n IPC_CHANNELS,\n MigrationItems,\n ProgressMessages,\n ProgressStatus,\n SENTRY_URL_ENDPOINT\n};\n","import { computed, ref } from 'vue'\nimport { defineStore } from 'pinia'\nimport { isElectron, electronAPI } from '@/utils/envUtil'\nimport {\n type DownloadState,\n DownloadStatus\n} from '@comfyorg/comfyui-electron-types'\n\nexport interface ElectronDownload\n extends Pick {\n progress?: number\n savePath?: string\n status?: DownloadStatus\n}\n\n/** Electron donwloads store handler */\nexport const useElectronDownloadStore = defineStore('downloads', () => {\n const downloads = ref([])\n const { DownloadManager } = electronAPI()\n\n const findByUrl = (url: string) =>\n downloads.value.find((download) => url === download.url)\n\n const initialize = async () => {\n if (isElectron()) {\n const allDownloads = await DownloadManager.getAllDownloads()\n\n for (const download of allDownloads) {\n downloads.value.push(download)\n }\n\n // ToDO: replace with ElectronDownload type\n DownloadManager.onDownloadProgress((data) => {\n if (!findByUrl(data.url)) {\n downloads.value.push(data)\n }\n\n const download = findByUrl(data.url)\n\n if (download) {\n download.progress = data.progress\n download.status = data.status\n download.filename = data.filename\n download.savePath = data.savePath\n }\n })\n }\n }\n\n void initialize()\n\n const start = ({\n url,\n savePath,\n filename\n }: {\n url: string\n savePath: string\n filename: string\n }) => DownloadManager.startDownload(url, savePath, filename)\n const pause = (url: string) => DownloadManager.pauseDownload(url)\n const resume = (url: string) => DownloadManager.resumeDownload(url)\n const cancel = (url: string) => DownloadManager.cancelDownload(url)\n\n return {\n downloads,\n start,\n pause,\n resume,\n cancel,\n findByUrl,\n initialize,\n inProgressDownloads: computed(() =>\n downloads.value.filter(\n ({ status }) => status !== DownloadStatus.COMPLETED\n )\n )\n }\n})\n","\n\n\n\n","\n\n\n\n","\n\n\n\n\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-tabs {\\n display: flex;\\n flex-direction: column;\\n}\\n\\n.p-tablist {\\n display: flex;\\n position: relative;\\n}\\n\\n.p-tabs-scrollable > .p-tablist {\\n overflow: hidden;\\n}\\n\\n.p-tablist-viewport {\\n overflow-x: auto;\\n overflow-y: hidden;\\n scroll-behavior: smooth;\\n scrollbar-width: none;\\n overscroll-behavior: contain auto;\\n}\\n\\n.p-tablist-viewport::-webkit-scrollbar {\\n display: none;\\n}\\n\\n.p-tablist-tab-list {\\n position: relative;\\n display: flex;\\n background: \".concat(dt('tabs.tablist.background'), \";\\n border-style: solid;\\n border-color: \").concat(dt('tabs.tablist.border.color'), \";\\n border-width: \").concat(dt('tabs.tablist.border.width'), \";\\n}\\n\\n.p-tablist-content {\\n flex-grow: 1;\\n}\\n\\n.p-tablist-nav-button {\\n all: unset;\\n position: absolute !important;\\n flex-shrink: 0;\\n top: 0;\\n z-index: 2;\\n height: 100%;\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n background: \").concat(dt('tabs.nav.button.background'), \";\\n color: \").concat(dt('tabs.nav.button.color'), \";\\n width: \").concat(dt('tabs.nav.button.width'), \";\\n transition: color \").concat(dt('tabs.transition.duration'), \", outline-color \").concat(dt('tabs.transition.duration'), \", box-shadow \").concat(dt('tabs.transition.duration'), \";\\n box-shadow: \").concat(dt('tabs.nav.button.shadow'), \";\\n outline-color: transparent;\\n cursor: pointer;\\n}\\n\\n.p-tablist-nav-button:focus-visible {\\n z-index: 1;\\n box-shadow: \").concat(dt('tabs.nav.button.focus.ring.shadow'), \";\\n outline: \").concat(dt('tabs.nav.button.focus.ring.width'), \" \").concat(dt('tabs.nav.button.focus.ring.style'), \" \").concat(dt('tabs.nav.button.focus.ring.color'), \";\\n outline-offset: \").concat(dt('tabs.nav.button.focus.ring.offset'), \";\\n}\\n\\n.p-tablist-nav-button:hover {\\n color: \").concat(dt('tabs.nav.button.hover.color'), \";\\n}\\n\\n.p-tablist-prev-button {\\n left: 0;\\n}\\n\\n.p-tablist-next-button {\\n right: 0;\\n}\\n\\n.p-tab {\\n flex-shrink: 0;\\n cursor: pointer;\\n user-select: none;\\n position: relative;\\n border-style: solid;\\n white-space: nowrap;\\n background: \").concat(dt('tabs.tab.background'), \";\\n border-width: \").concat(dt('tabs.tab.border.width'), \";\\n border-color: \").concat(dt('tabs.tab.border.color'), \";\\n color: \").concat(dt('tabs.tab.color'), \";\\n padding: \").concat(dt('tabs.tab.padding'), \";\\n font-weight: \").concat(dt('tabs.tab.font.weight'), \";\\n transition: background \").concat(dt('tabs.transition.duration'), \", border-color \").concat(dt('tabs.transition.duration'), \", color \").concat(dt('tabs.transition.duration'), \", outline-color \").concat(dt('tabs.transition.duration'), \", box-shadow \").concat(dt('tabs.transition.duration'), \";\\n margin: \").concat(dt('tabs.tab.margin'), \";\\n outline-color: transparent;\\n}\\n\\n.p-tab:not(.p-disabled):focus-visible {\\n z-index: 1;\\n box-shadow: \").concat(dt('tabs.tab.focus.ring.shadow'), \";\\n outline: \").concat(dt('tabs.tab.focus.ring.width'), \" \").concat(dt('tabs.tab.focus.ring.style'), \" \").concat(dt('tabs.tab.focus.ring.color'), \";\\n outline-offset: \").concat(dt('tabs.tab.focus.ring.offset'), \";\\n}\\n\\n.p-tab:not(.p-tab-active):not(.p-disabled):hover {\\n background: \").concat(dt('tabs.tab.hover.background'), \";\\n border-color: \").concat(dt('tabs.tab.hover.border.color'), \";\\n color: \").concat(dt('tabs.tab.hover.color'), \";\\n}\\n\\n.p-tab-active {\\n background: \").concat(dt('tabs.tab.active.background'), \";\\n border-color: \").concat(dt('tabs.tab.active.border.color'), \";\\n color: \").concat(dt('tabs.tab.active.color'), \";\\n}\\n\\n.p-tabpanels {\\n background: \").concat(dt('tabs.tabpanel.background'), \";\\n color: \").concat(dt('tabs.tabpanel.color'), \";\\n padding: \").concat(dt('tabs.tabpanel.padding'), \";\\n outline: 0 none;\\n}\\n\\n.p-tabpanel:focus-visible {\\n box-shadow: \").concat(dt('tabs.tabpanel.focus.ring.shadow'), \";\\n outline: \").concat(dt('tabs.tabpanel.focus.ring.width'), \" \").concat(dt('tabs.tabpanel.focus.ring.style'), \" \").concat(dt('tabs.tabpanel.focus.ring.color'), \";\\n outline-offset: \").concat(dt('tabs.tabpanel.focus.ring.offset'), \";\\n}\\n\\n.p-tablist-active-bar {\\n z-index: 1;\\n display: block;\\n position: absolute;\\n bottom: \").concat(dt('tabs.active.bar.bottom'), \";\\n height: \").concat(dt('tabs.active.bar.height'), \";\\n background: \").concat(dt('tabs.active.bar.background'), \";\\n transition: 250ms cubic-bezier(0.35, 0, 0.25, 1);\\n}\\n\");\n};\nvar classes = {\n root: function root(_ref2) {\n var props = _ref2.props;\n return ['p-tabs p-component', {\n 'p-tabs-scrollable': props.scrollable\n }];\n }\n};\nvar TabsStyle = BaseStyle.extend({\n name: 'tabs',\n theme: theme,\n classes: classes\n});\n\nexport { TabsStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { UniqueComponentId } from '@primevue/core/utils';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport TabsStyle from 'primevue/tabs/style';\nimport { openBlock, createElementBlock, mergeProps, renderSlot } from 'vue';\n\nvar script$1 = {\n name: 'BaseTabs',\n \"extends\": BaseComponent,\n props: {\n value: {\n type: [String, Number],\n \"default\": undefined\n },\n lazy: {\n type: Boolean,\n \"default\": false\n },\n scrollable: {\n type: Boolean,\n \"default\": false\n },\n showNavigators: {\n type: Boolean,\n \"default\": true\n },\n tabindex: {\n type: Number,\n \"default\": 0\n },\n selectOnFocus: {\n type: Boolean,\n \"default\": false\n }\n },\n style: TabsStyle,\n provide: function provide() {\n return {\n $pcTabs: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'Tabs',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['update:value'],\n data: function data() {\n return {\n id: this.$attrs.id,\n d_value: this.value\n };\n },\n watch: {\n '$attrs.id': function $attrsId(newValue) {\n this.id = newValue || UniqueComponentId();\n },\n value: function value(newValue) {\n this.d_value = newValue;\n }\n },\n mounted: function mounted() {\n this.id = this.id || UniqueComponentId();\n },\n methods: {\n updateValue: function updateValue(newValue) {\n if (this.d_value !== newValue) {\n this.d_value = newValue;\n this.$emit('update:value', newValue);\n }\n },\n isVertical: function isVertical() {\n return this.orientation === 'vertical';\n }\n }\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root')), [renderSlot(_ctx.$slots, \"default\")], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar classes = {\n root: 'p-tabpanels'\n};\nvar TabPanelsStyle = BaseStyle.extend({\n name: 'tabpanels',\n classes: classes\n});\n\nexport { TabPanelsStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseComponent from '@primevue/core/basecomponent';\nimport TabPanelsStyle from 'primevue/tabpanels/style';\nimport { openBlock, createElementBlock, mergeProps, renderSlot } from 'vue';\n\nvar script$1 = {\n name: 'BaseTabPanels',\n \"extends\": BaseComponent,\n props: {},\n style: TabPanelsStyle,\n provide: function provide() {\n return {\n $pcTabPanels: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'TabPanels',\n \"extends\": script$1,\n inheritAttrs: false\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root'),\n role: \"presentation\"\n }, _ctx.ptmi('root')), [renderSlot(_ctx.$slots, \"default\")], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-divider-horizontal {\\n display: flex;\\n width: 100%;\\n position: relative;\\n align-items: center;\\n margin: \".concat(dt('divider.horizontal.margin'), \";\\n padding: \").concat(dt('divider.horizontal.padding'), \";\\n}\\n\\n.p-divider-horizontal:before {\\n position: absolute;\\n display: block;\\n top: 50%;\\n left: 0;\\n width: 100%;\\n content: \\\"\\\";\\n border-top: 1px solid \").concat(dt('divider.border.color'), \";\\n}\\n\\n.p-divider-horizontal .p-divider-content {\\n padding: \").concat(dt('divider.horizontal.content.padding'), \";\\n}\\n\\n.p-divider-vertical {\\n min-height: 100%;\\n margin: 0 1rem;\\n display: flex;\\n position: relative;\\n justify-content: center;\\n margin: \").concat(dt('divider.vertical.margin'), \";\\n padding: \").concat(dt('divider.vertical.padding'), \";\\n}\\n\\n.p-divider-vertical:before {\\n position: absolute;\\n display: block;\\n top: 0;\\n left: 50%;\\n height: 100%;\\n content: \\\"\\\";\\n border-left: 1px solid \").concat(dt('divider.border.color'), \";\\n}\\n\\n.p-divider.p-divider-vertical .p-divider-content {\\n padding: \").concat(dt('divider.vertical.content.padding'), \";\\n}\\n\\n.p-divider-content {\\n z-index: 1;\\n background: \").concat(dt('divider.content.background'), \";\\n color: \").concat(dt('divider.content.color'), \";\\n}\\n\\n.p-divider-solid.p-divider-horizontal:before {\\n border-top-style: solid;\\n}\\n\\n.p-divider-solid.p-divider-vertical:before {\\n border-left-style: solid;\\n}\\n\\n.p-divider-dashed.p-divider-horizontal:before {\\n border-top-style: dashed;\\n}\\n\\n.p-divider-dashed.p-divider-vertical:before {\\n border-left-style: dashed;\\n}\\n\\n.p-divider-dotted.p-divider-horizontal:before {\\n border-top-style: dotted;\\n}\\n\\n.p-divider-dotted.p-divider-vertical:before {\\n border-left-style: dotted;\\n}\\n\");\n};\n\n/* Position */\nvar inlineStyles = {\n root: function root(_ref2) {\n var props = _ref2.props;\n return {\n justifyContent: props.layout === 'horizontal' ? props.align === 'center' || props.align === null ? 'center' : props.align === 'left' ? 'flex-start' : props.align === 'right' ? 'flex-end' : null : null,\n alignItems: props.layout === 'vertical' ? props.align === 'center' || props.align === null ? 'center' : props.align === 'top' ? 'flex-start' : props.align === 'bottom' ? 'flex-end' : null : null\n };\n }\n};\nvar classes = {\n root: function root(_ref3) {\n var props = _ref3.props;\n return ['p-divider p-component', 'p-divider-' + props.layout, 'p-divider-' + props.type, {\n 'p-divider-left': props.layout === 'horizontal' && (!props.align || props.align === 'left')\n }, {\n 'p-divider-center': props.layout === 'horizontal' && props.align === 'center'\n }, {\n 'p-divider-right': props.layout === 'horizontal' && props.align === 'right'\n }, {\n 'p-divider-top': props.layout === 'vertical' && props.align === 'top'\n }, {\n 'p-divider-center': props.layout === 'vertical' && (!props.align || props.align === 'center')\n }, {\n 'p-divider-bottom': props.layout === 'vertical' && props.align === 'bottom'\n }];\n },\n content: 'p-divider-content'\n};\nvar DividerStyle = BaseStyle.extend({\n name: 'divider',\n theme: theme,\n classes: classes,\n inlineStyles: inlineStyles\n});\n\nexport { DividerStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseComponent from '@primevue/core/basecomponent';\nimport DividerStyle from 'primevue/divider/style';\nimport { openBlock, createElementBlock, mergeProps, renderSlot, createCommentVNode } from 'vue';\n\nvar script$1 = {\n name: 'BaseDivider',\n \"extends\": BaseComponent,\n props: {\n align: {\n type: String,\n \"default\": null\n },\n layout: {\n type: String,\n \"default\": 'horizontal'\n },\n type: {\n type: String,\n \"default\": 'solid'\n }\n },\n style: DividerStyle,\n provide: function provide() {\n return {\n $pcDivider: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'Divider',\n \"extends\": script$1,\n inheritAttrs: false\n};\n\nvar _hoisted_1 = [\"aria-orientation\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root'),\n style: _ctx.sx('root'),\n role: \"separator\",\n \"aria-orientation\": _ctx.layout\n }, _ctx.ptmi('root')), [_ctx.$slots[\"default\"] ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('content')\n }, _ctx.ptm('content')), [renderSlot(_ctx.$slots, \"default\")], 16)) : createCommentVNode(\"\", true)], 16, _hoisted_1);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-scrollpanel-content-container {\\n overflow: hidden;\\n width: 100%;\\n height: 100%;\\n position: relative;\\n z-index: 1;\\n float: left;\\n}\\n\\n.p-scrollpanel-content {\\n height: calc(100% + calc(2 * \".concat(dt('scrollpanel.bar.size'), \"));\\n width: calc(100% + calc(2 * \").concat(dt('scrollpanel.bar.size'), \"));\\n padding: 0 calc(2 * \").concat(dt('scrollpanel.bar.size'), \") calc(2 * \").concat(dt('scrollpanel.bar.size'), \") 0;\\n position: relative;\\n overflow: auto;\\n box-sizing: border-box;\\n scrollbar-width: none;\\n}\\n\\n.p-scrollpanel-content::-webkit-scrollbar {\\n display: none;\\n}\\n\\n.p-scrollpanel-bar {\\n position: relative;\\n border-radius: \").concat(dt('scrollpanel.bar.border.radius'), \";\\n z-index: 2;\\n cursor: pointer;\\n opacity: 0;\\n outline-color: transparent;\\n transition: outline-color \").concat(dt('scrollpanel.transition.duration'), \";\\n background: \").concat(dt('scrollpanel.bar.background'), \";\\n border: 0 none;\\n transition: outline-color \").concat(dt('scrollpanel.transition.duration'), \", opacity \").concat(dt('scrollpanel.transition.duration'), \";\\n}\\n\\n.p-scrollpanel-bar:focus-visible {\\n box-shadow: \").concat(dt('scrollpanel.bar.focus.ring.shadow'), \";\\n outline: \").concat(dt('scrollpanel.barfocus.ring.width'), \" \").concat(dt('scrollpanel.bar.focus.ring.style'), \" \").concat(dt('scrollpanel.bar.focus.ring.color'), \";\\n outline-offset: \").concat(dt('scrollpanel.barfocus.ring.offset'), \";\\n}\\n\\n.p-scrollpanel-bar-y {\\n width: \").concat(dt('scrollpanel.bar.size'), \";\\n top: 0;\\n}\\n\\n.p-scrollpanel-bar-x {\\n height: \").concat(dt('scrollpanel.bar.size'), \";\\n bottom: 0;\\n}\\n\\n.p-scrollpanel-hidden {\\n visibility: hidden;\\n}\\n\\n.p-scrollpanel:hover .p-scrollpanel-bar,\\n.p-scrollpanel:active .p-scrollpanel-bar {\\n opacity: 1;\\n}\\n\\n.p-scrollpanel-grabbed {\\n user-select: none;\\n}\\n\");\n};\nvar classes = {\n root: 'p-scrollpanel p-component',\n contentContainer: 'p-scrollpanel-content-container',\n content: 'p-scrollpanel-content',\n barX: 'p-scrollpanel-bar p-scrollpanel-bar-x',\n barY: 'p-scrollpanel-bar p-scrollpanel-bar-y'\n};\nvar ScrollPanelStyle = BaseStyle.extend({\n name: 'scrollpanel',\n theme: theme,\n classes: classes\n});\n\nexport { ScrollPanelStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { UniqueComponentId } from '@primevue/core/utils';\nimport { getHeight, addClass, removeClass } from '@primeuix/utils/dom';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport ScrollPanelStyle from 'primevue/scrollpanel/style';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode, renderSlot } from 'vue';\n\nvar script$1 = {\n name: 'BaseScrollPanel',\n \"extends\": BaseComponent,\n props: {\n step: {\n type: Number,\n \"default\": 5\n }\n },\n style: ScrollPanelStyle,\n provide: function provide() {\n return {\n $pcScrollPanel: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'ScrollPanel',\n \"extends\": script$1,\n inheritAttrs: false,\n initialized: false,\n documentResizeListener: null,\n documentMouseMoveListener: null,\n documentMouseUpListener: null,\n frame: null,\n scrollXRatio: null,\n scrollYRatio: null,\n isXBarClicked: false,\n isYBarClicked: false,\n lastPageX: null,\n lastPageY: null,\n timer: null,\n outsideClickListener: null,\n data: function data() {\n return {\n id: this.$attrs.id,\n orientation: 'vertical',\n lastScrollTop: 0,\n lastScrollLeft: 0\n };\n },\n watch: {\n '$attrs.id': function $attrsId(newValue) {\n this.id = newValue || UniqueComponentId();\n }\n },\n mounted: function mounted() {\n this.id = this.id || UniqueComponentId();\n if (this.$el.offsetParent) {\n this.initialize();\n }\n },\n updated: function updated() {\n if (!this.initialized && this.$el.offsetParent) {\n this.initialize();\n }\n },\n beforeUnmount: function beforeUnmount() {\n this.unbindDocumentResizeListener();\n if (this.frame) {\n window.cancelAnimationFrame(this.frame);\n }\n },\n methods: {\n initialize: function initialize() {\n this.moveBar();\n this.bindDocumentResizeListener();\n this.calculateContainerHeight();\n },\n calculateContainerHeight: function calculateContainerHeight() {\n var containerStyles = getComputedStyle(this.$el),\n xBarStyles = getComputedStyle(this.$refs.xBar),\n pureContainerHeight = getHeight(this.$el) - parseInt(xBarStyles['height'], 10);\n if (containerStyles['max-height'] !== 'none' && pureContainerHeight === 0) {\n if (this.$refs.content.offsetHeight + parseInt(xBarStyles['height'], 10) > parseInt(containerStyles['max-height'], 10)) {\n this.$el.style.height = containerStyles['max-height'];\n } else {\n this.$el.style.height = this.$refs.content.offsetHeight + parseFloat(containerStyles.paddingTop) + parseFloat(containerStyles.paddingBottom) + parseFloat(containerStyles.borderTopWidth) + parseFloat(containerStyles.borderBottomWidth) + 'px';\n }\n }\n },\n moveBar: function moveBar() {\n var _this = this;\n if (this.$refs.content) {\n /* horizontal scroll */\n var totalWidth = this.$refs.content.scrollWidth;\n var ownWidth = this.$refs.content.clientWidth;\n var bottom = (this.$el.clientHeight - this.$refs.xBar.clientHeight) * -1;\n this.scrollXRatio = ownWidth / totalWidth;\n\n /* vertical scroll */\n var totalHeight = this.$refs.content.scrollHeight;\n var ownHeight = this.$refs.content.clientHeight;\n var right = (this.$el.clientWidth - this.$refs.yBar.clientWidth) * -1;\n this.scrollYRatio = ownHeight / totalHeight;\n this.frame = this.requestAnimationFrame(function () {\n if (_this.$refs.xBar) {\n if (_this.scrollXRatio >= 1) {\n _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'true');\n !_this.isUnstyled && addClass(_this.$refs.xBar, 'p-scrollpanel-hidden');\n } else {\n _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'false');\n !_this.isUnstyled && removeClass(_this.$refs.xBar, 'p-scrollpanel-hidden');\n _this.$refs.xBar.style.cssText = 'width:' + Math.max(_this.scrollXRatio * 100, 10) + '%; left:' + _this.$refs.content.scrollLeft / totalWidth * 100 + '%;bottom:' + bottom + 'px;';\n }\n }\n if (_this.$refs.yBar) {\n if (_this.scrollYRatio >= 1) {\n _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'true');\n !_this.isUnstyled && addClass(_this.$refs.yBar, 'p-scrollpanel-hidden');\n } else {\n _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'false');\n !_this.isUnstyled && removeClass(_this.$refs.yBar, 'p-scrollpanel-hidden');\n _this.$refs.yBar.style.cssText = 'height:' + Math.max(_this.scrollYRatio * 100, 10) + '%; top: calc(' + _this.$refs.content.scrollTop / totalHeight * 100 + '% - ' + _this.$refs.xBar.clientHeight + 'px);right:' + right + 'px;';\n }\n }\n });\n }\n },\n onYBarMouseDown: function onYBarMouseDown(e) {\n this.isYBarClicked = true;\n this.$refs.yBar.focus();\n this.lastPageY = e.pageY;\n this.$refs.yBar.setAttribute('data-p-scrollpanel-grabbed', 'true');\n !this.isUnstyled && addClass(this.$refs.yBar, 'p-scrollpanel-grabbed');\n document.body.setAttribute('data-p-scrollpanel-grabbed', 'true');\n !this.isUnstyled && addClass(document.body, 'p-scrollpanel-grabbed');\n this.bindDocumentMouseListeners();\n e.preventDefault();\n },\n onXBarMouseDown: function onXBarMouseDown(e) {\n this.isXBarClicked = true;\n this.$refs.xBar.focus();\n this.lastPageX = e.pageX;\n this.$refs.yBar.setAttribute('data-p-scrollpanel-grabbed', 'false');\n !this.isUnstyled && addClass(this.$refs.xBar, 'p-scrollpanel-grabbed');\n document.body.setAttribute('data-p-scrollpanel-grabbed', 'false');\n !this.isUnstyled && addClass(document.body, 'p-scrollpanel-grabbed');\n this.bindDocumentMouseListeners();\n e.preventDefault();\n },\n onScroll: function onScroll(event) {\n if (this.lastScrollLeft !== event.target.scrollLeft) {\n this.lastScrollLeft = event.target.scrollLeft;\n this.orientation = 'horizontal';\n } else if (this.lastScrollTop !== event.target.scrollTop) {\n this.lastScrollTop = event.target.scrollTop;\n this.orientation = 'vertical';\n }\n this.moveBar();\n },\n onKeyDown: function onKeyDown(event) {\n if (this.orientation === 'vertical') {\n switch (event.code) {\n case 'ArrowDown':\n {\n this.setTimer('scrollTop', this.step);\n event.preventDefault();\n break;\n }\n case 'ArrowUp':\n {\n this.setTimer('scrollTop', this.step * -1);\n event.preventDefault();\n break;\n }\n case 'ArrowLeft':\n case 'ArrowRight':\n {\n event.preventDefault();\n break;\n }\n }\n } else if (this.orientation === 'horizontal') {\n switch (event.code) {\n case 'ArrowRight':\n {\n this.setTimer('scrollLeft', this.step);\n event.preventDefault();\n break;\n }\n case 'ArrowLeft':\n {\n this.setTimer('scrollLeft', this.step * -1);\n event.preventDefault();\n break;\n }\n case 'ArrowDown':\n case 'ArrowUp':\n {\n event.preventDefault();\n break;\n }\n }\n }\n },\n onKeyUp: function onKeyUp() {\n this.clearTimer();\n },\n repeat: function repeat(bar, step) {\n this.$refs.content[bar] += step;\n this.moveBar();\n },\n setTimer: function setTimer(bar, step) {\n var _this2 = this;\n this.clearTimer();\n this.timer = setTimeout(function () {\n _this2.repeat(bar, step);\n }, 40);\n },\n clearTimer: function clearTimer() {\n if (this.timer) {\n clearTimeout(this.timer);\n }\n },\n onDocumentMouseMove: function onDocumentMouseMove(e) {\n if (this.isXBarClicked) {\n this.onMouseMoveForXBar(e);\n } else if (this.isYBarClicked) {\n this.onMouseMoveForYBar(e);\n } else {\n this.onMouseMoveForXBar(e);\n this.onMouseMoveForYBar(e);\n }\n },\n onMouseMoveForXBar: function onMouseMoveForXBar(e) {\n var _this3 = this;\n var deltaX = e.pageX - this.lastPageX;\n this.lastPageX = e.pageX;\n this.frame = this.requestAnimationFrame(function () {\n _this3.$refs.content.scrollLeft += deltaX / _this3.scrollXRatio;\n });\n },\n onMouseMoveForYBar: function onMouseMoveForYBar(e) {\n var _this4 = this;\n var deltaY = e.pageY - this.lastPageY;\n this.lastPageY = e.pageY;\n this.frame = this.requestAnimationFrame(function () {\n _this4.$refs.content.scrollTop += deltaY / _this4.scrollYRatio;\n });\n },\n onFocus: function onFocus(event) {\n if (this.$refs.xBar.isSameNode(event.target)) {\n this.orientation = 'horizontal';\n } else if (this.$refs.yBar.isSameNode(event.target)) {\n this.orientation = 'vertical';\n }\n },\n onBlur: function onBlur() {\n if (this.orientation === 'horizontal') {\n this.orientation = 'vertical';\n }\n },\n onDocumentMouseUp: function onDocumentMouseUp() {\n this.$refs.yBar.setAttribute('data-p-scrollpanel-grabbed', 'false');\n !this.isUnstyled && removeClass(this.$refs.yBar, 'p-scrollpanel-grabbed');\n this.$refs.xBar.setAttribute('data-p-scrollpanel-grabbed', 'false');\n !this.isUnstyled && removeClass(this.$refs.xBar, 'p-scrollpanel-grabbed');\n document.body.setAttribute('data-p-scrollpanel-grabbed', 'false');\n !this.isUnstyled && removeClass(document.body, 'p-scrollpanel-grabbed');\n this.unbindDocumentMouseListeners();\n this.isXBarClicked = false;\n this.isYBarClicked = false;\n },\n requestAnimationFrame: function requestAnimationFrame(f) {\n var frame = window.requestAnimationFrame || this.timeoutFrame;\n return frame(f);\n },\n refresh: function refresh() {\n this.moveBar();\n },\n scrollTop: function scrollTop(_scrollTop) {\n var scrollableHeight = this.$refs.content.scrollHeight - this.$refs.content.clientHeight;\n _scrollTop = _scrollTop > scrollableHeight ? scrollableHeight : _scrollTop > 0 ? _scrollTop : 0;\n this.$refs.content.scrollTop = _scrollTop;\n },\n timeoutFrame: function timeoutFrame(fn) {\n setTimeout(fn, 0);\n },\n bindDocumentMouseListeners: function bindDocumentMouseListeners() {\n var _this5 = this;\n if (!this.documentMouseMoveListener) {\n this.documentMouseMoveListener = function (e) {\n _this5.onDocumentMouseMove(e);\n };\n document.addEventListener('mousemove', this.documentMouseMoveListener);\n }\n if (!this.documentMouseUpListener) {\n this.documentMouseUpListener = function (e) {\n _this5.onDocumentMouseUp(e);\n };\n document.addEventListener('mouseup', this.documentMouseUpListener);\n }\n },\n unbindDocumentMouseListeners: function unbindDocumentMouseListeners() {\n if (this.documentMouseMoveListener) {\n document.removeEventListener('mousemove', this.documentMouseMoveListener);\n this.documentMouseMoveListener = null;\n }\n if (this.documentMouseUpListener) {\n document.removeEventListener('mouseup', this.documentMouseUpListener);\n this.documentMouseUpListener = null;\n }\n },\n bindDocumentResizeListener: function bindDocumentResizeListener() {\n var _this6 = this;\n if (!this.documentResizeListener) {\n this.documentResizeListener = function () {\n _this6.moveBar();\n };\n window.addEventListener('resize', this.documentResizeListener);\n }\n },\n unbindDocumentResizeListener: function unbindDocumentResizeListener() {\n if (this.documentResizeListener) {\n window.removeEventListener('resize', this.documentResizeListener);\n this.documentResizeListener = null;\n }\n }\n },\n computed: {\n contentId: function contentId() {\n return this.id + '_content';\n }\n }\n};\n\nvar _hoisted_1 = [\"id\"];\nvar _hoisted_2 = [\"aria-controls\", \"aria-valuenow\"];\nvar _hoisted_3 = [\"aria-controls\", \"aria-valuenow\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root')), [createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('contentContainer')\n }, _ctx.ptm('contentContainer')), [createElementVNode(\"div\", mergeProps({\n ref: \"content\",\n id: $options.contentId,\n \"class\": _ctx.cx('content'),\n onScroll: _cache[0] || (_cache[0] = function () {\n return $options.onScroll && $options.onScroll.apply($options, arguments);\n }),\n onMouseenter: _cache[1] || (_cache[1] = function () {\n return $options.moveBar && $options.moveBar.apply($options, arguments);\n })\n }, _ctx.ptm('content')), [renderSlot(_ctx.$slots, \"default\")], 16, _hoisted_1)], 16), createElementVNode(\"div\", mergeProps({\n ref: \"xBar\",\n \"class\": _ctx.cx('barx'),\n tabindex: \"0\",\n role: \"scrollbar\",\n \"aria-orientation\": \"horizontal\",\n \"aria-controls\": $options.contentId,\n \"aria-valuenow\": $data.lastScrollLeft,\n onMousedown: _cache[2] || (_cache[2] = function () {\n return $options.onXBarMouseDown && $options.onXBarMouseDown.apply($options, arguments);\n }),\n onKeydown: _cache[3] || (_cache[3] = function ($event) {\n return $options.onKeyDown($event);\n }),\n onKeyup: _cache[4] || (_cache[4] = function () {\n return $options.onKeyUp && $options.onKeyUp.apply($options, arguments);\n }),\n onFocus: _cache[5] || (_cache[5] = function () {\n return $options.onFocus && $options.onFocus.apply($options, arguments);\n }),\n onBlur: _cache[6] || (_cache[6] = function () {\n return $options.onBlur && $options.onBlur.apply($options, arguments);\n })\n }, _ctx.ptm('barx'), {\n \"data-pc-group-section\": \"bar\"\n }), null, 16, _hoisted_2), createElementVNode(\"div\", mergeProps({\n ref: \"yBar\",\n \"class\": _ctx.cx('bary'),\n tabindex: \"0\",\n role: \"scrollbar\",\n \"aria-orientation\": \"vertical\",\n \"aria-controls\": $options.contentId,\n \"aria-valuenow\": $data.lastScrollTop,\n onMousedown: _cache[7] || (_cache[7] = function () {\n return $options.onYBarMouseDown && $options.onYBarMouseDown.apply($options, arguments);\n }),\n onKeydown: _cache[8] || (_cache[8] = function ($event) {\n return $options.onKeyDown($event);\n }),\n onKeyup: _cache[9] || (_cache[9] = function () {\n return $options.onKeyUp && $options.onKeyUp.apply($options, arguments);\n }),\n onFocus: _cache[10] || (_cache[10] = function () {\n return $options.onFocus && $options.onFocus.apply($options, arguments);\n })\n }, _ctx.ptm('bary'), {\n \"data-pc-group-section\": \"bar\"\n }), null, 16, _hoisted_3)], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseIcon from '@primevue/icons/baseicon';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode } from 'vue';\n\nvar script = {\n name: 'TimesCircleIcon',\n \"extends\": BaseIcon\n};\n\nvar _hoisted_1 = /*#__PURE__*/createElementVNode(\"path\", {\n \"fill-rule\": \"evenodd\",\n \"clip-rule\": \"evenodd\",\n d: \"M7 14C5.61553 14 4.26215 13.5895 3.11101 12.8203C1.95987 12.0511 1.06266 10.9579 0.532846 9.67879C0.00303296 8.3997 -0.13559 6.99224 0.134506 5.63437C0.404603 4.2765 1.07129 3.02922 2.05026 2.05026C3.02922 1.07129 4.2765 0.404603 5.63437 0.134506C6.99224 -0.13559 8.3997 0.00303296 9.67879 0.532846C10.9579 1.06266 12.0511 1.95987 12.8203 3.11101C13.5895 4.26215 14 5.61553 14 7C14 8.85652 13.2625 10.637 11.9497 11.9497C10.637 13.2625 8.85652 14 7 14ZM7 1.16667C5.84628 1.16667 4.71846 1.50879 3.75918 2.14976C2.79989 2.79074 2.05222 3.70178 1.61071 4.76768C1.16919 5.83358 1.05367 7.00647 1.27876 8.13803C1.50384 9.26958 2.05941 10.309 2.87521 11.1248C3.69102 11.9406 4.73042 12.4962 5.86198 12.7212C6.99353 12.9463 8.16642 12.8308 9.23232 12.3893C10.2982 11.9478 11.2093 11.2001 11.8502 10.2408C12.4912 9.28154 12.8333 8.15373 12.8333 7C12.8333 5.45291 12.2188 3.96918 11.1248 2.87521C10.0308 1.78125 8.5471 1.16667 7 1.16667ZM4.66662 9.91668C4.58998 9.91704 4.51404 9.90209 4.44325 9.87271C4.37246 9.84333 4.30826 9.8001 4.2544 9.74557C4.14516 9.6362 4.0838 9.48793 4.0838 9.33335C4.0838 9.17876 4.14516 9.0305 4.2544 8.92113L6.17553 7L4.25443 5.07891C4.15139 4.96832 4.09529 4.82207 4.09796 4.67094C4.10063 4.51982 4.16185 4.37563 4.26872 4.26876C4.3756 4.16188 4.51979 4.10066 4.67091 4.09799C4.82204 4.09532 4.96829 4.15142 5.07887 4.25446L6.99997 6.17556L8.92106 4.25446C9.03164 4.15142 9.1779 4.09532 9.32903 4.09799C9.48015 4.10066 9.62434 4.16188 9.73121 4.26876C9.83809 4.37563 9.89931 4.51982 9.90198 4.67094C9.90464 4.82207 9.84855 4.96832 9.74551 5.07891L7.82441 7L9.74554 8.92113C9.85478 9.0305 9.91614 9.17876 9.91614 9.33335C9.91614 9.48793 9.85478 9.6362 9.74554 9.74557C9.69168 9.8001 9.62748 9.84333 9.55669 9.87271C9.4859 9.90209 9.40996 9.91704 9.33332 9.91668C9.25668 9.91704 9.18073 9.90209 9.10995 9.87271C9.03916 9.84333 8.97495 9.8001 8.9211 9.74557L6.99997 7.82444L5.07884 9.74557C5.02499 9.8001 4.96078 9.84333 4.88999 9.87271C4.81921 9.90209 4.74326 9.91704 4.66662 9.91668Z\",\n fill: \"currentColor\"\n}, null, -1);\nvar _hoisted_2 = [_hoisted_1];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"svg\", mergeProps({\n width: \"14\",\n height: \"14\",\n viewBox: \"0 0 14 14\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, _ctx.pti()), _hoisted_2, 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-chip {\\n display: inline-flex;\\n align-items: center;\\n background: \".concat(dt('chip.background'), \";\\n color: \").concat(dt('chip.color'), \";\\n border-radius: \").concat(dt('chip.border.radius'), \";\\n padding: \").concat(dt('chip.padding.y'), \" \").concat(dt('chip.padding.x'), \";\\n gap: \").concat(dt('chip.gap'), \";\\n}\\n\\n.p-chip-icon {\\n color: \").concat(dt('chip.icon.color'), \";\\n font-size: \").concat(dt('chip.icon.font.size'), \";\\n width: \").concat(dt('chip.icon.size'), \";\\n height: \").concat(dt('chip.icon.size'), \";\\n}\\n\\n.p-chip-image {\\n border-radius: 50%;\\n width: \").concat(dt('chip.image.width'), \";\\n height: \").concat(dt('chip.image.height'), \";\\n margin-left: calc(-1 * \").concat(dt('chip.padding.y'), \");\\n}\\n\\n.p-chip:has(.p-chip-remove-icon) {\\n padding-right: \").concat(dt('chip.padding.y'), \";\\n}\\n\\n.p-chip:has(.p-chip-image) {\\n padding-top: calc(\").concat(dt('chip.padding.y'), \" / 2);\\n padding-bottom: calc(\").concat(dt('chip.padding.y'), \" / 2);\\n}\\n\\n.p-chip-remove-icon {\\n cursor: pointer;\\n font-size: \").concat(dt('chip.remove.icon.size'), \";\\n width: \").concat(dt('chip.remove.icon.size'), \";\\n height: \").concat(dt('chip.remove.icon.size'), \";\\n color: \").concat(dt('chip.remove.icon.color'), \";\\n border-radius: 50%;\\n transition: outline-color \").concat(dt('chip.transition.duration'), \", box-shadow \").concat(dt('chip.transition.duration'), \";\\n outline-color: transparent;\\n}\\n\\n.p-chip-remove-icon:focus-visible {\\n box-shadow: \").concat(dt('chip.remove.icon.focus.ring.shadow'), \";\\n outline: \").concat(dt('chip.remove.icon.focus.ring.width'), \" \").concat(dt('chip.remove.icon.focus.ring.style'), \" \").concat(dt('chip.remove.icon.focus.ring.color'), \";\\n outline-offset: \").concat(dt('chip.remove.icon.focus.ring.offset'), \";\\n}\\n\");\n};\nvar classes = {\n root: 'p-chip p-component',\n image: 'p-chip-image',\n icon: 'p-chip-icon',\n label: 'p-chip-label',\n removeIcon: 'p-chip-remove-icon'\n};\nvar ChipStyle = BaseStyle.extend({\n name: 'chip',\n theme: theme,\n classes: classes\n});\n\nexport { ChipStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import TimesCircleIcon from '@primevue/icons/timescircle';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport ChipStyle from 'primevue/chip/style';\nimport { openBlock, createElementBlock, mergeProps, renderSlot, createBlock, resolveDynamicComponent, createCommentVNode, toDisplayString } from 'vue';\n\nvar script$1 = {\n name: 'BaseChip',\n \"extends\": BaseComponent,\n props: {\n label: {\n type: String,\n \"default\": null\n },\n icon: {\n type: String,\n \"default\": null\n },\n image: {\n type: String,\n \"default\": null\n },\n removable: {\n type: Boolean,\n \"default\": false\n },\n removeIcon: {\n type: String,\n \"default\": undefined\n }\n },\n style: ChipStyle,\n provide: function provide() {\n return {\n $pcChip: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'Chip',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['remove'],\n data: function data() {\n return {\n visible: true\n };\n },\n methods: {\n onKeydown: function onKeydown(event) {\n if (event.key === 'Enter' || event.key === 'Backspace') {\n this.close(event);\n }\n },\n close: function close(event) {\n this.visible = false;\n this.$emit('remove', event);\n }\n },\n components: {\n TimesCircleIcon: TimesCircleIcon\n }\n};\n\nvar _hoisted_1 = [\"aria-label\"];\nvar _hoisted_2 = [\"src\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return $data.visible ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('root'),\n \"aria-label\": _ctx.label\n }, _ctx.ptmi('root')), [renderSlot(_ctx.$slots, \"default\", {}, function () {\n return [_ctx.image ? (openBlock(), createElementBlock(\"img\", mergeProps({\n key: 0,\n src: _ctx.image\n }, _ctx.ptm('image'), {\n \"class\": _ctx.cx('image')\n }), null, 16, _hoisted_2)) : _ctx.$slots.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.icon), mergeProps({\n key: 1,\n \"class\": _ctx.cx('icon')\n }, _ctx.ptm('icon')), null, 16, [\"class\"])) : _ctx.icon ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 2,\n \"class\": [_ctx.cx('icon'), _ctx.icon]\n }, _ctx.ptm('icon')), null, 16)) : createCommentVNode(\"\", true), _ctx.label ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 3,\n \"class\": _ctx.cx('label')\n }, _ctx.ptm('label')), toDisplayString(_ctx.label), 17)) : createCommentVNode(\"\", true)];\n }), _ctx.removable ? renderSlot(_ctx.$slots, \"removeicon\", {\n key: 0,\n removeCallback: $options.close,\n keydownCallback: $options.onKeydown\n }, function () {\n return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.removeIcon ? 'span' : 'TimesCircleIcon'), mergeProps({\n tabindex: \"0\",\n \"class\": [_ctx.cx('removeIcon'), _ctx.removeIcon],\n onClick: $options.close,\n onKeydown: $options.onKeydown\n }, _ctx.ptm('removeIcon')), null, 16, [\"class\", \"onClick\", \"onKeydown\"]))];\n }) : createCommentVNode(\"\", true)], 16, _hoisted_1)) : createCommentVNode(\"\", true);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n\n\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-tag {\\n display: inline-flex;\\n align-items: center;\\n justify-content: center;\\n background: \".concat(dt('tag.primary.background'), \";\\n color: \").concat(dt('tag.primary.color'), \";\\n font-size: \").concat(dt('tag.font.size'), \";\\n font-weight: \").concat(dt('tag.font.weight'), \";\\n padding: \").concat(dt('tag.padding'), \";\\n border-radius: \").concat(dt('tag.border.radius'), \";\\n gap: \").concat(dt('tag.gap'), \";\\n}\\n\\n.p-tag-icon {\\n font-size: \").concat(dt('tag.icon.size'), \";\\n width: \").concat(dt('tag.icon.size'), \";\\n height:\").concat(dt('tag.icon.size'), \";\\n}\\n\\n.p-tag-rounded {\\n border-radius: \").concat(dt('tag.rounded.border.radius'), \";\\n}\\n\\n.p-tag-success {\\n background: \").concat(dt('tag.success.background'), \";\\n color: \").concat(dt('tag.success.color'), \";\\n}\\n\\n.p-tag-info {\\n background: \").concat(dt('tag.info.background'), \";\\n color: \").concat(dt('tag.info.color'), \";\\n}\\n\\n.p-tag-warn {\\n background: \").concat(dt('tag.warn.background'), \";\\n color: \").concat(dt('tag.warn.color'), \";\\n}\\n\\n.p-tag-danger {\\n background: \").concat(dt('tag.danger.background'), \";\\n color: \").concat(dt('tag.danger.color'), \";\\n}\\n\\n.p-tag-secondary {\\n background: \").concat(dt('tag.secondary.background'), \";\\n color: \").concat(dt('tag.secondary.color'), \";\\n}\\n\\n.p-tag-contrast {\\n background: \").concat(dt('tag.contrast.background'), \";\\n color: \").concat(dt('tag.contrast.color'), \";\\n}\\n\");\n};\nvar classes = {\n root: function root(_ref2) {\n var props = _ref2.props;\n return ['p-tag p-component', {\n 'p-tag-info': props.severity === 'info',\n 'p-tag-success': props.severity === 'success',\n 'p-tag-warn': props.severity === 'warn',\n 'p-tag-danger': props.severity === 'danger',\n 'p-tag-secondary': props.severity === 'secondary',\n 'p-tag-contrast': props.severity === 'contrast',\n 'p-tag-rounded': props.rounded\n }];\n },\n icon: 'p-tag-icon',\n label: 'p-tag-label'\n};\nvar TagStyle = BaseStyle.extend({\n name: 'tag',\n theme: theme,\n classes: classes\n});\n\nexport { TagStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseComponent from '@primevue/core/basecomponent';\nimport TagStyle from 'primevue/tag/style';\nimport { openBlock, createElementBlock, mergeProps, createBlock, resolveDynamicComponent, createCommentVNode, renderSlot, createElementVNode, toDisplayString } from 'vue';\n\nvar script$1 = {\n name: 'BaseTag',\n \"extends\": BaseComponent,\n props: {\n value: null,\n severity: null,\n rounded: Boolean,\n icon: String\n },\n style: TagStyle,\n provide: function provide() {\n return {\n $pcTag: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'Tag',\n \"extends\": script$1,\n inheritAttrs: false\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps({\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root')), [_ctx.$slots.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.icon), mergeProps({\n key: 0,\n \"class\": _ctx.cx('icon')\n }, _ctx.ptm('icon')), null, 16, [\"class\"])) : _ctx.icon ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 1,\n \"class\": [_ctx.cx('icon'), _ctx.icon]\n }, _ctx.ptm('icon')), null, 16)) : createCommentVNode(\"\", true), _ctx.value != null || _ctx.$slots[\"default\"] ? renderSlot(_ctx.$slots, \"default\", {\n key: 2\n }, function () {\n return [createElementVNode(\"span\", mergeProps({\n \"class\": _ctx.cx('label')\n }, _ctx.ptm('label')), toDisplayString(_ctx.value), 17)];\n }) : createCommentVNode(\"\", true)], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseIcon from '@primevue/icons/baseicon';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode } from 'vue';\n\nvar script = {\n name: 'AngleDownIcon',\n \"extends\": BaseIcon\n};\n\nvar _hoisted_1 = /*#__PURE__*/createElementVNode(\"path\", {\n d: \"M3.58659 4.5007C3.68513 4.50023 3.78277 4.51945 3.87379 4.55723C3.9648 4.59501 4.04735 4.65058 4.11659 4.7207L7.11659 7.7207L10.1166 4.7207C10.2619 4.65055 10.4259 4.62911 10.5843 4.65956C10.7427 4.69002 10.8871 4.77074 10.996 4.88976C11.1049 5.00877 11.1726 5.15973 11.1889 5.32022C11.2052 5.48072 11.1693 5.6422 11.0866 5.7807L7.58659 9.2807C7.44597 9.42115 7.25534 9.50004 7.05659 9.50004C6.85784 9.50004 6.66722 9.42115 6.52659 9.2807L3.02659 5.7807C2.88614 5.64007 2.80725 5.44945 2.80725 5.2507C2.80725 5.05195 2.88614 4.86132 3.02659 4.7207C3.09932 4.64685 3.18675 4.58911 3.28322 4.55121C3.37969 4.51331 3.48305 4.4961 3.58659 4.5007Z\",\n fill: \"currentColor\"\n}, null, -1);\nvar _hoisted_2 = [_hoisted_1];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"svg\", mergeProps({\n width: \"14\",\n height: \"14\",\n viewBox: \"0 0 14 14\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, _ctx.pti()), _hoisted_2, 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseIcon from '@primevue/icons/baseicon';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode } from 'vue';\n\nvar script = {\n name: 'AngleUpIcon',\n \"extends\": BaseIcon\n};\n\nvar _hoisted_1 = /*#__PURE__*/createElementVNode(\"path\", {\n d: \"M10.4134 9.49931C10.3148 9.49977 10.2172 9.48055 10.1262 9.44278C10.0352 9.405 9.95263 9.34942 9.88338 9.27931L6.88338 6.27931L3.88338 9.27931C3.73811 9.34946 3.57409 9.3709 3.41567 9.34044C3.25724 9.30999 3.11286 9.22926 3.00395 9.11025C2.89504 8.99124 2.82741 8.84028 2.8111 8.67978C2.79478 8.51928 2.83065 8.35781 2.91338 8.21931L6.41338 4.71931C6.55401 4.57886 6.74463 4.49997 6.94338 4.49997C7.14213 4.49997 7.33276 4.57886 7.47338 4.71931L10.9734 8.21931C11.1138 8.35994 11.1927 8.55056 11.1927 8.74931C11.1927 8.94806 11.1138 9.13868 10.9734 9.27931C10.9007 9.35315 10.8132 9.41089 10.7168 9.44879C10.6203 9.48669 10.5169 9.5039 10.4134 9.49931Z\",\n fill: \"currentColor\"\n}, null, -1);\nvar _hoisted_2 = [_hoisted_1];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"svg\", mergeProps({\n width: \"14\",\n height: \"14\",\n viewBox: \"0 0 14 14\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, _ctx.pti()), _hoisted_2, 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-inputnumber {\\n display: inline-flex;\\n position: relative;\\n}\\n\\n.p-inputnumber-button {\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n flex: 0 0 auto;\\n cursor: pointer;\\n background: \".concat(dt('inputnumber.button.background'), \";\\n color: \").concat(dt('inputnumber.button.color'), \";\\n width: \").concat(dt('inputnumber.button.width'), \";\\n transition: background \").concat(dt('inputnumber.transition.duration'), \", color \").concat(dt('inputnumber.transition.duration'), \", border-color \").concat(dt('inputnumber.transition.duration'), \", outline-color \").concat(dt('inputnumber.transition.duration'), \";\\n}\\n\\n.p-inputnumber-button:hover {\\n background: \").concat(dt('inputnumber.button.hover.background'), \";\\n color: \").concat(dt('inputnumber.button.hover.color'), \";\\n}\\n\\n.p-inputnumber-button:active {\\n background: \").concat(dt('inputnumber.button.active.background'), \";\\n color: \").concat(dt('inputnumber.button.active.color'), \";\\n}\\n\\n.p-inputnumber-stacked .p-inputnumber-button {\\n position: relative;\\n border: 0 none;\\n}\\n\\n.p-inputnumber-stacked .p-inputnumber-button-group {\\n display: flex;\\n flex-direction: column;\\n position: absolute;\\n top: 1px;\\n right: 1px;\\n height: calc(100% - 2px);\\n z-index: 1;\\n}\\n\\n.p-inputnumber-stacked .p-inputnumber-increment-button {\\n padding: 0;\\n border-top-right-radius: calc(\").concat(dt('inputnumber.button.border.radius'), \" - 1px);\\n}\\n\\n.p-inputnumber-stacked .p-inputnumber-decrement-button {\\n padding: 0;\\n border-bottom-right-radius: calc(\").concat(dt('inputnumber.button.border.radius'), \" - 1px);\\n}\\n\\n.p-inputnumber-stacked .p-inputnumber-button {\\n flex: 1 1 auto;\\n border: 0 none;\\n}\\n\\n.p-inputnumber-horizontal .p-inputnumber-button {\\n border: 1px solid \").concat(dt('inputnumber.button.border.color'), \";\\n}\\n\\n.p-inputnumber-horizontal .p-inputnumber-button:hover {\\n border-color: \").concat(dt('inputnumber.button.hover.border.color'), \";\\n}\\n\\n.p-inputnumber-horizontal .p-inputnumber-button:active {\\n border-color: \").concat(dt('inputnumber.button.active.border.color'), \";\\n}\\n\\n.p-inputnumber-horizontal .p-inputnumber-increment-button {\\n order: 3;\\n border-top-right-radius: \").concat(dt('inputnumber.button.border.radius'), \";\\n border-bottom-right-radius: \").concat(dt('inputnumber.button.border.radius'), \";\\n border-left: 0 none;\\n}\\n\\n.p-inputnumber-horizontal .p-inputnumber-input {\\n order: 2;\\n border-radius: 0;\\n}\\n\\n.p-inputnumber-horizontal .p-inputnumber-decrement-button {\\n order: 1;\\n border-top-left-radius: \").concat(dt('inputnumber.button.border.radius'), \";\\n border-bottom-left-radius: \").concat(dt('inputnumber.button.border.radius'), \";\\n border-right: 0 none;\\n}\\n\\n.p-inputnumber-vertical {\\n flex-direction: column;\\n}\\n\\n.p-inputnumber-vertical .p-inputnumber-button {\\n border: 1px solid \").concat(dt('inputnumber.button.border.color'), \";\\n padding: \").concat(dt('inputnumber.button.vertical.padding'), \"; 0;\\n}\\n\\n.p-inputnumber-vertical .p-inputnumber-button:hover {\\n border-color: \").concat(dt('inputnumber.button.hover.border.color'), \";\\n}\\n\\n.p-inputnumber-vertical .p-inputnumber-button:active {\\n border-color: \").concat(dt('inputnumber.button.active.border.color'), \";\\n}\\n\\n.p-inputnumber-vertical .p-inputnumber-increment-button {\\n order: 1;\\n border-top-left-radius: \").concat(dt('inputnumber.button.border.radius'), \";\\n border-top-right-radius: \").concat(dt('inputnumber.button.border.radius'), \";\\n width: 100%;\\n border-bottom: 0 none;\\n}\\n\\n.p-inputnumber-vertical .p-inputnumber-input {\\n order: 2;\\n border-radius: 0;\\n text-align: center;\\n}\\n\\n.p-inputnumber-vertical .p-inputnumber-decrement-button {\\n order: 3;\\n border-bottom-left-radius: \").concat(dt('inputnumber.button.border.radius'), \";\\n border-bottom-right-radius: \").concat(dt('inputnumber.button.border.radius'), \";\\n width: 100%;\\n border-top: 0 none;\\n}\\n\\n.p-inputnumber-input {\\n flex: 1 1 auto;\\n}\\n\\n.p-inputnumber-fluid {\\n width: 100%;\\n}\\n\\n.p-inputnumber-fluid .p-inputnumber-input {\\n width: 1%;\\n}\\n\\n.p-inputnumber-fluid.p-inputnumber-vertical .p-inputnumber-input {\\n width: 100%;\\n}\\n\");\n};\nvar classes = {\n root: function root(_ref2) {\n var instance = _ref2.instance,\n props = _ref2.props;\n return ['p-inputnumber p-component p-inputwrapper', {\n 'p-inputwrapper-filled': instance.filled || props.allowEmpty === false,\n 'p-inputwrapper-focus': instance.focused,\n 'p-inputnumber-stacked': props.showButtons && props.buttonLayout === 'stacked',\n 'p-inputnumber-horizontal': props.showButtons && props.buttonLayout === 'horizontal',\n 'p-inputnumber-vertical': props.showButtons && props.buttonLayout === 'vertical',\n 'p-inputnumber-fluid': instance.hasFluid\n }];\n },\n pcInput: 'p-inputnumber-input',\n buttonGroup: 'p-inputnumber-button-group',\n incrementButton: function incrementButton(_ref3) {\n var instance = _ref3.instance,\n props = _ref3.props;\n return ['p-inputnumber-button p-inputnumber-increment-button', {\n 'p-disabled': props.showButtons && props.max !== null && instance.maxBoundry()\n }];\n },\n decrementButton: function decrementButton(_ref4) {\n var instance = _ref4.instance,\n props = _ref4.props;\n return ['p-inputnumber-button p-inputnumber-decrement-button', {\n 'p-disabled': props.showButtons && props.min !== null && instance.minBoundry()\n }];\n }\n};\nvar InputNumberStyle = BaseStyle.extend({\n name: 'inputnumber',\n theme: theme,\n classes: classes\n});\n\nexport { InputNumberStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { getSelection, clearSelection } from '@primeuix/utils/dom';\nimport { isNotEmpty, isEmpty } from '@primeuix/utils/object';\nimport AngleDownIcon from '@primevue/icons/angledown';\nimport AngleUpIcon from '@primevue/icons/angleup';\nimport InputText from 'primevue/inputtext';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport InputNumberStyle from 'primevue/inputnumber/style';\nimport { resolveComponent, openBlock, createElementBlock, mergeProps, createVNode, normalizeClass, normalizeStyle, renderSlot, createElementVNode, toHandlers, createBlock, resolveDynamicComponent, createCommentVNode } from 'vue';\n\nvar script$1 = {\n name: 'BaseInputNumber',\n \"extends\": BaseComponent,\n props: {\n modelValue: {\n type: Number,\n \"default\": null\n },\n format: {\n type: Boolean,\n \"default\": true\n },\n showButtons: {\n type: Boolean,\n \"default\": false\n },\n buttonLayout: {\n type: String,\n \"default\": 'stacked'\n },\n incrementButtonClass: {\n type: String,\n \"default\": null\n },\n decrementButtonClass: {\n type: String,\n \"default\": null\n },\n incrementButtonIcon: {\n type: String,\n \"default\": undefined\n },\n incrementIcon: {\n type: String,\n \"default\": undefined\n },\n decrementButtonIcon: {\n type: String,\n \"default\": undefined\n },\n decrementIcon: {\n type: String,\n \"default\": undefined\n },\n locale: {\n type: String,\n \"default\": undefined\n },\n localeMatcher: {\n type: String,\n \"default\": undefined\n },\n mode: {\n type: String,\n \"default\": 'decimal'\n },\n prefix: {\n type: String,\n \"default\": null\n },\n suffix: {\n type: String,\n \"default\": null\n },\n currency: {\n type: String,\n \"default\": undefined\n },\n currencyDisplay: {\n type: String,\n \"default\": undefined\n },\n useGrouping: {\n type: Boolean,\n \"default\": true\n },\n minFractionDigits: {\n type: Number,\n \"default\": undefined\n },\n maxFractionDigits: {\n type: Number,\n \"default\": undefined\n },\n roundingMode: {\n type: String,\n \"default\": 'halfExpand',\n validator: function validator(value) {\n return ['ceil', 'floor', 'expand', 'trunc', 'halfCeil', 'halfFloor', 'halfExpand', 'halfTrunc', 'halfEven'].includes(value);\n }\n },\n min: {\n type: Number,\n \"default\": null\n },\n max: {\n type: Number,\n \"default\": null\n },\n step: {\n type: Number,\n \"default\": 1\n },\n allowEmpty: {\n type: Boolean,\n \"default\": true\n },\n highlightOnFocus: {\n type: Boolean,\n \"default\": false\n },\n readonly: {\n type: Boolean,\n \"default\": false\n },\n variant: {\n type: String,\n \"default\": null\n },\n invalid: {\n type: Boolean,\n \"default\": false\n },\n disabled: {\n type: Boolean,\n \"default\": false\n },\n placeholder: {\n type: String,\n \"default\": null\n },\n fluid: {\n type: Boolean,\n \"default\": null\n },\n inputId: {\n type: String,\n \"default\": null\n },\n inputClass: {\n type: [String, Object],\n \"default\": null\n },\n inputStyle: {\n type: Object,\n \"default\": null\n },\n ariaLabelledby: {\n type: String,\n \"default\": null\n },\n ariaLabel: {\n type: String,\n \"default\": null\n }\n },\n style: InputNumberStyle,\n provide: function provide() {\n return {\n $pcInputNumber: this,\n $parentInstance: this\n };\n }\n};\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _iterableToArray(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nvar script = {\n name: 'InputNumber',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['update:modelValue', 'input', 'focus', 'blur'],\n inject: {\n $pcFluid: {\n \"default\": null\n }\n },\n numberFormat: null,\n _numeral: null,\n _decimal: null,\n _group: null,\n _minusSign: null,\n _currency: null,\n _suffix: null,\n _prefix: null,\n _index: null,\n groupChar: '',\n isSpecialChar: null,\n prefixChar: null,\n suffixChar: null,\n timer: null,\n data: function data() {\n return {\n d_modelValue: this.modelValue,\n focused: false\n };\n },\n watch: {\n modelValue: function modelValue(newValue) {\n this.d_modelValue = newValue;\n },\n locale: function locale(newValue, oldValue) {\n this.updateConstructParser(newValue, oldValue);\n },\n localeMatcher: function localeMatcher(newValue, oldValue) {\n this.updateConstructParser(newValue, oldValue);\n },\n mode: function mode(newValue, oldValue) {\n this.updateConstructParser(newValue, oldValue);\n },\n currency: function currency(newValue, oldValue) {\n this.updateConstructParser(newValue, oldValue);\n },\n currencyDisplay: function currencyDisplay(newValue, oldValue) {\n this.updateConstructParser(newValue, oldValue);\n },\n useGrouping: function useGrouping(newValue, oldValue) {\n this.updateConstructParser(newValue, oldValue);\n },\n minFractionDigits: function minFractionDigits(newValue, oldValue) {\n this.updateConstructParser(newValue, oldValue);\n },\n maxFractionDigits: function maxFractionDigits(newValue, oldValue) {\n this.updateConstructParser(newValue, oldValue);\n },\n suffix: function suffix(newValue, oldValue) {\n this.updateConstructParser(newValue, oldValue);\n },\n prefix: function prefix(newValue, oldValue) {\n this.updateConstructParser(newValue, oldValue);\n }\n },\n created: function created() {\n this.constructParser();\n },\n methods: {\n getOptions: function getOptions() {\n return {\n localeMatcher: this.localeMatcher,\n style: this.mode,\n currency: this.currency,\n currencyDisplay: this.currencyDisplay,\n useGrouping: this.useGrouping,\n minimumFractionDigits: this.minFractionDigits,\n maximumFractionDigits: this.maxFractionDigits,\n roundingMode: this.roundingMode\n };\n },\n constructParser: function constructParser() {\n this.numberFormat = new Intl.NumberFormat(this.locale, this.getOptions());\n var numerals = _toConsumableArray(new Intl.NumberFormat(this.locale, {\n useGrouping: false\n }).format(9876543210)).reverse();\n var index = new Map(numerals.map(function (d, i) {\n return [d, i];\n }));\n this._numeral = new RegExp(\"[\".concat(numerals.join(''), \"]\"), 'g');\n this._group = this.getGroupingExpression();\n this._minusSign = this.getMinusSignExpression();\n this._currency = this.getCurrencyExpression();\n this._decimal = this.getDecimalExpression();\n this._suffix = this.getSuffixExpression();\n this._prefix = this.getPrefixExpression();\n this._index = function (d) {\n return index.get(d);\n };\n },\n updateConstructParser: function updateConstructParser(newValue, oldValue) {\n if (newValue !== oldValue) {\n this.constructParser();\n }\n },\n escapeRegExp: function escapeRegExp(text) {\n return text.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&');\n },\n getDecimalExpression: function getDecimalExpression() {\n var formatter = new Intl.NumberFormat(this.locale, _objectSpread(_objectSpread({}, this.getOptions()), {}, {\n useGrouping: false\n }));\n return new RegExp(\"[\".concat(formatter.format(1.1).replace(this._currency, '').trim().replace(this._numeral, ''), \"]\"), 'g');\n },\n getGroupingExpression: function getGroupingExpression() {\n var formatter = new Intl.NumberFormat(this.locale, {\n useGrouping: true\n });\n this.groupChar = formatter.format(1000000).trim().replace(this._numeral, '').charAt(0);\n return new RegExp(\"[\".concat(this.groupChar, \"]\"), 'g');\n },\n getMinusSignExpression: function getMinusSignExpression() {\n var formatter = new Intl.NumberFormat(this.locale, {\n useGrouping: false\n });\n return new RegExp(\"[\".concat(formatter.format(-1).trim().replace(this._numeral, ''), \"]\"), 'g');\n },\n getCurrencyExpression: function getCurrencyExpression() {\n if (this.currency) {\n var formatter = new Intl.NumberFormat(this.locale, {\n style: 'currency',\n currency: this.currency,\n currencyDisplay: this.currencyDisplay,\n minimumFractionDigits: 0,\n maximumFractionDigits: 0,\n roundingMode: this.roundingMode\n });\n return new RegExp(\"[\".concat(formatter.format(1).replace(/\\s/g, '').replace(this._numeral, '').replace(this._group, ''), \"]\"), 'g');\n }\n return new RegExp(\"[]\", 'g');\n },\n getPrefixExpression: function getPrefixExpression() {\n if (this.prefix) {\n this.prefixChar = this.prefix;\n } else {\n var formatter = new Intl.NumberFormat(this.locale, {\n style: this.mode,\n currency: this.currency,\n currencyDisplay: this.currencyDisplay\n });\n this.prefixChar = formatter.format(1).split('1')[0];\n }\n return new RegExp(\"\".concat(this.escapeRegExp(this.prefixChar || '')), 'g');\n },\n getSuffixExpression: function getSuffixExpression() {\n if (this.suffix) {\n this.suffixChar = this.suffix;\n } else {\n var formatter = new Intl.NumberFormat(this.locale, {\n style: this.mode,\n currency: this.currency,\n currencyDisplay: this.currencyDisplay,\n minimumFractionDigits: 0,\n maximumFractionDigits: 0,\n roundingMode: this.roundingMode\n });\n this.suffixChar = formatter.format(1).split('1')[1];\n }\n return new RegExp(\"\".concat(this.escapeRegExp(this.suffixChar || '')), 'g');\n },\n formatValue: function formatValue(value) {\n if (value != null) {\n if (value === '-') {\n // Minus sign\n return value;\n }\n if (this.format) {\n var formatter = new Intl.NumberFormat(this.locale, this.getOptions());\n var formattedValue = formatter.format(value);\n if (this.prefix) {\n formattedValue = this.prefix + formattedValue;\n }\n if (this.suffix) {\n formattedValue = formattedValue + this.suffix;\n }\n return formattedValue;\n }\n return value.toString();\n }\n return '';\n },\n parseValue: function parseValue(text) {\n var filteredText = text.replace(this._suffix, '').replace(this._prefix, '').trim().replace(/\\s/g, '').replace(this._currency, '').replace(this._group, '').replace(this._minusSign, '-').replace(this._decimal, '.').replace(this._numeral, this._index);\n if (filteredText) {\n if (filteredText === '-')\n // Minus sign\n return filteredText;\n var parsedValue = +filteredText;\n return isNaN(parsedValue) ? null : parsedValue;\n }\n return null;\n },\n repeat: function repeat(event, interval, dir) {\n var _this = this;\n if (this.readonly) {\n return;\n }\n var i = interval || 500;\n this.clearTimer();\n this.timer = setTimeout(function () {\n _this.repeat(event, 40, dir);\n }, i);\n this.spin(event, dir);\n },\n spin: function spin(event, dir) {\n if (this.$refs.input) {\n var step = this.step * dir;\n var currentValue = this.parseValue(this.$refs.input.$el.value) || 0;\n var newValue = this.validateValue(currentValue + step);\n this.updateInput(newValue, null, 'spin');\n this.updateModel(event, newValue);\n this.handleOnInput(event, currentValue, newValue);\n }\n },\n onUpButtonMouseDown: function onUpButtonMouseDown(event) {\n if (!this.disabled) {\n this.$refs.input.$el.focus();\n this.repeat(event, null, 1);\n event.preventDefault();\n }\n },\n onUpButtonMouseUp: function onUpButtonMouseUp() {\n if (!this.disabled) {\n this.clearTimer();\n }\n },\n onUpButtonMouseLeave: function onUpButtonMouseLeave() {\n if (!this.disabled) {\n this.clearTimer();\n }\n },\n onUpButtonKeyUp: function onUpButtonKeyUp() {\n if (!this.disabled) {\n this.clearTimer();\n }\n },\n onUpButtonKeyDown: function onUpButtonKeyDown(event) {\n if (event.code === 'Space' || event.code === 'Enter' || event.code === 'NumpadEnter') {\n this.repeat(event, null, 1);\n }\n },\n onDownButtonMouseDown: function onDownButtonMouseDown(event) {\n if (!this.disabled) {\n this.$refs.input.$el.focus();\n this.repeat(event, null, -1);\n event.preventDefault();\n }\n },\n onDownButtonMouseUp: function onDownButtonMouseUp() {\n if (!this.disabled) {\n this.clearTimer();\n }\n },\n onDownButtonMouseLeave: function onDownButtonMouseLeave() {\n if (!this.disabled) {\n this.clearTimer();\n }\n },\n onDownButtonKeyUp: function onDownButtonKeyUp() {\n if (!this.disabled) {\n this.clearTimer();\n }\n },\n onDownButtonKeyDown: function onDownButtonKeyDown(event) {\n if (event.code === 'Space' || event.code === 'Enter' || event.code === 'NumpadEnter') {\n this.repeat(event, null, -1);\n }\n },\n onUserInput: function onUserInput() {\n if (this.isSpecialChar) {\n this.$refs.input.$el.value = this.lastValue;\n }\n this.isSpecialChar = false;\n },\n onInputKeyDown: function onInputKeyDown(event) {\n if (this.readonly) {\n return;\n }\n if (event.altKey || event.ctrlKey || event.metaKey) {\n this.isSpecialChar = true;\n this.lastValue = this.$refs.input.$el.value;\n return;\n }\n this.lastValue = event.target.value;\n var selectionStart = event.target.selectionStart;\n var selectionEnd = event.target.selectionEnd;\n var inputValue = event.target.value;\n var newValueStr = null;\n switch (event.code) {\n case 'ArrowUp':\n this.spin(event, 1);\n event.preventDefault();\n break;\n case 'ArrowDown':\n this.spin(event, -1);\n event.preventDefault();\n break;\n case 'ArrowLeft':\n if (!this.isNumeralChar(inputValue.charAt(selectionStart - 1))) {\n event.preventDefault();\n }\n break;\n case 'ArrowRight':\n if (!this.isNumeralChar(inputValue.charAt(selectionStart))) {\n event.preventDefault();\n }\n break;\n case 'Tab':\n case 'Enter':\n case 'NumpadEnter':\n newValueStr = this.validateValue(this.parseValue(inputValue));\n this.$refs.input.$el.value = this.formatValue(newValueStr);\n this.$refs.input.$el.setAttribute('aria-valuenow', newValueStr);\n this.updateModel(event, newValueStr);\n break;\n case 'Backspace':\n {\n event.preventDefault();\n if (selectionStart === selectionEnd) {\n var deleteChar = inputValue.charAt(selectionStart - 1);\n var _this$getDecimalCharI = this.getDecimalCharIndexes(inputValue),\n decimalCharIndex = _this$getDecimalCharI.decimalCharIndex,\n decimalCharIndexWithoutPrefix = _this$getDecimalCharI.decimalCharIndexWithoutPrefix;\n if (this.isNumeralChar(deleteChar)) {\n var decimalLength = this.getDecimalLength(inputValue);\n if (this._group.test(deleteChar)) {\n this._group.lastIndex = 0;\n newValueStr = inputValue.slice(0, selectionStart - 2) + inputValue.slice(selectionStart - 1);\n } else if (this._decimal.test(deleteChar)) {\n this._decimal.lastIndex = 0;\n if (decimalLength) {\n this.$refs.input.$el.setSelectionRange(selectionStart - 1, selectionStart - 1);\n } else {\n newValueStr = inputValue.slice(0, selectionStart - 1) + inputValue.slice(selectionStart);\n }\n } else if (decimalCharIndex > 0 && selectionStart > decimalCharIndex) {\n var insertedText = this.isDecimalMode() && (this.minFractionDigits || 0) < decimalLength ? '' : '0';\n newValueStr = inputValue.slice(0, selectionStart - 1) + insertedText + inputValue.slice(selectionStart);\n } else if (decimalCharIndexWithoutPrefix === 1) {\n newValueStr = inputValue.slice(0, selectionStart - 1) + '0' + inputValue.slice(selectionStart);\n newValueStr = this.parseValue(newValueStr) > 0 ? newValueStr : '';\n } else {\n newValueStr = inputValue.slice(0, selectionStart - 1) + inputValue.slice(selectionStart);\n }\n }\n this.updateValue(event, newValueStr, null, 'delete-single');\n } else {\n newValueStr = this.deleteRange(inputValue, selectionStart, selectionEnd);\n this.updateValue(event, newValueStr, null, 'delete-range');\n }\n break;\n }\n case 'Delete':\n event.preventDefault();\n if (selectionStart === selectionEnd) {\n var _deleteChar = inputValue.charAt(selectionStart);\n var _this$getDecimalCharI2 = this.getDecimalCharIndexes(inputValue),\n _decimalCharIndex = _this$getDecimalCharI2.decimalCharIndex,\n _decimalCharIndexWithoutPrefix = _this$getDecimalCharI2.decimalCharIndexWithoutPrefix;\n if (this.isNumeralChar(_deleteChar)) {\n var _decimalLength = this.getDecimalLength(inputValue);\n if (this._group.test(_deleteChar)) {\n this._group.lastIndex = 0;\n newValueStr = inputValue.slice(0, selectionStart) + inputValue.slice(selectionStart + 2);\n } else if (this._decimal.test(_deleteChar)) {\n this._decimal.lastIndex = 0;\n if (_decimalLength) {\n this.$refs.input.$el.setSelectionRange(selectionStart + 1, selectionStart + 1);\n } else {\n newValueStr = inputValue.slice(0, selectionStart) + inputValue.slice(selectionStart + 1);\n }\n } else if (_decimalCharIndex > 0 && selectionStart > _decimalCharIndex) {\n var _insertedText = this.isDecimalMode() && (this.minFractionDigits || 0) < _decimalLength ? '' : '0';\n newValueStr = inputValue.slice(0, selectionStart) + _insertedText + inputValue.slice(selectionStart + 1);\n } else if (_decimalCharIndexWithoutPrefix === 1) {\n newValueStr = inputValue.slice(0, selectionStart) + '0' + inputValue.slice(selectionStart + 1);\n newValueStr = this.parseValue(newValueStr) > 0 ? newValueStr : '';\n } else {\n newValueStr = inputValue.slice(0, selectionStart) + inputValue.slice(selectionStart + 1);\n }\n }\n this.updateValue(event, newValueStr, null, 'delete-back-single');\n } else {\n newValueStr = this.deleteRange(inputValue, selectionStart, selectionEnd);\n this.updateValue(event, newValueStr, null, 'delete-range');\n }\n break;\n case 'Home':\n event.preventDefault();\n if (isNotEmpty(this.min)) {\n this.updateModel(event, this.min);\n }\n break;\n case 'End':\n event.preventDefault();\n if (isNotEmpty(this.max)) {\n this.updateModel(event, this.max);\n }\n break;\n }\n },\n onInputKeyPress: function onInputKeyPress(event) {\n if (this.readonly) {\n return;\n }\n var _char = event.key;\n var isDecimalSign = this.isDecimalSign(_char);\n var isMinusSign = this.isMinusSign(_char);\n if (event.code !== 'Enter') {\n event.preventDefault();\n }\n if (Number(_char) >= 0 && Number(_char) <= 9 || isMinusSign || isDecimalSign) {\n this.insert(event, _char, {\n isDecimalSign: isDecimalSign,\n isMinusSign: isMinusSign\n });\n }\n },\n onPaste: function onPaste(event) {\n event.preventDefault();\n var data = (event.clipboardData || window['clipboardData']).getData('Text');\n if (data) {\n var filteredData = this.parseValue(data);\n if (filteredData != null) {\n this.insert(event, filteredData.toString());\n }\n }\n },\n allowMinusSign: function allowMinusSign() {\n return this.min === null || this.min < 0;\n },\n isMinusSign: function isMinusSign(_char2) {\n if (this._minusSign.test(_char2) || _char2 === '-') {\n this._minusSign.lastIndex = 0;\n return true;\n }\n return false;\n },\n isDecimalSign: function isDecimalSign(_char3) {\n if (this._decimal.test(_char3)) {\n this._decimal.lastIndex = 0;\n return true;\n }\n return false;\n },\n isDecimalMode: function isDecimalMode() {\n return this.mode === 'decimal';\n },\n getDecimalCharIndexes: function getDecimalCharIndexes(val) {\n var decimalCharIndex = val.search(this._decimal);\n this._decimal.lastIndex = 0;\n var filteredVal = val.replace(this._prefix, '').trim().replace(/\\s/g, '').replace(this._currency, '');\n var decimalCharIndexWithoutPrefix = filteredVal.search(this._decimal);\n this._decimal.lastIndex = 0;\n return {\n decimalCharIndex: decimalCharIndex,\n decimalCharIndexWithoutPrefix: decimalCharIndexWithoutPrefix\n };\n },\n getCharIndexes: function getCharIndexes(val) {\n var decimalCharIndex = val.search(this._decimal);\n this._decimal.lastIndex = 0;\n var minusCharIndex = val.search(this._minusSign);\n this._minusSign.lastIndex = 0;\n var suffixCharIndex = val.search(this._suffix);\n this._suffix.lastIndex = 0;\n var currencyCharIndex = val.search(this._currency);\n this._currency.lastIndex = 0;\n return {\n decimalCharIndex: decimalCharIndex,\n minusCharIndex: minusCharIndex,\n suffixCharIndex: suffixCharIndex,\n currencyCharIndex: currencyCharIndex\n };\n },\n insert: function insert(event, text) {\n var sign = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {\n isDecimalSign: false,\n isMinusSign: false\n };\n var minusCharIndexOnText = text.search(this._minusSign);\n this._minusSign.lastIndex = 0;\n if (!this.allowMinusSign() && minusCharIndexOnText !== -1) {\n return;\n }\n var selectionStart = this.$refs.input.$el.selectionStart;\n var selectionEnd = this.$refs.input.$el.selectionEnd;\n var inputValue = this.$refs.input.$el.value.trim();\n var _this$getCharIndexes = this.getCharIndexes(inputValue),\n decimalCharIndex = _this$getCharIndexes.decimalCharIndex,\n minusCharIndex = _this$getCharIndexes.minusCharIndex,\n suffixCharIndex = _this$getCharIndexes.suffixCharIndex,\n currencyCharIndex = _this$getCharIndexes.currencyCharIndex;\n var newValueStr;\n if (sign.isMinusSign) {\n if (selectionStart === 0) {\n newValueStr = inputValue;\n if (minusCharIndex === -1 || selectionEnd !== 0) {\n newValueStr = this.insertText(inputValue, text, 0, selectionEnd);\n }\n this.updateValue(event, newValueStr, text, 'insert');\n }\n } else if (sign.isDecimalSign) {\n if (decimalCharIndex > 0 && selectionStart === decimalCharIndex) {\n this.updateValue(event, inputValue, text, 'insert');\n } else if (decimalCharIndex > selectionStart && decimalCharIndex < selectionEnd) {\n newValueStr = this.insertText(inputValue, text, selectionStart, selectionEnd);\n this.updateValue(event, newValueStr, text, 'insert');\n } else if (decimalCharIndex === -1 && this.maxFractionDigits) {\n newValueStr = this.insertText(inputValue, text, selectionStart, selectionEnd);\n this.updateValue(event, newValueStr, text, 'insert');\n }\n } else {\n var maxFractionDigits = this.numberFormat.resolvedOptions().maximumFractionDigits;\n var operation = selectionStart !== selectionEnd ? 'range-insert' : 'insert';\n if (decimalCharIndex > 0 && selectionStart > decimalCharIndex) {\n if (selectionStart + text.length - (decimalCharIndex + 1) <= maxFractionDigits) {\n var charIndex = currencyCharIndex >= selectionStart ? currencyCharIndex - 1 : suffixCharIndex >= selectionStart ? suffixCharIndex : inputValue.length;\n newValueStr = inputValue.slice(0, selectionStart) + text + inputValue.slice(selectionStart + text.length, charIndex) + inputValue.slice(charIndex);\n this.updateValue(event, newValueStr, text, operation);\n }\n } else {\n newValueStr = this.insertText(inputValue, text, selectionStart, selectionEnd);\n this.updateValue(event, newValueStr, text, operation);\n }\n }\n },\n insertText: function insertText(value, text, start, end) {\n var textSplit = text === '.' ? text : text.split('.');\n if (textSplit.length === 2) {\n var decimalCharIndex = value.slice(start, end).search(this._decimal);\n this._decimal.lastIndex = 0;\n return decimalCharIndex > 0 ? value.slice(0, start) + this.formatValue(text) + value.slice(end) : this.formatValue(text) || value;\n } else if (end - start === value.length) {\n return this.formatValue(text);\n } else if (start === 0) {\n return text + value.slice(end);\n } else if (end === value.length) {\n return value.slice(0, start) + text;\n } else {\n return value.slice(0, start) + text + value.slice(end);\n }\n },\n deleteRange: function deleteRange(value, start, end) {\n var newValueStr;\n if (end - start === value.length) newValueStr = '';else if (start === 0) newValueStr = value.slice(end);else if (end === value.length) newValueStr = value.slice(0, start);else newValueStr = value.slice(0, start) + value.slice(end);\n return newValueStr;\n },\n initCursor: function initCursor() {\n var selectionStart = this.$refs.input.$el.selectionStart;\n var inputValue = this.$refs.input.$el.value;\n var valueLength = inputValue.length;\n var index = null;\n\n // remove prefix\n var prefixLength = (this.prefixChar || '').length;\n inputValue = inputValue.replace(this._prefix, '');\n selectionStart = selectionStart - prefixLength;\n var _char4 = inputValue.charAt(selectionStart);\n if (this.isNumeralChar(_char4)) {\n return selectionStart + prefixLength;\n }\n\n //left\n var i = selectionStart - 1;\n while (i >= 0) {\n _char4 = inputValue.charAt(i);\n if (this.isNumeralChar(_char4)) {\n index = i + prefixLength;\n break;\n } else {\n i--;\n }\n }\n if (index !== null) {\n this.$refs.input.$el.setSelectionRange(index + 1, index + 1);\n } else {\n i = selectionStart;\n while (i < valueLength) {\n _char4 = inputValue.charAt(i);\n if (this.isNumeralChar(_char4)) {\n index = i + prefixLength;\n break;\n } else {\n i++;\n }\n }\n if (index !== null) {\n this.$refs.input.$el.setSelectionRange(index, index);\n }\n }\n return index || 0;\n },\n onInputClick: function onInputClick() {\n var currentValue = this.$refs.input.$el.value;\n if (!this.readonly && currentValue !== getSelection()) {\n this.initCursor();\n }\n },\n isNumeralChar: function isNumeralChar(_char5) {\n if (_char5.length === 1 && (this._numeral.test(_char5) || this._decimal.test(_char5) || this._group.test(_char5) || this._minusSign.test(_char5))) {\n this.resetRegex();\n return true;\n }\n return false;\n },\n resetRegex: function resetRegex() {\n this._numeral.lastIndex = 0;\n this._decimal.lastIndex = 0;\n this._group.lastIndex = 0;\n this._minusSign.lastIndex = 0;\n },\n updateValue: function updateValue(event, valueStr, insertedValueStr, operation) {\n var currentValue = this.$refs.input.$el.value;\n var newValue = null;\n if (valueStr != null) {\n newValue = this.parseValue(valueStr);\n newValue = !newValue && !this.allowEmpty ? 0 : newValue;\n this.updateInput(newValue, insertedValueStr, operation, valueStr);\n this.handleOnInput(event, currentValue, newValue);\n }\n },\n handleOnInput: function handleOnInput(event, currentValue, newValue) {\n if (this.isValueChanged(currentValue, newValue)) {\n this.$emit('input', {\n originalEvent: event,\n value: newValue,\n formattedValue: currentValue\n });\n }\n },\n isValueChanged: function isValueChanged(currentValue, newValue) {\n if (newValue === null && currentValue !== null) {\n return true;\n }\n if (newValue != null) {\n var parsedCurrentValue = typeof currentValue === 'string' ? this.parseValue(currentValue) : currentValue;\n return newValue !== parsedCurrentValue;\n }\n return false;\n },\n validateValue: function validateValue(value) {\n if (value === '-' || value == null) {\n return null;\n }\n if (this.min != null && value < this.min) {\n return this.min;\n }\n if (this.max != null && value > this.max) {\n return this.max;\n }\n return value;\n },\n updateInput: function updateInput(value, insertedValueStr, operation, valueStr) {\n insertedValueStr = insertedValueStr || '';\n var inputValue = this.$refs.input.$el.value;\n var newValue = this.formatValue(value);\n var currentLength = inputValue.length;\n if (newValue !== valueStr) {\n newValue = this.concatValues(newValue, valueStr);\n }\n if (currentLength === 0) {\n this.$refs.input.$el.value = newValue;\n this.$refs.input.$el.setSelectionRange(0, 0);\n var index = this.initCursor();\n var selectionEnd = index + insertedValueStr.length;\n this.$refs.input.$el.setSelectionRange(selectionEnd, selectionEnd);\n } else {\n var selectionStart = this.$refs.input.$el.selectionStart;\n var _selectionEnd = this.$refs.input.$el.selectionEnd;\n this.$refs.input.$el.value = newValue;\n var newLength = newValue.length;\n if (operation === 'range-insert') {\n var startValue = this.parseValue((inputValue || '').slice(0, selectionStart));\n var startValueStr = startValue !== null ? startValue.toString() : '';\n var startExpr = startValueStr.split('').join(\"(\".concat(this.groupChar, \")?\"));\n var sRegex = new RegExp(startExpr, 'g');\n sRegex.test(newValue);\n var tExpr = insertedValueStr.split('').join(\"(\".concat(this.groupChar, \")?\"));\n var tRegex = new RegExp(tExpr, 'g');\n tRegex.test(newValue.slice(sRegex.lastIndex));\n _selectionEnd = sRegex.lastIndex + tRegex.lastIndex;\n this.$refs.input.$el.setSelectionRange(_selectionEnd, _selectionEnd);\n } else if (newLength === currentLength) {\n if (operation === 'insert' || operation === 'delete-back-single') {\n this.$refs.input.$el.setSelectionRange(_selectionEnd + 1, _selectionEnd + 1);\n } else if (operation === 'delete-single') {\n this.$refs.input.$el.setSelectionRange(_selectionEnd - 1, _selectionEnd - 1);\n } else if (operation === 'delete-range' || operation === 'spin') {\n this.$refs.input.$el.setSelectionRange(_selectionEnd, _selectionEnd);\n }\n } else if (operation === 'delete-back-single') {\n var prevChar = inputValue.charAt(_selectionEnd - 1);\n var nextChar = inputValue.charAt(_selectionEnd);\n var diff = currentLength - newLength;\n var isGroupChar = this._group.test(nextChar);\n if (isGroupChar && diff === 1) {\n _selectionEnd += 1;\n } else if (!isGroupChar && this.isNumeralChar(prevChar)) {\n _selectionEnd += -1 * diff + 1;\n }\n this._group.lastIndex = 0;\n this.$refs.input.$el.setSelectionRange(_selectionEnd, _selectionEnd);\n } else if (inputValue === '-' && operation === 'insert') {\n this.$refs.input.$el.setSelectionRange(0, 0);\n var _index = this.initCursor();\n var _selectionEnd2 = _index + insertedValueStr.length + 1;\n this.$refs.input.$el.setSelectionRange(_selectionEnd2, _selectionEnd2);\n } else {\n _selectionEnd = _selectionEnd + (newLength - currentLength);\n this.$refs.input.$el.setSelectionRange(_selectionEnd, _selectionEnd);\n }\n }\n this.$refs.input.$el.setAttribute('aria-valuenow', value);\n },\n concatValues: function concatValues(val1, val2) {\n if (val1 && val2) {\n var decimalCharIndex = val2.search(this._decimal);\n this._decimal.lastIndex = 0;\n if (this.suffixChar) {\n return decimalCharIndex !== -1 ? val1.replace(this.suffixChar, '').split(this._decimal)[0] + val2.replace(this.suffixChar, '').slice(decimalCharIndex) + this.suffixChar : val1;\n } else {\n return decimalCharIndex !== -1 ? val1.split(this._decimal)[0] + val2.slice(decimalCharIndex) : val1;\n }\n }\n return val1;\n },\n getDecimalLength: function getDecimalLength(value) {\n if (value) {\n var valueSplit = value.split(this._decimal);\n if (valueSplit.length === 2) {\n return valueSplit[1].replace(this._suffix, '').trim().replace(/\\s/g, '').replace(this._currency, '').length;\n }\n }\n return 0;\n },\n updateModel: function updateModel(event, value) {\n this.d_modelValue = value;\n this.$emit('update:modelValue', value);\n },\n onInputFocus: function onInputFocus(event) {\n this.focused = true;\n if (!this.disabled && !this.readonly && this.$refs.input.$el.value !== getSelection() && this.highlightOnFocus) {\n event.target.select();\n }\n this.$emit('focus', event);\n },\n onInputBlur: function onInputBlur(event) {\n this.focused = false;\n var input = event.target;\n var newValue = this.validateValue(this.parseValue(input.value));\n this.$emit('blur', {\n originalEvent: event,\n value: input.value\n });\n input.value = this.formatValue(newValue);\n input.setAttribute('aria-valuenow', newValue);\n this.updateModel(event, newValue);\n if (!this.disabled && !this.readonly && this.highlightOnFocus) {\n clearSelection();\n }\n },\n clearTimer: function clearTimer() {\n if (this.timer) {\n clearInterval(this.timer);\n }\n },\n maxBoundry: function maxBoundry() {\n return this.d_modelValue >= this.max;\n },\n minBoundry: function minBoundry() {\n return this.d_modelValue <= this.min;\n }\n },\n computed: {\n filled: function filled() {\n return this.modelValue != null && this.modelValue.toString().length > 0;\n },\n upButtonListeners: function upButtonListeners() {\n var _this2 = this;\n return {\n mousedown: function mousedown(event) {\n return _this2.onUpButtonMouseDown(event);\n },\n mouseup: function mouseup(event) {\n return _this2.onUpButtonMouseUp(event);\n },\n mouseleave: function mouseleave(event) {\n return _this2.onUpButtonMouseLeave(event);\n },\n keydown: function keydown(event) {\n return _this2.onUpButtonKeyDown(event);\n },\n keyup: function keyup(event) {\n return _this2.onUpButtonKeyUp(event);\n }\n };\n },\n downButtonListeners: function downButtonListeners() {\n var _this3 = this;\n return {\n mousedown: function mousedown(event) {\n return _this3.onDownButtonMouseDown(event);\n },\n mouseup: function mouseup(event) {\n return _this3.onDownButtonMouseUp(event);\n },\n mouseleave: function mouseleave(event) {\n return _this3.onDownButtonMouseLeave(event);\n },\n keydown: function keydown(event) {\n return _this3.onDownButtonKeyDown(event);\n },\n keyup: function keyup(event) {\n return _this3.onDownButtonKeyUp(event);\n }\n };\n },\n formattedValue: function formattedValue() {\n var val = !this.modelValue && !this.allowEmpty ? 0 : this.modelValue;\n return this.formatValue(val);\n },\n getFormatter: function getFormatter() {\n return this.numberFormat;\n },\n hasFluid: function hasFluid() {\n return isEmpty(this.fluid) ? !!this.$pcFluid : this.fluid;\n }\n },\n components: {\n InputText: InputText,\n AngleUpIcon: AngleUpIcon,\n AngleDownIcon: AngleDownIcon\n }\n};\n\nvar _hoisted_1 = [\"disabled\"];\nvar _hoisted_2 = [\"disabled\"];\nvar _hoisted_3 = [\"disabled\"];\nvar _hoisted_4 = [\"disabled\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_InputText = resolveComponent(\"InputText\");\n return openBlock(), createElementBlock(\"span\", mergeProps({\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root')), [createVNode(_component_InputText, {\n ref: \"input\",\n id: _ctx.inputId,\n role: \"spinbutton\",\n \"class\": normalizeClass([_ctx.cx('pcInput'), _ctx.inputClass]),\n style: normalizeStyle(_ctx.inputStyle),\n value: $options.formattedValue,\n \"aria-valuemin\": _ctx.min,\n \"aria-valuemax\": _ctx.max,\n \"aria-valuenow\": _ctx.modelValue,\n inputmode: _ctx.mode === 'decimal' && !_ctx.minFractionDigits ? 'numeric' : 'decimal',\n disabled: _ctx.disabled,\n readonly: _ctx.readonly,\n placeholder: _ctx.placeholder,\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-label\": _ctx.ariaLabel,\n invalid: _ctx.invalid,\n variant: _ctx.variant,\n onInput: $options.onUserInput,\n onKeydown: $options.onInputKeyDown,\n onKeypress: $options.onInputKeyPress,\n onPaste: $options.onPaste,\n onClick: $options.onInputClick,\n onFocus: $options.onInputFocus,\n onBlur: $options.onInputBlur,\n pt: _ctx.ptm('pcInput'),\n unstyled: _ctx.unstyled\n }, null, 8, [\"id\", \"class\", \"style\", \"value\", \"aria-valuemin\", \"aria-valuemax\", \"aria-valuenow\", \"inputmode\", \"disabled\", \"readonly\", \"placeholder\", \"aria-labelledby\", \"aria-label\", \"invalid\", \"variant\", \"onInput\", \"onKeydown\", \"onKeypress\", \"onPaste\", \"onClick\", \"onFocus\", \"onBlur\", \"pt\", \"unstyled\"]), _ctx.showButtons && _ctx.buttonLayout === 'stacked' ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('buttonGroup')\n }, _ctx.ptm('buttonGroup')), [renderSlot(_ctx.$slots, \"incrementbutton\", {\n listeners: $options.upButtonListeners\n }, function () {\n return [createElementVNode(\"button\", mergeProps({\n \"class\": [_ctx.cx('incrementButton'), _ctx.incrementButtonClass]\n }, toHandlers($options.upButtonListeners, true), {\n disabled: _ctx.disabled,\n tabindex: -1,\n \"aria-hidden\": \"true\",\n type: \"button\"\n }, _ctx.ptm('incrementButton')), [renderSlot(_ctx.$slots, _ctx.$slots.incrementicon ? 'incrementicon' : 'incrementbuttonicon', {}, function () {\n return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.incrementIcon || _ctx.incrementButtonIcon ? 'span' : 'AngleUpIcon'), mergeProps({\n \"class\": [_ctx.incrementIcon, _ctx.incrementButtonIcon]\n }, _ctx.ptm('incrementIcon'), {\n \"data-pc-section\": \"incrementicon\"\n }), null, 16, [\"class\"]))];\n })], 16, _hoisted_1)];\n }), renderSlot(_ctx.$slots, \"decrementbutton\", {\n listeners: $options.downButtonListeners\n }, function () {\n return [createElementVNode(\"button\", mergeProps({\n \"class\": [_ctx.cx('decrementButton'), _ctx.decrementButtonClass]\n }, toHandlers($options.downButtonListeners, true), {\n disabled: _ctx.disabled,\n tabindex: -1,\n \"aria-hidden\": \"true\",\n type: \"button\"\n }, _ctx.ptm('decrementButton')), [renderSlot(_ctx.$slots, _ctx.$slots.decrementicon ? 'decrementicon' : 'decrementbuttonicon', {}, function () {\n return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.decrementIcon || _ctx.decrementButtonIcon ? 'span' : 'AngleDownIcon'), mergeProps({\n \"class\": [_ctx.decrementIcon, _ctx.decrementButtonIcon]\n }, _ctx.ptm('decrementIcon'), {\n \"data-pc-section\": \"decrementicon\"\n }), null, 16, [\"class\"]))];\n })], 16, _hoisted_2)];\n })], 16)) : createCommentVNode(\"\", true), renderSlot(_ctx.$slots, \"incrementbutton\", {\n listeners: $options.upButtonListeners\n }, function () {\n return [_ctx.showButtons && _ctx.buttonLayout !== 'stacked' ? (openBlock(), createElementBlock(\"button\", mergeProps({\n key: 0,\n \"class\": [_ctx.cx('incrementButton'), _ctx.incrementButtonClass]\n }, toHandlers($options.upButtonListeners, true), {\n disabled: _ctx.disabled,\n tabindex: -1,\n \"aria-hidden\": \"true\",\n type: \"button\"\n }, _ctx.ptm('incrementButton')), [renderSlot(_ctx.$slots, _ctx.$slots.incrementicon ? 'incrementicon' : 'incrementbuttonicon', {}, function () {\n return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.incrementIcon || _ctx.incrementButtonIcon ? 'span' : 'AngleUpIcon'), mergeProps({\n \"class\": [_ctx.incrementIcon, _ctx.incrementButtonIcon]\n }, _ctx.ptm('incrementIcon'), {\n \"data-pc-section\": \"incrementicon\"\n }), null, 16, [\"class\"]))];\n })], 16, _hoisted_3)) : createCommentVNode(\"\", true)];\n }), renderSlot(_ctx.$slots, \"decrementbutton\", {\n listeners: $options.downButtonListeners\n }, function () {\n return [_ctx.showButtons && _ctx.buttonLayout !== 'stacked' ? (openBlock(), createElementBlock(\"button\", mergeProps({\n key: 0,\n \"class\": [_ctx.cx('decrementButton'), _ctx.decrementButtonClass]\n }, toHandlers($options.downButtonListeners, true), {\n disabled: _ctx.disabled,\n tabindex: -1,\n \"aria-hidden\": \"true\",\n type: \"button\"\n }, _ctx.ptm('decrementButton')), [renderSlot(_ctx.$slots, _ctx.$slots.decrementicon ? 'decrementicon' : 'decrementbuttonicon', {}, function () {\n return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.decrementIcon || _ctx.decrementButtonIcon ? 'span' : 'AngleDownIcon'), mergeProps({\n \"class\": [_ctx.decrementIcon, _ctx.decrementButtonIcon]\n }, _ctx.ptm('decrementIcon'), {\n \"data-pc-section\": \"decrementicon\"\n }), null, 16, [\"class\"]))];\n })], 16, _hoisted_4)) : createCommentVNode(\"\", true)];\n })], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseIcon from '@primevue/icons/baseicon';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode } from 'vue';\n\nvar script = {\n name: 'ChevronDownIcon',\n \"extends\": BaseIcon\n};\n\nvar _hoisted_1 = /*#__PURE__*/createElementVNode(\"path\", {\n d: \"M7.01744 10.398C6.91269 10.3985 6.8089 10.378 6.71215 10.3379C6.61541 10.2977 6.52766 10.2386 6.45405 10.1641L1.13907 4.84913C1.03306 4.69404 0.985221 4.5065 1.00399 4.31958C1.02276 4.13266 1.10693 3.95838 1.24166 3.82747C1.37639 3.69655 1.55301 3.61742 1.74039 3.60402C1.92777 3.59062 2.11386 3.64382 2.26584 3.75424L7.01744 8.47394L11.769 3.75424C11.9189 3.65709 12.097 3.61306 12.2748 3.62921C12.4527 3.64535 12.6199 3.72073 12.7498 3.84328C12.8797 3.96582 12.9647 4.12842 12.9912 4.30502C13.0177 4.48162 12.9841 4.662 12.8958 4.81724L7.58083 10.1322C7.50996 10.2125 7.42344 10.2775 7.32656 10.3232C7.22968 10.3689 7.12449 10.3944 7.01744 10.398Z\",\n fill: \"currentColor\"\n}, null, -1);\nvar _hoisted_2 = [_hoisted_1];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"svg\", mergeProps({\n width: \"14\",\n height: \"14\",\n viewBox: \"0 0 14 14\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, _ctx.pti()), _hoisted_2, 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseIcon from '@primevue/icons/baseicon';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode } from 'vue';\n\nvar script = {\n name: 'TimesIcon',\n \"extends\": BaseIcon\n};\n\nvar _hoisted_1 = /*#__PURE__*/createElementVNode(\"path\", {\n d: \"M8.01186 7.00933L12.27 2.75116C12.341 2.68501 12.398 2.60524 12.4375 2.51661C12.4769 2.42798 12.4982 2.3323 12.4999 2.23529C12.5016 2.13827 12.4838 2.0419 12.4474 1.95194C12.4111 1.86197 12.357 1.78024 12.2884 1.71163C12.2198 1.64302 12.138 1.58893 12.0481 1.55259C11.9581 1.51625 11.8617 1.4984 11.7647 1.50011C11.6677 1.50182 11.572 1.52306 11.4834 1.56255C11.3948 1.60204 11.315 1.65898 11.2488 1.72997L6.99067 5.98814L2.7325 1.72997C2.59553 1.60234 2.41437 1.53286 2.22718 1.53616C2.03999 1.53946 1.8614 1.61529 1.72901 1.74767C1.59663 1.88006 1.5208 2.05865 1.5175 2.24584C1.5142 2.43303 1.58368 2.61419 1.71131 2.75116L5.96948 7.00933L1.71131 11.2675C1.576 11.403 1.5 11.5866 1.5 11.7781C1.5 11.9696 1.576 12.1532 1.71131 12.2887C1.84679 12.424 2.03043 12.5 2.2219 12.5C2.41338 12.5 2.59702 12.424 2.7325 12.2887L6.99067 8.03052L11.2488 12.2887C11.3843 12.424 11.568 12.5 11.7594 12.5C11.9509 12.5 12.1346 12.424 12.27 12.2887C12.4053 12.1532 12.4813 11.9696 12.4813 11.7781C12.4813 11.5866 12.4053 11.403 12.27 11.2675L8.01186 7.00933Z\",\n fill: \"currentColor\"\n}, null, -1);\nvar _hoisted_2 = [_hoisted_1];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"svg\", mergeProps({\n width: \"14\",\n height: \"14\",\n viewBox: \"0 0 14 14\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, _ctx.pti()), _hoisted_2, 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import { EventBus } from '@primeuix/utils/eventbus';\n\nvar OverlayEventBus = EventBus();\n\nexport { OverlayEventBus as default };\n//# sourceMappingURL=index.mjs.map\n","import { isClient } from '@primeuix/utils/dom';\nimport { renderSlot, openBlock, createBlock, Teleport, createCommentVNode } from 'vue';\n\nvar script = {\n name: 'Portal',\n props: {\n appendTo: {\n type: [String, Object],\n \"default\": 'body'\n },\n disabled: {\n type: Boolean,\n \"default\": false\n }\n },\n data: function data() {\n return {\n mounted: false\n };\n },\n mounted: function mounted() {\n this.mounted = isClient();\n },\n computed: {\n inline: function inline() {\n return this.disabled || this.appendTo === 'self';\n }\n }\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return $options.inline ? renderSlot(_ctx.$slots, \"default\", {\n key: 0\n }) : $data.mounted ? (openBlock(), createBlock(Teleport, {\n key: 1,\n to: $props.appendTo\n }, [renderSlot(_ctx.$slots, \"default\")], 8, [\"to\"])) : createCommentVNode(\"\", true);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-select {\\n display: inline-flex;\\n cursor: pointer;\\n position: relative;\\n user-select: none;\\n background: \".concat(dt('select.background'), \";\\n border: 1px solid \").concat(dt('select.border.color'), \";\\n transition: background \").concat(dt('select.transition.duration'), \", color \").concat(dt('select.transition.duration'), \", border-color \").concat(dt('select.transition.duration'), \",\\n outline-color \").concat(dt('select.transition.duration'), \", box-shadow \").concat(dt('select.transition.duration'), \";\\n border-radius: \").concat(dt('select.border.radius'), \";\\n outline-color: transparent;\\n box-shadow: \").concat(dt('select.shadow'), \";\\n}\\n\\n.p-select:not(.p-disabled):hover {\\n border-color: \").concat(dt('select.hover.border.color'), \";\\n}\\n\\n.p-select:not(.p-disabled).p-focus {\\n border-color: \").concat(dt('select.focus.border.color'), \";\\n box-shadow: \").concat(dt('select.focus.ring.shadow'), \";\\n outline: \").concat(dt('select.focus.ring.width'), \" \").concat(dt('select.focus.ring.style'), \" \").concat(dt('select.focus.ring.color'), \";\\n outline-offset: \").concat(dt('select.focus.ring.offset'), \";\\n}\\n\\n.p-select.p-variant-filled {\\n background: \").concat(dt('select.filled.background'), \";\\n}\\n\\n.p-select.p-variant-filled.p-focus {\\n background: \").concat(dt('select.filled.focus.background'), \";\\n}\\n\\n.p-select.p-invalid {\\n border-color: \").concat(dt('select.invalid.border.color'), \";\\n}\\n\\n.p-select.p-disabled {\\n opacity: 1;\\n background: \").concat(dt('select.disabled.background'), \";\\n}\\n\\n.p-select-clear-icon {\\n position: absolute;\\n top: 50%;\\n margin-top: -0.5rem;\\n color: \").concat(dt('select.clear.icon.color'), \";\\n right: \").concat(dt('select.dropdown.width'), \";\\n}\\n\\n.p-select-dropdown {\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n flex-shrink: 0;\\n background: transparent;\\n color: \").concat(dt('select.dropdown.color'), \";\\n width: \").concat(dt('select.dropdown.width'), \";\\n border-top-right-radius: \").concat(dt('select.border.radius'), \";\\n border-bottom-right-radius: \").concat(dt('select.border.radius'), \";\\n}\\n\\n.p-select-label {\\n display: block;\\n white-space: nowrap;\\n overflow: hidden;\\n flex: 1 1 auto;\\n width: 1%;\\n padding: \").concat(dt('select.padding.y'), \" \").concat(dt('select.padding.x'), \";\\n text-overflow: ellipsis;\\n cursor: pointer;\\n color: \").concat(dt('select.color'), \";\\n background: transparent;\\n border: 0 none;\\n outline: 0 none;\\n}\\n\\n.p-select-label.p-placeholder {\\n color: \").concat(dt('select.placeholder.color'), \";\\n}\\n\\n.p-select:has(.p-select-clear-icon) .p-select-label {\\n padding-right: calc(1rem + \").concat(dt('select.padding.x'), \");\\n}\\n\\n.p-select.p-disabled .p-select-label {\\n color: \").concat(dt('select.disabled.color'), \";\\n}\\n\\n.p-select-label-empty {\\n overflow: hidden;\\n opacity: 0;\\n}\\n\\ninput.p-select-label {\\n cursor: default;\\n}\\n\\n.p-select .p-select-overlay {\\n min-width: 100%;\\n}\\n\\n.p-select-overlay {\\n position: absolute;\\n top: 0;\\n left: 0;\\n background: \").concat(dt('select.overlay.background'), \";\\n color: \").concat(dt('select.overlay.color'), \";\\n border: 1px solid \").concat(dt('select.overlay.border.color'), \";\\n border-radius: \").concat(dt('select.overlay.border.radius'), \";\\n box-shadow: \").concat(dt('select.overlay.shadow'), \";\\n}\\n\\n.p-select-header {\\n padding: \").concat(dt('select.list.header.padding'), \";\\n}\\n\\n.p-select-filter {\\n width: 100%;\\n}\\n\\n.p-select-list-container {\\n overflow: auto;\\n}\\n\\n.p-select-option-group {\\n cursor: auto;\\n margin: 0;\\n padding: \").concat(dt('select.option.group.padding'), \";\\n background: \").concat(dt('select.option.group.background'), \";\\n color: \").concat(dt('select.option.group.color'), \";\\n font-weight: \").concat(dt('select.option.group.font.weight'), \";\\n}\\n\\n.p-select-list {\\n margin: 0;\\n padding: 0;\\n list-style-type: none;\\n padding: \").concat(dt('select.list.padding'), \";\\n gap: \").concat(dt('select.list.gap'), \";\\n display: flex;\\n flex-direction: column;\\n}\\n\\n.p-select-option {\\n cursor: pointer;\\n font-weight: normal;\\n white-space: nowrap;\\n position: relative;\\n overflow: hidden;\\n display: flex;\\n align-items: center;\\n padding: \").concat(dt('select.option.padding'), \";\\n border: 0 none;\\n color: \").concat(dt('select.option.color'), \";\\n background: transparent;\\n transition: background \").concat(dt('select.transition.duration'), \", color \").concat(dt('select.transition.duration'), \", border-color \").concat(dt('select.transition.duration'), \",\\n box-shadow \").concat(dt('select.transition.duration'), \", outline-color \").concat(dt('select.transition.duration'), \";\\n border-radius: \").concat(dt('select.option.border.radius'), \";\\n}\\n\\n.p-select-option:not(.p-select-option-selected):not(.p-disabled).p-focus {\\n background: \").concat(dt('select.option.focus.background'), \";\\n color: \").concat(dt('select.option.focus.color'), \";\\n}\\n\\n.p-select-option.p-select-option-selected {\\n background: \").concat(dt('select.option.selected.background'), \";\\n color: \").concat(dt('select.option.selected.color'), \";\\n}\\n\\n.p-select-option.p-select-option-selected.p-focus {\\n background: \").concat(dt('select.option.selected.focus.background'), \";\\n color: \").concat(dt('select.option.selected.focus.color'), \";\\n}\\n\\n.p-select-option-check-icon {\\n position: relative;\\n margin-inline-start: \").concat(dt('select.checkmark.gutter.start'), \";\\n margin-inline-end: \").concat(dt('select.checkmark.gutter.end'), \";\\n color: \").concat(dt('select.checkmark.color'), \";\\n}\\n\\n.p-select-empty-message {\\n padding: \").concat(dt('select.empty.message.padding'), \";\\n}\\n\\n.p-select-fluid {\\n display: flex;\\n}\\n\");\n};\nvar classes = {\n root: function root(_ref2) {\n var instance = _ref2.instance,\n props = _ref2.props,\n state = _ref2.state;\n return ['p-select p-component p-inputwrapper', {\n 'p-disabled': props.disabled,\n 'p-invalid': props.invalid,\n 'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled' || instance.$primevue.config.inputVariant === 'filled',\n 'p-focus': state.focused,\n 'p-inputwrapper-filled': instance.hasSelectedOption,\n 'p-inputwrapper-focus': state.focused || state.overlayVisible,\n 'p-select-open': state.overlayVisible,\n 'p-select-fluid': instance.hasFluid\n }];\n },\n label: function label(_ref3) {\n var instance = _ref3.instance,\n props = _ref3.props;\n return ['p-select-label', {\n 'p-placeholder': !props.editable && instance.label === props.placeholder,\n 'p-select-label-empty': !props.editable && !instance.$slots['value'] && (instance.label === 'p-emptylabel' || instance.label.length === 0)\n }];\n },\n clearIcon: 'p-select-clear-icon',\n dropdown: 'p-select-dropdown',\n loadingicon: 'p-select-loading-icon',\n dropdownIcon: 'p-select-dropdown-icon',\n overlay: 'p-select-overlay p-component',\n header: 'p-select-header',\n pcFilter: 'p-select-filter',\n listContainer: 'p-select-list-container',\n list: 'p-select-list',\n optionGroup: 'p-select-option-group',\n optionGroupLabel: 'p-select-option-group-label',\n option: function option(_ref4) {\n var instance = _ref4.instance,\n props = _ref4.props,\n state = _ref4.state,\n _option = _ref4.option,\n focusedOption = _ref4.focusedOption;\n return ['p-select-option', {\n 'p-select-option-selected': instance.isSelected(_option) && props.highlightOnSelect,\n 'p-focus': state.focusedOptionIndex === focusedOption,\n 'p-disabled': instance.isOptionDisabled(_option)\n }];\n },\n optionLabel: 'p-select-option-label',\n optionCheckIcon: 'p-select-option-check-icon',\n optionBlankIcon: 'p-select-option-blank-icon',\n emptyMessage: 'p-select-empty-message'\n};\nvar SelectStyle = BaseStyle.extend({\n name: 'select',\n theme: theme,\n classes: classes\n});\n\nexport { SelectStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { focus, isAndroid, getFirstFocusableElement, getLastFocusableElement, addStyle, relativePosition, getOuterWidth, absolutePosition, isTouchDevice, isVisible, getFocusableElements, findSingle } from '@primeuix/utils/dom';\nimport { resolveFieldData, isPrintableCharacter, isNotEmpty, equals, findLastIndex, isEmpty } from '@primeuix/utils/object';\nimport { ZIndex } from '@primeuix/utils/zindex';\nimport { FilterService } from '@primevue/core/api';\nimport { UniqueComponentId, ConnectedOverlayScrollHandler } from '@primevue/core/utils';\nimport BlankIcon from '@primevue/icons/blank';\nimport CheckIcon from '@primevue/icons/check';\nimport ChevronDownIcon from '@primevue/icons/chevrondown';\nimport SearchIcon from '@primevue/icons/search';\nimport SpinnerIcon from '@primevue/icons/spinner';\nimport TimesIcon from '@primevue/icons/times';\nimport IconField from 'primevue/iconfield';\nimport InputIcon from 'primevue/inputicon';\nimport InputText from 'primevue/inputtext';\nimport OverlayEventBus from 'primevue/overlayeventbus';\nimport Portal from 'primevue/portal';\nimport Ripple from 'primevue/ripple';\nimport VirtualScroller from 'primevue/virtualscroller';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport SelectStyle from 'primevue/select/style';\nimport { resolveComponent, resolveDirective, openBlock, createElementBlock, mergeProps, renderSlot, createTextVNode, toDisplayString, normalizeClass, createBlock, resolveDynamicComponent, createCommentVNode, createElementVNode, createVNode, withCtx, Transition, normalizeProps, createSlots, Fragment, renderList, withDirectives } from 'vue';\n\nvar script$1 = {\n name: 'BaseSelect',\n \"extends\": BaseComponent,\n props: {\n modelValue: null,\n options: Array,\n optionLabel: [String, Function],\n optionValue: [String, Function],\n optionDisabled: [String, Function],\n optionGroupLabel: [String, Function],\n optionGroupChildren: [String, Function],\n scrollHeight: {\n type: String,\n \"default\": '14rem'\n },\n filter: Boolean,\n filterPlaceholder: String,\n filterLocale: String,\n filterMatchMode: {\n type: String,\n \"default\": 'contains'\n },\n filterFields: {\n type: Array,\n \"default\": null\n },\n editable: Boolean,\n placeholder: {\n type: String,\n \"default\": null\n },\n variant: {\n type: String,\n \"default\": null\n },\n invalid: {\n type: Boolean,\n \"default\": false\n },\n disabled: {\n type: Boolean,\n \"default\": false\n },\n dataKey: null,\n showClear: {\n type: Boolean,\n \"default\": false\n },\n fluid: {\n type: Boolean,\n \"default\": null\n },\n inputId: {\n type: String,\n \"default\": null\n },\n inputClass: {\n type: [String, Object],\n \"default\": null\n },\n inputStyle: {\n type: Object,\n \"default\": null\n },\n labelId: {\n type: String,\n \"default\": null\n },\n labelClass: {\n type: [String, Object],\n \"default\": null\n },\n labelStyle: {\n type: Object,\n \"default\": null\n },\n panelClass: {\n type: [String, Object],\n \"default\": null\n },\n overlayStyle: {\n type: Object,\n \"default\": null\n },\n overlayClass: {\n type: [String, Object],\n \"default\": null\n },\n panelStyle: {\n type: Object,\n \"default\": null\n },\n appendTo: {\n type: [String, Object],\n \"default\": 'body'\n },\n loading: {\n type: Boolean,\n \"default\": false\n },\n clearIcon: {\n type: String,\n \"default\": undefined\n },\n dropdownIcon: {\n type: String,\n \"default\": undefined\n },\n filterIcon: {\n type: String,\n \"default\": undefined\n },\n loadingIcon: {\n type: String,\n \"default\": undefined\n },\n resetFilterOnHide: {\n type: Boolean,\n \"default\": false\n },\n resetFilterOnClear: {\n type: Boolean,\n \"default\": false\n },\n virtualScrollerOptions: {\n type: Object,\n \"default\": null\n },\n autoOptionFocus: {\n type: Boolean,\n \"default\": false\n },\n autoFilterFocus: {\n type: Boolean,\n \"default\": false\n },\n selectOnFocus: {\n type: Boolean,\n \"default\": false\n },\n focusOnHover: {\n type: Boolean,\n \"default\": true\n },\n highlightOnSelect: {\n type: Boolean,\n \"default\": true\n },\n checkmark: {\n type: Boolean,\n \"default\": false\n },\n filterMessage: {\n type: String,\n \"default\": null\n },\n selectionMessage: {\n type: String,\n \"default\": null\n },\n emptySelectionMessage: {\n type: String,\n \"default\": null\n },\n emptyFilterMessage: {\n type: String,\n \"default\": null\n },\n emptyMessage: {\n type: String,\n \"default\": null\n },\n tabindex: {\n type: Number,\n \"default\": 0\n },\n ariaLabel: {\n type: String,\n \"default\": null\n },\n ariaLabelledby: {\n type: String,\n \"default\": null\n }\n },\n style: SelectStyle,\n provide: function provide() {\n return {\n $pcSelect: this,\n $parentInstance: this\n };\n }\n};\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _iterableToArray(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar script = {\n name: 'Select',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['update:modelValue', 'change', 'focus', 'blur', 'before-show', 'before-hide', 'show', 'hide', 'filter'],\n inject: {\n $pcFluid: {\n \"default\": null\n }\n },\n outsideClickListener: null,\n scrollHandler: null,\n resizeListener: null,\n labelClickListener: null,\n overlay: null,\n list: null,\n virtualScroller: null,\n searchTimeout: null,\n searchValue: null,\n isModelValueChanged: false,\n data: function data() {\n return {\n id: this.$attrs.id,\n clicked: false,\n focused: false,\n focusedOptionIndex: -1,\n filterValue: null,\n overlayVisible: false\n };\n },\n watch: {\n '$attrs.id': function $attrsId(newValue) {\n this.id = newValue || UniqueComponentId();\n },\n modelValue: function modelValue() {\n this.isModelValueChanged = true;\n },\n options: function options() {\n this.autoUpdateModel();\n }\n },\n mounted: function mounted() {\n this.id = this.id || UniqueComponentId();\n this.autoUpdateModel();\n this.bindLabelClickListener();\n },\n updated: function updated() {\n if (this.overlayVisible && this.isModelValueChanged) {\n this.scrollInView(this.findSelectedOptionIndex());\n }\n this.isModelValueChanged = false;\n },\n beforeUnmount: function beforeUnmount() {\n this.unbindOutsideClickListener();\n this.unbindResizeListener();\n this.unbindLabelClickListener();\n if (this.scrollHandler) {\n this.scrollHandler.destroy();\n this.scrollHandler = null;\n }\n if (this.overlay) {\n ZIndex.clear(this.overlay);\n this.overlay = null;\n }\n },\n methods: {\n getOptionIndex: function getOptionIndex(index, fn) {\n return this.virtualScrollerDisabled ? index : fn && fn(index)['index'];\n },\n getOptionLabel: function getOptionLabel(option) {\n return this.optionLabel ? resolveFieldData(option, this.optionLabel) : option;\n },\n getOptionValue: function getOptionValue(option) {\n return this.optionValue ? resolveFieldData(option, this.optionValue) : option;\n },\n getOptionRenderKey: function getOptionRenderKey(option, index) {\n return (this.dataKey ? resolveFieldData(option, this.dataKey) : this.getOptionLabel(option)) + '_' + index;\n },\n getPTItemOptions: function getPTItemOptions(option, itemOptions, index, key) {\n return this.ptm(key, {\n context: {\n option: option,\n index: index,\n selected: this.isSelected(option),\n focused: this.focusedOptionIndex === this.getOptionIndex(index, itemOptions),\n disabled: this.isOptionDisabled(option)\n }\n });\n },\n isOptionDisabled: function isOptionDisabled(option) {\n return this.optionDisabled ? resolveFieldData(option, this.optionDisabled) : false;\n },\n isOptionGroup: function isOptionGroup(option) {\n return this.optionGroupLabel && option.optionGroup && option.group;\n },\n getOptionGroupLabel: function getOptionGroupLabel(optionGroup) {\n return resolveFieldData(optionGroup, this.optionGroupLabel);\n },\n getOptionGroupChildren: function getOptionGroupChildren(optionGroup) {\n return resolveFieldData(optionGroup, this.optionGroupChildren);\n },\n getAriaPosInset: function getAriaPosInset(index) {\n var _this = this;\n return (this.optionGroupLabel ? index - this.visibleOptions.slice(0, index).filter(function (option) {\n return _this.isOptionGroup(option);\n }).length : index) + 1;\n },\n show: function show(isFocus) {\n this.$emit('before-show');\n this.overlayVisible = true;\n this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : this.editable ? -1 : this.findSelectedOptionIndex();\n isFocus && focus(this.$refs.focusInput);\n },\n hide: function hide(isFocus) {\n var _this2 = this;\n var _hide = function _hide() {\n _this2.$emit('before-hide');\n _this2.overlayVisible = false;\n _this2.clicked = false;\n _this2.focusedOptionIndex = -1;\n _this2.searchValue = '';\n _this2.resetFilterOnHide && (_this2.filterValue = null);\n isFocus && focus(_this2.$refs.focusInput);\n };\n setTimeout(function () {\n _hide();\n }, 0); // For ScreenReaders\n },\n onFocus: function onFocus(event) {\n if (this.disabled) {\n // For ScreenReaders\n return;\n }\n this.focused = true;\n if (this.overlayVisible) {\n this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : this.editable ? -1 : this.findSelectedOptionIndex();\n this.scrollInView(this.focusedOptionIndex);\n }\n this.$emit('focus', event);\n },\n onBlur: function onBlur(event) {\n this.focused = false;\n this.focusedOptionIndex = -1;\n this.searchValue = '';\n this.$emit('blur', event);\n },\n onKeyDown: function onKeyDown(event) {\n if (this.disabled || isAndroid()) {\n event.preventDefault();\n return;\n }\n var metaKey = event.metaKey || event.ctrlKey;\n switch (event.code) {\n case 'ArrowDown':\n this.onArrowDownKey(event);\n break;\n case 'ArrowUp':\n this.onArrowUpKey(event, this.editable);\n break;\n case 'ArrowLeft':\n case 'ArrowRight':\n this.onArrowLeftKey(event, this.editable);\n break;\n case 'Home':\n this.onHomeKey(event, this.editable);\n break;\n case 'End':\n this.onEndKey(event, this.editable);\n break;\n case 'PageDown':\n this.onPageDownKey(event);\n break;\n case 'PageUp':\n this.onPageUpKey(event);\n break;\n case 'Space':\n this.onSpaceKey(event, this.editable);\n break;\n case 'Enter':\n case 'NumpadEnter':\n this.onEnterKey(event);\n break;\n case 'Escape':\n this.onEscapeKey(event);\n break;\n case 'Tab':\n this.onTabKey(event);\n break;\n case 'Backspace':\n this.onBackspaceKey(event, this.editable);\n break;\n case 'ShiftLeft':\n case 'ShiftRight':\n //NOOP\n break;\n default:\n if (!metaKey && isPrintableCharacter(event.key)) {\n !this.overlayVisible && this.show();\n !this.editable && this.searchOptions(event, event.key);\n }\n break;\n }\n this.clicked = false;\n },\n onEditableInput: function onEditableInput(event) {\n var value = event.target.value;\n this.searchValue = '';\n var matched = this.searchOptions(event, value);\n !matched && (this.focusedOptionIndex = -1);\n this.updateModel(event, value);\n !this.overlayVisible && isNotEmpty(value) && this.show();\n },\n onContainerClick: function onContainerClick(event) {\n if (this.disabled || this.loading) {\n return;\n }\n if (event.target.tagName === 'INPUT' || event.target.getAttribute('data-pc-section') === 'clearicon' || event.target.closest('[data-pc-section=\"clearicon\"]')) {\n return;\n } else if (!this.overlay || !this.overlay.contains(event.target)) {\n this.overlayVisible ? this.hide(true) : this.show(true);\n }\n this.clicked = true;\n },\n onClearClick: function onClearClick(event) {\n this.updateModel(event, null);\n this.resetFilterOnClear && (this.filterValue = null);\n },\n onFirstHiddenFocus: function onFirstHiddenFocus(event) {\n var focusableEl = event.relatedTarget === this.$refs.focusInput ? getFirstFocusableElement(this.overlay, ':not([data-p-hidden-focusable=\"true\"])') : this.$refs.focusInput;\n focus(focusableEl);\n },\n onLastHiddenFocus: function onLastHiddenFocus(event) {\n var focusableEl = event.relatedTarget === this.$refs.focusInput ? getLastFocusableElement(this.overlay, ':not([data-p-hidden-focusable=\"true\"])') : this.$refs.focusInput;\n focus(focusableEl);\n },\n onOptionSelect: function onOptionSelect(event, option) {\n var isHide = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n var value = this.getOptionValue(option);\n this.updateModel(event, value);\n isHide && this.hide(true);\n },\n onOptionMouseMove: function onOptionMouseMove(event, index) {\n if (this.focusOnHover) {\n this.changeFocusedOptionIndex(event, index);\n }\n },\n onFilterChange: function onFilterChange(event) {\n var value = event.target.value;\n this.filterValue = value;\n this.focusedOptionIndex = -1;\n this.$emit('filter', {\n originalEvent: event,\n value: value\n });\n !this.virtualScrollerDisabled && this.virtualScroller.scrollToIndex(0);\n },\n onFilterKeyDown: function onFilterKeyDown(event) {\n switch (event.code) {\n case 'ArrowDown':\n this.onArrowDownKey(event);\n break;\n case 'ArrowUp':\n this.onArrowUpKey(event, true);\n break;\n case 'ArrowLeft':\n case 'ArrowRight':\n this.onArrowLeftKey(event, true);\n break;\n case 'Home':\n this.onHomeKey(event, true);\n break;\n case 'End':\n this.onEndKey(event, true);\n break;\n case 'Enter':\n case 'NumpadEnter':\n this.onEnterKey(event);\n break;\n case 'Escape':\n this.onEscapeKey(event);\n break;\n case 'Tab':\n this.onTabKey(event, true);\n break;\n }\n },\n onFilterBlur: function onFilterBlur() {\n this.focusedOptionIndex = -1;\n },\n onFilterUpdated: function onFilterUpdated() {\n if (this.overlayVisible) {\n this.alignOverlay();\n }\n },\n onOverlayClick: function onOverlayClick(event) {\n OverlayEventBus.emit('overlay-click', {\n originalEvent: event,\n target: this.$el\n });\n },\n onOverlayKeyDown: function onOverlayKeyDown(event) {\n switch (event.code) {\n case 'Escape':\n this.onEscapeKey(event);\n break;\n }\n },\n onArrowDownKey: function onArrowDownKey(event) {\n if (!this.overlayVisible) {\n this.show();\n this.editable && this.changeFocusedOptionIndex(event, this.findSelectedOptionIndex());\n } else {\n var optionIndex = this.focusedOptionIndex !== -1 ? this.findNextOptionIndex(this.focusedOptionIndex) : this.clicked ? this.findFirstOptionIndex() : this.findFirstFocusedOptionIndex();\n this.changeFocusedOptionIndex(event, optionIndex);\n }\n event.preventDefault();\n },\n onArrowUpKey: function onArrowUpKey(event) {\n var pressedInInputText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n if (event.altKey && !pressedInInputText) {\n if (this.focusedOptionIndex !== -1) {\n this.onOptionSelect(event, this.visibleOptions[this.focusedOptionIndex]);\n }\n this.overlayVisible && this.hide();\n event.preventDefault();\n } else {\n var optionIndex = this.focusedOptionIndex !== -1 ? this.findPrevOptionIndex(this.focusedOptionIndex) : this.clicked ? this.findLastOptionIndex() : this.findLastFocusedOptionIndex();\n this.changeFocusedOptionIndex(event, optionIndex);\n !this.overlayVisible && this.show();\n event.preventDefault();\n }\n },\n onArrowLeftKey: function onArrowLeftKey(event) {\n var pressedInInputText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n pressedInInputText && (this.focusedOptionIndex = -1);\n },\n onHomeKey: function onHomeKey(event) {\n var pressedInInputText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n if (pressedInInputText) {\n var target = event.currentTarget;\n if (event.shiftKey) {\n target.setSelectionRange(0, event.target.selectionStart);\n } else {\n target.setSelectionRange(0, 0);\n this.focusedOptionIndex = -1;\n }\n } else {\n this.changeFocusedOptionIndex(event, this.findFirstOptionIndex());\n !this.overlayVisible && this.show();\n }\n event.preventDefault();\n },\n onEndKey: function onEndKey(event) {\n var pressedInInputText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n if (pressedInInputText) {\n var target = event.currentTarget;\n if (event.shiftKey) {\n target.setSelectionRange(event.target.selectionStart, target.value.length);\n } else {\n var len = target.value.length;\n target.setSelectionRange(len, len);\n this.focusedOptionIndex = -1;\n }\n } else {\n this.changeFocusedOptionIndex(event, this.findLastOptionIndex());\n !this.overlayVisible && this.show();\n }\n event.preventDefault();\n },\n onPageUpKey: function onPageUpKey(event) {\n this.scrollInView(0);\n event.preventDefault();\n },\n onPageDownKey: function onPageDownKey(event) {\n this.scrollInView(this.visibleOptions.length - 1);\n event.preventDefault();\n },\n onEnterKey: function onEnterKey(event) {\n if (!this.overlayVisible) {\n this.focusedOptionIndex = -1; // reset\n this.onArrowDownKey(event);\n } else {\n if (this.focusedOptionIndex !== -1) {\n this.onOptionSelect(event, this.visibleOptions[this.focusedOptionIndex]);\n }\n this.hide();\n }\n event.preventDefault();\n },\n onSpaceKey: function onSpaceKey(event) {\n var pressedInInputText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n !pressedInInputText && this.onEnterKey(event);\n },\n onEscapeKey: function onEscapeKey(event) {\n this.overlayVisible && this.hide(true);\n event.preventDefault();\n event.stopPropagation(); //@todo will be changed next versionss\n },\n onTabKey: function onTabKey(event) {\n var pressedInInputText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n if (!pressedInInputText) {\n if (this.overlayVisible && this.hasFocusableElements()) {\n focus(this.$refs.firstHiddenFocusableElementOnOverlay);\n event.preventDefault();\n } else {\n if (this.focusedOptionIndex !== -1) {\n this.onOptionSelect(event, this.visibleOptions[this.focusedOptionIndex]);\n }\n this.overlayVisible && this.hide(this.filter);\n }\n }\n },\n onBackspaceKey: function onBackspaceKey(event) {\n var pressedInInputText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n if (pressedInInputText) {\n !this.overlayVisible && this.show();\n }\n },\n onOverlayEnter: function onOverlayEnter(el) {\n ZIndex.set('overlay', el, this.$primevue.config.zIndex.overlay);\n addStyle(el, {\n position: 'absolute',\n top: '0',\n left: '0'\n });\n this.alignOverlay();\n this.scrollInView();\n this.autoFilterFocus && focus(this.$refs.filterInput.$el);\n },\n onOverlayAfterEnter: function onOverlayAfterEnter() {\n this.bindOutsideClickListener();\n this.bindScrollListener();\n this.bindResizeListener();\n this.$emit('show');\n },\n onOverlayLeave: function onOverlayLeave() {\n this.unbindOutsideClickListener();\n this.unbindScrollListener();\n this.unbindResizeListener();\n this.autoFilterFocus && focus(this.$refs.focusInput);\n this.$emit('hide');\n this.overlay = null;\n },\n onOverlayAfterLeave: function onOverlayAfterLeave(el) {\n ZIndex.clear(el);\n },\n alignOverlay: function alignOverlay() {\n if (this.appendTo === 'self') {\n relativePosition(this.overlay, this.$el);\n } else {\n this.overlay.style.minWidth = getOuterWidth(this.$el) + 'px';\n absolutePosition(this.overlay, this.$el);\n }\n },\n bindOutsideClickListener: function bindOutsideClickListener() {\n var _this3 = this;\n if (!this.outsideClickListener) {\n this.outsideClickListener = function (event) {\n if (_this3.overlayVisible && _this3.overlay && !_this3.$el.contains(event.target) && !_this3.overlay.contains(event.target)) {\n _this3.hide();\n }\n };\n document.addEventListener('click', this.outsideClickListener);\n }\n },\n unbindOutsideClickListener: function unbindOutsideClickListener() {\n if (this.outsideClickListener) {\n document.removeEventListener('click', this.outsideClickListener);\n this.outsideClickListener = null;\n }\n },\n bindScrollListener: function bindScrollListener() {\n var _this4 = this;\n if (!this.scrollHandler) {\n this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, function () {\n if (_this4.overlayVisible) {\n _this4.hide();\n }\n });\n }\n this.scrollHandler.bindScrollListener();\n },\n unbindScrollListener: function unbindScrollListener() {\n if (this.scrollHandler) {\n this.scrollHandler.unbindScrollListener();\n }\n },\n bindResizeListener: function bindResizeListener() {\n var _this5 = this;\n if (!this.resizeListener) {\n this.resizeListener = function () {\n if (_this5.overlayVisible && !isTouchDevice()) {\n _this5.hide();\n }\n };\n window.addEventListener('resize', this.resizeListener);\n }\n },\n unbindResizeListener: function unbindResizeListener() {\n if (this.resizeListener) {\n window.removeEventListener('resize', this.resizeListener);\n this.resizeListener = null;\n }\n },\n bindLabelClickListener: function bindLabelClickListener() {\n var _this6 = this;\n if (!this.editable && !this.labelClickListener) {\n var label = document.querySelector(\"label[for=\\\"\".concat(this.inputId, \"\\\"]\"));\n if (label && isVisible(label)) {\n this.labelClickListener = function () {\n focus(_this6.$refs.focusInput);\n };\n label.addEventListener('click', this.labelClickListener);\n }\n }\n },\n unbindLabelClickListener: function unbindLabelClickListener() {\n if (this.labelClickListener) {\n var label = document.querySelector(\"label[for=\\\"\".concat(this.inputId, \"\\\"]\"));\n if (label && isVisible(label)) {\n label.removeEventListener('click', this.labelClickListener);\n }\n }\n },\n hasFocusableElements: function hasFocusableElements() {\n return getFocusableElements(this.overlay, ':not([data-p-hidden-focusable=\"true\"])').length > 0;\n },\n isOptionMatched: function isOptionMatched(option) {\n var _this$getOptionLabel;\n return this.isValidOption(option) && typeof this.getOptionLabel(option) === 'string' && ((_this$getOptionLabel = this.getOptionLabel(option)) === null || _this$getOptionLabel === void 0 ? void 0 : _this$getOptionLabel.toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale)));\n },\n isValidOption: function isValidOption(option) {\n return isNotEmpty(option) && !(this.isOptionDisabled(option) || this.isOptionGroup(option));\n },\n isValidSelectedOption: function isValidSelectedOption(option) {\n return this.isValidOption(option) && this.isSelected(option);\n },\n isSelected: function isSelected(option) {\n return this.isValidOption(option) && equals(this.modelValue, this.getOptionValue(option), this.equalityKey);\n },\n findFirstOptionIndex: function findFirstOptionIndex() {\n var _this7 = this;\n return this.visibleOptions.findIndex(function (option) {\n return _this7.isValidOption(option);\n });\n },\n findLastOptionIndex: function findLastOptionIndex() {\n var _this8 = this;\n return findLastIndex(this.visibleOptions, function (option) {\n return _this8.isValidOption(option);\n });\n },\n findNextOptionIndex: function findNextOptionIndex(index) {\n var _this9 = this;\n var matchedOptionIndex = index < this.visibleOptions.length - 1 ? this.visibleOptions.slice(index + 1).findIndex(function (option) {\n return _this9.isValidOption(option);\n }) : -1;\n return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index;\n },\n findPrevOptionIndex: function findPrevOptionIndex(index) {\n var _this10 = this;\n var matchedOptionIndex = index > 0 ? findLastIndex(this.visibleOptions.slice(0, index), function (option) {\n return _this10.isValidOption(option);\n }) : -1;\n return matchedOptionIndex > -1 ? matchedOptionIndex : index;\n },\n findSelectedOptionIndex: function findSelectedOptionIndex() {\n var _this11 = this;\n return this.hasSelectedOption ? this.visibleOptions.findIndex(function (option) {\n return _this11.isValidSelectedOption(option);\n }) : -1;\n },\n findFirstFocusedOptionIndex: function findFirstFocusedOptionIndex() {\n var selectedIndex = this.findSelectedOptionIndex();\n return selectedIndex < 0 ? this.findFirstOptionIndex() : selectedIndex;\n },\n findLastFocusedOptionIndex: function findLastFocusedOptionIndex() {\n var selectedIndex = this.findSelectedOptionIndex();\n return selectedIndex < 0 ? this.findLastOptionIndex() : selectedIndex;\n },\n searchOptions: function searchOptions(event, _char) {\n var _this12 = this;\n this.searchValue = (this.searchValue || '') + _char;\n var optionIndex = -1;\n var matched = false;\n if (isNotEmpty(this.searchValue)) {\n if (this.focusedOptionIndex !== -1) {\n optionIndex = this.visibleOptions.slice(this.focusedOptionIndex).findIndex(function (option) {\n return _this12.isOptionMatched(option);\n });\n optionIndex = optionIndex === -1 ? this.visibleOptions.slice(0, this.focusedOptionIndex).findIndex(function (option) {\n return _this12.isOptionMatched(option);\n }) : optionIndex + this.focusedOptionIndex;\n } else {\n optionIndex = this.visibleOptions.findIndex(function (option) {\n return _this12.isOptionMatched(option);\n });\n }\n if (optionIndex !== -1) {\n matched = true;\n }\n if (optionIndex === -1 && this.focusedOptionIndex === -1) {\n optionIndex = this.findFirstFocusedOptionIndex();\n }\n if (optionIndex !== -1) {\n this.changeFocusedOptionIndex(event, optionIndex);\n }\n }\n if (this.searchTimeout) {\n clearTimeout(this.searchTimeout);\n }\n this.searchTimeout = setTimeout(function () {\n _this12.searchValue = '';\n _this12.searchTimeout = null;\n }, 500);\n return matched;\n },\n changeFocusedOptionIndex: function changeFocusedOptionIndex(event, index) {\n if (this.focusedOptionIndex !== index) {\n this.focusedOptionIndex = index;\n this.scrollInView();\n if (this.selectOnFocus) {\n this.onOptionSelect(event, this.visibleOptions[index], false);\n }\n }\n },\n scrollInView: function scrollInView() {\n var _this13 = this;\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;\n this.$nextTick(function () {\n var id = index !== -1 ? \"\".concat(_this13.id, \"_\").concat(index) : _this13.focusedOptionId;\n var element = findSingle(_this13.list, \"li[id=\\\"\".concat(id, \"\\\"]\"));\n if (element) {\n element.scrollIntoView && element.scrollIntoView({\n block: 'nearest',\n inline: 'start'\n });\n } else if (!_this13.virtualScrollerDisabled) {\n _this13.virtualScroller && _this13.virtualScroller.scrollToIndex(index !== -1 ? index : _this13.focusedOptionIndex);\n }\n });\n },\n autoUpdateModel: function autoUpdateModel() {\n if (this.selectOnFocus && this.autoOptionFocus && !this.hasSelectedOption) {\n this.focusedOptionIndex = this.findFirstFocusedOptionIndex();\n this.onOptionSelect(null, this.visibleOptions[this.focusedOptionIndex], false);\n }\n },\n updateModel: function updateModel(event, value) {\n this.$emit('update:modelValue', value);\n this.$emit('change', {\n originalEvent: event,\n value: value\n });\n },\n flatOptions: function flatOptions(options) {\n var _this14 = this;\n return (options || []).reduce(function (result, option, index) {\n result.push({\n optionGroup: option,\n group: true,\n index: index\n });\n var optionGroupChildren = _this14.getOptionGroupChildren(option);\n optionGroupChildren && optionGroupChildren.forEach(function (o) {\n return result.push(o);\n });\n return result;\n }, []);\n },\n overlayRef: function overlayRef(el) {\n this.overlay = el;\n },\n listRef: function listRef(el, contentRef) {\n this.list = el;\n contentRef && contentRef(el); // For VirtualScroller\n },\n virtualScrollerRef: function virtualScrollerRef(el) {\n this.virtualScroller = el;\n }\n },\n computed: {\n visibleOptions: function visibleOptions() {\n var _this15 = this;\n var options = this.optionGroupLabel ? this.flatOptions(this.options) : this.options || [];\n if (this.filterValue) {\n var filteredOptions = FilterService.filter(options, this.searchFields, this.filterValue, this.filterMatchMode, this.filterLocale);\n if (this.optionGroupLabel) {\n var optionGroups = this.options || [];\n var filtered = [];\n optionGroups.forEach(function (group) {\n var groupChildren = _this15.getOptionGroupChildren(group);\n var filteredItems = groupChildren.filter(function (item) {\n return filteredOptions.includes(item);\n });\n if (filteredItems.length > 0) filtered.push(_objectSpread(_objectSpread({}, group), {}, _defineProperty({}, typeof _this15.optionGroupChildren === 'string' ? _this15.optionGroupChildren : 'items', _toConsumableArray(filteredItems))));\n });\n return this.flatOptions(filtered);\n }\n return filteredOptions;\n }\n return options;\n },\n hasSelectedOption: function hasSelectedOption() {\n return isNotEmpty(this.modelValue);\n },\n label: function label() {\n var selectedOptionIndex = this.findSelectedOptionIndex();\n return selectedOptionIndex !== -1 ? this.getOptionLabel(this.visibleOptions[selectedOptionIndex]) : this.placeholder || 'p-emptylabel';\n },\n editableInputValue: function editableInputValue() {\n var selectedOptionIndex = this.findSelectedOptionIndex();\n return selectedOptionIndex !== -1 ? this.getOptionLabel(this.visibleOptions[selectedOptionIndex]) : this.modelValue || '';\n },\n equalityKey: function equalityKey() {\n return this.optionValue ? null : this.dataKey;\n },\n searchFields: function searchFields() {\n return this.filterFields || [this.optionLabel];\n },\n filterResultMessageText: function filterResultMessageText() {\n return isNotEmpty(this.visibleOptions) ? this.filterMessageText.replaceAll('{0}', this.visibleOptions.length) : this.emptyFilterMessageText;\n },\n filterMessageText: function filterMessageText() {\n return this.filterMessage || this.$primevue.config.locale.searchMessage || '';\n },\n emptyFilterMessageText: function emptyFilterMessageText() {\n return this.emptyFilterMessage || this.$primevue.config.locale.emptySearchMessage || this.$primevue.config.locale.emptyFilterMessage || '';\n },\n emptyMessageText: function emptyMessageText() {\n return this.emptyMessage || this.$primevue.config.locale.emptyMessage || '';\n },\n selectionMessageText: function selectionMessageText() {\n return this.selectionMessage || this.$primevue.config.locale.selectionMessage || '';\n },\n emptySelectionMessageText: function emptySelectionMessageText() {\n return this.emptySelectionMessage || this.$primevue.config.locale.emptySelectionMessage || '';\n },\n selectedMessageText: function selectedMessageText() {\n return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', '1') : this.emptySelectionMessageText;\n },\n focusedOptionId: function focusedOptionId() {\n return this.focusedOptionIndex !== -1 ? \"\".concat(this.id, \"_\").concat(this.focusedOptionIndex) : null;\n },\n ariaSetSize: function ariaSetSize() {\n var _this16 = this;\n return this.visibleOptions.filter(function (option) {\n return !_this16.isOptionGroup(option);\n }).length;\n },\n isClearIconVisible: function isClearIconVisible() {\n return this.showClear && this.modelValue != null && isNotEmpty(this.options);\n },\n virtualScrollerDisabled: function virtualScrollerDisabled() {\n return !this.virtualScrollerOptions;\n },\n hasFluid: function hasFluid() {\n return isEmpty(this.fluid) ? !!this.$pcFluid : this.fluid;\n }\n },\n directives: {\n ripple: Ripple\n },\n components: {\n InputText: InputText,\n VirtualScroller: VirtualScroller,\n Portal: Portal,\n InputIcon: InputIcon,\n IconField: IconField,\n TimesIcon: TimesIcon,\n ChevronDownIcon: ChevronDownIcon,\n SpinnerIcon: SpinnerIcon,\n SearchIcon: SearchIcon,\n CheckIcon: CheckIcon,\n BlankIcon: BlankIcon\n }\n};\n\nvar _hoisted_1 = [\"id\"];\nvar _hoisted_2 = [\"id\", \"value\", \"placeholder\", \"tabindex\", \"disabled\", \"aria-label\", \"aria-labelledby\", \"aria-expanded\", \"aria-controls\", \"aria-activedescendant\", \"aria-invalid\"];\nvar _hoisted_3 = [\"id\", \"tabindex\", \"aria-label\", \"aria-labelledby\", \"aria-expanded\", \"aria-controls\", \"aria-activedescendant\", \"aria-disabled\"];\nvar _hoisted_4 = [\"id\"];\nvar _hoisted_5 = [\"id\"];\nvar _hoisted_6 = [\"id\", \"aria-label\", \"aria-selected\", \"aria-disabled\", \"aria-setsize\", \"aria-posinset\", \"onClick\", \"onMousemove\", \"data-p-selected\", \"data-p-focused\", \"data-p-disabled\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_SpinnerIcon = resolveComponent(\"SpinnerIcon\");\n var _component_InputText = resolveComponent(\"InputText\");\n var _component_SearchIcon = resolveComponent(\"SearchIcon\");\n var _component_InputIcon = resolveComponent(\"InputIcon\");\n var _component_IconField = resolveComponent(\"IconField\");\n var _component_CheckIcon = resolveComponent(\"CheckIcon\");\n var _component_BlankIcon = resolveComponent(\"BlankIcon\");\n var _component_VirtualScroller = resolveComponent(\"VirtualScroller\");\n var _component_Portal = resolveComponent(\"Portal\");\n var _directive_ripple = resolveDirective(\"ripple\");\n return openBlock(), createElementBlock(\"div\", mergeProps({\n ref: \"container\",\n id: $data.id,\n \"class\": _ctx.cx('root'),\n onClick: _cache[11] || (_cache[11] = function () {\n return $options.onContainerClick && $options.onContainerClick.apply($options, arguments);\n })\n }, _ctx.ptmi('root')), [_ctx.editable ? (openBlock(), createElementBlock(\"input\", mergeProps({\n key: 0,\n ref: \"focusInput\",\n id: _ctx.labelId || _ctx.inputId,\n type: \"text\",\n \"class\": [_ctx.cx('label'), _ctx.inputClass, _ctx.labelClass],\n style: [_ctx.inputStyle, _ctx.labelStyle],\n value: $options.editableInputValue,\n placeholder: _ctx.placeholder,\n tabindex: !_ctx.disabled ? _ctx.tabindex : -1,\n disabled: _ctx.disabled,\n autocomplete: \"off\",\n role: \"combobox\",\n \"aria-label\": _ctx.ariaLabel,\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-haspopup\": \"listbox\",\n \"aria-expanded\": $data.overlayVisible,\n \"aria-controls\": $data.id + '_list',\n \"aria-activedescendant\": $data.focused ? $options.focusedOptionId : undefined,\n \"aria-invalid\": _ctx.invalid || undefined,\n onFocus: _cache[0] || (_cache[0] = function () {\n return $options.onFocus && $options.onFocus.apply($options, arguments);\n }),\n onBlur: _cache[1] || (_cache[1] = function () {\n return $options.onBlur && $options.onBlur.apply($options, arguments);\n }),\n onKeydown: _cache[2] || (_cache[2] = function () {\n return $options.onKeyDown && $options.onKeyDown.apply($options, arguments);\n }),\n onInput: _cache[3] || (_cache[3] = function () {\n return $options.onEditableInput && $options.onEditableInput.apply($options, arguments);\n })\n }, _ctx.ptm('label')), null, 16, _hoisted_2)) : (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 1,\n ref: \"focusInput\",\n id: _ctx.labelId || _ctx.inputId,\n \"class\": [_ctx.cx('label'), _ctx.inputClass, _ctx.labelClass],\n style: [_ctx.inputStyle, _ctx.labelStyle],\n tabindex: !_ctx.disabled ? _ctx.tabindex : -1,\n role: \"combobox\",\n \"aria-label\": _ctx.ariaLabel || ($options.label === 'p-emptylabel' ? undefined : $options.label),\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-haspopup\": \"listbox\",\n \"aria-expanded\": $data.overlayVisible,\n \"aria-controls\": $data.id + '_list',\n \"aria-activedescendant\": $data.focused ? $options.focusedOptionId : undefined,\n \"aria-disabled\": _ctx.disabled,\n onFocus: _cache[4] || (_cache[4] = function () {\n return $options.onFocus && $options.onFocus.apply($options, arguments);\n }),\n onBlur: _cache[5] || (_cache[5] = function () {\n return $options.onBlur && $options.onBlur.apply($options, arguments);\n }),\n onKeydown: _cache[6] || (_cache[6] = function () {\n return $options.onKeyDown && $options.onKeyDown.apply($options, arguments);\n })\n }, _ctx.ptm('label')), [renderSlot(_ctx.$slots, \"value\", {\n value: _ctx.modelValue,\n placeholder: _ctx.placeholder\n }, function () {\n return [createTextVNode(toDisplayString($options.label === 'p-emptylabel' ? ' ' : $options.label || 'empty'), 1)];\n })], 16, _hoisted_3)), $options.isClearIconVisible ? renderSlot(_ctx.$slots, \"clearicon\", {\n key: 2,\n \"class\": normalizeClass(_ctx.cx('clearIcon')),\n clearCallback: $options.onClearClick\n }, function () {\n return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon ? 'i' : 'TimesIcon'), mergeProps({\n ref: \"clearIcon\",\n \"class\": [_ctx.cx('clearIcon'), _ctx.clearIcon],\n onClick: $options.onClearClick\n }, _ctx.ptm('clearIcon'), {\n \"data-pc-section\": \"clearicon\"\n }), null, 16, [\"class\", \"onClick\"]))];\n }) : createCommentVNode(\"\", true), createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('dropdown')\n }, _ctx.ptm('dropdown')), [_ctx.loading ? renderSlot(_ctx.$slots, \"loadingicon\", {\n key: 0,\n \"class\": normalizeClass(_ctx.cx('loadingIcon'))\n }, function () {\n return [_ctx.loadingIcon ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 0,\n \"class\": [_ctx.cx('loadingIcon'), 'pi-spin', _ctx.loadingIcon],\n \"aria-hidden\": \"true\"\n }, _ctx.ptm('loadingIcon')), null, 16)) : (openBlock(), createBlock(_component_SpinnerIcon, mergeProps({\n key: 1,\n \"class\": _ctx.cx('loadingIcon'),\n spin: \"\",\n \"aria-hidden\": \"true\"\n }, _ctx.ptm('loadingIcon')), null, 16, [\"class\"]))];\n }) : renderSlot(_ctx.$slots, \"dropdownicon\", {\n key: 1,\n \"class\": normalizeClass(_ctx.cx('dropdownIcon'))\n }, function () {\n return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.dropdownIcon ? 'span' : 'ChevronDownIcon'), mergeProps({\n \"class\": [_ctx.cx('dropdownIcon'), _ctx.dropdownIcon],\n \"aria-hidden\": \"true\"\n }, _ctx.ptm('dropdownIcon')), null, 16, [\"class\"]))];\n })], 16), createVNode(_component_Portal, {\n appendTo: _ctx.appendTo\n }, {\n \"default\": withCtx(function () {\n return [createVNode(Transition, mergeProps({\n name: \"p-connected-overlay\",\n onEnter: $options.onOverlayEnter,\n onAfterEnter: $options.onOverlayAfterEnter,\n onLeave: $options.onOverlayLeave,\n onAfterLeave: $options.onOverlayAfterLeave\n }, _ctx.ptm('transition')), {\n \"default\": withCtx(function () {\n return [$data.overlayVisible ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n ref: $options.overlayRef,\n \"class\": [_ctx.cx('overlay'), _ctx.panelClass, _ctx.overlayClass],\n style: [_ctx.panelStyle, _ctx.overlayStyle],\n onClick: _cache[9] || (_cache[9] = function () {\n return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments);\n }),\n onKeydown: _cache[10] || (_cache[10] = function () {\n return $options.onOverlayKeyDown && $options.onOverlayKeyDown.apply($options, arguments);\n })\n }, _ctx.ptm('overlay')), [createElementVNode(\"span\", mergeProps({\n ref: \"firstHiddenFocusableElementOnOverlay\",\n role: \"presentation\",\n \"aria-hidden\": \"true\",\n \"class\": \"p-hidden-accessible p-hidden-focusable\",\n tabindex: 0,\n onFocus: _cache[7] || (_cache[7] = function () {\n return $options.onFirstHiddenFocus && $options.onFirstHiddenFocus.apply($options, arguments);\n })\n }, _ctx.ptm('hiddenFirstFocusableEl'), {\n \"data-p-hidden-accessible\": true,\n \"data-p-hidden-focusable\": true\n }), null, 16), renderSlot(_ctx.$slots, \"header\", {\n value: _ctx.modelValue,\n options: $options.visibleOptions\n }), _ctx.filter ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('header')\n }, _ctx.ptm('header')), [createVNode(_component_IconField, {\n unstyled: _ctx.unstyled,\n pt: _ctx.ptm('pcFilterContainer')\n }, {\n \"default\": withCtx(function () {\n return [createVNode(_component_InputText, {\n ref: \"filterInput\",\n type: \"text\",\n value: $data.filterValue,\n onVnodeMounted: $options.onFilterUpdated,\n onVnodeUpdated: $options.onFilterUpdated,\n \"class\": normalizeClass(_ctx.cx('pcFilter')),\n placeholder: _ctx.filterPlaceholder,\n variant: _ctx.variant,\n unstyled: _ctx.unstyled,\n role: \"searchbox\",\n autocomplete: \"off\",\n \"aria-owns\": $data.id + '_list',\n \"aria-activedescendant\": $options.focusedOptionId,\n onKeydown: $options.onFilterKeyDown,\n onBlur: $options.onFilterBlur,\n onInput: $options.onFilterChange,\n pt: _ctx.ptm('pcFilter')\n }, null, 8, [\"value\", \"onVnodeMounted\", \"onVnodeUpdated\", \"class\", \"placeholder\", \"variant\", \"unstyled\", \"aria-owns\", \"aria-activedescendant\", \"onKeydown\", \"onBlur\", \"onInput\", \"pt\"]), createVNode(_component_InputIcon, mergeProps({\n unstyled: _ctx.unstyled\n }, _ctx.ptm('pcFilterIconContainer')), {\n \"default\": withCtx(function () {\n return [renderSlot(_ctx.$slots, \"filtericon\", {}, function () {\n return [_ctx.filterIcon ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 0,\n \"class\": _ctx.filterIcon\n }, _ctx.ptm('filterIcon')), null, 16)) : (openBlock(), createBlock(_component_SearchIcon, normalizeProps(mergeProps({\n key: 1\n }, _ctx.ptm('filterIcon'))), null, 16))];\n })];\n }),\n _: 3\n }, 16, [\"unstyled\"])];\n }),\n _: 3\n }, 8, [\"unstyled\", \"pt\"]), createElementVNode(\"span\", mergeProps({\n role: \"status\",\n \"aria-live\": \"polite\",\n \"class\": \"p-hidden-accessible\"\n }, _ctx.ptm('hiddenFilterResult'), {\n \"data-p-hidden-accessible\": true\n }), toDisplayString($options.filterResultMessageText), 17)], 16)) : createCommentVNode(\"\", true), createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('listContainer'),\n style: {\n 'max-height': $options.virtualScrollerDisabled ? _ctx.scrollHeight : ''\n }\n }, _ctx.ptm('listContainer')), [createVNode(_component_VirtualScroller, mergeProps({\n ref: $options.virtualScrollerRef\n }, _ctx.virtualScrollerOptions, {\n items: $options.visibleOptions,\n style: {\n height: _ctx.scrollHeight\n },\n tabindex: -1,\n disabled: $options.virtualScrollerDisabled,\n pt: _ctx.ptm('virtualScroller')\n }), createSlots({\n content: withCtx(function (_ref) {\n var styleClass = _ref.styleClass,\n contentRef = _ref.contentRef,\n items = _ref.items,\n getItemOptions = _ref.getItemOptions,\n contentStyle = _ref.contentStyle,\n itemSize = _ref.itemSize;\n return [createElementVNode(\"ul\", mergeProps({\n ref: function ref(el) {\n return $options.listRef(el, contentRef);\n },\n id: $data.id + '_list',\n \"class\": [_ctx.cx('list'), styleClass],\n style: contentStyle,\n role: \"listbox\"\n }, _ctx.ptm('list')), [(openBlock(true), createElementBlock(Fragment, null, renderList(items, function (option, i) {\n return openBlock(), createElementBlock(Fragment, {\n key: $options.getOptionRenderKey(option, $options.getOptionIndex(i, getItemOptions))\n }, [$options.isOptionGroup(option) ? (openBlock(), createElementBlock(\"li\", mergeProps({\n key: 0,\n id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),\n style: {\n height: itemSize ? itemSize + 'px' : undefined\n },\n \"class\": _ctx.cx('optionGroup'),\n role: \"option\",\n ref_for: true\n }, _ctx.ptm('optionGroup')), [renderSlot(_ctx.$slots, \"optiongroup\", {\n option: option.optionGroup,\n index: $options.getOptionIndex(i, getItemOptions)\n }, function () {\n return [createElementVNode(\"span\", mergeProps({\n \"class\": _ctx.cx('optionGroupLabel'),\n ref_for: true\n }, _ctx.ptm('optionGroupLabel')), toDisplayString($options.getOptionGroupLabel(option.optionGroup)), 17)];\n })], 16, _hoisted_5)) : withDirectives((openBlock(), createElementBlock(\"li\", mergeProps({\n key: 1,\n id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),\n \"class\": _ctx.cx('option', {\n option: option,\n focusedOption: $options.getOptionIndex(i, getItemOptions)\n }),\n style: {\n height: itemSize ? itemSize + 'px' : undefined\n },\n role: \"option\",\n \"aria-label\": $options.getOptionLabel(option),\n \"aria-selected\": $options.isSelected(option),\n \"aria-disabled\": $options.isOptionDisabled(option),\n \"aria-setsize\": $options.ariaSetSize,\n \"aria-posinset\": $options.getAriaPosInset($options.getOptionIndex(i, getItemOptions)),\n onClick: function onClick($event) {\n return $options.onOptionSelect($event, option);\n },\n onMousemove: function onMousemove($event) {\n return $options.onOptionMouseMove($event, $options.getOptionIndex(i, getItemOptions));\n },\n \"data-p-selected\": $options.isSelected(option),\n \"data-p-focused\": $data.focusedOptionIndex === $options.getOptionIndex(i, getItemOptions),\n \"data-p-disabled\": $options.isOptionDisabled(option),\n ref_for: true\n }, $options.getPTItemOptions(option, getItemOptions, i, 'option')), [_ctx.checkmark ? (openBlock(), createElementBlock(Fragment, {\n key: 0\n }, [$options.isSelected(option) ? (openBlock(), createBlock(_component_CheckIcon, mergeProps({\n key: 0,\n \"class\": _ctx.cx('optionCheckIcon'),\n ref_for: true\n }, _ctx.ptm('optionCheckIcon')), null, 16, [\"class\"])) : (openBlock(), createBlock(_component_BlankIcon, mergeProps({\n key: 1,\n \"class\": _ctx.cx('optionBlankIcon'),\n ref_for: true\n }, _ctx.ptm('optionBlankIcon')), null, 16, [\"class\"]))], 64)) : createCommentVNode(\"\", true), renderSlot(_ctx.$slots, \"option\", {\n option: option,\n selected: $options.isSelected(option),\n index: $options.getOptionIndex(i, getItemOptions)\n }, function () {\n return [createElementVNode(\"span\", mergeProps({\n \"class\": _ctx.cx('optionLabel'),\n ref_for: true\n }, _ctx.ptm('optionLabel')), toDisplayString($options.getOptionLabel(option)), 17)];\n })], 16, _hoisted_6)), [[_directive_ripple]])], 64);\n }), 128)), $data.filterValue && (!items || items && items.length === 0) ? (openBlock(), createElementBlock(\"li\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('emptyMessage'),\n role: \"option\"\n }, _ctx.ptm('emptyMessage'), {\n \"data-p-hidden-accessible\": true\n }), [renderSlot(_ctx.$slots, \"emptyfilter\", {}, function () {\n return [createTextVNode(toDisplayString($options.emptyFilterMessageText), 1)];\n })], 16)) : !_ctx.options || _ctx.options && _ctx.options.length === 0 ? (openBlock(), createElementBlock(\"li\", mergeProps({\n key: 1,\n \"class\": _ctx.cx('emptyMessage'),\n role: \"option\"\n }, _ctx.ptm('emptyMessage'), {\n \"data-p-hidden-accessible\": true\n }), [renderSlot(_ctx.$slots, \"empty\", {}, function () {\n return [createTextVNode(toDisplayString($options.emptyMessageText), 1)];\n })], 16)) : createCommentVNode(\"\", true)], 16, _hoisted_4)];\n }),\n _: 2\n }, [_ctx.$slots.loader ? {\n name: \"loader\",\n fn: withCtx(function (_ref2) {\n var options = _ref2.options;\n return [renderSlot(_ctx.$slots, \"loader\", {\n options: options\n })];\n }),\n key: \"0\"\n } : undefined]), 1040, [\"items\", \"style\", \"disabled\", \"pt\"])], 16), renderSlot(_ctx.$slots, \"footer\", {\n value: _ctx.modelValue,\n options: $options.visibleOptions\n }), !_ctx.options || _ctx.options && _ctx.options.length === 0 ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 1,\n role: \"status\",\n \"aria-live\": \"polite\",\n \"class\": \"p-hidden-accessible\"\n }, _ctx.ptm('hiddenEmptyMessage'), {\n \"data-p-hidden-accessible\": true\n }), toDisplayString($options.emptyMessageText), 17)) : createCommentVNode(\"\", true), createElementVNode(\"span\", mergeProps({\n role: \"status\",\n \"aria-live\": \"polite\",\n \"class\": \"p-hidden-accessible\"\n }, _ctx.ptm('hiddenSelectedMessage'), {\n \"data-p-hidden-accessible\": true\n }), toDisplayString($options.selectedMessageText), 17), createElementVNode(\"span\", mergeProps({\n ref: \"lastHiddenFocusableElementOnOverlay\",\n role: \"presentation\",\n \"aria-hidden\": \"true\",\n \"class\": \"p-hidden-accessible p-hidden-focusable\",\n tabindex: 0,\n onFocus: _cache[8] || (_cache[8] = function () {\n return $options.onLastHiddenFocus && $options.onLastHiddenFocus.apply($options, arguments);\n })\n }, _ctx.ptm('hiddenLastFocusableEl'), {\n \"data-p-hidden-accessible\": true,\n \"data-p-hidden-focusable\": true\n }), null, 16)], 16)) : createCommentVNode(\"\", true)];\n }),\n _: 3\n }, 16, [\"onEnter\", \"onAfterEnter\", \"onLeave\", \"onAfterLeave\"])];\n }),\n _: 3\n }, 8, [\"appendTo\"])], 16, _hoisted_1);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-toggleswitch {\\n display: inline-block;\\n width: \".concat(dt('toggleswitch.width'), \";\\n height: \").concat(dt('toggleswitch.height'), \";\\n}\\n\\n.p-toggleswitch-input {\\n cursor: pointer;\\n appearance: none;\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 100%;\\n height: 100%;\\n padding: 0;\\n margin: 0;\\n opacity: 0;\\n z-index: 1;\\n outline: 0 none;\\n border-radius: \").concat(dt('toggleswitch.border.radius'), \";\\n}\\n\\n.p-toggleswitch-slider {\\n display: inline-block;\\n cursor: pointer;\\n width: 100%;\\n height: 100%;\\n border-width: \").concat(dt('toggleswitch.border.width'), \";\\n border-style: solid;\\n border-color: \").concat(dt('toggleswitch.border.color'), \";\\n background: \").concat(dt('toggleswitch.background'), \";\\n transition: background \").concat(dt('toggleswitch.transition.duration'), \", color \").concat(dt('toggleswitch.transition.duration'), \", border-color \").concat(dt('toggleswitch.transition.duration'), \", outline-color \").concat(dt('toggleswitch.transition.duration'), \", box-shadow \").concat(dt('toggleswitch.transition.duration'), \";\\n border-radius: \").concat(dt('toggleswitch.border.radius'), \";\\n outline-color: transparent;\\n box-shadow: \").concat(dt('toggleswitch.shadow'), \";\\n}\\n\\n.p-toggleswitch-slider:before {\\n position: absolute;\\n content: \\\"\\\";\\n top: 50%;\\n background: \").concat(dt('toggleswitch.handle.background'), \";\\n width: \").concat(dt('toggleswitch.handle.size'), \";\\n height: \").concat(dt('toggleswitch.handle.size'), \";\\n left: \").concat(dt('toggleswitch.gap'), \";\\n margin-top: calc(-1 * calc(\").concat(dt('toggleswitch.handle.size'), \" / 2));\\n border-radius: \").concat(dt('toggleswitch.handle.border.radius'), \";\\n transition: background \").concat(dt('toggleswitch.transition.duration'), \", left \").concat(dt('toggleswitch.slide.duration'), \";\\n}\\n\\n.p-toggleswitch.p-toggleswitch-checked .p-toggleswitch-slider {\\n background: \").concat(dt('toggleswitch.checked.background'), \";\\n border-color: \").concat(dt('toggleswitch.checked.border.color'), \";\\n}\\n\\n.p-toggleswitch.p-toggleswitch-checked .p-toggleswitch-slider:before {\\n background: \").concat(dt('toggleswitch.handle.checked.background'), \";\\n left: calc(\").concat(dt('toggleswitch.width'), \" - calc(\").concat(dt('toggleswitch.handle.size'), \" + \").concat(dt('toggleswitch.gap'), \"));\\n}\\n\\n.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover) .p-toggleswitch-slider {\\n background: \").concat(dt('toggleswitch.hover.background'), \";\\n border-color: \").concat(dt('toggleswitch.hover.border.color'), \";\\n}\\n\\n.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover) .p-toggleswitch-slider:before {\\n background: \").concat(dt('toggleswitch.handle.hover.background'), \";\\n}\\n\\n.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover).p-toggleswitch-checked .p-toggleswitch-slider {\\n background: \").concat(dt('toggleswitch.checked.hover.background'), \";\\n border-color: \").concat(dt('toggleswitch.checked.hover.border.color'), \";\\n}\\n\\n.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover).p-toggleswitch-checked .p-toggleswitch-slider:before {\\n background: \").concat(dt('toggleswitch.handle.checked.hover.background'), \";\\n}\\n\\n.p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:focus-visible) .p-toggleswitch-slider {\\n box-shadow: \").concat(dt('toggleswitch.focus.ring.shadow'), \";\\n outline: \").concat(dt('toggleswitch.focus.ring.width'), \" \").concat(dt('toggleswitch.focus.ring.style'), \" \").concat(dt('toggleswitch.focus.ring.color'), \";\\n outline-offset: \").concat(dt('toggleswitch.focus.ring.offset'), \";\\n}\\n\\n.p-toggleswitch.p-invalid > .p-toggleswitch-slider {\\n border-color: \").concat(dt('toggleswitch.invalid.border.color'), \";\\n}\\n\\n.p-toggleswitch.p-disabled {\\n opacity: 1;\\n}\\n\\n.p-toggleswitch.p-disabled .p-toggleswitch-slider {\\n background: \").concat(dt('toggleswitch.disabled.background'), \";\\n}\\n\\n.p-toggleswitch.p-disabled .p-toggleswitch-slider:before {\\n background: \").concat(dt('toggleswitch.handle.disabled.background'), \";\\n}\\n\");\n};\nvar inlineStyles = {\n root: {\n position: 'relative'\n }\n};\nvar classes = {\n root: function root(_ref2) {\n var instance = _ref2.instance,\n props = _ref2.props;\n return ['p-toggleswitch p-component', {\n 'p-toggleswitch-checked': instance.checked,\n 'p-disabled': props.disabled,\n 'p-invalid': props.invalid\n }];\n },\n input: 'p-toggleswitch-input',\n slider: 'p-toggleswitch-slider'\n};\nvar ToggleSwitchStyle = BaseStyle.extend({\n name: 'toggleswitch',\n theme: theme,\n classes: classes,\n inlineStyles: inlineStyles\n});\n\nexport { ToggleSwitchStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseComponent from '@primevue/core/basecomponent';\nimport ToggleSwitchStyle from 'primevue/toggleswitch/style';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode } from 'vue';\n\nvar script$1 = {\n name: 'BaseToggleSwitch',\n \"extends\": BaseComponent,\n props: {\n modelValue: {\n type: null,\n \"default\": false\n },\n trueValue: {\n type: null,\n \"default\": true\n },\n falseValue: {\n type: null,\n \"default\": false\n },\n invalid: {\n type: Boolean,\n \"default\": false\n },\n disabled: {\n type: Boolean,\n \"default\": false\n },\n readonly: {\n type: Boolean,\n \"default\": false\n },\n tabindex: {\n type: Number,\n \"default\": null\n },\n inputId: {\n type: String,\n \"default\": null\n },\n inputClass: {\n type: [String, Object],\n \"default\": null\n },\n inputStyle: {\n type: Object,\n \"default\": null\n },\n ariaLabelledby: {\n type: String,\n \"default\": null\n },\n ariaLabel: {\n type: String,\n \"default\": null\n }\n },\n style: ToggleSwitchStyle,\n provide: function provide() {\n return {\n $pcToggleSwitch: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'ToggleSwitch',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['update:modelValue', 'change', 'focus', 'blur'],\n methods: {\n getPTOptions: function getPTOptions(key) {\n var _ptm = key === 'root' ? this.ptmi : this.ptm;\n return _ptm(key, {\n context: {\n checked: this.checked,\n disabled: this.disabled\n }\n });\n },\n onChange: function onChange(event) {\n if (!this.disabled && !this.readonly) {\n var newValue = this.checked ? this.falseValue : this.trueValue;\n this.$emit('update:modelValue', newValue);\n this.$emit('change', event);\n }\n },\n onFocus: function onFocus(event) {\n this.$emit('focus', event);\n },\n onBlur: function onBlur(event) {\n this.$emit('blur', event);\n }\n },\n computed: {\n checked: function checked() {\n return this.modelValue === this.trueValue;\n }\n }\n};\n\nvar _hoisted_1 = [\"data-p-checked\", \"data-p-disabled\"];\nvar _hoisted_2 = [\"id\", \"checked\", \"tabindex\", \"disabled\", \"readonly\", \"aria-checked\", \"aria-labelledby\", \"aria-label\", \"aria-invalid\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root'),\n style: _ctx.sx('root')\n }, $options.getPTOptions('root'), {\n \"data-p-checked\": $options.checked,\n \"data-p-disabled\": _ctx.disabled\n }), [createElementVNode(\"input\", mergeProps({\n id: _ctx.inputId,\n type: \"checkbox\",\n role: \"switch\",\n \"class\": [_ctx.cx('input'), _ctx.inputClass],\n style: _ctx.inputStyle,\n checked: $options.checked,\n tabindex: _ctx.tabindex,\n disabled: _ctx.disabled,\n readonly: _ctx.readonly,\n \"aria-checked\": $options.checked,\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-label\": _ctx.ariaLabel,\n \"aria-invalid\": _ctx.invalid || undefined,\n onFocus: _cache[0] || (_cache[0] = function () {\n return $options.onFocus && $options.onFocus.apply($options, arguments);\n }),\n onBlur: _cache[1] || (_cache[1] = function () {\n return $options.onBlur && $options.onBlur.apply($options, arguments);\n }),\n onChange: _cache[2] || (_cache[2] = function () {\n return $options.onChange && $options.onChange.apply($options, arguments);\n })\n }, $options.getPTOptions('input')), null, 16, _hoisted_2), createElementVNode(\"span\", mergeProps({\n \"class\": _ctx.cx('slider')\n }, $options.getPTOptions('slider')), null, 16)], 16, _hoisted_1);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-slider {\\n position: relative;\\n background: \".concat(dt('slider.track.background'), \";\\n border-radius: \").concat(dt('slider.border.radius'), \";\\n}\\n\\n.p-slider-handle {\\n cursor: grab;\\n touch-action: none;\\n display: flex;\\n justify-content: center;\\n align-items: center;\\n height: \").concat(dt('slider.handle.height'), \";\\n width: \").concat(dt('slider.handle.width'), \";\\n background: \").concat(dt('slider.handle.background'), \";\\n border-radius: \").concat(dt('slider.handle.border.radius'), \";\\n transition: background \").concat(dt('slider.transition.duration'), \", color \").concat(dt('slider.transition.duration'), \", border-color \").concat(dt('slider.transition.duration'), \", box-shadow \").concat(dt('slider.transition.duration'), \", outline-color \").concat(dt('slider.transition.duration'), \";\\n outline-color: transparent;\\n}\\n\\n.p-slider-handle::before {\\n content: \\\"\\\";\\n width: \").concat(dt('slider.handle.content.width'), \";\\n height: \").concat(dt('slider.handle.content.height'), \";\\n display: block;\\n background: \").concat(dt('slider.handle.content.background'), \";\\n border-radius: \").concat(dt('slider.handle.content.border.radius'), \";\\n box-shadow: \").concat(dt('slider.handle.content.shadow'), \";\\n transition: background \").concat(dt('slider.transition.duration'), \";\\n}\\n\\n.p-slider:not(.p-disabled) .p-slider-handle:hover {\\n background: \").concat(dt('slider.handle.hover.background'), \";\\n}\\n\\n.p-slider:not(.p-disabled) .p-slider-handle:hover::before {\\n background: \").concat(dt('slider.handle.content.hover.background'), \";\\n}\\n\\n.p-slider-handle:focus-visible {\\n border-color: \").concat(dt('slider.handle.focus.border.color'), \";\\n box-shadow: \").concat(dt('slider.handle.focus.ring.shadow'), \";\\n outline: \").concat(dt('slider.handle.focus.ring.width'), \" \").concat(dt('slider.handle.focus.ring.style'), \" \").concat(dt('slider.handle.focus.ring.color'), \";\\n outline-offset: \").concat(dt('slider.handle.focus.ring.offset'), \";\\n}\\n\\n.p-slider-range {\\n display: block;\\n background: \").concat(dt('slider.range.background'), \";\\n border-radius: \").concat(dt('slider.border.radius'), \";\\n}\\n\\n.p-slider.p-slider-horizontal {\\n height: \").concat(dt('slider.track.size'), \";\\n}\\n\\n.p-slider-horizontal .p-slider-range {\\n top: 0;\\n left: 0;\\n height: 100%;\\n}\\n\\n.p-slider-horizontal .p-slider-handle {\\n top: 50%;\\n margin-top: calc(-1 * calc(\").concat(dt('slider.handle.height'), \" / 2));\\n margin-left: calc(-1 * calc(\").concat(dt('slider.handle.width'), \" / 2));\\n}\\n\\n.p-slider-vertical {\\n min-height: 100px;\\n width: \").concat(dt('slider.track.size'), \";\\n}\\n\\n.p-slider-vertical .p-slider-handle {\\n left: 50%;\\n margin-left: calc(-1 * calc(\").concat(dt('slider.handle.width'), \" / 2));\\n margin-bottom: calc(-1 * calc(\").concat(dt('slider.handle.height'), \" / 2));\\n}\\n\\n.p-slider-vertical .p-slider-range {\\n bottom: 0;\\n left: 0;\\n width: 100%;\\n}\\n\");\n};\nvar inlineStyles = {\n handle: {\n position: 'absolute'\n },\n range: {\n position: 'absolute'\n }\n};\nvar classes = {\n root: function root(_ref2) {\n var props = _ref2.props;\n return ['p-slider p-component', {\n 'p-disabled': props.disabled,\n 'p-slider-horizontal': props.orientation === 'horizontal',\n 'p-slider-vertical': props.orientation === 'vertical'\n }];\n },\n range: 'p-slider-range',\n handle: 'p-slider-handle'\n};\nvar SliderStyle = BaseStyle.extend({\n name: 'slider',\n theme: theme,\n classes: classes,\n inlineStyles: inlineStyles\n});\n\nexport { SliderStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { getWindowScrollLeft, getWindowScrollTop, getAttribute } from '@primeuix/utils/dom';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport SliderStyle from 'primevue/slider/style';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode, createCommentVNode } from 'vue';\n\nvar script$1 = {\n name: 'BaseSlider',\n \"extends\": BaseComponent,\n props: {\n modelValue: [Number, Array],\n min: {\n type: Number,\n \"default\": 0\n },\n max: {\n type: Number,\n \"default\": 100\n },\n orientation: {\n type: String,\n \"default\": 'horizontal'\n },\n step: {\n type: Number,\n \"default\": null\n },\n range: {\n type: Boolean,\n \"default\": false\n },\n disabled: {\n type: Boolean,\n \"default\": false\n },\n tabindex: {\n type: Number,\n \"default\": 0\n },\n ariaLabelledby: {\n type: String,\n \"default\": null\n },\n ariaLabel: {\n type: String,\n \"default\": null\n }\n },\n style: SliderStyle,\n provide: function provide() {\n return {\n $pcSlider: this,\n $parentInstance: this\n };\n }\n};\n\nfunction _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _iterableToArray(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nvar script = {\n name: 'Slider',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['update:modelValue', 'change', 'slideend'],\n dragging: false,\n handleIndex: null,\n initX: null,\n initY: null,\n barWidth: null,\n barHeight: null,\n dragListener: null,\n dragEndListener: null,\n beforeUnmount: function beforeUnmount() {\n this.unbindDragListeners();\n },\n methods: {\n updateDomData: function updateDomData() {\n var rect = this.$el.getBoundingClientRect();\n this.initX = rect.left + getWindowScrollLeft();\n this.initY = rect.top + getWindowScrollTop();\n this.barWidth = this.$el.offsetWidth;\n this.barHeight = this.$el.offsetHeight;\n },\n setValue: function setValue(event) {\n var handleValue;\n var pageX = event.touches ? event.touches[0].pageX : event.pageX;\n var pageY = event.touches ? event.touches[0].pageY : event.pageY;\n if (this.orientation === 'horizontal') handleValue = (pageX - this.initX) * 100 / this.barWidth;else handleValue = (this.initY + this.barHeight - pageY) * 100 / this.barHeight;\n var newValue = (this.max - this.min) * (handleValue / 100) + this.min;\n if (this.step) {\n var oldValue = this.range ? this.value[this.handleIndex] : this.value;\n var diff = newValue - oldValue;\n if (diff < 0) newValue = oldValue + Math.ceil(newValue / this.step - oldValue / this.step) * this.step;else if (diff > 0) newValue = oldValue + Math.floor(newValue / this.step - oldValue / this.step) * this.step;\n } else {\n newValue = Math.floor(newValue);\n }\n this.updateModel(event, newValue);\n },\n updateModel: function updateModel(event, value) {\n var newValue = parseFloat(value.toFixed(10));\n var modelValue;\n if (this.range) {\n modelValue = this.value ? _toConsumableArray(this.value) : [];\n if (this.handleIndex == 0) {\n if (newValue < this.min) newValue = this.min;else if (newValue >= this.max) newValue = this.max;\n modelValue[0] = newValue;\n } else {\n if (newValue > this.max) newValue = this.max;else if (newValue <= this.min) newValue = this.min;\n modelValue[1] = newValue;\n }\n } else {\n if (newValue < this.min) newValue = this.min;else if (newValue > this.max) newValue = this.max;\n modelValue = newValue;\n }\n this.$emit('update:modelValue', modelValue);\n this.$emit('change', modelValue);\n },\n onDragStart: function onDragStart(event, index) {\n if (this.disabled) {\n return;\n }\n this.$el.setAttribute('data-p-sliding', true);\n this.dragging = true;\n this.updateDomData();\n if (this.range && this.value[0] === this.max) {\n this.handleIndex = 0;\n } else {\n this.handleIndex = index;\n }\n event.currentTarget.focus();\n event.preventDefault();\n },\n onDrag: function onDrag(event) {\n if (this.dragging) {\n this.setValue(event);\n event.preventDefault();\n }\n },\n onDragEnd: function onDragEnd(event) {\n if (this.dragging) {\n this.dragging = false;\n this.$el.setAttribute('data-p-sliding', false);\n this.$emit('slideend', {\n originalEvent: event,\n value: this.value\n });\n }\n },\n onBarClick: function onBarClick(event) {\n if (this.disabled) {\n return;\n }\n if (getAttribute(event.target, 'data-pc-section') !== 'handle') {\n this.updateDomData();\n this.setValue(event);\n }\n },\n onMouseDown: function onMouseDown(event, index) {\n this.bindDragListeners();\n this.onDragStart(event, index);\n },\n onKeyDown: function onKeyDown(event, index) {\n this.handleIndex = index;\n switch (event.code) {\n case 'ArrowDown':\n case 'ArrowLeft':\n this.decrementValue(event, index);\n event.preventDefault();\n break;\n case 'ArrowUp':\n case 'ArrowRight':\n this.incrementValue(event, index);\n event.preventDefault();\n break;\n case 'PageDown':\n this.decrementValue(event, index, true);\n event.preventDefault();\n break;\n case 'PageUp':\n this.incrementValue(event, index, true);\n event.preventDefault();\n break;\n case 'Home':\n this.updateModel(event, this.min);\n event.preventDefault();\n break;\n case 'End':\n this.updateModel(event, this.max);\n event.preventDefault();\n break;\n }\n },\n decrementValue: function decrementValue(event, index) {\n var pageKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var newValue;\n if (this.range) {\n if (this.step) newValue = this.value[index] - this.step;else newValue = this.value[index] - 1;\n } else {\n if (this.step) newValue = this.value - this.step;else if (!this.step && pageKey) newValue = this.value - 10;else newValue = this.value - 1;\n }\n this.updateModel(event, newValue);\n event.preventDefault();\n },\n incrementValue: function incrementValue(event, index) {\n var pageKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var newValue;\n if (this.range) {\n if (this.step) newValue = this.value[index] + this.step;else newValue = this.value[index] + 1;\n } else {\n if (this.step) newValue = this.value + this.step;else if (!this.step && pageKey) newValue = this.value + 10;else newValue = this.value + 1;\n }\n this.updateModel(event, newValue);\n event.preventDefault();\n },\n bindDragListeners: function bindDragListeners() {\n if (!this.dragListener) {\n this.dragListener = this.onDrag.bind(this);\n document.addEventListener('mousemove', this.dragListener);\n }\n if (!this.dragEndListener) {\n this.dragEndListener = this.onDragEnd.bind(this);\n document.addEventListener('mouseup', this.dragEndListener);\n }\n },\n unbindDragListeners: function unbindDragListeners() {\n if (this.dragListener) {\n document.removeEventListener('mousemove', this.dragListener);\n this.dragListener = null;\n }\n if (this.dragEndListener) {\n document.removeEventListener('mouseup', this.dragEndListener);\n this.dragEndListener = null;\n }\n }\n },\n computed: {\n value: function value() {\n var _this$modelValue3;\n if (this.range) {\n var _this$modelValue$, _this$modelValue, _this$modelValue$2, _this$modelValue2;\n return [(_this$modelValue$ = (_this$modelValue = this.modelValue) === null || _this$modelValue === void 0 ? void 0 : _this$modelValue[0]) !== null && _this$modelValue$ !== void 0 ? _this$modelValue$ : this.min, (_this$modelValue$2 = (_this$modelValue2 = this.modelValue) === null || _this$modelValue2 === void 0 ? void 0 : _this$modelValue2[1]) !== null && _this$modelValue$2 !== void 0 ? _this$modelValue$2 : this.max];\n }\n return (_this$modelValue3 = this.modelValue) !== null && _this$modelValue3 !== void 0 ? _this$modelValue3 : this.min;\n },\n horizontal: function horizontal() {\n return this.orientation === 'horizontal';\n },\n vertical: function vertical() {\n return this.orientation === 'vertical';\n },\n rangeStyle: function rangeStyle() {\n if (this.range) {\n var rangeSliderWidth = this.rangeEndPosition > this.rangeStartPosition ? this.rangeEndPosition - this.rangeStartPosition : this.rangeStartPosition - this.rangeEndPosition;\n var rangeSliderPosition = this.rangeEndPosition > this.rangeStartPosition ? this.rangeStartPosition : this.rangeEndPosition;\n if (this.horizontal) return {\n left: rangeSliderPosition + '%',\n width: rangeSliderWidth + '%'\n };else return {\n bottom: rangeSliderPosition + '%',\n height: rangeSliderWidth + '%'\n };\n } else {\n if (this.horizontal) return {\n width: this.handlePosition + '%'\n };else return {\n height: this.handlePosition + '%'\n };\n }\n },\n handleStyle: function handleStyle() {\n if (this.horizontal) return {\n left: this.handlePosition + '%'\n };else return {\n bottom: this.handlePosition + '%'\n };\n },\n handlePosition: function handlePosition() {\n if (this.value < this.min) return 0;else if (this.value > this.max) return 100;else return (this.value - this.min) * 100 / (this.max - this.min);\n },\n rangeStartPosition: function rangeStartPosition() {\n if (this.value && this.value[0]) return (this.value[0] < this.min ? 0 : this.value[0] - this.min) * 100 / (this.max - this.min);else return 0;\n },\n rangeEndPosition: function rangeEndPosition() {\n if (this.value && this.value.length === 2) return (this.value[1] > this.max ? 100 : this.value[1] - this.min) * 100 / (this.max - this.min);else return 100;\n },\n rangeStartHandleStyle: function rangeStartHandleStyle() {\n if (this.horizontal) return {\n left: this.rangeStartPosition + '%'\n };else return {\n bottom: this.rangeStartPosition + '%'\n };\n },\n rangeEndHandleStyle: function rangeEndHandleStyle() {\n if (this.horizontal) return {\n left: this.rangeEndPosition + '%'\n };else return {\n bottom: this.rangeEndPosition + '%'\n };\n }\n }\n};\n\nvar _hoisted_1 = [\"tabindex\", \"aria-valuemin\", \"aria-valuenow\", \"aria-valuemax\", \"aria-labelledby\", \"aria-label\", \"aria-orientation\"];\nvar _hoisted_2 = [\"tabindex\", \"aria-valuemin\", \"aria-valuenow\", \"aria-valuemax\", \"aria-labelledby\", \"aria-label\", \"aria-orientation\"];\nvar _hoisted_3 = [\"tabindex\", \"aria-valuemin\", \"aria-valuenow\", \"aria-valuemax\", \"aria-labelledby\", \"aria-label\", \"aria-orientation\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root'),\n onClick: _cache[15] || (_cache[15] = function () {\n return $options.onBarClick && $options.onBarClick.apply($options, arguments);\n })\n }, _ctx.ptmi('root'), {\n \"data-p-sliding\": false\n }), [createElementVNode(\"span\", mergeProps({\n \"class\": _ctx.cx('range'),\n style: [_ctx.sx('range'), $options.rangeStyle]\n }, _ctx.ptm('range')), null, 16), !_ctx.range ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('handle'),\n style: [_ctx.sx('handle'), $options.handleStyle],\n onTouchstartPassive: _cache[0] || (_cache[0] = function ($event) {\n return $options.onDragStart($event);\n }),\n onTouchmovePassive: _cache[1] || (_cache[1] = function ($event) {\n return $options.onDrag($event);\n }),\n onTouchend: _cache[2] || (_cache[2] = function ($event) {\n return $options.onDragEnd($event);\n }),\n onMousedown: _cache[3] || (_cache[3] = function ($event) {\n return $options.onMouseDown($event);\n }),\n onKeydown: _cache[4] || (_cache[4] = function ($event) {\n return $options.onKeyDown($event);\n }),\n tabindex: _ctx.tabindex,\n role: \"slider\",\n \"aria-valuemin\": _ctx.min,\n \"aria-valuenow\": _ctx.modelValue,\n \"aria-valuemax\": _ctx.max,\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-label\": _ctx.ariaLabel,\n \"aria-orientation\": _ctx.orientation\n }, _ctx.ptm('handle')), null, 16, _hoisted_1)) : createCommentVNode(\"\", true), _ctx.range ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 1,\n \"class\": _ctx.cx('handle'),\n style: [_ctx.sx('handle'), $options.rangeStartHandleStyle],\n onTouchstartPassive: _cache[5] || (_cache[5] = function ($event) {\n return $options.onDragStart($event, 0);\n }),\n onTouchmovePassive: _cache[6] || (_cache[6] = function ($event) {\n return $options.onDrag($event);\n }),\n onTouchend: _cache[7] || (_cache[7] = function ($event) {\n return $options.onDragEnd($event);\n }),\n onMousedown: _cache[8] || (_cache[8] = function ($event) {\n return $options.onMouseDown($event, 0);\n }),\n onKeydown: _cache[9] || (_cache[9] = function ($event) {\n return $options.onKeyDown($event, 0);\n }),\n tabindex: _ctx.tabindex,\n role: \"slider\",\n \"aria-valuemin\": _ctx.min,\n \"aria-valuenow\": _ctx.modelValue ? _ctx.modelValue[0] : null,\n \"aria-valuemax\": _ctx.max,\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-label\": _ctx.ariaLabel,\n \"aria-orientation\": _ctx.orientation\n }, _ctx.ptm('startHandler')), null, 16, _hoisted_2)) : createCommentVNode(\"\", true), _ctx.range ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 2,\n \"class\": _ctx.cx('handle'),\n style: [_ctx.sx('handle'), $options.rangeEndHandleStyle],\n onTouchstartPassive: _cache[10] || (_cache[10] = function ($event) {\n return $options.onDragStart($event, 1);\n }),\n onTouchmovePassive: _cache[11] || (_cache[11] = function ($event) {\n return $options.onDrag($event);\n }),\n onTouchend: _cache[12] || (_cache[12] = function ($event) {\n return $options.onDragEnd($event);\n }),\n onMousedown: _cache[13] || (_cache[13] = function ($event) {\n return $options.onMouseDown($event, 1);\n }),\n onKeydown: _cache[14] || (_cache[14] = function ($event) {\n return $options.onKeyDown($event, 1);\n }),\n tabindex: _ctx.tabindex,\n role: \"slider\",\n \"aria-valuemin\": _ctx.min,\n \"aria-valuenow\": _ctx.modelValue ? _ctx.modelValue[1] : null,\n \"aria-valuemax\": _ctx.max,\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-label\": _ctx.ariaLabel,\n \"aria-orientation\": _ctx.orientation\n }, _ctx.ptm('endHandler')), null, 16, _hoisted_3)) : createCommentVNode(\"\", true)], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n","\n\n\n\n\n\n","\n\n\n","\n\n\n","import BaseStyle from '@primevue/core/base/style';\n\nvar classes = {\n root: function root(_ref) {\n var instance = _ref.instance;\n return ['p-tabpanel', {\n 'p-tabpanel-active': instance.active\n }];\n }\n};\nvar TabPanelStyle = BaseStyle.extend({\n name: 'tabpanel',\n classes: classes\n});\n\nexport { TabPanelStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { equals } from '@primeuix/utils/object';\nimport { mergeProps, renderSlot, openBlock, createElementBlock, Fragment, withDirectives, createBlock, resolveDynamicComponent, withCtx, vShow, createCommentVNode, normalizeClass } from 'vue';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport TabPanelStyle from 'primevue/tabpanel/style';\n\nvar script$1 = {\n name: 'BaseTabPanel',\n \"extends\": BaseComponent,\n props: {\n // in Tabs\n value: {\n type: [String, Number],\n \"default\": undefined\n },\n as: {\n type: [String, Object],\n \"default\": 'DIV'\n },\n asChild: {\n type: Boolean,\n \"default\": false\n },\n // in TabView\n header: null,\n headerStyle: null,\n headerClass: null,\n headerProps: null,\n headerActionProps: null,\n contentStyle: null,\n contentClass: null,\n contentProps: null,\n disabled: Boolean\n },\n style: TabPanelStyle,\n provide: function provide() {\n return {\n $pcTabPanel: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'TabPanel',\n \"extends\": script$1,\n inheritAttrs: false,\n inject: ['$pcTabs'],\n computed: {\n active: function active() {\n var _this$$pcTabs;\n return equals((_this$$pcTabs = this.$pcTabs) === null || _this$$pcTabs === void 0 ? void 0 : _this$$pcTabs.d_value, this.value);\n },\n id: function id() {\n var _this$$pcTabs2;\n return \"\".concat((_this$$pcTabs2 = this.$pcTabs) === null || _this$$pcTabs2 === void 0 ? void 0 : _this$$pcTabs2.id, \"_tabpanel_\").concat(this.value);\n },\n ariaLabelledby: function ariaLabelledby() {\n var _this$$pcTabs3;\n return \"\".concat((_this$$pcTabs3 = this.$pcTabs) === null || _this$$pcTabs3 === void 0 ? void 0 : _this$$pcTabs3.id, \"_tab_\").concat(this.value);\n },\n attrs: function attrs() {\n return mergeProps(this.a11yAttrs, this.ptmi('root', this.ptParams));\n },\n a11yAttrs: function a11yAttrs() {\n var _this$$pcTabs4;\n return {\n id: this.id,\n tabindex: (_this$$pcTabs4 = this.$pcTabs) === null || _this$$pcTabs4 === void 0 ? void 0 : _this$$pcTabs4.tabindex,\n role: 'tabpanel',\n 'aria-labelledby': this.ariaLabelledby,\n 'data-pc-name': 'tabpanel',\n 'data-p-active': this.active\n };\n },\n ptParams: function ptParams() {\n return {\n context: {\n active: this.active\n }\n };\n }\n }\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _$options$$pcTabs, _$options$$pcTabs2;\n return !$options.$pcTabs ? renderSlot(_ctx.$slots, \"default\", {\n key: 0\n }) : (openBlock(), createElementBlock(Fragment, {\n key: 1\n }, [!_ctx.asChild ? (openBlock(), createElementBlock(Fragment, {\n key: 0\n }, [((_$options$$pcTabs = $options.$pcTabs) !== null && _$options$$pcTabs !== void 0 && _$options$$pcTabs.lazy ? $options.active : true) ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({\n key: 0,\n \"class\": _ctx.cx('root')\n }, $options.attrs), {\n \"default\": withCtx(function () {\n return [renderSlot(_ctx.$slots, \"default\")];\n }),\n _: 3\n }, 16, [\"class\"])), [[vShow, (_$options$$pcTabs2 = $options.$pcTabs) !== null && _$options$$pcTabs2 !== void 0 && _$options$$pcTabs2.lazy ? true : $options.active]]) : createCommentVNode(\"\", true)], 64)) : renderSlot(_ctx.$slots, \"default\", {\n key: 1,\n \"class\": normalizeClass(_ctx.cx('root')),\n active: $options.active,\n a11yAttrs: $options.a11yAttrs\n })], 64));\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n","import { defineStore } from 'pinia'\nimport { ref } from 'vue'\nimport { api } from '@/scripts/api'\nimport type { SystemStats } from '@/types/apiTypes'\n\nexport const useSystemStatsStore = defineStore('systemStats', () => {\n const systemStats = ref(null)\n const isLoading = ref(false)\n const error = ref(null)\n\n async function fetchSystemStats() {\n isLoading.value = true\n error.value = null\n\n try {\n systemStats.value = await api.getSystemStats()\n } catch (err) {\n error.value =\n err instanceof Error\n ? err.message\n : 'An error occurred while fetching system stats'\n console.error('Error fetching system stats:', err)\n } finally {\n isLoading.value = false\n }\n }\n\n return {\n systemStats,\n isLoading,\n error,\n fetchSystemStats\n }\n})\n","export const CORE_MENU_COMMANDS = [\n [['Workflow'], ['Comfy.NewBlankWorkflow']],\n [['Workflow'], ['Comfy.OpenWorkflow', 'Comfy.BrowseTemplates']],\n [\n ['Workflow'],\n [\n 'Comfy.SaveWorkflow',\n 'Comfy.SaveWorkflowAs',\n 'Comfy.ExportWorkflow',\n 'Comfy.ExportWorkflowAPI'\n ]\n ],\n [['Edit'], ['Comfy.Undo', 'Comfy.Redo']],\n [['Edit'], ['Comfy.RefreshNodeDefinitions']],\n [['Edit'], ['Comfy.ClearWorkflow']],\n [['Edit'], ['Comfy.OpenClipspace']],\n [\n ['Help'],\n [\n 'Comfy.Help.OpenComfyUIIssues',\n 'Comfy.Help.OpenComfyUIDocs',\n 'Comfy.Help.OpenComfyOrgDiscord'\n ]\n ]\n]\n","import { defineStore } from 'pinia'\nimport type { MenuItem } from 'primevue/menuitem'\nimport { ref } from 'vue'\nimport { useCommandStore } from './commandStore'\nimport { ComfyExtension } from '@/types/comfy'\nimport { CORE_MENU_COMMANDS } from '@/constants/coreMenuCommands'\n\nexport const useMenuItemStore = defineStore('menuItem', () => {\n const commandStore = useCommandStore()\n const menuItems = ref([])\n\n const registerMenuGroup = (path: string[], items: MenuItem[]) => {\n let currentLevel = menuItems.value\n\n // Traverse the path, creating nodes if necessary\n for (let i = 0; i < path.length; i++) {\n const segment = path[i]\n let found = currentLevel.find((item) => item.label === segment)\n\n if (!found) {\n // Create a new node if it doesn't exist\n found = {\n label: segment,\n items: []\n }\n currentLevel.push(found)\n }\n\n // Ensure the found item has an 'items' array\n if (!found.items) {\n found.items = []\n }\n\n // Move to the next level\n currentLevel = found.items\n }\n\n if (currentLevel.length > 0) {\n currentLevel.push({\n separator: true\n })\n }\n // Add the new items to the last level\n currentLevel.push(...items)\n }\n\n const registerCommands = (path: string[], commandIds: string[]) => {\n const items = commandIds\n .map((commandId) => commandStore.getCommand(commandId))\n .map(\n (command) =>\n ({\n command: () => commandStore.execute(command.id),\n label: command.menubarLabel,\n icon: command.icon,\n tooltip: command.tooltip,\n comfyCommand: command\n }) as MenuItem\n )\n registerMenuGroup(path, items)\n }\n\n const loadExtensionMenuCommands = (extension: ComfyExtension) => {\n if (!extension.menuCommands) {\n return\n }\n\n const extensionCommandIds = new Set(\n extension.commands?.map((command) => command.id) ?? []\n )\n extension.menuCommands.forEach((menuCommand) => {\n const commands = menuCommand.commands.filter((command) =>\n extensionCommandIds.has(command)\n )\n if (commands.length) {\n registerCommands(menuCommand.path, commands)\n }\n })\n }\n\n const registerCoreMenuCommands = () => {\n for (const [path, commands] of CORE_MENU_COMMANDS) {\n registerCommands(path, commands)\n }\n }\n\n return {\n menuItems,\n registerMenuGroup,\n registerCommands,\n loadExtensionMenuCommands,\n registerCoreMenuCommands\n }\n})\n","import { ref, computed } from 'vue'\nimport { defineStore } from 'pinia'\nimport { api } from '@/scripts/api'\nimport { ComfyWorkflow } from './workflowStore'\nimport type { ComfyNode, ComfyWorkflowJSON } from '@/types/comfyWorkflow'\nimport type {\n ExecutedWsMessage,\n ExecutingWsMessage,\n ExecutionCachedWsMessage,\n ExecutionStartWsMessage,\n ProgressWsMessage,\n StatusWsMessage\n} from '@/types/apiTypes'\n\nexport interface QueuedPrompt {\n nodes: Record\n workflow?: ComfyWorkflow\n}\n\nexport const useExecutionStore = defineStore('execution', () => {\n const clientId = ref(null)\n const activePromptId = ref(null)\n const queuedPrompts = ref>({})\n const executingNodeId = ref(null)\n const executingNode = computed(() => {\n if (!executingNodeId.value) return null\n\n const workflow: ComfyWorkflow | undefined = activePrompt.value?.workflow\n if (!workflow) return null\n\n const canvasState: ComfyWorkflowJSON | null =\n workflow.changeTracker?.activeState ?? null\n if (!canvasState) return null\n\n return (\n canvasState.nodes.find(\n (n: ComfyNode) => String(n.id) === executingNodeId.value\n ) ?? null\n )\n })\n\n // This is the progress of the currently executing node, if any\n const _executingNodeProgress = ref(null)\n const executingNodeProgress = computed(() =>\n _executingNodeProgress.value\n ? Math.round(\n (_executingNodeProgress.value.value /\n _executingNodeProgress.value.max) *\n 100\n )\n : null\n )\n\n const activePrompt = computed(\n () => queuedPrompts.value[activePromptId.value ?? '']\n )\n\n const totalNodesToExecute = computed(() => {\n if (!activePrompt.value) return 0\n return Object.values(activePrompt.value.nodes).length\n })\n\n const isIdle = computed(() => !activePromptId.value)\n\n const nodesExecuted = computed(() => {\n if (!activePrompt.value) return 0\n return Object.values(activePrompt.value.nodes).filter(Boolean).length\n })\n\n const executionProgress = computed(() => {\n if (!activePrompt.value) return 0\n const total = totalNodesToExecute.value\n const done = nodesExecuted.value\n return Math.round((done / total) * 100)\n })\n\n function bindExecutionEvents() {\n api.addEventListener(\n 'execution_start',\n handleExecutionStart as EventListener\n )\n api.addEventListener(\n 'execution_cached',\n handleExecutionCached as EventListener\n )\n api.addEventListener('executed', handleExecuted as EventListener)\n api.addEventListener('executing', handleExecuting as EventListener)\n api.addEventListener('progress', handleProgress as EventListener)\n api.addEventListener('status', handleStatus as EventListener)\n }\n\n function unbindExecutionEvents() {\n api.removeEventListener(\n 'execution_start',\n handleExecutionStart as EventListener\n )\n api.removeEventListener(\n 'execution_cached',\n handleExecutionCached as EventListener\n )\n api.removeEventListener('executed', handleExecuted as EventListener)\n api.removeEventListener('executing', handleExecuting as EventListener)\n api.removeEventListener('progress', handleProgress as EventListener)\n api.removeEventListener('status', handleStatus as EventListener)\n }\n\n function handleExecutionStart(e: CustomEvent) {\n activePromptId.value = e.detail.prompt_id\n queuedPrompts.value[activePromptId.value] ??= { nodes: {} }\n }\n\n function handleExecutionCached(e: CustomEvent) {\n if (!activePrompt.value) return\n for (const n of e.detail.nodes) {\n activePrompt.value.nodes[n] = true\n }\n }\n\n function handleExecuted(e: CustomEvent) {\n if (!activePrompt.value) return\n activePrompt.value.nodes[e.detail.node] = true\n }\n\n function handleExecuting(e: CustomEvent) {\n // Clear the current node progress when a new node starts executing\n _executingNodeProgress.value = null\n\n if (!activePrompt.value) return\n\n if (executingNodeId.value && activePrompt.value) {\n // Seems sometimes nodes that are cached fire executing but not executed\n activePrompt.value.nodes[executingNodeId.value] = true\n }\n executingNodeId.value = e.detail ? String(e.detail) : null\n if (!executingNodeId.value) {\n if (activePromptId.value) {\n delete queuedPrompts.value[activePromptId.value]\n }\n activePromptId.value = null\n }\n }\n\n function handleProgress(e: CustomEvent) {\n _executingNodeProgress.value = e.detail\n }\n\n function handleStatus(e: CustomEvent) {\n if (api.clientId) {\n clientId.value = api.clientId\n\n // Once we've received the clientId we no longer need to listen\n api.removeEventListener('status', handleStatus as EventListener)\n }\n }\n\n function storePrompt({\n nodes,\n id,\n workflow\n }: {\n nodes: string[]\n id: string\n workflow: ComfyWorkflow\n }) {\n queuedPrompts.value[id] ??= { nodes: {} }\n const queuedPrompt = queuedPrompts.value[id]\n queuedPrompt.nodes = {\n ...nodes.reduce((p: Record, n) => {\n p[n] = false\n return p\n }, {}),\n ...queuedPrompt.nodes\n }\n queuedPrompt.workflow = workflow\n\n console.debug(\n `queued task ${id} with ${Object.values(queuedPrompt.nodes).length} nodes`\n )\n }\n\n return {\n isIdle,\n clientId,\n activePromptId,\n queuedPrompts,\n executingNodeId,\n activePrompt,\n totalNodesToExecute,\n nodesExecuted,\n executionProgress,\n executingNode,\n executingNodeProgress,\n bindExecutionEvents,\n unbindExecutionEvents,\n storePrompt\n }\n})\n","import * as Vue from 'vue'\n\nvar isVue2 = false\nvar isVue3 = true\nvar Vue2 = undefined\n\nfunction install() {}\n\nexport function set(target, key, val) {\n if (Array.isArray(target)) {\n target.length = Math.max(target.length, key)\n target.splice(key, 1, val)\n return val\n }\n target[key] = val\n return val\n}\n\nexport function del(target, key) {\n if (Array.isArray(target)) {\n target.splice(key, 1)\n return\n }\n delete target[key]\n}\n\nexport * from 'vue'\nexport {\n Vue,\n Vue2,\n isVue2,\n isVue3,\n install,\n}\n","import { shallowRef, watchEffect, readonly, ref, watch, customRef, getCurrentScope, onScopeDispose, effectScope, getCurrentInstance, provide, inject, isVue3, version, isRef, unref, computed, reactive, toRefs as toRefs$1, toRef as toRef$1, isVue2, set as set$1, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue-demi';\n\nfunction computedEager(fn, options) {\n var _a;\n const result = shallowRef();\n watchEffect(() => {\n result.value = fn();\n }, {\n ...options,\n flush: (_a = options == null ? void 0 : options.flush) != null ? _a : \"sync\"\n });\n return readonly(result);\n}\n\nfunction computedWithControl(source, fn) {\n let v = void 0;\n let track;\n let trigger;\n const dirty = ref(true);\n const update = () => {\n dirty.value = true;\n trigger();\n };\n watch(source, update, { flush: \"sync\" });\n const get = typeof fn === \"function\" ? fn : fn.get;\n const set = typeof fn === \"function\" ? void 0 : fn.set;\n const result = customRef((_track, _trigger) => {\n track = _track;\n trigger = _trigger;\n return {\n get() {\n if (dirty.value) {\n v = get(v);\n dirty.value = false;\n }\n track();\n return v;\n },\n set(v2) {\n set == null ? void 0 : set(v2);\n }\n };\n });\n if (Object.isExtensible(result))\n result.trigger = update;\n return result;\n}\n\nfunction tryOnScopeDispose(fn) {\n if (getCurrentScope()) {\n onScopeDispose(fn);\n return true;\n }\n return false;\n}\n\nfunction createEventHook() {\n const fns = /* @__PURE__ */ new Set();\n const off = (fn) => {\n fns.delete(fn);\n };\n const on = (fn) => {\n fns.add(fn);\n const offFn = () => off(fn);\n tryOnScopeDispose(offFn);\n return {\n off: offFn\n };\n };\n const trigger = (...args) => {\n return Promise.all(Array.from(fns).map((fn) => fn(...args)));\n };\n return {\n on,\n off,\n trigger\n };\n}\n\nfunction createGlobalState(stateFactory) {\n let initialized = false;\n let state;\n const scope = effectScope(true);\n return (...args) => {\n if (!initialized) {\n state = scope.run(() => stateFactory(...args));\n initialized = true;\n }\n return state;\n };\n}\n\nconst localProvidedStateMap = /* @__PURE__ */ new WeakMap();\n\nconst provideLocal = (key, value) => {\n var _a;\n const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;\n if (instance == null)\n throw new Error(\"provideLocal must be called in setup\");\n if (!localProvidedStateMap.has(instance))\n localProvidedStateMap.set(instance, /* @__PURE__ */ Object.create(null));\n const localProvidedState = localProvidedStateMap.get(instance);\n localProvidedState[key] = value;\n provide(key, value);\n};\n\nconst injectLocal = (...args) => {\n var _a;\n const key = args[0];\n const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;\n if (instance == null)\n throw new Error(\"injectLocal must be called in setup\");\n if (localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))\n return localProvidedStateMap.get(instance)[key];\n return inject(...args);\n};\n\nfunction createInjectionState(composable, options) {\n const key = (options == null ? void 0 : options.injectionKey) || Symbol(composable.name || \"InjectionState\");\n const defaultValue = options == null ? void 0 : options.defaultValue;\n const useProvidingState = (...args) => {\n const state = composable(...args);\n provideLocal(key, state);\n return state;\n };\n const useInjectedState = () => injectLocal(key, defaultValue);\n return [useProvidingState, useInjectedState];\n}\n\nfunction createSharedComposable(composable) {\n let subscribers = 0;\n let state;\n let scope;\n const dispose = () => {\n subscribers -= 1;\n if (scope && subscribers <= 0) {\n scope.stop();\n state = void 0;\n scope = void 0;\n }\n };\n return (...args) => {\n subscribers += 1;\n if (!state) {\n scope = effectScope(true);\n state = scope.run(() => composable(...args));\n }\n tryOnScopeDispose(dispose);\n return state;\n };\n}\n\nfunction extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {\n if (!isVue3 && !version.startsWith(\"2.7.\")) {\n if (process.env.NODE_ENV !== \"production\")\n throw new Error(\"[VueUse] extendRef only works in Vue 2.7 or above.\");\n return;\n }\n for (const [key, value] of Object.entries(extend)) {\n if (key === \"value\")\n continue;\n if (isRef(value) && unwrap) {\n Object.defineProperty(ref, key, {\n get() {\n return value.value;\n },\n set(v) {\n value.value = v;\n },\n enumerable\n });\n } else {\n Object.defineProperty(ref, key, { value, enumerable });\n }\n }\n return ref;\n}\n\nfunction get(obj, key) {\n if (key == null)\n return unref(obj);\n return unref(obj)[key];\n}\n\nfunction isDefined(v) {\n return unref(v) != null;\n}\n\nfunction makeDestructurable(obj, arr) {\n if (typeof Symbol !== \"undefined\") {\n const clone = { ...obj };\n Object.defineProperty(clone, Symbol.iterator, {\n enumerable: false,\n value() {\n let index = 0;\n return {\n next: () => ({\n value: arr[index++],\n done: index > arr.length\n })\n };\n }\n });\n return clone;\n } else {\n return Object.assign([...arr], obj);\n }\n}\n\nfunction toValue(r) {\n return typeof r === \"function\" ? r() : unref(r);\n}\nconst resolveUnref = toValue;\n\nfunction reactify(fn, options) {\n const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? unref : toValue;\n return function(...args) {\n return computed(() => fn.apply(this, args.map((i) => unrefFn(i))));\n };\n}\n\nfunction reactifyObject(obj, optionsOrKeys = {}) {\n let keys = [];\n let options;\n if (Array.isArray(optionsOrKeys)) {\n keys = optionsOrKeys;\n } else {\n options = optionsOrKeys;\n const { includeOwnProperties = true } = optionsOrKeys;\n keys.push(...Object.keys(obj));\n if (includeOwnProperties)\n keys.push(...Object.getOwnPropertyNames(obj));\n }\n return Object.fromEntries(\n keys.map((key) => {\n const value = obj[key];\n return [\n key,\n typeof value === \"function\" ? reactify(value.bind(obj), options) : value\n ];\n })\n );\n}\n\nfunction toReactive(objectRef) {\n if (!isRef(objectRef))\n return reactive(objectRef);\n const proxy = new Proxy({}, {\n get(_, p, receiver) {\n return unref(Reflect.get(objectRef.value, p, receiver));\n },\n set(_, p, value) {\n if (isRef(objectRef.value[p]) && !isRef(value))\n objectRef.value[p].value = value;\n else\n objectRef.value[p] = value;\n return true;\n },\n deleteProperty(_, p) {\n return Reflect.deleteProperty(objectRef.value, p);\n },\n has(_, p) {\n return Reflect.has(objectRef.value, p);\n },\n ownKeys() {\n return Object.keys(objectRef.value);\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true\n };\n }\n });\n return reactive(proxy);\n}\n\nfunction reactiveComputed(fn) {\n return toReactive(computed(fn));\n}\n\nfunction reactiveOmit(obj, ...keys) {\n const flatKeys = keys.flat();\n const predicate = flatKeys[0];\n return reactiveComputed(() => typeof predicate === \"function\" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => !predicate(toValue(v), k))) : Object.fromEntries(Object.entries(toRefs$1(obj)).filter((e) => !flatKeys.includes(e[0]))));\n}\n\nconst isClient = typeof window !== \"undefined\" && typeof document !== \"undefined\";\nconst isWorker = typeof WorkerGlobalScope !== \"undefined\" && globalThis instanceof WorkerGlobalScope;\nconst isDef = (val) => typeof val !== \"undefined\";\nconst notNullish = (val) => val != null;\nconst assert = (condition, ...infos) => {\n if (!condition)\n console.warn(...infos);\n};\nconst toString = Object.prototype.toString;\nconst isObject = (val) => toString.call(val) === \"[object Object]\";\nconst now = () => Date.now();\nconst timestamp = () => +Date.now();\nconst clamp = (n, min, max) => Math.min(max, Math.max(min, n));\nconst noop = () => {\n};\nconst rand = (min, max) => {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1)) + min;\n};\nconst hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);\nconst isIOS = /* @__PURE__ */ getIsIOS();\nfunction getIsIOS() {\n var _a, _b;\n return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));\n}\n\nfunction createFilterWrapper(filter, fn) {\n function wrapper(...args) {\n return new Promise((resolve, reject) => {\n Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject);\n });\n }\n return wrapper;\n}\nconst bypassFilter = (invoke) => {\n return invoke();\n};\nfunction debounceFilter(ms, options = {}) {\n let timer;\n let maxTimer;\n let lastRejector = noop;\n const _clearTimeout = (timer2) => {\n clearTimeout(timer2);\n lastRejector();\n lastRejector = noop;\n };\n const filter = (invoke) => {\n const duration = toValue(ms);\n const maxDuration = toValue(options.maxWait);\n if (timer)\n _clearTimeout(timer);\n if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {\n if (maxTimer) {\n _clearTimeout(maxTimer);\n maxTimer = null;\n }\n return Promise.resolve(invoke());\n }\n return new Promise((resolve, reject) => {\n lastRejector = options.rejectOnCancel ? reject : resolve;\n if (maxDuration && !maxTimer) {\n maxTimer = setTimeout(() => {\n if (timer)\n _clearTimeout(timer);\n maxTimer = null;\n resolve(invoke());\n }, maxDuration);\n }\n timer = setTimeout(() => {\n if (maxTimer)\n _clearTimeout(maxTimer);\n maxTimer = null;\n resolve(invoke());\n }, duration);\n });\n };\n return filter;\n}\nfunction throttleFilter(...args) {\n let lastExec = 0;\n let timer;\n let isLeading = true;\n let lastRejector = noop;\n let lastValue;\n let ms;\n let trailing;\n let leading;\n let rejectOnCancel;\n if (!isRef(args[0]) && typeof args[0] === \"object\")\n ({ delay: ms, trailing = true, leading = true, rejectOnCancel = false } = args[0]);\n else\n [ms, trailing = true, leading = true, rejectOnCancel = false] = args;\n const clear = () => {\n if (timer) {\n clearTimeout(timer);\n timer = void 0;\n lastRejector();\n lastRejector = noop;\n }\n };\n const filter = (_invoke) => {\n const duration = toValue(ms);\n const elapsed = Date.now() - lastExec;\n const invoke = () => {\n return lastValue = _invoke();\n };\n clear();\n if (duration <= 0) {\n lastExec = Date.now();\n return invoke();\n }\n if (elapsed > duration && (leading || !isLeading)) {\n lastExec = Date.now();\n invoke();\n } else if (trailing) {\n lastValue = new Promise((resolve, reject) => {\n lastRejector = rejectOnCancel ? reject : resolve;\n timer = setTimeout(() => {\n lastExec = Date.now();\n isLeading = true;\n resolve(invoke());\n clear();\n }, Math.max(0, duration - elapsed));\n });\n }\n if (!leading && !timer)\n timer = setTimeout(() => isLeading = true, duration);\n isLeading = false;\n return lastValue;\n };\n return filter;\n}\nfunction pausableFilter(extendFilter = bypassFilter) {\n const isActive = ref(true);\n function pause() {\n isActive.value = false;\n }\n function resume() {\n isActive.value = true;\n }\n const eventFilter = (...args) => {\n if (isActive.value)\n extendFilter(...args);\n };\n return { isActive: readonly(isActive), pause, resume, eventFilter };\n}\n\nconst directiveHooks = {\n mounted: isVue3 ? \"mounted\" : \"inserted\",\n updated: isVue3 ? \"updated\" : \"componentUpdated\",\n unmounted: isVue3 ? \"unmounted\" : \"unbind\"\n};\n\nfunction cacheStringFunction(fn) {\n const cache = /* @__PURE__ */ Object.create(null);\n return (str) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n };\n}\nconst hyphenateRE = /\\B([A-Z])/g;\nconst hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, \"-$1\").toLowerCase());\nconst camelizeRE = /-(\\w)/g;\nconst camelize = cacheStringFunction((str) => {\n return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : \"\");\n});\n\nfunction promiseTimeout(ms, throwOnTimeout = false, reason = \"Timeout\") {\n return new Promise((resolve, reject) => {\n if (throwOnTimeout)\n setTimeout(() => reject(reason), ms);\n else\n setTimeout(resolve, ms);\n });\n}\nfunction identity(arg) {\n return arg;\n}\nfunction createSingletonPromise(fn) {\n let _promise;\n function wrapper() {\n if (!_promise)\n _promise = fn();\n return _promise;\n }\n wrapper.reset = async () => {\n const _prev = _promise;\n _promise = void 0;\n if (_prev)\n await _prev;\n };\n return wrapper;\n}\nfunction invoke(fn) {\n return fn();\n}\nfunction containsProp(obj, ...props) {\n return props.some((k) => k in obj);\n}\nfunction increaseWithUnit(target, delta) {\n var _a;\n if (typeof target === \"number\")\n return target + delta;\n const value = ((_a = target.match(/^-?\\d+\\.?\\d*/)) == null ? void 0 : _a[0]) || \"\";\n const unit = target.slice(value.length);\n const result = Number.parseFloat(value) + delta;\n if (Number.isNaN(result))\n return target;\n return result + unit;\n}\nfunction objectPick(obj, keys, omitUndefined = false) {\n return keys.reduce((n, k) => {\n if (k in obj) {\n if (!omitUndefined || obj[k] !== void 0)\n n[k] = obj[k];\n }\n return n;\n }, {});\n}\nfunction objectOmit(obj, keys, omitUndefined = false) {\n return Object.fromEntries(Object.entries(obj).filter(([key, value]) => {\n return (!omitUndefined || value !== void 0) && !keys.includes(key);\n }));\n}\nfunction objectEntries(obj) {\n return Object.entries(obj);\n}\nfunction getLifeCycleTarget(target) {\n return target || getCurrentInstance();\n}\n\nfunction toRef(...args) {\n if (args.length !== 1)\n return toRef$1(...args);\n const r = args[0];\n return typeof r === \"function\" ? readonly(customRef(() => ({ get: r, set: noop }))) : ref(r);\n}\nconst resolveRef = toRef;\n\nfunction reactivePick(obj, ...keys) {\n const flatKeys = keys.flat();\n const predicate = flatKeys[0];\n return reactiveComputed(() => typeof predicate === \"function\" ? Object.fromEntries(Object.entries(toRefs$1(obj)).filter(([k, v]) => predicate(toValue(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));\n}\n\nfunction refAutoReset(defaultValue, afterMs = 1e4) {\n return customRef((track, trigger) => {\n let value = toValue(defaultValue);\n let timer;\n const resetAfter = () => setTimeout(() => {\n value = toValue(defaultValue);\n trigger();\n }, toValue(afterMs));\n tryOnScopeDispose(() => {\n clearTimeout(timer);\n });\n return {\n get() {\n track();\n return value;\n },\n set(newValue) {\n value = newValue;\n trigger();\n clearTimeout(timer);\n timer = resetAfter();\n }\n };\n });\n}\n\nfunction useDebounceFn(fn, ms = 200, options = {}) {\n return createFilterWrapper(\n debounceFilter(ms, options),\n fn\n );\n}\n\nfunction refDebounced(value, ms = 200, options = {}) {\n const debounced = ref(value.value);\n const updater = useDebounceFn(() => {\n debounced.value = value.value;\n }, ms, options);\n watch(value, () => updater());\n return debounced;\n}\n\nfunction refDefault(source, defaultValue) {\n return computed({\n get() {\n var _a;\n return (_a = source.value) != null ? _a : defaultValue;\n },\n set(value) {\n source.value = value;\n }\n });\n}\n\nfunction useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {\n return createFilterWrapper(\n throttleFilter(ms, trailing, leading, rejectOnCancel),\n fn\n );\n}\n\nfunction refThrottled(value, delay = 200, trailing = true, leading = true) {\n if (delay <= 0)\n return value;\n const throttled = ref(value.value);\n const updater = useThrottleFn(() => {\n throttled.value = value.value;\n }, delay, trailing, leading);\n watch(value, () => updater());\n return throttled;\n}\n\nfunction refWithControl(initial, options = {}) {\n let source = initial;\n let track;\n let trigger;\n const ref = customRef((_track, _trigger) => {\n track = _track;\n trigger = _trigger;\n return {\n get() {\n return get();\n },\n set(v) {\n set(v);\n }\n };\n });\n function get(tracking = true) {\n if (tracking)\n track();\n return source;\n }\n function set(value, triggering = true) {\n var _a, _b;\n if (value === source)\n return;\n const old = source;\n if (((_a = options.onBeforeChange) == null ? void 0 : _a.call(options, value, old)) === false)\n return;\n source = value;\n (_b = options.onChanged) == null ? void 0 : _b.call(options, value, old);\n if (triggering)\n trigger();\n }\n const untrackedGet = () => get(false);\n const silentSet = (v) => set(v, false);\n const peek = () => get(false);\n const lay = (v) => set(v, false);\n return extendRef(\n ref,\n {\n get,\n set,\n untrackedGet,\n silentSet,\n peek,\n lay\n },\n { enumerable: true }\n );\n}\nconst controlledRef = refWithControl;\n\nfunction set(...args) {\n if (args.length === 2) {\n const [ref, value] = args;\n ref.value = value;\n }\n if (args.length === 3) {\n if (isVue2) {\n set$1(...args);\n } else {\n const [target, key, value] = args;\n target[key] = value;\n }\n }\n}\n\nfunction watchWithFilter(source, cb, options = {}) {\n const {\n eventFilter = bypassFilter,\n ...watchOptions\n } = options;\n return watch(\n source,\n createFilterWrapper(\n eventFilter,\n cb\n ),\n watchOptions\n );\n}\n\nfunction watchPausable(source, cb, options = {}) {\n const {\n eventFilter: filter,\n ...watchOptions\n } = options;\n const { eventFilter, pause, resume, isActive } = pausableFilter(filter);\n const stop = watchWithFilter(\n source,\n cb,\n {\n ...watchOptions,\n eventFilter\n }\n );\n return { stop, pause, resume, isActive };\n}\n\nfunction syncRef(left, right, ...[options]) {\n const {\n flush = \"sync\",\n deep = false,\n immediate = true,\n direction = \"both\",\n transform = {}\n } = options || {};\n const watchers = [];\n const transformLTR = \"ltr\" in transform && transform.ltr || ((v) => v);\n const transformRTL = \"rtl\" in transform && transform.rtl || ((v) => v);\n if (direction === \"both\" || direction === \"ltr\") {\n watchers.push(watchPausable(\n left,\n (newValue) => {\n watchers.forEach((w) => w.pause());\n right.value = transformLTR(newValue);\n watchers.forEach((w) => w.resume());\n },\n { flush, deep, immediate }\n ));\n }\n if (direction === \"both\" || direction === \"rtl\") {\n watchers.push(watchPausable(\n right,\n (newValue) => {\n watchers.forEach((w) => w.pause());\n left.value = transformRTL(newValue);\n watchers.forEach((w) => w.resume());\n },\n { flush, deep, immediate }\n ));\n }\n const stop = () => {\n watchers.forEach((w) => w.stop());\n };\n return stop;\n}\n\nfunction syncRefs(source, targets, options = {}) {\n const {\n flush = \"sync\",\n deep = false,\n immediate = true\n } = options;\n if (!Array.isArray(targets))\n targets = [targets];\n return watch(\n source,\n (newValue) => targets.forEach((target) => target.value = newValue),\n { flush, deep, immediate }\n );\n}\n\nfunction toRefs(objectRef, options = {}) {\n if (!isRef(objectRef))\n return toRefs$1(objectRef);\n const result = Array.isArray(objectRef.value) ? Array.from({ length: objectRef.value.length }) : {};\n for (const key in objectRef.value) {\n result[key] = customRef(() => ({\n get() {\n return objectRef.value[key];\n },\n set(v) {\n var _a;\n const replaceRef = (_a = toValue(options.replaceRef)) != null ? _a : true;\n if (replaceRef) {\n if (Array.isArray(objectRef.value)) {\n const copy = [...objectRef.value];\n copy[key] = v;\n objectRef.value = copy;\n } else {\n const newObject = { ...objectRef.value, [key]: v };\n Object.setPrototypeOf(newObject, Object.getPrototypeOf(objectRef.value));\n objectRef.value = newObject;\n }\n } else {\n objectRef.value[key] = v;\n }\n }\n }));\n }\n return result;\n}\n\nfunction tryOnBeforeMount(fn, sync = true, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onBeforeMount(fn, target);\n else if (sync)\n fn();\n else\n nextTick(fn);\n}\n\nfunction tryOnBeforeUnmount(fn, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onBeforeUnmount(fn, target);\n}\n\nfunction tryOnMounted(fn, sync = true, target) {\n const instance = getLifeCycleTarget();\n if (instance)\n onMounted(fn, target);\n else if (sync)\n fn();\n else\n nextTick(fn);\n}\n\nfunction tryOnUnmounted(fn, target) {\n const instance = getLifeCycleTarget(target);\n if (instance)\n onUnmounted(fn, target);\n}\n\nfunction createUntil(r, isNot = false) {\n function toMatch(condition, { flush = \"sync\", deep = false, timeout, throwOnTimeout } = {}) {\n let stop = null;\n const watcher = new Promise((resolve) => {\n stop = watch(\n r,\n (v) => {\n if (condition(v) !== isNot) {\n if (stop)\n stop();\n else\n nextTick(() => stop == null ? void 0 : stop());\n resolve(v);\n }\n },\n {\n flush,\n deep,\n immediate: true\n }\n );\n });\n const promises = [watcher];\n if (timeout != null) {\n promises.push(\n promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop == null ? void 0 : stop())\n );\n }\n return Promise.race(promises);\n }\n function toBe(value, options) {\n if (!isRef(value))\n return toMatch((v) => v === value, options);\n const { flush = \"sync\", deep = false, timeout, throwOnTimeout } = options != null ? options : {};\n let stop = null;\n const watcher = new Promise((resolve) => {\n stop = watch(\n [r, value],\n ([v1, v2]) => {\n if (isNot !== (v1 === v2)) {\n if (stop)\n stop();\n else\n nextTick(() => stop == null ? void 0 : stop());\n resolve(v1);\n }\n },\n {\n flush,\n deep,\n immediate: true\n }\n );\n });\n const promises = [watcher];\n if (timeout != null) {\n promises.push(\n promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => {\n stop == null ? void 0 : stop();\n return toValue(r);\n })\n );\n }\n return Promise.race(promises);\n }\n function toBeTruthy(options) {\n return toMatch((v) => Boolean(v), options);\n }\n function toBeNull(options) {\n return toBe(null, options);\n }\n function toBeUndefined(options) {\n return toBe(void 0, options);\n }\n function toBeNaN(options) {\n return toMatch(Number.isNaN, options);\n }\n function toContains(value, options) {\n return toMatch((v) => {\n const array = Array.from(v);\n return array.includes(value) || array.includes(toValue(value));\n }, options);\n }\n function changed(options) {\n return changedTimes(1, options);\n }\n function changedTimes(n = 1, options) {\n let count = -1;\n return toMatch(() => {\n count += 1;\n return count >= n;\n }, options);\n }\n if (Array.isArray(toValue(r))) {\n const instance = {\n toMatch,\n toContains,\n changed,\n changedTimes,\n get not() {\n return createUntil(r, !isNot);\n }\n };\n return instance;\n } else {\n const instance = {\n toMatch,\n toBe,\n toBeTruthy,\n toBeNull,\n toBeNaN,\n toBeUndefined,\n changed,\n changedTimes,\n get not() {\n return createUntil(r, !isNot);\n }\n };\n return instance;\n }\n}\nfunction until(r) {\n return createUntil(r);\n}\n\nfunction defaultComparator(value, othVal) {\n return value === othVal;\n}\nfunction useArrayDifference(...args) {\n var _a;\n const list = args[0];\n const values = args[1];\n let compareFn = (_a = args[2]) != null ? _a : defaultComparator;\n if (typeof compareFn === \"string\") {\n const key = compareFn;\n compareFn = (value, othVal) => value[key] === othVal[key];\n }\n return computed(() => toValue(list).filter((x) => toValue(values).findIndex((y) => compareFn(x, y)) === -1));\n}\n\nfunction useArrayEvery(list, fn) {\n return computed(() => toValue(list).every((element, index, array) => fn(toValue(element), index, array)));\n}\n\nfunction useArrayFilter(list, fn) {\n return computed(() => toValue(list).map((i) => toValue(i)).filter(fn));\n}\n\nfunction useArrayFind(list, fn) {\n return computed(() => toValue(\n toValue(list).find((element, index, array) => fn(toValue(element), index, array))\n ));\n}\n\nfunction useArrayFindIndex(list, fn) {\n return computed(() => toValue(list).findIndex((element, index, array) => fn(toValue(element), index, array)));\n}\n\nfunction findLast(arr, cb) {\n let index = arr.length;\n while (index-- > 0) {\n if (cb(arr[index], index, arr))\n return arr[index];\n }\n return void 0;\n}\nfunction useArrayFindLast(list, fn) {\n return computed(() => toValue(\n !Array.prototype.findLast ? findLast(toValue(list), (element, index, array) => fn(toValue(element), index, array)) : toValue(list).findLast((element, index, array) => fn(toValue(element), index, array))\n ));\n}\n\nfunction isArrayIncludesOptions(obj) {\n return isObject(obj) && containsProp(obj, \"formIndex\", \"comparator\");\n}\nfunction useArrayIncludes(...args) {\n var _a;\n const list = args[0];\n const value = args[1];\n let comparator = args[2];\n let formIndex = 0;\n if (isArrayIncludesOptions(comparator)) {\n formIndex = (_a = comparator.fromIndex) != null ? _a : 0;\n comparator = comparator.comparator;\n }\n if (typeof comparator === \"string\") {\n const key = comparator;\n comparator = (element, value2) => element[key] === toValue(value2);\n }\n comparator = comparator != null ? comparator : (element, value2) => element === toValue(value2);\n return computed(() => toValue(list).slice(formIndex).some((element, index, array) => comparator(\n toValue(element),\n toValue(value),\n index,\n toValue(array)\n )));\n}\n\nfunction useArrayJoin(list, separator) {\n return computed(() => toValue(list).map((i) => toValue(i)).join(toValue(separator)));\n}\n\nfunction useArrayMap(list, fn) {\n return computed(() => toValue(list).map((i) => toValue(i)).map(fn));\n}\n\nfunction useArrayReduce(list, reducer, ...args) {\n const reduceCallback = (sum, value, index) => reducer(toValue(sum), toValue(value), index);\n return computed(() => {\n const resolved = toValue(list);\n return args.length ? resolved.reduce(reduceCallback, toValue(args[0])) : resolved.reduce(reduceCallback);\n });\n}\n\nfunction useArraySome(list, fn) {\n return computed(() => toValue(list).some((element, index, array) => fn(toValue(element), index, array)));\n}\n\nfunction uniq(array) {\n return Array.from(new Set(array));\n}\nfunction uniqueElementsBy(array, fn) {\n return array.reduce((acc, v) => {\n if (!acc.some((x) => fn(v, x, array)))\n acc.push(v);\n return acc;\n }, []);\n}\nfunction useArrayUnique(list, compareFn) {\n return computed(() => {\n const resolvedList = toValue(list).map((element) => toValue(element));\n return compareFn ? uniqueElementsBy(resolvedList, compareFn) : uniq(resolvedList);\n });\n}\n\nfunction useCounter(initialValue = 0, options = {}) {\n let _initialValue = unref(initialValue);\n const count = ref(initialValue);\n const {\n max = Number.POSITIVE_INFINITY,\n min = Number.NEGATIVE_INFINITY\n } = options;\n const inc = (delta = 1) => count.value = Math.max(Math.min(max, count.value + delta), min);\n const dec = (delta = 1) => count.value = Math.min(Math.max(min, count.value - delta), max);\n const get = () => count.value;\n const set = (val) => count.value = Math.max(min, Math.min(max, val));\n const reset = (val = _initialValue) => {\n _initialValue = val;\n return set(val);\n };\n return { count, inc, dec, get, set, reset };\n}\n\nconst REGEX_PARSE = /^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[T\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/i;\nconst REGEX_FORMAT = /[YMDHhms]o|\\[([^\\]]+)\\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;\nfunction defaultMeridiem(hours, minutes, isLowercase, hasPeriod) {\n let m = hours < 12 ? \"AM\" : \"PM\";\n if (hasPeriod)\n m = m.split(\"\").reduce((acc, curr) => acc += `${curr}.`, \"\");\n return isLowercase ? m.toLowerCase() : m;\n}\nfunction formatOrdinal(num) {\n const suffixes = [\"th\", \"st\", \"nd\", \"rd\"];\n const v = num % 100;\n return num + (suffixes[(v - 20) % 10] || suffixes[v] || suffixes[0]);\n}\nfunction formatDate(date, formatStr, options = {}) {\n var _a;\n const years = date.getFullYear();\n const month = date.getMonth();\n const days = date.getDate();\n const hours = date.getHours();\n const minutes = date.getMinutes();\n const seconds = date.getSeconds();\n const milliseconds = date.getMilliseconds();\n const day = date.getDay();\n const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem;\n const matches = {\n Yo: () => formatOrdinal(years),\n YY: () => String(years).slice(-2),\n YYYY: () => years,\n M: () => month + 1,\n Mo: () => formatOrdinal(month + 1),\n MM: () => `${month + 1}`.padStart(2, \"0\"),\n MMM: () => date.toLocaleDateString(toValue(options.locales), { month: \"short\" }),\n MMMM: () => date.toLocaleDateString(toValue(options.locales), { month: \"long\" }),\n D: () => String(days),\n Do: () => formatOrdinal(days),\n DD: () => `${days}`.padStart(2, \"0\"),\n H: () => String(hours),\n Ho: () => formatOrdinal(hours),\n HH: () => `${hours}`.padStart(2, \"0\"),\n h: () => `${hours % 12 || 12}`.padStart(1, \"0\"),\n ho: () => formatOrdinal(hours % 12 || 12),\n hh: () => `${hours % 12 || 12}`.padStart(2, \"0\"),\n m: () => String(minutes),\n mo: () => formatOrdinal(minutes),\n mm: () => `${minutes}`.padStart(2, \"0\"),\n s: () => String(seconds),\n so: () => formatOrdinal(seconds),\n ss: () => `${seconds}`.padStart(2, \"0\"),\n SSS: () => `${milliseconds}`.padStart(3, \"0\"),\n d: () => day,\n dd: () => date.toLocaleDateString(toValue(options.locales), { weekday: \"narrow\" }),\n ddd: () => date.toLocaleDateString(toValue(options.locales), { weekday: \"short\" }),\n dddd: () => date.toLocaleDateString(toValue(options.locales), { weekday: \"long\" }),\n A: () => meridiem(hours, minutes),\n AA: () => meridiem(hours, minutes, false, true),\n a: () => meridiem(hours, minutes, true),\n aa: () => meridiem(hours, minutes, true, true)\n };\n return formatStr.replace(REGEX_FORMAT, (match, $1) => {\n var _a2, _b;\n return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ? void 0 : _a2.call(matches)) != null ? _b : match;\n });\n}\nfunction normalizeDate(date) {\n if (date === null)\n return new Date(Number.NaN);\n if (date === void 0)\n return /* @__PURE__ */ new Date();\n if (date instanceof Date)\n return new Date(date);\n if (typeof date === \"string\" && !/Z$/i.test(date)) {\n const d = date.match(REGEX_PARSE);\n if (d) {\n const m = d[2] - 1 || 0;\n const ms = (d[7] || \"0\").substring(0, 3);\n return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);\n }\n }\n return new Date(date);\n}\nfunction useDateFormat(date, formatStr = \"HH:mm:ss\", options = {}) {\n return computed(() => formatDate(normalizeDate(toValue(date)), toValue(formatStr), options));\n}\n\nfunction useIntervalFn(cb, interval = 1e3, options = {}) {\n const {\n immediate = true,\n immediateCallback = false\n } = options;\n let timer = null;\n const isActive = ref(false);\n function clean() {\n if (timer) {\n clearInterval(timer);\n timer = null;\n }\n }\n function pause() {\n isActive.value = false;\n clean();\n }\n function resume() {\n const intervalValue = toValue(interval);\n if (intervalValue <= 0)\n return;\n isActive.value = true;\n if (immediateCallback)\n cb();\n clean();\n timer = setInterval(cb, intervalValue);\n }\n if (immediate && isClient)\n resume();\n if (isRef(interval) || typeof interval === \"function\") {\n const stopWatch = watch(interval, () => {\n if (isActive.value && isClient)\n resume();\n });\n tryOnScopeDispose(stopWatch);\n }\n tryOnScopeDispose(pause);\n return {\n isActive,\n pause,\n resume\n };\n}\n\nfunction useInterval(interval = 1e3, options = {}) {\n const {\n controls: exposeControls = false,\n immediate = true,\n callback\n } = options;\n const counter = ref(0);\n const update = () => counter.value += 1;\n const reset = () => {\n counter.value = 0;\n };\n const controls = useIntervalFn(\n callback ? () => {\n update();\n callback(counter.value);\n } : update,\n interval,\n { immediate }\n );\n if (exposeControls) {\n return {\n counter,\n reset,\n ...controls\n };\n } else {\n return counter;\n }\n}\n\nfunction useLastChanged(source, options = {}) {\n var _a;\n const ms = ref((_a = options.initialValue) != null ? _a : null);\n watch(\n source,\n () => ms.value = timestamp(),\n options\n );\n return ms;\n}\n\nfunction useTimeoutFn(cb, interval, options = {}) {\n const {\n immediate = true\n } = options;\n const isPending = ref(false);\n let timer = null;\n function clear() {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n }\n function stop() {\n isPending.value = false;\n clear();\n }\n function start(...args) {\n clear();\n isPending.value = true;\n timer = setTimeout(() => {\n isPending.value = false;\n timer = null;\n cb(...args);\n }, toValue(interval));\n }\n if (immediate) {\n isPending.value = true;\n if (isClient)\n start();\n }\n tryOnScopeDispose(stop);\n return {\n isPending: readonly(isPending),\n start,\n stop\n };\n}\n\nfunction useTimeout(interval = 1e3, options = {}) {\n const {\n controls: exposeControls = false,\n callback\n } = options;\n const controls = useTimeoutFn(\n callback != null ? callback : noop,\n interval,\n options\n );\n const ready = computed(() => !controls.isPending.value);\n if (exposeControls) {\n return {\n ready,\n ...controls\n };\n } else {\n return ready;\n }\n}\n\nfunction useToNumber(value, options = {}) {\n const {\n method = \"parseFloat\",\n radix,\n nanToZero\n } = options;\n return computed(() => {\n let resolved = toValue(value);\n if (typeof resolved === \"string\")\n resolved = Number[method](resolved, radix);\n if (nanToZero && Number.isNaN(resolved))\n resolved = 0;\n return resolved;\n });\n}\n\nfunction useToString(value) {\n return computed(() => `${toValue(value)}`);\n}\n\nfunction useToggle(initialValue = false, options = {}) {\n const {\n truthyValue = true,\n falsyValue = false\n } = options;\n const valueIsRef = isRef(initialValue);\n const _value = ref(initialValue);\n function toggle(value) {\n if (arguments.length) {\n _value.value = value;\n return _value.value;\n } else {\n const truthy = toValue(truthyValue);\n _value.value = _value.value === truthy ? toValue(falsyValue) : truthy;\n return _value.value;\n }\n }\n if (valueIsRef)\n return toggle;\n else\n return [_value, toggle];\n}\n\nfunction watchArray(source, cb, options) {\n let oldList = (options == null ? void 0 : options.immediate) ? [] : [...source instanceof Function ? source() : Array.isArray(source) ? source : toValue(source)];\n return watch(source, (newList, _, onCleanup) => {\n const oldListRemains = Array.from({ length: oldList.length });\n const added = [];\n for (const obj of newList) {\n let found = false;\n for (let i = 0; i < oldList.length; i++) {\n if (!oldListRemains[i] && obj === oldList[i]) {\n oldListRemains[i] = true;\n found = true;\n break;\n }\n }\n if (!found)\n added.push(obj);\n }\n const removed = oldList.filter((_2, i) => !oldListRemains[i]);\n cb(newList, oldList, added, removed, onCleanup);\n oldList = [...newList];\n }, options);\n}\n\nfunction watchAtMost(source, cb, options) {\n const {\n count,\n ...watchOptions\n } = options;\n const current = ref(0);\n const stop = watchWithFilter(\n source,\n (...args) => {\n current.value += 1;\n if (current.value >= toValue(count))\n nextTick(() => stop());\n cb(...args);\n },\n watchOptions\n );\n return { count: current, stop };\n}\n\nfunction watchDebounced(source, cb, options = {}) {\n const {\n debounce = 0,\n maxWait = void 0,\n ...watchOptions\n } = options;\n return watchWithFilter(\n source,\n cb,\n {\n ...watchOptions,\n eventFilter: debounceFilter(debounce, { maxWait })\n }\n );\n}\n\nfunction watchDeep(source, cb, options) {\n return watch(\n source,\n cb,\n {\n ...options,\n deep: true\n }\n );\n}\n\nfunction watchIgnorable(source, cb, options = {}) {\n const {\n eventFilter = bypassFilter,\n ...watchOptions\n } = options;\n const filteredCb = createFilterWrapper(\n eventFilter,\n cb\n );\n let ignoreUpdates;\n let ignorePrevAsyncUpdates;\n let stop;\n if (watchOptions.flush === \"sync\") {\n const ignore = ref(false);\n ignorePrevAsyncUpdates = () => {\n };\n ignoreUpdates = (updater) => {\n ignore.value = true;\n updater();\n ignore.value = false;\n };\n stop = watch(\n source,\n (...args) => {\n if (!ignore.value)\n filteredCb(...args);\n },\n watchOptions\n );\n } else {\n const disposables = [];\n const ignoreCounter = ref(0);\n const syncCounter = ref(0);\n ignorePrevAsyncUpdates = () => {\n ignoreCounter.value = syncCounter.value;\n };\n disposables.push(\n watch(\n source,\n () => {\n syncCounter.value++;\n },\n { ...watchOptions, flush: \"sync\" }\n )\n );\n ignoreUpdates = (updater) => {\n const syncCounterPrev = syncCounter.value;\n updater();\n ignoreCounter.value += syncCounter.value - syncCounterPrev;\n };\n disposables.push(\n watch(\n source,\n (...args) => {\n const ignore = ignoreCounter.value > 0 && ignoreCounter.value === syncCounter.value;\n ignoreCounter.value = 0;\n syncCounter.value = 0;\n if (ignore)\n return;\n filteredCb(...args);\n },\n watchOptions\n )\n );\n stop = () => {\n disposables.forEach((fn) => fn());\n };\n }\n return { stop, ignoreUpdates, ignorePrevAsyncUpdates };\n}\n\nfunction watchImmediate(source, cb, options) {\n return watch(\n source,\n cb,\n {\n ...options,\n immediate: true\n }\n );\n}\n\nfunction watchOnce(source, cb, options) {\n const stop = watch(source, (...args) => {\n nextTick(() => stop());\n return cb(...args);\n }, options);\n return stop;\n}\n\nfunction watchThrottled(source, cb, options = {}) {\n const {\n throttle = 0,\n trailing = true,\n leading = true,\n ...watchOptions\n } = options;\n return watchWithFilter(\n source,\n cb,\n {\n ...watchOptions,\n eventFilter: throttleFilter(throttle, trailing, leading)\n }\n );\n}\n\nfunction watchTriggerable(source, cb, options = {}) {\n let cleanupFn;\n function onEffect() {\n if (!cleanupFn)\n return;\n const fn = cleanupFn;\n cleanupFn = void 0;\n fn();\n }\n function onCleanup(callback) {\n cleanupFn = callback;\n }\n const _cb = (value, oldValue) => {\n onEffect();\n return cb(value, oldValue, onCleanup);\n };\n const res = watchIgnorable(source, _cb, options);\n const { ignoreUpdates } = res;\n const trigger = () => {\n let res2;\n ignoreUpdates(() => {\n res2 = _cb(getWatchSources(source), getOldValue(source));\n });\n return res2;\n };\n return {\n ...res,\n trigger\n };\n}\nfunction getWatchSources(sources) {\n if (isReactive(sources))\n return sources;\n if (Array.isArray(sources))\n return sources.map((item) => toValue(item));\n return toValue(sources);\n}\nfunction getOldValue(source) {\n return Array.isArray(source) ? source.map(() => void 0) : void 0;\n}\n\nfunction whenever(source, cb, options) {\n const stop = watch(\n source,\n (v, ov, onInvalidate) => {\n if (v) {\n if (options == null ? void 0 : options.once)\n nextTick(() => stop());\n cb(v, ov, onInvalidate);\n }\n },\n {\n ...options,\n once: false\n }\n );\n return stop;\n}\n\nexport { assert, refAutoReset as autoResetRef, bypassFilter, camelize, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, getLifeCycleTarget, hasOwn, hyphenate, identity, watchIgnorable as ignorableWatch, increaseWithUnit, injectLocal, invoke, isClient, isDef, isDefined, isIOS, isObject, isWorker, makeDestructurable, noop, normalizeDate, notNullish, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, provideLocal, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };\n","import * as Vue from 'vue'\n\nvar isVue2 = false\nvar isVue3 = true\nvar Vue2 = undefined\n\nfunction install() {}\n\nexport function set(target, key, val) {\n if (Array.isArray(target)) {\n target.length = Math.max(target.length, key)\n target.splice(key, 1, val)\n return val\n }\n target[key] = val\n return val\n}\n\nexport function del(target, key) {\n if (Array.isArray(target)) {\n target.splice(key, 1)\n return\n }\n delete target[key]\n}\n\nexport * from 'vue'\nexport {\n Vue,\n Vue2,\n isVue2,\n isVue3,\n install,\n}\n","import { noop, makeDestructurable, camelize, toValue, isClient, isObject, tryOnScopeDispose, isIOS, tryOnMounted, notNullish, objectOmit, promiseTimeout, until, increaseWithUnit, objectEntries, createSingletonPromise, useTimeoutFn, pausableWatch, toRef, createEventHook, computedWithControl, timestamp, pausableFilter, watchIgnorable, debounceFilter, createFilterWrapper, bypassFilter, toRefs, useIntervalFn, containsProp, hasOwn, throttleFilter, useDebounceFn, useThrottleFn, clamp, syncRef, objectPick, tryOnUnmounted, watchWithFilter, tryOnBeforeUnmount, identity, isDef, whenever, isWorker } from '@vueuse/shared';\nexport * from '@vueuse/shared';\nimport { isRef, ref, shallowRef, watchEffect, computed, inject, isVue3, version, defineComponent, h, TransitionGroup, shallowReactive, Fragment, watch, getCurrentInstance, customRef, onUpdated, onMounted, isVue2, readonly, reactive, nextTick, markRaw, unref, getCurrentScope, set, del, isReadonly, onBeforeUpdate } from 'vue-demi';\n\nfunction computedAsync(evaluationCallback, initialState, optionsOrRef) {\n let options;\n if (isRef(optionsOrRef)) {\n options = {\n evaluating: optionsOrRef\n };\n } else {\n options = optionsOrRef || {};\n }\n const {\n lazy = false,\n evaluating = void 0,\n shallow = true,\n onError = noop\n } = options;\n const started = ref(!lazy);\n const current = shallow ? shallowRef(initialState) : ref(initialState);\n let counter = 0;\n watchEffect(async (onInvalidate) => {\n if (!started.value)\n return;\n counter++;\n const counterAtBeginning = counter;\n let hasFinished = false;\n if (evaluating) {\n Promise.resolve().then(() => {\n evaluating.value = true;\n });\n }\n try {\n const result = await evaluationCallback((cancelCallback) => {\n onInvalidate(() => {\n if (evaluating)\n evaluating.value = false;\n if (!hasFinished)\n cancelCallback();\n });\n });\n if (counterAtBeginning === counter)\n current.value = result;\n } catch (e) {\n onError(e);\n } finally {\n if (evaluating && counterAtBeginning === counter)\n evaluating.value = false;\n hasFinished = true;\n }\n });\n if (lazy) {\n return computed(() => {\n started.value = true;\n return current.value;\n });\n } else {\n return current;\n }\n}\n\nfunction computedInject(key, options, defaultSource, treatDefaultAsFactory) {\n let source = inject(key);\n if (defaultSource)\n source = inject(key, defaultSource);\n if (treatDefaultAsFactory)\n source = inject(key, defaultSource, treatDefaultAsFactory);\n if (typeof options === \"function\") {\n return computed((ctx) => options(source, ctx));\n } else {\n return computed({\n get: (ctx) => options.get(source, ctx),\n set: options.set\n });\n }\n}\n\nfunction createReusableTemplate(options = {}) {\n if (!isVue3 && !version.startsWith(\"2.7.\")) {\n if (process.env.NODE_ENV !== \"production\")\n throw new Error(\"[VueUse] createReusableTemplate only works in Vue 2.7 or above.\");\n return;\n }\n const {\n inheritAttrs = true\n } = options;\n const render = shallowRef();\n const define = /* #__PURE__ */ defineComponent({\n setup(_, { slots }) {\n return () => {\n render.value = slots.default;\n };\n }\n });\n const reuse = /* #__PURE__ */ defineComponent({\n inheritAttrs,\n setup(_, { attrs, slots }) {\n return () => {\n var _a;\n if (!render.value && process.env.NODE_ENV !== \"production\")\n throw new Error(\"[VueUse] Failed to find the definition of reusable template\");\n const vnode = (_a = render.value) == null ? void 0 : _a.call(render, { ...keysToCamelKebabCase(attrs), $slots: slots });\n return inheritAttrs && (vnode == null ? void 0 : vnode.length) === 1 ? vnode[0] : vnode;\n };\n }\n });\n return makeDestructurable(\n { define, reuse },\n [define, reuse]\n );\n}\nfunction keysToCamelKebabCase(obj) {\n const newObj = {};\n for (const key in obj)\n newObj[camelize(key)] = obj[key];\n return newObj;\n}\n\nfunction createTemplatePromise(options = {}) {\n if (!isVue3) {\n if (process.env.NODE_ENV !== \"production\")\n throw new Error(\"[VueUse] createTemplatePromise only works in Vue 3 or above.\");\n return;\n }\n let index = 0;\n const instances = ref([]);\n function create(...args) {\n const props = shallowReactive({\n key: index++,\n args,\n promise: void 0,\n resolve: () => {\n },\n reject: () => {\n },\n isResolving: false,\n options\n });\n instances.value.push(props);\n props.promise = new Promise((_resolve, _reject) => {\n props.resolve = (v) => {\n props.isResolving = true;\n return _resolve(v);\n };\n props.reject = _reject;\n }).finally(() => {\n props.promise = void 0;\n const index2 = instances.value.indexOf(props);\n if (index2 !== -1)\n instances.value.splice(index2, 1);\n });\n return props.promise;\n }\n function start(...args) {\n if (options.singleton && instances.value.length > 0)\n return instances.value[0].promise;\n return create(...args);\n }\n const component = /* #__PURE__ */ defineComponent((_, { slots }) => {\n const renderList = () => instances.value.map((props) => {\n var _a;\n return h(Fragment, { key: props.key }, (_a = slots.default) == null ? void 0 : _a.call(slots, props));\n });\n if (options.transition)\n return () => h(TransitionGroup, options.transition, renderList);\n return renderList;\n });\n component.start = start;\n return component;\n}\n\nfunction createUnrefFn(fn) {\n return function(...args) {\n return fn.apply(this, args.map((i) => toValue(i)));\n };\n}\n\nfunction unrefElement(elRef) {\n var _a;\n const plain = toValue(elRef);\n return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;\n}\n\nconst defaultWindow = isClient ? window : void 0;\nconst defaultDocument = isClient ? window.document : void 0;\nconst defaultNavigator = isClient ? window.navigator : void 0;\nconst defaultLocation = isClient ? window.location : void 0;\n\nfunction useEventListener(...args) {\n let target;\n let events;\n let listeners;\n let options;\n if (typeof args[0] === \"string\" || Array.isArray(args[0])) {\n [events, listeners, options] = args;\n target = defaultWindow;\n } else {\n [target, events, listeners, options] = args;\n }\n if (!target)\n return noop;\n if (!Array.isArray(events))\n events = [events];\n if (!Array.isArray(listeners))\n listeners = [listeners];\n const cleanups = [];\n const cleanup = () => {\n cleanups.forEach((fn) => fn());\n cleanups.length = 0;\n };\n const register = (el, event, listener, options2) => {\n el.addEventListener(event, listener, options2);\n return () => el.removeEventListener(event, listener, options2);\n };\n const stopWatch = watch(\n () => [unrefElement(target), toValue(options)],\n ([el, options2]) => {\n cleanup();\n if (!el)\n return;\n const optionsClone = isObject(options2) ? { ...options2 } : options2;\n cleanups.push(\n ...events.flatMap((event) => {\n return listeners.map((listener) => register(el, event, listener, optionsClone));\n })\n );\n },\n { immediate: true, flush: \"post\" }\n );\n const stop = () => {\n stopWatch();\n cleanup();\n };\n tryOnScopeDispose(stop);\n return stop;\n}\n\nlet _iOSWorkaround = false;\nfunction onClickOutside(target, handler, options = {}) {\n const { window = defaultWindow, ignore = [], capture = true, detectIframe = false } = options;\n if (!window)\n return noop;\n if (isIOS && !_iOSWorkaround) {\n _iOSWorkaround = true;\n Array.from(window.document.body.children).forEach((el) => el.addEventListener(\"click\", noop));\n window.document.documentElement.addEventListener(\"click\", noop);\n }\n let shouldListen = true;\n const shouldIgnore = (event) => {\n return ignore.some((target2) => {\n if (typeof target2 === \"string\") {\n return Array.from(window.document.querySelectorAll(target2)).some((el) => el === event.target || event.composedPath().includes(el));\n } else {\n const el = unrefElement(target2);\n return el && (event.target === el || event.composedPath().includes(el));\n }\n });\n };\n const listener = (event) => {\n const el = unrefElement(target);\n if (!el || el === event.target || event.composedPath().includes(el))\n return;\n if (event.detail === 0)\n shouldListen = !shouldIgnore(event);\n if (!shouldListen) {\n shouldListen = true;\n return;\n }\n handler(event);\n };\n const cleanup = [\n useEventListener(window, \"click\", listener, { passive: true, capture }),\n useEventListener(window, \"pointerdown\", (e) => {\n const el = unrefElement(target);\n shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el));\n }, { passive: true }),\n detectIframe && useEventListener(window, \"blur\", (event) => {\n setTimeout(() => {\n var _a;\n const el = unrefElement(target);\n if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === \"IFRAME\" && !(el == null ? void 0 : el.contains(window.document.activeElement))) {\n handler(event);\n }\n }, 0);\n })\n ].filter(Boolean);\n const stop = () => cleanup.forEach((fn) => fn());\n return stop;\n}\n\nfunction createKeyPredicate(keyFilter) {\n if (typeof keyFilter === \"function\")\n return keyFilter;\n else if (typeof keyFilter === \"string\")\n return (event) => event.key === keyFilter;\n else if (Array.isArray(keyFilter))\n return (event) => keyFilter.includes(event.key);\n return () => true;\n}\nfunction onKeyStroke(...args) {\n let key;\n let handler;\n let options = {};\n if (args.length === 3) {\n key = args[0];\n handler = args[1];\n options = args[2];\n } else if (args.length === 2) {\n if (typeof args[1] === \"object\") {\n key = true;\n handler = args[0];\n options = args[1];\n } else {\n key = args[0];\n handler = args[1];\n }\n } else {\n key = true;\n handler = args[0];\n }\n const {\n target = defaultWindow,\n eventName = \"keydown\",\n passive = false,\n dedupe = false\n } = options;\n const predicate = createKeyPredicate(key);\n const listener = (e) => {\n if (e.repeat && toValue(dedupe))\n return;\n if (predicate(e))\n handler(e);\n };\n return useEventListener(target, eventName, listener, passive);\n}\nfunction onKeyDown(key, handler, options = {}) {\n return onKeyStroke(key, handler, { ...options, eventName: \"keydown\" });\n}\nfunction onKeyPressed(key, handler, options = {}) {\n return onKeyStroke(key, handler, { ...options, eventName: \"keypress\" });\n}\nfunction onKeyUp(key, handler, options = {}) {\n return onKeyStroke(key, handler, { ...options, eventName: \"keyup\" });\n}\n\nconst DEFAULT_DELAY = 500;\nconst DEFAULT_THRESHOLD = 10;\nfunction onLongPress(target, handler, options) {\n var _a, _b;\n const elementRef = computed(() => unrefElement(target));\n let timeout;\n let posStart;\n let startTimestamp;\n let hasLongPressed = false;\n function clear() {\n if (timeout) {\n clearTimeout(timeout);\n timeout = void 0;\n }\n posStart = void 0;\n startTimestamp = void 0;\n hasLongPressed = false;\n }\n function onRelease(ev) {\n var _a2, _b2, _c;\n const [_startTimestamp, _posStart, _hasLongPressed] = [startTimestamp, posStart, hasLongPressed];\n clear();\n if (!(options == null ? void 0 : options.onMouseUp) || !_posStart || !_startTimestamp)\n return;\n if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)\n return;\n if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)\n ev.preventDefault();\n if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)\n ev.stopPropagation();\n const dx = ev.x - _posStart.x;\n const dy = ev.y - _posStart.y;\n const distance = Math.sqrt(dx * dx + dy * dy);\n options.onMouseUp(ev.timeStamp - _startTimestamp, distance, _hasLongPressed);\n }\n function onDown(ev) {\n var _a2, _b2, _c, _d;\n if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)\n return;\n clear();\n if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)\n ev.preventDefault();\n if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)\n ev.stopPropagation();\n posStart = {\n x: ev.x,\n y: ev.y\n };\n startTimestamp = ev.timeStamp;\n timeout = setTimeout(\n () => {\n hasLongPressed = true;\n handler(ev);\n },\n (_d = options == null ? void 0 : options.delay) != null ? _d : DEFAULT_DELAY\n );\n }\n function onMove(ev) {\n var _a2, _b2, _c, _d;\n if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)\n return;\n if (!posStart || (options == null ? void 0 : options.distanceThreshold) === false)\n return;\n if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)\n ev.preventDefault();\n if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)\n ev.stopPropagation();\n const dx = ev.x - posStart.x;\n const dy = ev.y - posStart.y;\n const distance = Math.sqrt(dx * dx + dy * dy);\n if (distance >= ((_d = options == null ? void 0 : options.distanceThreshold) != null ? _d : DEFAULT_THRESHOLD))\n clear();\n }\n const listenerOptions = {\n capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,\n once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once\n };\n const cleanup = [\n useEventListener(elementRef, \"pointerdown\", onDown, listenerOptions),\n useEventListener(elementRef, \"pointermove\", onMove, listenerOptions),\n useEventListener(elementRef, [\"pointerup\", \"pointerleave\"], onRelease, listenerOptions)\n ];\n const stop = () => cleanup.forEach((fn) => fn());\n return stop;\n}\n\nfunction isFocusedElementEditable() {\n const { activeElement, body } = document;\n if (!activeElement)\n return false;\n if (activeElement === body)\n return false;\n switch (activeElement.tagName) {\n case \"INPUT\":\n case \"TEXTAREA\":\n return true;\n }\n return activeElement.hasAttribute(\"contenteditable\");\n}\nfunction isTypedCharValid({\n keyCode,\n metaKey,\n ctrlKey,\n altKey\n}) {\n if (metaKey || ctrlKey || altKey)\n return false;\n if (keyCode >= 48 && keyCode <= 57)\n return true;\n if (keyCode >= 65 && keyCode <= 90)\n return true;\n if (keyCode >= 97 && keyCode <= 122)\n return true;\n return false;\n}\nfunction onStartTyping(callback, options = {}) {\n const { document: document2 = defaultDocument } = options;\n const keydown = (event) => {\n if (!isFocusedElementEditable() && isTypedCharValid(event)) {\n callback(event);\n }\n };\n if (document2)\n useEventListener(document2, \"keydown\", keydown, { passive: true });\n}\n\nfunction templateRef(key, initialValue = null) {\n const instance = getCurrentInstance();\n let _trigger = () => {\n };\n const element = customRef((track, trigger) => {\n _trigger = trigger;\n return {\n get() {\n var _a, _b;\n track();\n return (_b = (_a = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a.$refs[key]) != null ? _b : initialValue;\n },\n set() {\n }\n };\n });\n tryOnMounted(_trigger);\n onUpdated(_trigger);\n return element;\n}\n\nfunction useMounted() {\n const isMounted = ref(false);\n const instance = getCurrentInstance();\n if (instance) {\n onMounted(() => {\n isMounted.value = true;\n }, isVue2 ? void 0 : instance);\n }\n return isMounted;\n}\n\nfunction useSupported(callback) {\n const isMounted = useMounted();\n return computed(() => {\n isMounted.value;\n return Boolean(callback());\n });\n}\n\nfunction useMutationObserver(target, callback, options = {}) {\n const { window = defaultWindow, ...mutationOptions } = options;\n let observer;\n const isSupported = useSupported(() => window && \"MutationObserver\" in window);\n const cleanup = () => {\n if (observer) {\n observer.disconnect();\n observer = void 0;\n }\n };\n const targets = computed(() => {\n const value = toValue(target);\n const items = (Array.isArray(value) ? value : [value]).map(unrefElement).filter(notNullish);\n return new Set(items);\n });\n const stopWatch = watch(\n () => targets.value,\n (targets2) => {\n cleanup();\n if (isSupported.value && targets2.size) {\n observer = new MutationObserver(callback);\n targets2.forEach((el) => observer.observe(el, mutationOptions));\n }\n },\n { immediate: true, flush: \"post\" }\n );\n const takeRecords = () => {\n return observer == null ? void 0 : observer.takeRecords();\n };\n const stop = () => {\n stopWatch();\n cleanup();\n };\n tryOnScopeDispose(stop);\n return {\n isSupported,\n stop,\n takeRecords\n };\n}\n\nfunction useActiveElement(options = {}) {\n var _a;\n const {\n window = defaultWindow,\n deep = true,\n triggerOnRemoval = false\n } = options;\n const document = (_a = options.document) != null ? _a : window == null ? void 0 : window.document;\n const getDeepActiveElement = () => {\n var _a2;\n let element = document == null ? void 0 : document.activeElement;\n if (deep) {\n while (element == null ? void 0 : element.shadowRoot)\n element = (_a2 = element == null ? void 0 : element.shadowRoot) == null ? void 0 : _a2.activeElement;\n }\n return element;\n };\n const activeElement = ref();\n const trigger = () => {\n activeElement.value = getDeepActiveElement();\n };\n if (window) {\n useEventListener(window, \"blur\", (event) => {\n if (event.relatedTarget !== null)\n return;\n trigger();\n }, true);\n useEventListener(window, \"focus\", trigger, true);\n }\n if (triggerOnRemoval) {\n useMutationObserver(document, (mutations) => {\n mutations.filter((m) => m.removedNodes.length).map((n) => Array.from(n.removedNodes)).flat().forEach((node) => {\n if (node === activeElement.value)\n trigger();\n });\n }, {\n childList: true,\n subtree: true\n });\n }\n trigger();\n return activeElement;\n}\n\nfunction useRafFn(fn, options = {}) {\n const {\n immediate = true,\n fpsLimit = void 0,\n window = defaultWindow\n } = options;\n const isActive = ref(false);\n const intervalLimit = fpsLimit ? 1e3 / fpsLimit : null;\n let previousFrameTimestamp = 0;\n let rafId = null;\n function loop(timestamp) {\n if (!isActive.value || !window)\n return;\n if (!previousFrameTimestamp)\n previousFrameTimestamp = timestamp;\n const delta = timestamp - previousFrameTimestamp;\n if (intervalLimit && delta < intervalLimit) {\n rafId = window.requestAnimationFrame(loop);\n return;\n }\n previousFrameTimestamp = timestamp;\n fn({ delta, timestamp });\n rafId = window.requestAnimationFrame(loop);\n }\n function resume() {\n if (!isActive.value && window) {\n isActive.value = true;\n previousFrameTimestamp = 0;\n rafId = window.requestAnimationFrame(loop);\n }\n }\n function pause() {\n isActive.value = false;\n if (rafId != null && window) {\n window.cancelAnimationFrame(rafId);\n rafId = null;\n }\n }\n if (immediate)\n resume();\n tryOnScopeDispose(pause);\n return {\n isActive: readonly(isActive),\n pause,\n resume\n };\n}\n\nfunction useAnimate(target, keyframes, options) {\n let config;\n let animateOptions;\n if (isObject(options)) {\n config = options;\n animateOptions = objectOmit(options, [\"window\", \"immediate\", \"commitStyles\", \"persist\", \"onReady\", \"onError\"]);\n } else {\n config = { duration: options };\n animateOptions = options;\n }\n const {\n window = defaultWindow,\n immediate = true,\n commitStyles,\n persist,\n playbackRate: _playbackRate = 1,\n onReady,\n onError = (e) => {\n console.error(e);\n }\n } = config;\n const isSupported = useSupported(() => window && HTMLElement && \"animate\" in HTMLElement.prototype);\n const animate = shallowRef(void 0);\n const store = shallowReactive({\n startTime: null,\n currentTime: null,\n timeline: null,\n playbackRate: _playbackRate,\n pending: false,\n playState: immediate ? \"idle\" : \"paused\",\n replaceState: \"active\"\n });\n const pending = computed(() => store.pending);\n const playState = computed(() => store.playState);\n const replaceState = computed(() => store.replaceState);\n const startTime = computed({\n get() {\n return store.startTime;\n },\n set(value) {\n store.startTime = value;\n if (animate.value)\n animate.value.startTime = value;\n }\n });\n const currentTime = computed({\n get() {\n return store.currentTime;\n },\n set(value) {\n store.currentTime = value;\n if (animate.value) {\n animate.value.currentTime = value;\n syncResume();\n }\n }\n });\n const timeline = computed({\n get() {\n return store.timeline;\n },\n set(value) {\n store.timeline = value;\n if (animate.value)\n animate.value.timeline = value;\n }\n });\n const playbackRate = computed({\n get() {\n return store.playbackRate;\n },\n set(value) {\n store.playbackRate = value;\n if (animate.value)\n animate.value.playbackRate = value;\n }\n });\n const play = () => {\n if (animate.value) {\n try {\n animate.value.play();\n syncResume();\n } catch (e) {\n syncPause();\n onError(e);\n }\n } else {\n update();\n }\n };\n const pause = () => {\n var _a;\n try {\n (_a = animate.value) == null ? void 0 : _a.pause();\n syncPause();\n } catch (e) {\n onError(e);\n }\n };\n const reverse = () => {\n var _a;\n if (!animate.value)\n update();\n try {\n (_a = animate.value) == null ? void 0 : _a.reverse();\n syncResume();\n } catch (e) {\n syncPause();\n onError(e);\n }\n };\n const finish = () => {\n var _a;\n try {\n (_a = animate.value) == null ? void 0 : _a.finish();\n syncPause();\n } catch (e) {\n onError(e);\n }\n };\n const cancel = () => {\n var _a;\n try {\n (_a = animate.value) == null ? void 0 : _a.cancel();\n syncPause();\n } catch (e) {\n onError(e);\n }\n };\n watch(() => unrefElement(target), (el) => {\n if (el)\n update();\n });\n watch(() => keyframes, (value) => {\n if (animate.value)\n update();\n if (!unrefElement(target) && animate.value) {\n animate.value.effect = new KeyframeEffect(\n unrefElement(target),\n toValue(value),\n animateOptions\n );\n }\n }, { deep: true });\n tryOnMounted(() => update(true), false);\n tryOnScopeDispose(cancel);\n function update(init) {\n const el = unrefElement(target);\n if (!isSupported.value || !el)\n return;\n if (!animate.value)\n animate.value = el.animate(toValue(keyframes), animateOptions);\n if (persist)\n animate.value.persist();\n if (_playbackRate !== 1)\n animate.value.playbackRate = _playbackRate;\n if (init && !immediate)\n animate.value.pause();\n else\n syncResume();\n onReady == null ? void 0 : onReady(animate.value);\n }\n useEventListener(animate, [\"cancel\", \"finish\", \"remove\"], syncPause);\n useEventListener(animate, \"finish\", () => {\n var _a;\n if (commitStyles)\n (_a = animate.value) == null ? void 0 : _a.commitStyles();\n });\n const { resume: resumeRef, pause: pauseRef } = useRafFn(() => {\n if (!animate.value)\n return;\n store.pending = animate.value.pending;\n store.playState = animate.value.playState;\n store.replaceState = animate.value.replaceState;\n store.startTime = animate.value.startTime;\n store.currentTime = animate.value.currentTime;\n store.timeline = animate.value.timeline;\n store.playbackRate = animate.value.playbackRate;\n }, { immediate: false });\n function syncResume() {\n if (isSupported.value)\n resumeRef();\n }\n function syncPause() {\n if (isSupported.value && window)\n window.requestAnimationFrame(pauseRef);\n }\n return {\n isSupported,\n animate,\n // actions\n play,\n pause,\n reverse,\n finish,\n cancel,\n // state\n pending,\n playState,\n replaceState,\n startTime,\n currentTime,\n timeline,\n playbackRate\n };\n}\n\nfunction useAsyncQueue(tasks, options) {\n const {\n interrupt = true,\n onError = noop,\n onFinished = noop,\n signal\n } = options || {};\n const promiseState = {\n aborted: \"aborted\",\n fulfilled: \"fulfilled\",\n pending: \"pending\",\n rejected: \"rejected\"\n };\n const initialResult = Array.from(Array.from({ length: tasks.length }), () => ({ state: promiseState.pending, data: null }));\n const result = reactive(initialResult);\n const activeIndex = ref(-1);\n if (!tasks || tasks.length === 0) {\n onFinished();\n return {\n activeIndex,\n result\n };\n }\n function updateResult(state, res) {\n activeIndex.value++;\n result[activeIndex.value].data = res;\n result[activeIndex.value].state = state;\n }\n tasks.reduce((prev, curr) => {\n return prev.then((prevRes) => {\n var _a;\n if (signal == null ? void 0 : signal.aborted) {\n updateResult(promiseState.aborted, new Error(\"aborted\"));\n return;\n }\n if (((_a = result[activeIndex.value]) == null ? void 0 : _a.state) === promiseState.rejected && interrupt) {\n onFinished();\n return;\n }\n const done = curr(prevRes).then((currentRes) => {\n updateResult(promiseState.fulfilled, currentRes);\n if (activeIndex.value === tasks.length - 1)\n onFinished();\n return currentRes;\n });\n if (!signal)\n return done;\n return Promise.race([done, whenAborted(signal)]);\n }).catch((e) => {\n if (signal == null ? void 0 : signal.aborted) {\n updateResult(promiseState.aborted, e);\n return e;\n }\n updateResult(promiseState.rejected, e);\n onError();\n return e;\n });\n }, Promise.resolve());\n return {\n activeIndex,\n result\n };\n}\nfunction whenAborted(signal) {\n return new Promise((resolve, reject) => {\n const error = new Error(\"aborted\");\n if (signal.aborted)\n reject(error);\n else\n signal.addEventListener(\"abort\", () => reject(error), { once: true });\n });\n}\n\nfunction useAsyncState(promise, initialState, options) {\n const {\n immediate = true,\n delay = 0,\n onError = noop,\n onSuccess = noop,\n resetOnExecute = true,\n shallow = true,\n throwError\n } = options != null ? options : {};\n const state = shallow ? shallowRef(initialState) : ref(initialState);\n const isReady = ref(false);\n const isLoading = ref(false);\n const error = shallowRef(void 0);\n async function execute(delay2 = 0, ...args) {\n if (resetOnExecute)\n state.value = initialState;\n error.value = void 0;\n isReady.value = false;\n isLoading.value = true;\n if (delay2 > 0)\n await promiseTimeout(delay2);\n const _promise = typeof promise === \"function\" ? promise(...args) : promise;\n try {\n const data = await _promise;\n state.value = data;\n isReady.value = true;\n onSuccess(data);\n } catch (e) {\n error.value = e;\n onError(e);\n if (throwError)\n throw e;\n } finally {\n isLoading.value = false;\n }\n return state.value;\n }\n if (immediate)\n execute(delay);\n const shell = {\n state,\n isReady,\n isLoading,\n error,\n execute\n };\n function waitUntilIsLoaded() {\n return new Promise((resolve, reject) => {\n until(isLoading).toBe(false).then(() => resolve(shell)).catch(reject);\n });\n }\n return {\n ...shell,\n then(onFulfilled, onRejected) {\n return waitUntilIsLoaded().then(onFulfilled, onRejected);\n }\n };\n}\n\nconst defaults = {\n array: (v) => JSON.stringify(v),\n object: (v) => JSON.stringify(v),\n set: (v) => JSON.stringify(Array.from(v)),\n map: (v) => JSON.stringify(Object.fromEntries(v)),\n null: () => \"\"\n};\nfunction getDefaultSerialization(target) {\n if (!target)\n return defaults.null;\n if (target instanceof Map)\n return defaults.map;\n else if (target instanceof Set)\n return defaults.set;\n else if (Array.isArray(target))\n return defaults.array;\n else\n return defaults.object;\n}\n\nfunction useBase64(target, options) {\n const base64 = ref(\"\");\n const promise = ref();\n function execute() {\n if (!isClient)\n return;\n promise.value = new Promise((resolve, reject) => {\n try {\n const _target = toValue(target);\n if (_target == null) {\n resolve(\"\");\n } else if (typeof _target === \"string\") {\n resolve(blobToBase64(new Blob([_target], { type: \"text/plain\" })));\n } else if (_target instanceof Blob) {\n resolve(blobToBase64(_target));\n } else if (_target instanceof ArrayBuffer) {\n resolve(window.btoa(String.fromCharCode(...new Uint8Array(_target))));\n } else if (_target instanceof HTMLCanvasElement) {\n resolve(_target.toDataURL(options == null ? void 0 : options.type, options == null ? void 0 : options.quality));\n } else if (_target instanceof HTMLImageElement) {\n const img = _target.cloneNode(false);\n img.crossOrigin = \"Anonymous\";\n imgLoaded(img).then(() => {\n const canvas = document.createElement(\"canvas\");\n const ctx = canvas.getContext(\"2d\");\n canvas.width = img.width;\n canvas.height = img.height;\n ctx.drawImage(img, 0, 0, canvas.width, canvas.height);\n resolve(canvas.toDataURL(options == null ? void 0 : options.type, options == null ? void 0 : options.quality));\n }).catch(reject);\n } else if (typeof _target === \"object\") {\n const _serializeFn = (options == null ? void 0 : options.serializer) || getDefaultSerialization(_target);\n const serialized = _serializeFn(_target);\n return resolve(blobToBase64(new Blob([serialized], { type: \"application/json\" })));\n } else {\n reject(new Error(\"target is unsupported types\"));\n }\n } catch (error) {\n reject(error);\n }\n });\n promise.value.then((res) => base64.value = res);\n return promise.value;\n }\n if (isRef(target) || typeof target === \"function\")\n watch(target, execute, { immediate: true });\n else\n execute();\n return {\n base64,\n promise,\n execute\n };\n}\nfunction imgLoaded(img) {\n return new Promise((resolve, reject) => {\n if (!img.complete) {\n img.onload = () => {\n resolve();\n };\n img.onerror = reject;\n } else {\n resolve();\n }\n });\n}\nfunction blobToBase64(blob) {\n return new Promise((resolve, reject) => {\n const fr = new FileReader();\n fr.onload = (e) => {\n resolve(e.target.result);\n };\n fr.onerror = reject;\n fr.readAsDataURL(blob);\n });\n}\n\nfunction useBattery(options = {}) {\n const { navigator = defaultNavigator } = options;\n const events = [\"chargingchange\", \"chargingtimechange\", \"dischargingtimechange\", \"levelchange\"];\n const isSupported = useSupported(() => navigator && \"getBattery\" in navigator && typeof navigator.getBattery === \"function\");\n const charging = ref(false);\n const chargingTime = ref(0);\n const dischargingTime = ref(0);\n const level = ref(1);\n let battery;\n function updateBatteryInfo() {\n charging.value = this.charging;\n chargingTime.value = this.chargingTime || 0;\n dischargingTime.value = this.dischargingTime || 0;\n level.value = this.level;\n }\n if (isSupported.value) {\n navigator.getBattery().then((_battery) => {\n battery = _battery;\n updateBatteryInfo.call(battery);\n useEventListener(battery, events, updateBatteryInfo, { passive: true });\n });\n }\n return {\n isSupported,\n charging,\n chargingTime,\n dischargingTime,\n level\n };\n}\n\nfunction useBluetooth(options) {\n let {\n acceptAllDevices = false\n } = options || {};\n const {\n filters = void 0,\n optionalServices = void 0,\n navigator = defaultNavigator\n } = options || {};\n const isSupported = useSupported(() => navigator && \"bluetooth\" in navigator);\n const device = shallowRef(void 0);\n const error = shallowRef(null);\n watch(device, () => {\n connectToBluetoothGATTServer();\n });\n async function requestDevice() {\n if (!isSupported.value)\n return;\n error.value = null;\n if (filters && filters.length > 0)\n acceptAllDevices = false;\n try {\n device.value = await (navigator == null ? void 0 : navigator.bluetooth.requestDevice({\n acceptAllDevices,\n filters,\n optionalServices\n }));\n } catch (err) {\n error.value = err;\n }\n }\n const server = ref();\n const isConnected = computed(() => {\n var _a;\n return ((_a = server.value) == null ? void 0 : _a.connected) || false;\n });\n async function connectToBluetoothGATTServer() {\n error.value = null;\n if (device.value && device.value.gatt) {\n device.value.addEventListener(\"gattserverdisconnected\", () => {\n });\n try {\n server.value = await device.value.gatt.connect();\n } catch (err) {\n error.value = err;\n }\n }\n }\n tryOnMounted(() => {\n var _a;\n if (device.value)\n (_a = device.value.gatt) == null ? void 0 : _a.connect();\n });\n tryOnScopeDispose(() => {\n var _a;\n if (device.value)\n (_a = device.value.gatt) == null ? void 0 : _a.disconnect();\n });\n return {\n isSupported,\n isConnected,\n // Device:\n device,\n requestDevice,\n // Server:\n server,\n // Errors:\n error\n };\n}\n\nfunction useMediaQuery(query, options = {}) {\n const { window = defaultWindow } = options;\n const isSupported = useSupported(() => window && \"matchMedia\" in window && typeof window.matchMedia === \"function\");\n let mediaQuery;\n const matches = ref(false);\n const handler = (event) => {\n matches.value = event.matches;\n };\n const cleanup = () => {\n if (!mediaQuery)\n return;\n if (\"removeEventListener\" in mediaQuery)\n mediaQuery.removeEventListener(\"change\", handler);\n else\n mediaQuery.removeListener(handler);\n };\n const stopWatch = watchEffect(() => {\n if (!isSupported.value)\n return;\n cleanup();\n mediaQuery = window.matchMedia(toValue(query));\n if (\"addEventListener\" in mediaQuery)\n mediaQuery.addEventListener(\"change\", handler);\n else\n mediaQuery.addListener(handler);\n matches.value = mediaQuery.matches;\n });\n tryOnScopeDispose(() => {\n stopWatch();\n cleanup();\n mediaQuery = void 0;\n });\n return matches;\n}\n\nconst breakpointsTailwind = {\n \"sm\": 640,\n \"md\": 768,\n \"lg\": 1024,\n \"xl\": 1280,\n \"2xl\": 1536\n};\nconst breakpointsBootstrapV5 = {\n xs: 0,\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200,\n xxl: 1400\n};\nconst breakpointsVuetifyV2 = {\n xs: 0,\n sm: 600,\n md: 960,\n lg: 1264,\n xl: 1904\n};\nconst breakpointsVuetifyV3 = {\n xs: 0,\n sm: 600,\n md: 960,\n lg: 1280,\n xl: 1920,\n xxl: 2560\n};\nconst breakpointsVuetify = breakpointsVuetifyV2;\nconst breakpointsAntDesign = {\n xs: 480,\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200,\n xxl: 1600\n};\nconst breakpointsQuasar = {\n xs: 0,\n sm: 600,\n md: 1024,\n lg: 1440,\n xl: 1920\n};\nconst breakpointsSematic = {\n mobileS: 320,\n mobileM: 375,\n mobileL: 425,\n tablet: 768,\n laptop: 1024,\n laptopL: 1440,\n desktop4K: 2560\n};\nconst breakpointsMasterCss = {\n \"3xs\": 360,\n \"2xs\": 480,\n \"xs\": 600,\n \"sm\": 768,\n \"md\": 1024,\n \"lg\": 1280,\n \"xl\": 1440,\n \"2xl\": 1600,\n \"3xl\": 1920,\n \"4xl\": 2560\n};\nconst breakpointsPrimeFlex = {\n sm: 576,\n md: 768,\n lg: 992,\n xl: 1200\n};\n\nfunction useBreakpoints(breakpoints, options = {}) {\n function getValue(k, delta) {\n let v = toValue(breakpoints[toValue(k)]);\n if (delta != null)\n v = increaseWithUnit(v, delta);\n if (typeof v === \"number\")\n v = `${v}px`;\n return v;\n }\n const { window = defaultWindow, strategy = \"min-width\" } = options;\n function match(query) {\n if (!window)\n return false;\n return window.matchMedia(query).matches;\n }\n const greaterOrEqual = (k) => {\n return useMediaQuery(() => `(min-width: ${getValue(k)})`, options);\n };\n const smallerOrEqual = (k) => {\n return useMediaQuery(() => `(max-width: ${getValue(k)})`, options);\n };\n const shortcutMethods = Object.keys(breakpoints).reduce((shortcuts, k) => {\n Object.defineProperty(shortcuts, k, {\n get: () => strategy === \"min-width\" ? greaterOrEqual(k) : smallerOrEqual(k),\n enumerable: true,\n configurable: true\n });\n return shortcuts;\n }, {});\n function current() {\n const points = Object.keys(breakpoints).map((i) => [i, greaterOrEqual(i)]);\n return computed(() => points.filter(([, v]) => v.value).map(([k]) => k));\n }\n return Object.assign(shortcutMethods, {\n greaterOrEqual,\n smallerOrEqual,\n greater(k) {\n return useMediaQuery(() => `(min-width: ${getValue(k, 0.1)})`, options);\n },\n smaller(k) {\n return useMediaQuery(() => `(max-width: ${getValue(k, -0.1)})`, options);\n },\n between(a, b) {\n return useMediaQuery(() => `(min-width: ${getValue(a)}) and (max-width: ${getValue(b, -0.1)})`, options);\n },\n isGreater(k) {\n return match(`(min-width: ${getValue(k, 0.1)})`);\n },\n isGreaterOrEqual(k) {\n return match(`(min-width: ${getValue(k)})`);\n },\n isSmaller(k) {\n return match(`(max-width: ${getValue(k, -0.1)})`);\n },\n isSmallerOrEqual(k) {\n return match(`(max-width: ${getValue(k)})`);\n },\n isInBetween(a, b) {\n return match(`(min-width: ${getValue(a)}) and (max-width: ${getValue(b, -0.1)})`);\n },\n current,\n active() {\n const bps = current();\n return computed(() => bps.value.length === 0 ? \"\" : bps.value.at(-1));\n }\n });\n}\n\nfunction useBroadcastChannel(options) {\n const {\n name,\n window = defaultWindow\n } = options;\n const isSupported = useSupported(() => window && \"BroadcastChannel\" in window);\n const isClosed = ref(false);\n const channel = ref();\n const data = ref();\n const error = shallowRef(null);\n const post = (data2) => {\n if (channel.value)\n channel.value.postMessage(data2);\n };\n const close = () => {\n if (channel.value)\n channel.value.close();\n isClosed.value = true;\n };\n if (isSupported.value) {\n tryOnMounted(() => {\n error.value = null;\n channel.value = new BroadcastChannel(name);\n channel.value.addEventListener(\"message\", (e) => {\n data.value = e.data;\n }, { passive: true });\n channel.value.addEventListener(\"messageerror\", (e) => {\n error.value = e;\n }, { passive: true });\n channel.value.addEventListener(\"close\", () => {\n isClosed.value = true;\n });\n });\n }\n tryOnScopeDispose(() => {\n close();\n });\n return {\n isSupported,\n channel,\n data,\n post,\n close,\n error,\n isClosed\n };\n}\n\nconst WRITABLE_PROPERTIES = [\n \"hash\",\n \"host\",\n \"hostname\",\n \"href\",\n \"pathname\",\n \"port\",\n \"protocol\",\n \"search\"\n];\nfunction useBrowserLocation(options = {}) {\n const { window = defaultWindow } = options;\n const refs = Object.fromEntries(\n WRITABLE_PROPERTIES.map((key) => [key, ref()])\n );\n for (const [key, ref2] of objectEntries(refs)) {\n watch(ref2, (value) => {\n if (!(window == null ? void 0 : window.location) || window.location[key] === value)\n return;\n window.location[key] = value;\n });\n }\n const buildState = (trigger) => {\n var _a;\n const { state: state2, length } = (window == null ? void 0 : window.history) || {};\n const { origin } = (window == null ? void 0 : window.location) || {};\n for (const key of WRITABLE_PROPERTIES)\n refs[key].value = (_a = window == null ? void 0 : window.location) == null ? void 0 : _a[key];\n return reactive({\n trigger,\n state: state2,\n length,\n origin,\n ...refs\n });\n };\n const state = ref(buildState(\"load\"));\n if (window) {\n useEventListener(window, \"popstate\", () => state.value = buildState(\"popstate\"), { passive: true });\n useEventListener(window, \"hashchange\", () => state.value = buildState(\"hashchange\"), { passive: true });\n }\n return state;\n}\n\nfunction useCached(refValue, comparator = (a, b) => a === b, watchOptions) {\n const cachedValue = ref(refValue.value);\n watch(() => refValue.value, (value) => {\n if (!comparator(value, cachedValue.value))\n cachedValue.value = value;\n }, watchOptions);\n return cachedValue;\n}\n\nfunction usePermission(permissionDesc, options = {}) {\n const {\n controls = false,\n navigator = defaultNavigator\n } = options;\n const isSupported = useSupported(() => navigator && \"permissions\" in navigator);\n let permissionStatus;\n const desc = typeof permissionDesc === \"string\" ? { name: permissionDesc } : permissionDesc;\n const state = ref();\n const onChange = () => {\n if (permissionStatus)\n state.value = permissionStatus.state;\n };\n const query = createSingletonPromise(async () => {\n if (!isSupported.value)\n return;\n if (!permissionStatus) {\n try {\n permissionStatus = await navigator.permissions.query(desc);\n useEventListener(permissionStatus, \"change\", onChange);\n onChange();\n } catch (e) {\n state.value = \"prompt\";\n }\n }\n return permissionStatus;\n });\n query();\n if (controls) {\n return {\n state,\n isSupported,\n query\n };\n } else {\n return state;\n }\n}\n\nfunction useClipboard(options = {}) {\n const {\n navigator = defaultNavigator,\n read = false,\n source,\n copiedDuring = 1500,\n legacy = false\n } = options;\n const isClipboardApiSupported = useSupported(() => navigator && \"clipboard\" in navigator);\n const permissionRead = usePermission(\"clipboard-read\");\n const permissionWrite = usePermission(\"clipboard-write\");\n const isSupported = computed(() => isClipboardApiSupported.value || legacy);\n const text = ref(\"\");\n const copied = ref(false);\n const timeout = useTimeoutFn(() => copied.value = false, copiedDuring);\n function updateText() {\n if (isClipboardApiSupported.value && isAllowed(permissionRead.value)) {\n navigator.clipboard.readText().then((value) => {\n text.value = value;\n });\n } else {\n text.value = legacyRead();\n }\n }\n if (isSupported.value && read)\n useEventListener([\"copy\", \"cut\"], updateText);\n async function copy(value = toValue(source)) {\n if (isSupported.value && value != null) {\n if (isClipboardApiSupported.value && isAllowed(permissionWrite.value))\n await navigator.clipboard.writeText(value);\n else\n legacyCopy(value);\n text.value = value;\n copied.value = true;\n timeout.start();\n }\n }\n function legacyCopy(value) {\n const ta = document.createElement(\"textarea\");\n ta.value = value != null ? value : \"\";\n ta.style.position = \"absolute\";\n ta.style.opacity = \"0\";\n document.body.appendChild(ta);\n ta.select();\n document.execCommand(\"copy\");\n ta.remove();\n }\n function legacyRead() {\n var _a, _b, _c;\n return (_c = (_b = (_a = document == null ? void 0 : document.getSelection) == null ? void 0 : _a.call(document)) == null ? void 0 : _b.toString()) != null ? _c : \"\";\n }\n function isAllowed(status) {\n return status === \"granted\" || status === \"prompt\";\n }\n return {\n isSupported,\n text,\n copied,\n copy\n };\n}\n\nfunction useClipboardItems(options = {}) {\n const {\n navigator = defaultNavigator,\n read = false,\n source,\n copiedDuring = 1500\n } = options;\n const isSupported = useSupported(() => navigator && \"clipboard\" in navigator);\n const content = ref([]);\n const copied = ref(false);\n const timeout = useTimeoutFn(() => copied.value = false, copiedDuring);\n function updateContent() {\n if (isSupported.value) {\n navigator.clipboard.read().then((items) => {\n content.value = items;\n });\n }\n }\n if (isSupported.value && read)\n useEventListener([\"copy\", \"cut\"], updateContent);\n async function copy(value = toValue(source)) {\n if (isSupported.value && value != null) {\n await navigator.clipboard.write(value);\n content.value = value;\n copied.value = true;\n timeout.start();\n }\n }\n return {\n isSupported,\n content,\n copied,\n copy\n };\n}\n\nfunction cloneFnJSON(source) {\n return JSON.parse(JSON.stringify(source));\n}\nfunction useCloned(source, options = {}) {\n const cloned = ref({});\n const {\n manual,\n clone = cloneFnJSON,\n // watch options\n deep = true,\n immediate = true\n } = options;\n function sync() {\n cloned.value = clone(toValue(source));\n }\n if (!manual && (isRef(source) || typeof source === \"function\")) {\n watch(source, sync, {\n ...options,\n deep,\n immediate\n });\n } else {\n sync();\n }\n return { cloned, sync };\n}\n\nconst _global = typeof globalThis !== \"undefined\" ? globalThis : typeof window !== \"undefined\" ? window : typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : {};\nconst globalKey = \"__vueuse_ssr_handlers__\";\nconst handlers = /* @__PURE__ */ getHandlers();\nfunction getHandlers() {\n if (!(globalKey in _global))\n _global[globalKey] = _global[globalKey] || {};\n return _global[globalKey];\n}\nfunction getSSRHandler(key, fallback) {\n return handlers[key] || fallback;\n}\nfunction setSSRHandler(key, fn) {\n handlers[key] = fn;\n}\n\nfunction guessSerializerType(rawInit) {\n return rawInit == null ? \"any\" : rawInit instanceof Set ? \"set\" : rawInit instanceof Map ? \"map\" : rawInit instanceof Date ? \"date\" : typeof rawInit === \"boolean\" ? \"boolean\" : typeof rawInit === \"string\" ? \"string\" : typeof rawInit === \"object\" ? \"object\" : !Number.isNaN(rawInit) ? \"number\" : \"any\";\n}\n\nconst StorageSerializers = {\n boolean: {\n read: (v) => v === \"true\",\n write: (v) => String(v)\n },\n object: {\n read: (v) => JSON.parse(v),\n write: (v) => JSON.stringify(v)\n },\n number: {\n read: (v) => Number.parseFloat(v),\n write: (v) => String(v)\n },\n any: {\n read: (v) => v,\n write: (v) => String(v)\n },\n string: {\n read: (v) => v,\n write: (v) => String(v)\n },\n map: {\n read: (v) => new Map(JSON.parse(v)),\n write: (v) => JSON.stringify(Array.from(v.entries()))\n },\n set: {\n read: (v) => new Set(JSON.parse(v)),\n write: (v) => JSON.stringify(Array.from(v))\n },\n date: {\n read: (v) => new Date(v),\n write: (v) => v.toISOString()\n }\n};\nconst customStorageEventName = \"vueuse-storage\";\nfunction useStorage(key, defaults, storage, options = {}) {\n var _a;\n const {\n flush = \"pre\",\n deep = true,\n listenToStorageChanges = true,\n writeDefaults = true,\n mergeDefaults = false,\n shallow,\n window = defaultWindow,\n eventFilter,\n onError = (e) => {\n console.error(e);\n },\n initOnMounted\n } = options;\n const data = (shallow ? shallowRef : ref)(typeof defaults === \"function\" ? defaults() : defaults);\n if (!storage) {\n try {\n storage = getSSRHandler(\"getDefaultStorage\", () => {\n var _a2;\n return (_a2 = defaultWindow) == null ? void 0 : _a2.localStorage;\n })();\n } catch (e) {\n onError(e);\n }\n }\n if (!storage)\n return data;\n const rawInit = toValue(defaults);\n const type = guessSerializerType(rawInit);\n const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];\n const { pause: pauseWatch, resume: resumeWatch } = pausableWatch(\n data,\n () => write(data.value),\n { flush, deep, eventFilter }\n );\n if (window && listenToStorageChanges) {\n tryOnMounted(() => {\n if (storage instanceof Storage)\n useEventListener(window, \"storage\", update);\n else\n useEventListener(window, customStorageEventName, updateFromCustomEvent);\n if (initOnMounted)\n update();\n });\n }\n if (!initOnMounted)\n update();\n function dispatchWriteEvent(oldValue, newValue) {\n if (window && !(storage instanceof Storage)) {\n window.dispatchEvent(new CustomEvent(customStorageEventName, {\n detail: {\n key,\n oldValue,\n newValue,\n storageArea: storage\n }\n }));\n }\n }\n function write(v) {\n try {\n const oldValue = storage.getItem(key);\n if (v == null) {\n dispatchWriteEvent(oldValue, null);\n storage.removeItem(key);\n } else {\n const serialized = serializer.write(v);\n if (oldValue !== serialized) {\n storage.setItem(key, serialized);\n dispatchWriteEvent(oldValue, serialized);\n }\n }\n } catch (e) {\n onError(e);\n }\n }\n function read(event) {\n const rawValue = event ? event.newValue : storage.getItem(key);\n if (rawValue == null) {\n if (writeDefaults && rawInit != null)\n storage.setItem(key, serializer.write(rawInit));\n return rawInit;\n } else if (!event && mergeDefaults) {\n const value = serializer.read(rawValue);\n if (typeof mergeDefaults === \"function\")\n return mergeDefaults(value, rawInit);\n else if (type === \"object\" && !Array.isArray(value))\n return { ...rawInit, ...value };\n return value;\n } else if (typeof rawValue !== \"string\") {\n return rawValue;\n } else {\n return serializer.read(rawValue);\n }\n }\n function update(event) {\n if (event && event.storageArea !== storage)\n return;\n if (event && event.key == null) {\n data.value = rawInit;\n return;\n }\n if (event && event.key !== key)\n return;\n pauseWatch();\n try {\n if ((event == null ? void 0 : event.newValue) !== serializer.write(data.value))\n data.value = read(event);\n } catch (e) {\n onError(e);\n } finally {\n if (event)\n nextTick(resumeWatch);\n else\n resumeWatch();\n }\n }\n function updateFromCustomEvent(event) {\n update(event.detail);\n }\n return data;\n}\n\nfunction usePreferredDark(options) {\n return useMediaQuery(\"(prefers-color-scheme: dark)\", options);\n}\n\nconst CSS_DISABLE_TRANS = \"*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}\";\nfunction useColorMode(options = {}) {\n const {\n selector = \"html\",\n attribute = \"class\",\n initialValue = \"auto\",\n window = defaultWindow,\n storage,\n storageKey = \"vueuse-color-scheme\",\n listenToStorageChanges = true,\n storageRef,\n emitAuto,\n disableTransition = true\n } = options;\n const modes = {\n auto: \"\",\n light: \"light\",\n dark: \"dark\",\n ...options.modes || {}\n };\n const preferredDark = usePreferredDark({ window });\n const system = computed(() => preferredDark.value ? \"dark\" : \"light\");\n const store = storageRef || (storageKey == null ? toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));\n const state = computed(() => store.value === \"auto\" ? system.value : store.value);\n const updateHTMLAttrs = getSSRHandler(\n \"updateHTMLAttrs\",\n (selector2, attribute2, value) => {\n const el = typeof selector2 === \"string\" ? window == null ? void 0 : window.document.querySelector(selector2) : unrefElement(selector2);\n if (!el)\n return;\n const classesToAdd = /* @__PURE__ */ new Set();\n const classesToRemove = /* @__PURE__ */ new Set();\n let attributeToChange = null;\n if (attribute2 === \"class\") {\n const current = value.split(/\\s/g);\n Object.values(modes).flatMap((i) => (i || \"\").split(/\\s/g)).filter(Boolean).forEach((v) => {\n if (current.includes(v))\n classesToAdd.add(v);\n else\n classesToRemove.add(v);\n });\n } else {\n attributeToChange = { key: attribute2, value };\n }\n if (classesToAdd.size === 0 && classesToRemove.size === 0 && attributeToChange === null)\n return;\n let style;\n if (disableTransition) {\n style = window.document.createElement(\"style\");\n style.appendChild(document.createTextNode(CSS_DISABLE_TRANS));\n window.document.head.appendChild(style);\n }\n for (const c of classesToAdd) {\n el.classList.add(c);\n }\n for (const c of classesToRemove) {\n el.classList.remove(c);\n }\n if (attributeToChange) {\n el.setAttribute(attributeToChange.key, attributeToChange.value);\n }\n if (disableTransition) {\n window.getComputedStyle(style).opacity;\n document.head.removeChild(style);\n }\n }\n );\n function defaultOnChanged(mode) {\n var _a;\n updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);\n }\n function onChanged(mode) {\n if (options.onChanged)\n options.onChanged(mode, defaultOnChanged);\n else\n defaultOnChanged(mode);\n }\n watch(state, onChanged, { flush: \"post\", immediate: true });\n tryOnMounted(() => onChanged(state.value));\n const auto = computed({\n get() {\n return emitAuto ? store.value : state.value;\n },\n set(v) {\n store.value = v;\n }\n });\n try {\n return Object.assign(auto, { store, system, state });\n } catch (e) {\n return auto;\n }\n}\n\nfunction useConfirmDialog(revealed = ref(false)) {\n const confirmHook = createEventHook();\n const cancelHook = createEventHook();\n const revealHook = createEventHook();\n let _resolve = noop;\n const reveal = (data) => {\n revealHook.trigger(data);\n revealed.value = true;\n return new Promise((resolve) => {\n _resolve = resolve;\n });\n };\n const confirm = (data) => {\n revealed.value = false;\n confirmHook.trigger(data);\n _resolve({ data, isCanceled: false });\n };\n const cancel = (data) => {\n revealed.value = false;\n cancelHook.trigger(data);\n _resolve({ data, isCanceled: true });\n };\n return {\n isRevealed: computed(() => revealed.value),\n reveal,\n confirm,\n cancel,\n onReveal: revealHook.on,\n onConfirm: confirmHook.on,\n onCancel: cancelHook.on\n };\n}\n\nfunction useCssVar(prop, target, options = {}) {\n const { window = defaultWindow, initialValue, observe = false } = options;\n const variable = ref(initialValue);\n const elRef = computed(() => {\n var _a;\n return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);\n });\n function updateCssVar() {\n var _a;\n const key = toValue(prop);\n const el = toValue(elRef);\n if (el && window && key) {\n const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();\n variable.value = value || initialValue;\n }\n }\n if (observe) {\n useMutationObserver(elRef, updateCssVar, {\n attributeFilter: [\"style\", \"class\"],\n window\n });\n }\n watch(\n [elRef, () => toValue(prop)],\n (_, old) => {\n if (old[0] && old[1] && window)\n window.getComputedStyle(old[0]).removeProperty(old[1]);\n updateCssVar();\n },\n { immediate: true }\n );\n watch(\n variable,\n (val) => {\n var _a;\n const raw_prop = toValue(prop);\n if (((_a = elRef.value) == null ? void 0 : _a.style) && raw_prop) {\n if (val == null)\n elRef.value.style.removeProperty(raw_prop);\n else\n elRef.value.style.setProperty(raw_prop, val);\n }\n }\n );\n return variable;\n}\n\nfunction useCurrentElement(rootComponent) {\n const vm = getCurrentInstance();\n const currentElement = computedWithControl(\n () => null,\n () => rootComponent ? unrefElement(rootComponent) : vm.proxy.$el\n );\n onUpdated(currentElement.trigger);\n onMounted(currentElement.trigger);\n return currentElement;\n}\n\nfunction useCycleList(list, options) {\n const state = shallowRef(getInitialValue());\n const listRef = toRef(list);\n const index = computed({\n get() {\n var _a;\n const targetList = listRef.value;\n let index2 = (options == null ? void 0 : options.getIndexOf) ? options.getIndexOf(state.value, targetList) : targetList.indexOf(state.value);\n if (index2 < 0)\n index2 = (_a = options == null ? void 0 : options.fallbackIndex) != null ? _a : 0;\n return index2;\n },\n set(v) {\n set(v);\n }\n });\n function set(i) {\n const targetList = listRef.value;\n const length = targetList.length;\n const index2 = (i % length + length) % length;\n const value = targetList[index2];\n state.value = value;\n return value;\n }\n function shift(delta = 1) {\n return set(index.value + delta);\n }\n function next(n = 1) {\n return shift(n);\n }\n function prev(n = 1) {\n return shift(-n);\n }\n function getInitialValue() {\n var _a, _b;\n return (_b = toValue((_a = options == null ? void 0 : options.initialValue) != null ? _a : toValue(list)[0])) != null ? _b : void 0;\n }\n watch(listRef, () => set(index.value));\n return {\n state,\n index,\n next,\n prev,\n go: set\n };\n}\n\nfunction useDark(options = {}) {\n const {\n valueDark = \"dark\",\n valueLight = \"\",\n window = defaultWindow\n } = options;\n const mode = useColorMode({\n ...options,\n onChanged: (mode2, defaultHandler) => {\n var _a;\n if (options.onChanged)\n (_a = options.onChanged) == null ? void 0 : _a.call(options, mode2 === \"dark\", defaultHandler, mode2);\n else\n defaultHandler(mode2);\n },\n modes: {\n dark: valueDark,\n light: valueLight\n }\n });\n const system = computed(() => {\n if (mode.system) {\n return mode.system.value;\n } else {\n const preferredDark = usePreferredDark({ window });\n return preferredDark.value ? \"dark\" : \"light\";\n }\n });\n const isDark = computed({\n get() {\n return mode.value === \"dark\";\n },\n set(v) {\n const modeVal = v ? \"dark\" : \"light\";\n if (system.value === modeVal)\n mode.value = \"auto\";\n else\n mode.value = modeVal;\n }\n });\n return isDark;\n}\n\nfunction fnBypass(v) {\n return v;\n}\nfunction fnSetSource(source, value) {\n return source.value = value;\n}\nfunction defaultDump(clone) {\n return clone ? typeof clone === \"function\" ? clone : cloneFnJSON : fnBypass;\n}\nfunction defaultParse(clone) {\n return clone ? typeof clone === \"function\" ? clone : cloneFnJSON : fnBypass;\n}\nfunction useManualRefHistory(source, options = {}) {\n const {\n clone = false,\n dump = defaultDump(clone),\n parse = defaultParse(clone),\n setSource = fnSetSource\n } = options;\n function _createHistoryRecord() {\n return markRaw({\n snapshot: dump(source.value),\n timestamp: timestamp()\n });\n }\n const last = ref(_createHistoryRecord());\n const undoStack = ref([]);\n const redoStack = ref([]);\n const _setSource = (record) => {\n setSource(source, parse(record.snapshot));\n last.value = record;\n };\n const commit = () => {\n undoStack.value.unshift(last.value);\n last.value = _createHistoryRecord();\n if (options.capacity && undoStack.value.length > options.capacity)\n undoStack.value.splice(options.capacity, Number.POSITIVE_INFINITY);\n if (redoStack.value.length)\n redoStack.value.splice(0, redoStack.value.length);\n };\n const clear = () => {\n undoStack.value.splice(0, undoStack.value.length);\n redoStack.value.splice(0, redoStack.value.length);\n };\n const undo = () => {\n const state = undoStack.value.shift();\n if (state) {\n redoStack.value.unshift(last.value);\n _setSource(state);\n }\n };\n const redo = () => {\n const state = redoStack.value.shift();\n if (state) {\n undoStack.value.unshift(last.value);\n _setSource(state);\n }\n };\n const reset = () => {\n _setSource(last.value);\n };\n const history = computed(() => [last.value, ...undoStack.value]);\n const canUndo = computed(() => undoStack.value.length > 0);\n const canRedo = computed(() => redoStack.value.length > 0);\n return {\n source,\n undoStack,\n redoStack,\n last,\n history,\n canUndo,\n canRedo,\n clear,\n commit,\n reset,\n undo,\n redo\n };\n}\n\nfunction useRefHistory(source, options = {}) {\n const {\n deep = false,\n flush = \"pre\",\n eventFilter\n } = options;\n const {\n eventFilter: composedFilter,\n pause,\n resume: resumeTracking,\n isActive: isTracking\n } = pausableFilter(eventFilter);\n const {\n ignoreUpdates,\n ignorePrevAsyncUpdates,\n stop\n } = watchIgnorable(\n source,\n commit,\n { deep, flush, eventFilter: composedFilter }\n );\n function setSource(source2, value) {\n ignorePrevAsyncUpdates();\n ignoreUpdates(() => {\n source2.value = value;\n });\n }\n const manualHistory = useManualRefHistory(source, { ...options, clone: options.clone || deep, setSource });\n const { clear, commit: manualCommit } = manualHistory;\n function commit() {\n ignorePrevAsyncUpdates();\n manualCommit();\n }\n function resume(commitNow) {\n resumeTracking();\n if (commitNow)\n commit();\n }\n function batch(fn) {\n let canceled = false;\n const cancel = () => canceled = true;\n ignoreUpdates(() => {\n fn(cancel);\n });\n if (!canceled)\n commit();\n }\n function dispose() {\n stop();\n clear();\n }\n return {\n ...manualHistory,\n isTracking,\n pause,\n resume,\n commit,\n batch,\n dispose\n };\n}\n\nfunction useDebouncedRefHistory(source, options = {}) {\n const filter = options.debounce ? debounceFilter(options.debounce) : void 0;\n const history = useRefHistory(source, { ...options, eventFilter: filter });\n return {\n ...history\n };\n}\n\nfunction useDeviceMotion(options = {}) {\n const {\n window = defaultWindow,\n eventFilter = bypassFilter\n } = options;\n const acceleration = ref({ x: null, y: null, z: null });\n const rotationRate = ref({ alpha: null, beta: null, gamma: null });\n const interval = ref(0);\n const accelerationIncludingGravity = ref({\n x: null,\n y: null,\n z: null\n });\n if (window) {\n const onDeviceMotion = createFilterWrapper(\n eventFilter,\n (event) => {\n acceleration.value = event.acceleration;\n accelerationIncludingGravity.value = event.accelerationIncludingGravity;\n rotationRate.value = event.rotationRate;\n interval.value = event.interval;\n }\n );\n useEventListener(window, \"devicemotion\", onDeviceMotion);\n }\n return {\n acceleration,\n accelerationIncludingGravity,\n rotationRate,\n interval\n };\n}\n\nfunction useDeviceOrientation(options = {}) {\n const { window = defaultWindow } = options;\n const isSupported = useSupported(() => window && \"DeviceOrientationEvent\" in window);\n const isAbsolute = ref(false);\n const alpha = ref(null);\n const beta = ref(null);\n const gamma = ref(null);\n if (window && isSupported.value) {\n useEventListener(window, \"deviceorientation\", (event) => {\n isAbsolute.value = event.absolute;\n alpha.value = event.alpha;\n beta.value = event.beta;\n gamma.value = event.gamma;\n });\n }\n return {\n isSupported,\n isAbsolute,\n alpha,\n beta,\n gamma\n };\n}\n\nfunction useDevicePixelRatio(options = {}) {\n const {\n window = defaultWindow\n } = options;\n const pixelRatio = ref(1);\n if (window) {\n let observe2 = function() {\n pixelRatio.value = window.devicePixelRatio;\n cleanup2();\n media = window.matchMedia(`(resolution: ${pixelRatio.value}dppx)`);\n media.addEventListener(\"change\", observe2, { once: true });\n }, cleanup2 = function() {\n media == null ? void 0 : media.removeEventListener(\"change\", observe2);\n };\n let media;\n observe2();\n tryOnScopeDispose(cleanup2);\n }\n return { pixelRatio };\n}\n\nfunction useDevicesList(options = {}) {\n const {\n navigator = defaultNavigator,\n requestPermissions = false,\n constraints = { audio: true, video: true },\n onUpdated\n } = options;\n const devices = ref([]);\n const videoInputs = computed(() => devices.value.filter((i) => i.kind === \"videoinput\"));\n const audioInputs = computed(() => devices.value.filter((i) => i.kind === \"audioinput\"));\n const audioOutputs = computed(() => devices.value.filter((i) => i.kind === \"audiooutput\"));\n const isSupported = useSupported(() => navigator && navigator.mediaDevices && navigator.mediaDevices.enumerateDevices);\n const permissionGranted = ref(false);\n let stream;\n async function update() {\n if (!isSupported.value)\n return;\n devices.value = await navigator.mediaDevices.enumerateDevices();\n onUpdated == null ? void 0 : onUpdated(devices.value);\n if (stream) {\n stream.getTracks().forEach((t) => t.stop());\n stream = null;\n }\n }\n async function ensurePermissions() {\n if (!isSupported.value)\n return false;\n if (permissionGranted.value)\n return true;\n const { state, query } = usePermission(\"camera\", { controls: true });\n await query();\n if (state.value !== \"granted\") {\n stream = await navigator.mediaDevices.getUserMedia(constraints);\n update();\n permissionGranted.value = true;\n } else {\n permissionGranted.value = true;\n }\n return permissionGranted.value;\n }\n if (isSupported.value) {\n if (requestPermissions)\n ensurePermissions();\n useEventListener(navigator.mediaDevices, \"devicechange\", update);\n update();\n }\n return {\n devices,\n ensurePermissions,\n permissionGranted,\n videoInputs,\n audioInputs,\n audioOutputs,\n isSupported\n };\n}\n\nfunction useDisplayMedia(options = {}) {\n var _a;\n const enabled = ref((_a = options.enabled) != null ? _a : false);\n const video = options.video;\n const audio = options.audio;\n const { navigator = defaultNavigator } = options;\n const isSupported = useSupported(() => {\n var _a2;\n return (_a2 = navigator == null ? void 0 : navigator.mediaDevices) == null ? void 0 : _a2.getDisplayMedia;\n });\n const constraint = { audio, video };\n const stream = shallowRef();\n async function _start() {\n var _a2;\n if (!isSupported.value || stream.value)\n return;\n stream.value = await navigator.mediaDevices.getDisplayMedia(constraint);\n (_a2 = stream.value) == null ? void 0 : _a2.getTracks().forEach((t) => t.addEventListener(\"ended\", stop));\n return stream.value;\n }\n async function _stop() {\n var _a2;\n (_a2 = stream.value) == null ? void 0 : _a2.getTracks().forEach((t) => t.stop());\n stream.value = void 0;\n }\n function stop() {\n _stop();\n enabled.value = false;\n }\n async function start() {\n await _start();\n if (stream.value)\n enabled.value = true;\n return stream.value;\n }\n watch(\n enabled,\n (v) => {\n if (v)\n _start();\n else\n _stop();\n },\n { immediate: true }\n );\n return {\n isSupported,\n stream,\n start,\n stop,\n enabled\n };\n}\n\nfunction useDocumentVisibility(options = {}) {\n const { document = defaultDocument } = options;\n if (!document)\n return ref(\"visible\");\n const visibility = ref(document.visibilityState);\n useEventListener(document, \"visibilitychange\", () => {\n visibility.value = document.visibilityState;\n });\n return visibility;\n}\n\nfunction useDraggable(target, options = {}) {\n var _a, _b;\n const {\n pointerTypes,\n preventDefault,\n stopPropagation,\n exact,\n onMove,\n onEnd,\n onStart,\n initialValue,\n axis = \"both\",\n draggingElement = defaultWindow,\n containerElement,\n handle: draggingHandle = target,\n buttons = [0]\n } = options;\n const position = ref(\n (_a = toValue(initialValue)) != null ? _a : { x: 0, y: 0 }\n );\n const pressedDelta = ref();\n const filterEvent = (e) => {\n if (pointerTypes)\n return pointerTypes.includes(e.pointerType);\n return true;\n };\n const handleEvent = (e) => {\n if (toValue(preventDefault))\n e.preventDefault();\n if (toValue(stopPropagation))\n e.stopPropagation();\n };\n const start = (e) => {\n var _a2;\n if (!toValue(buttons).includes(e.button))\n return;\n if (toValue(options.disabled) || !filterEvent(e))\n return;\n if (toValue(exact) && e.target !== toValue(target))\n return;\n const container = toValue(containerElement);\n const containerRect = (_a2 = container == null ? void 0 : container.getBoundingClientRect) == null ? void 0 : _a2.call(container);\n const targetRect = toValue(target).getBoundingClientRect();\n const pos = {\n x: e.clientX - (container ? targetRect.left - containerRect.left + container.scrollLeft : targetRect.left),\n y: e.clientY - (container ? targetRect.top - containerRect.top + container.scrollTop : targetRect.top)\n };\n if ((onStart == null ? void 0 : onStart(pos, e)) === false)\n return;\n pressedDelta.value = pos;\n handleEvent(e);\n };\n const move = (e) => {\n if (toValue(options.disabled) || !filterEvent(e))\n return;\n if (!pressedDelta.value)\n return;\n const container = toValue(containerElement);\n const targetRect = toValue(target).getBoundingClientRect();\n let { x, y } = position.value;\n if (axis === \"x\" || axis === \"both\") {\n x = e.clientX - pressedDelta.value.x;\n if (container)\n x = Math.min(Math.max(0, x), container.scrollWidth - targetRect.width);\n }\n if (axis === \"y\" || axis === \"both\") {\n y = e.clientY - pressedDelta.value.y;\n if (container)\n y = Math.min(Math.max(0, y), container.scrollHeight - targetRect.height);\n }\n position.value = {\n x,\n y\n };\n onMove == null ? void 0 : onMove(position.value, e);\n handleEvent(e);\n };\n const end = (e) => {\n if (toValue(options.disabled) || !filterEvent(e))\n return;\n if (!pressedDelta.value)\n return;\n pressedDelta.value = void 0;\n onEnd == null ? void 0 : onEnd(position.value, e);\n handleEvent(e);\n };\n if (isClient) {\n const config = { capture: (_b = options.capture) != null ? _b : true };\n useEventListener(draggingHandle, \"pointerdown\", start, config);\n useEventListener(draggingElement, \"pointermove\", move, config);\n useEventListener(draggingElement, \"pointerup\", end, config);\n }\n return {\n ...toRefs(position),\n position,\n isDragging: computed(() => !!pressedDelta.value),\n style: computed(\n () => `left:${position.value.x}px;top:${position.value.y}px;`\n )\n };\n}\n\nfunction useDropZone(target, options = {}) {\n const isOverDropZone = ref(false);\n const files = shallowRef(null);\n let counter = 0;\n let isDataTypeIncluded = true;\n if (isClient) {\n const _options = typeof options === \"function\" ? { onDrop: options } : options;\n const getFiles = (event) => {\n var _a, _b;\n const list = Array.from((_b = (_a = event.dataTransfer) == null ? void 0 : _a.files) != null ? _b : []);\n return files.value = list.length === 0 ? null : list;\n };\n useEventListener(target, \"dragenter\", (event) => {\n var _a, _b;\n const types = Array.from(((_a = event == null ? void 0 : event.dataTransfer) == null ? void 0 : _a.items) || []).map((i) => i.kind === \"file\" ? i.type : null).filter(notNullish);\n if (_options.dataTypes && event.dataTransfer) {\n const dataTypes = unref(_options.dataTypes);\n isDataTypeIncluded = typeof dataTypes === \"function\" ? dataTypes(types) : dataTypes ? dataTypes.some((item) => types.includes(item)) : true;\n if (!isDataTypeIncluded)\n return;\n }\n event.preventDefault();\n counter += 1;\n isOverDropZone.value = true;\n (_b = _options.onEnter) == null ? void 0 : _b.call(_options, getFiles(event), event);\n });\n useEventListener(target, \"dragover\", (event) => {\n var _a;\n if (!isDataTypeIncluded)\n return;\n event.preventDefault();\n (_a = _options.onOver) == null ? void 0 : _a.call(_options, getFiles(event), event);\n });\n useEventListener(target, \"dragleave\", (event) => {\n var _a;\n if (!isDataTypeIncluded)\n return;\n event.preventDefault();\n counter -= 1;\n if (counter === 0)\n isOverDropZone.value = false;\n (_a = _options.onLeave) == null ? void 0 : _a.call(_options, getFiles(event), event);\n });\n useEventListener(target, \"drop\", (event) => {\n var _a;\n event.preventDefault();\n counter = 0;\n isOverDropZone.value = false;\n (_a = _options.onDrop) == null ? void 0 : _a.call(_options, getFiles(event), event);\n });\n }\n return {\n files,\n isOverDropZone\n };\n}\n\nfunction useResizeObserver(target, callback, options = {}) {\n const { window = defaultWindow, ...observerOptions } = options;\n let observer;\n const isSupported = useSupported(() => window && \"ResizeObserver\" in window);\n const cleanup = () => {\n if (observer) {\n observer.disconnect();\n observer = void 0;\n }\n };\n const targets = computed(() => {\n const _targets = toValue(target);\n return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];\n });\n const stopWatch = watch(\n targets,\n (els) => {\n cleanup();\n if (isSupported.value && window) {\n observer = new ResizeObserver(callback);\n for (const _el of els) {\n if (_el)\n observer.observe(_el, observerOptions);\n }\n }\n },\n { immediate: true, flush: \"post\" }\n );\n const stop = () => {\n cleanup();\n stopWatch();\n };\n tryOnScopeDispose(stop);\n return {\n isSupported,\n stop\n };\n}\n\nfunction useElementBounding(target, options = {}) {\n const {\n reset = true,\n windowResize = true,\n windowScroll = true,\n immediate = true,\n updateTiming = \"sync\"\n } = options;\n const height = ref(0);\n const bottom = ref(0);\n const left = ref(0);\n const right = ref(0);\n const top = ref(0);\n const width = ref(0);\n const x = ref(0);\n const y = ref(0);\n function recalculate() {\n const el = unrefElement(target);\n if (!el) {\n if (reset) {\n height.value = 0;\n bottom.value = 0;\n left.value = 0;\n right.value = 0;\n top.value = 0;\n width.value = 0;\n x.value = 0;\n y.value = 0;\n }\n return;\n }\n const rect = el.getBoundingClientRect();\n height.value = rect.height;\n bottom.value = rect.bottom;\n left.value = rect.left;\n right.value = rect.right;\n top.value = rect.top;\n width.value = rect.width;\n x.value = rect.x;\n y.value = rect.y;\n }\n function update() {\n if (updateTiming === \"sync\")\n recalculate();\n else if (updateTiming === \"next-frame\")\n requestAnimationFrame(() => recalculate());\n }\n useResizeObserver(target, update);\n watch(() => unrefElement(target), (ele) => !ele && update());\n useMutationObserver(target, update, {\n attributeFilter: [\"style\", \"class\"]\n });\n if (windowScroll)\n useEventListener(\"scroll\", update, { capture: true, passive: true });\n if (windowResize)\n useEventListener(\"resize\", update, { passive: true });\n tryOnMounted(() => {\n if (immediate)\n update();\n });\n return {\n height,\n bottom,\n left,\n right,\n top,\n width,\n x,\n y,\n update\n };\n}\n\nfunction useElementByPoint(options) {\n const {\n x,\n y,\n document = defaultDocument,\n multiple,\n interval = \"requestAnimationFrame\",\n immediate = true\n } = options;\n const isSupported = useSupported(() => {\n if (toValue(multiple))\n return document && \"elementsFromPoint\" in document;\n return document && \"elementFromPoint\" in document;\n });\n const element = ref(null);\n const cb = () => {\n var _a, _b;\n element.value = toValue(multiple) ? (_a = document == null ? void 0 : document.elementsFromPoint(toValue(x), toValue(y))) != null ? _a : [] : (_b = document == null ? void 0 : document.elementFromPoint(toValue(x), toValue(y))) != null ? _b : null;\n };\n const controls = interval === \"requestAnimationFrame\" ? useRafFn(cb, { immediate }) : useIntervalFn(cb, interval, { immediate });\n return {\n isSupported,\n element,\n ...controls\n };\n}\n\nfunction useElementHover(el, options = {}) {\n const {\n delayEnter = 0,\n delayLeave = 0,\n window = defaultWindow\n } = options;\n const isHovered = ref(false);\n let timer;\n const toggle = (entering) => {\n const delay = entering ? delayEnter : delayLeave;\n if (timer) {\n clearTimeout(timer);\n timer = void 0;\n }\n if (delay)\n timer = setTimeout(() => isHovered.value = entering, delay);\n else\n isHovered.value = entering;\n };\n if (!window)\n return isHovered;\n useEventListener(el, \"mouseenter\", () => toggle(true), { passive: true });\n useEventListener(el, \"mouseleave\", () => toggle(false), { passive: true });\n return isHovered;\n}\n\nfunction useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {\n const { window = defaultWindow, box = \"content-box\" } = options;\n const isSVG = computed(() => {\n var _a, _b;\n return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes(\"svg\");\n });\n const width = ref(initialSize.width);\n const height = ref(initialSize.height);\n const { stop: stop1 } = useResizeObserver(\n target,\n ([entry]) => {\n const boxSize = box === \"border-box\" ? entry.borderBoxSize : box === \"content-box\" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;\n if (window && isSVG.value) {\n const $elem = unrefElement(target);\n if ($elem) {\n const rect = $elem.getBoundingClientRect();\n width.value = rect.width;\n height.value = rect.height;\n }\n } else {\n if (boxSize) {\n const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];\n width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);\n height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);\n } else {\n width.value = entry.contentRect.width;\n height.value = entry.contentRect.height;\n }\n }\n },\n options\n );\n tryOnMounted(() => {\n const ele = unrefElement(target);\n if (ele) {\n width.value = \"offsetWidth\" in ele ? ele.offsetWidth : initialSize.width;\n height.value = \"offsetHeight\" in ele ? ele.offsetHeight : initialSize.height;\n }\n });\n const stop2 = watch(\n () => unrefElement(target),\n (ele) => {\n width.value = ele ? initialSize.width : 0;\n height.value = ele ? initialSize.height : 0;\n }\n );\n function stop() {\n stop1();\n stop2();\n }\n return {\n width,\n height,\n stop\n };\n}\n\nfunction useIntersectionObserver(target, callback, options = {}) {\n const {\n root,\n rootMargin = \"0px\",\n threshold = 0,\n window = defaultWindow,\n immediate = true\n } = options;\n const isSupported = useSupported(() => window && \"IntersectionObserver\" in window);\n const targets = computed(() => {\n const _target = toValue(target);\n return (Array.isArray(_target) ? _target : [_target]).map(unrefElement).filter(notNullish);\n });\n let cleanup = noop;\n const isActive = ref(immediate);\n const stopWatch = isSupported.value ? watch(\n () => [targets.value, unrefElement(root), isActive.value],\n ([targets2, root2]) => {\n cleanup();\n if (!isActive.value)\n return;\n if (!targets2.length)\n return;\n const observer = new IntersectionObserver(\n callback,\n {\n root: unrefElement(root2),\n rootMargin,\n threshold\n }\n );\n targets2.forEach((el) => el && observer.observe(el));\n cleanup = () => {\n observer.disconnect();\n cleanup = noop;\n };\n },\n { immediate, flush: \"post\" }\n ) : noop;\n const stop = () => {\n cleanup();\n stopWatch();\n isActive.value = false;\n };\n tryOnScopeDispose(stop);\n return {\n isSupported,\n isActive,\n pause() {\n cleanup();\n isActive.value = false;\n },\n resume() {\n isActive.value = true;\n },\n stop\n };\n}\n\nfunction useElementVisibility(element, options = {}) {\n const { window = defaultWindow, scrollTarget, threshold = 0 } = options;\n const elementIsVisible = ref(false);\n useIntersectionObserver(\n element,\n (intersectionObserverEntries) => {\n let isIntersecting = elementIsVisible.value;\n let latestTime = 0;\n for (const entry of intersectionObserverEntries) {\n if (entry.time >= latestTime) {\n latestTime = entry.time;\n isIntersecting = entry.isIntersecting;\n }\n }\n elementIsVisible.value = isIntersecting;\n },\n {\n root: scrollTarget,\n window,\n threshold\n }\n );\n return elementIsVisible;\n}\n\nconst events = /* @__PURE__ */ new Map();\n\nfunction useEventBus(key) {\n const scope = getCurrentScope();\n function on(listener) {\n var _a;\n const listeners = events.get(key) || /* @__PURE__ */ new Set();\n listeners.add(listener);\n events.set(key, listeners);\n const _off = () => off(listener);\n (_a = scope == null ? void 0 : scope.cleanups) == null ? void 0 : _a.push(_off);\n return _off;\n }\n function once(listener) {\n function _listener(...args) {\n off(_listener);\n listener(...args);\n }\n return on(_listener);\n }\n function off(listener) {\n const listeners = events.get(key);\n if (!listeners)\n return;\n listeners.delete(listener);\n if (!listeners.size)\n reset();\n }\n function reset() {\n events.delete(key);\n }\n function emit(event, payload) {\n var _a;\n (_a = events.get(key)) == null ? void 0 : _a.forEach((v) => v(event, payload));\n }\n return { on, once, off, emit, reset };\n}\n\nfunction resolveNestedOptions$1(options) {\n if (options === true)\n return {};\n return options;\n}\nfunction useEventSource(url, events = [], options = {}) {\n const event = ref(null);\n const data = ref(null);\n const status = ref(\"CONNECTING\");\n const eventSource = ref(null);\n const error = shallowRef(null);\n const urlRef = toRef(url);\n const lastEventId = shallowRef(null);\n let explicitlyClosed = false;\n let retried = 0;\n const {\n withCredentials = false,\n immediate = true\n } = options;\n const close = () => {\n if (isClient && eventSource.value) {\n eventSource.value.close();\n eventSource.value = null;\n status.value = \"CLOSED\";\n explicitlyClosed = true;\n }\n };\n const _init = () => {\n if (explicitlyClosed || typeof urlRef.value === \"undefined\")\n return;\n const es = new EventSource(urlRef.value, { withCredentials });\n status.value = \"CONNECTING\";\n eventSource.value = es;\n es.onopen = () => {\n status.value = \"OPEN\";\n error.value = null;\n };\n es.onerror = (e) => {\n status.value = \"CLOSED\";\n error.value = e;\n if (es.readyState === 2 && !explicitlyClosed && options.autoReconnect) {\n es.close();\n const {\n retries = -1,\n delay = 1e3,\n onFailed\n } = resolveNestedOptions$1(options.autoReconnect);\n retried += 1;\n if (typeof retries === \"number\" && (retries < 0 || retried < retries))\n setTimeout(_init, delay);\n else if (typeof retries === \"function\" && retries())\n setTimeout(_init, delay);\n else\n onFailed == null ? void 0 : onFailed();\n }\n };\n es.onmessage = (e) => {\n event.value = null;\n data.value = e.data;\n lastEventId.value = e.lastEventId;\n };\n for (const event_name of events) {\n useEventListener(es, event_name, (e) => {\n event.value = event_name;\n data.value = e.data || null;\n });\n }\n };\n const open = () => {\n if (!isClient)\n return;\n close();\n explicitlyClosed = false;\n retried = 0;\n _init();\n };\n if (immediate)\n watch(urlRef, open, { immediate: true });\n tryOnScopeDispose(close);\n return {\n eventSource,\n event,\n data,\n status,\n error,\n open,\n close,\n lastEventId\n };\n}\n\nfunction useEyeDropper(options = {}) {\n const { initialValue = \"\" } = options;\n const isSupported = useSupported(() => typeof window !== \"undefined\" && \"EyeDropper\" in window);\n const sRGBHex = ref(initialValue);\n async function open(openOptions) {\n if (!isSupported.value)\n return;\n const eyeDropper = new window.EyeDropper();\n const result = await eyeDropper.open(openOptions);\n sRGBHex.value = result.sRGBHex;\n return result;\n }\n return { isSupported, sRGBHex, open };\n}\n\nfunction useFavicon(newIcon = null, options = {}) {\n const {\n baseUrl = \"\",\n rel = \"icon\",\n document = defaultDocument\n } = options;\n const favicon = toRef(newIcon);\n const applyIcon = (icon) => {\n const elements = document == null ? void 0 : document.head.querySelectorAll(`link[rel*=\"${rel}\"]`);\n if (!elements || elements.length === 0) {\n const link = document == null ? void 0 : document.createElement(\"link\");\n if (link) {\n link.rel = rel;\n link.href = `${baseUrl}${icon}`;\n link.type = `image/${icon.split(\".\").pop()}`;\n document == null ? void 0 : document.head.append(link);\n }\n return;\n }\n elements == null ? void 0 : elements.forEach((el) => el.href = `${baseUrl}${icon}`);\n };\n watch(\n favicon,\n (i, o) => {\n if (typeof i === \"string\" && i !== o)\n applyIcon(i);\n },\n { immediate: true }\n );\n return favicon;\n}\n\nconst payloadMapping = {\n json: \"application/json\",\n text: \"text/plain\"\n};\nfunction isFetchOptions(obj) {\n return obj && containsProp(obj, \"immediate\", \"refetch\", \"initialData\", \"timeout\", \"beforeFetch\", \"afterFetch\", \"onFetchError\", \"fetch\", \"updateDataOnError\");\n}\nconst reAbsolute = /^(?:[a-z][a-z\\d+\\-.]*:)?\\/\\//i;\nfunction isAbsoluteURL(url) {\n return reAbsolute.test(url);\n}\nfunction headersToObject(headers) {\n if (typeof Headers !== \"undefined\" && headers instanceof Headers)\n return Object.fromEntries(headers.entries());\n return headers;\n}\nfunction combineCallbacks(combination, ...callbacks) {\n if (combination === \"overwrite\") {\n return async (ctx) => {\n const callback = callbacks[callbacks.length - 1];\n if (callback)\n return { ...ctx, ...await callback(ctx) };\n return ctx;\n };\n } else {\n return async (ctx) => {\n for (const callback of callbacks) {\n if (callback)\n ctx = { ...ctx, ...await callback(ctx) };\n }\n return ctx;\n };\n }\n}\nfunction createFetch(config = {}) {\n const _combination = config.combination || \"chain\";\n const _options = config.options || {};\n const _fetchOptions = config.fetchOptions || {};\n function useFactoryFetch(url, ...args) {\n const computedUrl = computed(() => {\n const baseUrl = toValue(config.baseUrl);\n const targetUrl = toValue(url);\n return baseUrl && !isAbsoluteURL(targetUrl) ? joinPaths(baseUrl, targetUrl) : targetUrl;\n });\n let options = _options;\n let fetchOptions = _fetchOptions;\n if (args.length > 0) {\n if (isFetchOptions(args[0])) {\n options = {\n ...options,\n ...args[0],\n beforeFetch: combineCallbacks(_combination, _options.beforeFetch, args[0].beforeFetch),\n afterFetch: combineCallbacks(_combination, _options.afterFetch, args[0].afterFetch),\n onFetchError: combineCallbacks(_combination, _options.onFetchError, args[0].onFetchError)\n };\n } else {\n fetchOptions = {\n ...fetchOptions,\n ...args[0],\n headers: {\n ...headersToObject(fetchOptions.headers) || {},\n ...headersToObject(args[0].headers) || {}\n }\n };\n }\n }\n if (args.length > 1 && isFetchOptions(args[1])) {\n options = {\n ...options,\n ...args[1],\n beforeFetch: combineCallbacks(_combination, _options.beforeFetch, args[1].beforeFetch),\n afterFetch: combineCallbacks(_combination, _options.afterFetch, args[1].afterFetch),\n onFetchError: combineCallbacks(_combination, _options.onFetchError, args[1].onFetchError)\n };\n }\n return useFetch(computedUrl, fetchOptions, options);\n }\n return useFactoryFetch;\n}\nfunction useFetch(url, ...args) {\n var _a;\n const supportsAbort = typeof AbortController === \"function\";\n let fetchOptions = {};\n let options = {\n immediate: true,\n refetch: false,\n timeout: 0,\n updateDataOnError: false\n };\n const config = {\n method: \"GET\",\n type: \"text\",\n payload: void 0\n };\n if (args.length > 0) {\n if (isFetchOptions(args[0]))\n options = { ...options, ...args[0] };\n else\n fetchOptions = args[0];\n }\n if (args.length > 1) {\n if (isFetchOptions(args[1]))\n options = { ...options, ...args[1] };\n }\n const {\n fetch = (_a = defaultWindow) == null ? void 0 : _a.fetch,\n initialData,\n timeout\n } = options;\n const responseEvent = createEventHook();\n const errorEvent = createEventHook();\n const finallyEvent = createEventHook();\n const isFinished = ref(false);\n const isFetching = ref(false);\n const aborted = ref(false);\n const statusCode = ref(null);\n const response = shallowRef(null);\n const error = shallowRef(null);\n const data = shallowRef(initialData || null);\n const canAbort = computed(() => supportsAbort && isFetching.value);\n let controller;\n let timer;\n const abort = () => {\n if (supportsAbort) {\n controller == null ? void 0 : controller.abort();\n controller = new AbortController();\n controller.signal.onabort = () => aborted.value = true;\n fetchOptions = {\n ...fetchOptions,\n signal: controller.signal\n };\n }\n };\n const loading = (isLoading) => {\n isFetching.value = isLoading;\n isFinished.value = !isLoading;\n };\n if (timeout)\n timer = useTimeoutFn(abort, timeout, { immediate: false });\n let executeCounter = 0;\n const execute = async (throwOnFailed = false) => {\n var _a2, _b;\n abort();\n loading(true);\n error.value = null;\n statusCode.value = null;\n aborted.value = false;\n executeCounter += 1;\n const currentExecuteCounter = executeCounter;\n const defaultFetchOptions = {\n method: config.method,\n headers: {}\n };\n if (config.payload) {\n const headers = headersToObject(defaultFetchOptions.headers);\n const payload = toValue(config.payload);\n if (!config.payloadType && payload && Object.getPrototypeOf(payload) === Object.prototype && !(payload instanceof FormData))\n config.payloadType = \"json\";\n if (config.payloadType)\n headers[\"Content-Type\"] = (_a2 = payloadMapping[config.payloadType]) != null ? _a2 : config.payloadType;\n defaultFetchOptions.body = config.payloadType === \"json\" ? JSON.stringify(payload) : payload;\n }\n let isCanceled = false;\n const context = {\n url: toValue(url),\n options: {\n ...defaultFetchOptions,\n ...fetchOptions\n },\n cancel: () => {\n isCanceled = true;\n }\n };\n if (options.beforeFetch)\n Object.assign(context, await options.beforeFetch(context));\n if (isCanceled || !fetch) {\n loading(false);\n return Promise.resolve(null);\n }\n let responseData = null;\n if (timer)\n timer.start();\n return fetch(\n context.url,\n {\n ...defaultFetchOptions,\n ...context.options,\n headers: {\n ...headersToObject(defaultFetchOptions.headers),\n ...headersToObject((_b = context.options) == null ? void 0 : _b.headers)\n }\n }\n ).then(async (fetchResponse) => {\n response.value = fetchResponse;\n statusCode.value = fetchResponse.status;\n responseData = await fetchResponse.clone()[config.type]();\n if (!fetchResponse.ok) {\n data.value = initialData || null;\n throw new Error(fetchResponse.statusText);\n }\n if (options.afterFetch) {\n ({ data: responseData } = await options.afterFetch({\n data: responseData,\n response: fetchResponse\n }));\n }\n data.value = responseData;\n responseEvent.trigger(fetchResponse);\n return fetchResponse;\n }).catch(async (fetchError) => {\n let errorData = fetchError.message || fetchError.name;\n if (options.onFetchError) {\n ({ error: errorData, data: responseData } = await options.onFetchError({\n data: responseData,\n error: fetchError,\n response: response.value\n }));\n }\n error.value = errorData;\n if (options.updateDataOnError)\n data.value = responseData;\n errorEvent.trigger(fetchError);\n if (throwOnFailed)\n throw fetchError;\n return null;\n }).finally(() => {\n if (currentExecuteCounter === executeCounter)\n loading(false);\n if (timer)\n timer.stop();\n finallyEvent.trigger(null);\n });\n };\n const refetch = toRef(options.refetch);\n watch(\n [\n refetch,\n toRef(url)\n ],\n ([refetch2]) => refetch2 && execute(),\n { deep: true }\n );\n const shell = {\n isFinished: readonly(isFinished),\n isFetching: readonly(isFetching),\n statusCode,\n response,\n error,\n data,\n canAbort,\n aborted,\n abort,\n execute,\n onFetchResponse: responseEvent.on,\n onFetchError: errorEvent.on,\n onFetchFinally: finallyEvent.on,\n // method\n get: setMethod(\"GET\"),\n put: setMethod(\"PUT\"),\n post: setMethod(\"POST\"),\n delete: setMethod(\"DELETE\"),\n patch: setMethod(\"PATCH\"),\n head: setMethod(\"HEAD\"),\n options: setMethod(\"OPTIONS\"),\n // type\n json: setType(\"json\"),\n text: setType(\"text\"),\n blob: setType(\"blob\"),\n arrayBuffer: setType(\"arrayBuffer\"),\n formData: setType(\"formData\")\n };\n function setMethod(method) {\n return (payload, payloadType) => {\n if (!isFetching.value) {\n config.method = method;\n config.payload = payload;\n config.payloadType = payloadType;\n if (isRef(config.payload)) {\n watch(\n [\n refetch,\n toRef(config.payload)\n ],\n ([refetch2]) => refetch2 && execute(),\n { deep: true }\n );\n }\n return {\n ...shell,\n then(onFulfilled, onRejected) {\n return waitUntilFinished().then(onFulfilled, onRejected);\n }\n };\n }\n return void 0;\n };\n }\n function waitUntilFinished() {\n return new Promise((resolve, reject) => {\n until(isFinished).toBe(true).then(() => resolve(shell)).catch((error2) => reject(error2));\n });\n }\n function setType(type) {\n return () => {\n if (!isFetching.value) {\n config.type = type;\n return {\n ...shell,\n then(onFulfilled, onRejected) {\n return waitUntilFinished().then(onFulfilled, onRejected);\n }\n };\n }\n return void 0;\n };\n }\n if (options.immediate)\n Promise.resolve().then(() => execute());\n return {\n ...shell,\n then(onFulfilled, onRejected) {\n return waitUntilFinished().then(onFulfilled, onRejected);\n }\n };\n}\nfunction joinPaths(start, end) {\n if (!start.endsWith(\"/\") && !end.startsWith(\"/\"))\n return `${start}/${end}`;\n return `${start}${end}`;\n}\n\nconst DEFAULT_OPTIONS = {\n multiple: true,\n accept: \"*\",\n reset: false,\n directory: false\n};\nfunction useFileDialog(options = {}) {\n const {\n document = defaultDocument\n } = options;\n const files = ref(null);\n const { on: onChange, trigger } = createEventHook();\n let input;\n if (document) {\n input = document.createElement(\"input\");\n input.type = \"file\";\n input.onchange = (event) => {\n const result = event.target;\n files.value = result.files;\n trigger(files.value);\n };\n }\n const reset = () => {\n files.value = null;\n if (input && input.value) {\n input.value = \"\";\n trigger(null);\n }\n };\n const open = (localOptions) => {\n if (!input)\n return;\n const _options = {\n ...DEFAULT_OPTIONS,\n ...options,\n ...localOptions\n };\n input.multiple = _options.multiple;\n input.accept = _options.accept;\n input.webkitdirectory = _options.directory;\n if (hasOwn(_options, \"capture\"))\n input.capture = _options.capture;\n if (_options.reset)\n reset();\n input.click();\n };\n return {\n files: readonly(files),\n open,\n reset,\n onChange\n };\n}\n\nfunction useFileSystemAccess(options = {}) {\n const {\n window: _window = defaultWindow,\n dataType = \"Text\"\n } = options;\n const window = _window;\n const isSupported = useSupported(() => window && \"showSaveFilePicker\" in window && \"showOpenFilePicker\" in window);\n const fileHandle = ref();\n const data = ref();\n const file = ref();\n const fileName = computed(() => {\n var _a, _b;\n return (_b = (_a = file.value) == null ? void 0 : _a.name) != null ? _b : \"\";\n });\n const fileMIME = computed(() => {\n var _a, _b;\n return (_b = (_a = file.value) == null ? void 0 : _a.type) != null ? _b : \"\";\n });\n const fileSize = computed(() => {\n var _a, _b;\n return (_b = (_a = file.value) == null ? void 0 : _a.size) != null ? _b : 0;\n });\n const fileLastModified = computed(() => {\n var _a, _b;\n return (_b = (_a = file.value) == null ? void 0 : _a.lastModified) != null ? _b : 0;\n });\n async function open(_options = {}) {\n if (!isSupported.value)\n return;\n const [handle] = await window.showOpenFilePicker({ ...toValue(options), ..._options });\n fileHandle.value = handle;\n await updateData();\n }\n async function create(_options = {}) {\n if (!isSupported.value)\n return;\n fileHandle.value = await window.showSaveFilePicker({ ...options, ..._options });\n data.value = void 0;\n await updateData();\n }\n async function save(_options = {}) {\n if (!isSupported.value)\n return;\n if (!fileHandle.value)\n return saveAs(_options);\n if (data.value) {\n const writableStream = await fileHandle.value.createWritable();\n await writableStream.write(data.value);\n await writableStream.close();\n }\n await updateFile();\n }\n async function saveAs(_options = {}) {\n if (!isSupported.value)\n return;\n fileHandle.value = await window.showSaveFilePicker({ ...options, ..._options });\n if (data.value) {\n const writableStream = await fileHandle.value.createWritable();\n await writableStream.write(data.value);\n await writableStream.close();\n }\n await updateFile();\n }\n async function updateFile() {\n var _a;\n file.value = await ((_a = fileHandle.value) == null ? void 0 : _a.getFile());\n }\n async function updateData() {\n var _a, _b;\n await updateFile();\n const type = toValue(dataType);\n if (type === \"Text\")\n data.value = await ((_a = file.value) == null ? void 0 : _a.text());\n else if (type === \"ArrayBuffer\")\n data.value = await ((_b = file.value) == null ? void 0 : _b.arrayBuffer());\n else if (type === \"Blob\")\n data.value = file.value;\n }\n watch(() => toValue(dataType), updateData);\n return {\n isSupported,\n data,\n file,\n fileName,\n fileMIME,\n fileSize,\n fileLastModified,\n open,\n create,\n save,\n saveAs,\n updateData\n };\n}\n\nfunction useFocus(target, options = {}) {\n const { initialValue = false, focusVisible = false, preventScroll = false } = options;\n const innerFocused = ref(false);\n const targetElement = computed(() => unrefElement(target));\n useEventListener(targetElement, \"focus\", (event) => {\n var _a, _b;\n if (!focusVisible || ((_b = (_a = event.target).matches) == null ? void 0 : _b.call(_a, \":focus-visible\")))\n innerFocused.value = true;\n });\n useEventListener(targetElement, \"blur\", () => innerFocused.value = false);\n const focused = computed({\n get: () => innerFocused.value,\n set(value) {\n var _a, _b;\n if (!value && innerFocused.value)\n (_a = targetElement.value) == null ? void 0 : _a.blur();\n else if (value && !innerFocused.value)\n (_b = targetElement.value) == null ? void 0 : _b.focus({ preventScroll });\n }\n });\n watch(\n targetElement,\n () => {\n focused.value = initialValue;\n },\n { immediate: true, flush: \"post\" }\n );\n return { focused };\n}\n\nfunction useFocusWithin(target, options = {}) {\n const activeElement = useActiveElement(options);\n const targetElement = computed(() => unrefElement(target));\n const focused = computed(() => targetElement.value && activeElement.value ? targetElement.value.contains(activeElement.value) : false);\n return { focused };\n}\n\nfunction useFps(options) {\n var _a;\n const fps = ref(0);\n if (typeof performance === \"undefined\")\n return fps;\n const every = (_a = options == null ? void 0 : options.every) != null ? _a : 10;\n let last = performance.now();\n let ticks = 0;\n useRafFn(() => {\n ticks += 1;\n if (ticks >= every) {\n const now = performance.now();\n const diff = now - last;\n fps.value = Math.round(1e3 / (diff / ticks));\n last = now;\n ticks = 0;\n }\n });\n return fps;\n}\n\nconst eventHandlers = [\n \"fullscreenchange\",\n \"webkitfullscreenchange\",\n \"webkitendfullscreen\",\n \"mozfullscreenchange\",\n \"MSFullscreenChange\"\n];\nfunction useFullscreen(target, options = {}) {\n const {\n document = defaultDocument,\n autoExit = false\n } = options;\n const targetRef = computed(() => {\n var _a;\n return (_a = unrefElement(target)) != null ? _a : document == null ? void 0 : document.querySelector(\"html\");\n });\n const isFullscreen = ref(false);\n const requestMethod = computed(() => {\n return [\n \"requestFullscreen\",\n \"webkitRequestFullscreen\",\n \"webkitEnterFullscreen\",\n \"webkitEnterFullScreen\",\n \"webkitRequestFullScreen\",\n \"mozRequestFullScreen\",\n \"msRequestFullscreen\"\n ].find((m) => document && m in document || targetRef.value && m in targetRef.value);\n });\n const exitMethod = computed(() => {\n return [\n \"exitFullscreen\",\n \"webkitExitFullscreen\",\n \"webkitExitFullScreen\",\n \"webkitCancelFullScreen\",\n \"mozCancelFullScreen\",\n \"msExitFullscreen\"\n ].find((m) => document && m in document || targetRef.value && m in targetRef.value);\n });\n const fullscreenEnabled = computed(() => {\n return [\n \"fullScreen\",\n \"webkitIsFullScreen\",\n \"webkitDisplayingFullscreen\",\n \"mozFullScreen\",\n \"msFullscreenElement\"\n ].find((m) => document && m in document || targetRef.value && m in targetRef.value);\n });\n const fullscreenElementMethod = [\n \"fullscreenElement\",\n \"webkitFullscreenElement\",\n \"mozFullScreenElement\",\n \"msFullscreenElement\"\n ].find((m) => document && m in document);\n const isSupported = useSupported(() => targetRef.value && document && requestMethod.value !== void 0 && exitMethod.value !== void 0 && fullscreenEnabled.value !== void 0);\n const isCurrentElementFullScreen = () => {\n if (fullscreenElementMethod)\n return (document == null ? void 0 : document[fullscreenElementMethod]) === targetRef.value;\n return false;\n };\n const isElementFullScreen = () => {\n if (fullscreenEnabled.value) {\n if (document && document[fullscreenEnabled.value] != null) {\n return document[fullscreenEnabled.value];\n } else {\n const target2 = targetRef.value;\n if ((target2 == null ? void 0 : target2[fullscreenEnabled.value]) != null) {\n return Boolean(target2[fullscreenEnabled.value]);\n }\n }\n }\n return false;\n };\n async function exit() {\n if (!isSupported.value || !isFullscreen.value)\n return;\n if (exitMethod.value) {\n if ((document == null ? void 0 : document[exitMethod.value]) != null) {\n await document[exitMethod.value]();\n } else {\n const target2 = targetRef.value;\n if ((target2 == null ? void 0 : target2[exitMethod.value]) != null)\n await target2[exitMethod.value]();\n }\n }\n isFullscreen.value = false;\n }\n async function enter() {\n if (!isSupported.value || isFullscreen.value)\n return;\n if (isElementFullScreen())\n await exit();\n const target2 = targetRef.value;\n if (requestMethod.value && (target2 == null ? void 0 : target2[requestMethod.value]) != null) {\n await target2[requestMethod.value]();\n isFullscreen.value = true;\n }\n }\n async function toggle() {\n await (isFullscreen.value ? exit() : enter());\n }\n const handlerCallback = () => {\n const isElementFullScreenValue = isElementFullScreen();\n if (!isElementFullScreenValue || isElementFullScreenValue && isCurrentElementFullScreen())\n isFullscreen.value = isElementFullScreenValue;\n };\n useEventListener(document, eventHandlers, handlerCallback, false);\n useEventListener(() => unrefElement(targetRef), eventHandlers, handlerCallback, false);\n if (autoExit)\n tryOnScopeDispose(exit);\n return {\n isSupported,\n isFullscreen,\n enter,\n exit,\n toggle\n };\n}\n\nfunction mapGamepadToXbox360Controller(gamepad) {\n return computed(() => {\n if (gamepad.value) {\n return {\n buttons: {\n a: gamepad.value.buttons[0],\n b: gamepad.value.buttons[1],\n x: gamepad.value.buttons[2],\n y: gamepad.value.buttons[3]\n },\n bumper: {\n left: gamepad.value.buttons[4],\n right: gamepad.value.buttons[5]\n },\n triggers: {\n left: gamepad.value.buttons[6],\n right: gamepad.value.buttons[7]\n },\n stick: {\n left: {\n horizontal: gamepad.value.axes[0],\n vertical: gamepad.value.axes[1],\n button: gamepad.value.buttons[10]\n },\n right: {\n horizontal: gamepad.value.axes[2],\n vertical: gamepad.value.axes[3],\n button: gamepad.value.buttons[11]\n }\n },\n dpad: {\n up: gamepad.value.buttons[12],\n down: gamepad.value.buttons[13],\n left: gamepad.value.buttons[14],\n right: gamepad.value.buttons[15]\n },\n back: gamepad.value.buttons[8],\n start: gamepad.value.buttons[9]\n };\n }\n return null;\n });\n}\nfunction useGamepad(options = {}) {\n const {\n navigator = defaultNavigator\n } = options;\n const isSupported = useSupported(() => navigator && \"getGamepads\" in navigator);\n const gamepads = ref([]);\n const onConnectedHook = createEventHook();\n const onDisconnectedHook = createEventHook();\n const stateFromGamepad = (gamepad) => {\n const hapticActuators = [];\n const vibrationActuator = \"vibrationActuator\" in gamepad ? gamepad.vibrationActuator : null;\n if (vibrationActuator)\n hapticActuators.push(vibrationActuator);\n if (gamepad.hapticActuators)\n hapticActuators.push(...gamepad.hapticActuators);\n return {\n id: gamepad.id,\n index: gamepad.index,\n connected: gamepad.connected,\n mapping: gamepad.mapping,\n timestamp: gamepad.timestamp,\n vibrationActuator: gamepad.vibrationActuator,\n hapticActuators,\n axes: gamepad.axes.map((axes) => axes),\n buttons: gamepad.buttons.map((button) => ({ pressed: button.pressed, touched: button.touched, value: button.value }))\n };\n };\n const updateGamepadState = () => {\n const _gamepads = (navigator == null ? void 0 : navigator.getGamepads()) || [];\n for (const gamepad of _gamepads) {\n if (gamepad && gamepads.value[gamepad.index])\n gamepads.value[gamepad.index] = stateFromGamepad(gamepad);\n }\n };\n const { isActive, pause, resume } = useRafFn(updateGamepadState);\n const onGamepadConnected = (gamepad) => {\n if (!gamepads.value.some(({ index }) => index === gamepad.index)) {\n gamepads.value.push(stateFromGamepad(gamepad));\n onConnectedHook.trigger(gamepad.index);\n }\n resume();\n };\n const onGamepadDisconnected = (gamepad) => {\n gamepads.value = gamepads.value.filter((x) => x.index !== gamepad.index);\n onDisconnectedHook.trigger(gamepad.index);\n };\n useEventListener(\"gamepadconnected\", (e) => onGamepadConnected(e.gamepad));\n useEventListener(\"gamepaddisconnected\", (e) => onGamepadDisconnected(e.gamepad));\n tryOnMounted(() => {\n const _gamepads = (navigator == null ? void 0 : navigator.getGamepads()) || [];\n for (const gamepad of _gamepads) {\n if (gamepad && gamepads.value[gamepad.index])\n onGamepadConnected(gamepad);\n }\n });\n pause();\n return {\n isSupported,\n onConnected: onConnectedHook.on,\n onDisconnected: onDisconnectedHook.on,\n gamepads,\n pause,\n resume,\n isActive\n };\n}\n\nfunction useGeolocation(options = {}) {\n const {\n enableHighAccuracy = true,\n maximumAge = 3e4,\n timeout = 27e3,\n navigator = defaultNavigator,\n immediate = true\n } = options;\n const isSupported = useSupported(() => navigator && \"geolocation\" in navigator);\n const locatedAt = ref(null);\n const error = shallowRef(null);\n const coords = ref({\n accuracy: 0,\n latitude: Number.POSITIVE_INFINITY,\n longitude: Number.POSITIVE_INFINITY,\n altitude: null,\n altitudeAccuracy: null,\n heading: null,\n speed: null\n });\n function updatePosition(position) {\n locatedAt.value = position.timestamp;\n coords.value = position.coords;\n error.value = null;\n }\n let watcher;\n function resume() {\n if (isSupported.value) {\n watcher = navigator.geolocation.watchPosition(\n updatePosition,\n (err) => error.value = err,\n {\n enableHighAccuracy,\n maximumAge,\n timeout\n }\n );\n }\n }\n if (immediate)\n resume();\n function pause() {\n if (watcher && navigator)\n navigator.geolocation.clearWatch(watcher);\n }\n tryOnScopeDispose(() => {\n pause();\n });\n return {\n isSupported,\n coords,\n locatedAt,\n error,\n resume,\n pause\n };\n}\n\nconst defaultEvents$1 = [\"mousemove\", \"mousedown\", \"resize\", \"keydown\", \"touchstart\", \"wheel\"];\nconst oneMinute = 6e4;\nfunction useIdle(timeout = oneMinute, options = {}) {\n const {\n initialState = false,\n listenForVisibilityChange = true,\n events = defaultEvents$1,\n window = defaultWindow,\n eventFilter = throttleFilter(50)\n } = options;\n const idle = ref(initialState);\n const lastActive = ref(timestamp());\n let timer;\n const reset = () => {\n idle.value = false;\n clearTimeout(timer);\n timer = setTimeout(() => idle.value = true, timeout);\n };\n const onEvent = createFilterWrapper(\n eventFilter,\n () => {\n lastActive.value = timestamp();\n reset();\n }\n );\n if (window) {\n const document = window.document;\n for (const event of events)\n useEventListener(window, event, onEvent, { passive: true });\n if (listenForVisibilityChange) {\n useEventListener(document, \"visibilitychange\", () => {\n if (!document.hidden)\n onEvent();\n });\n }\n reset();\n }\n return {\n idle,\n lastActive,\n reset\n };\n}\n\nasync function loadImage(options) {\n return new Promise((resolve, reject) => {\n const img = new Image();\n const { src, srcset, sizes, class: clazz, loading, crossorigin, referrerPolicy } = options;\n img.src = src;\n if (srcset)\n img.srcset = srcset;\n if (sizes)\n img.sizes = sizes;\n if (clazz)\n img.className = clazz;\n if (loading)\n img.loading = loading;\n if (crossorigin)\n img.crossOrigin = crossorigin;\n if (referrerPolicy)\n img.referrerPolicy = referrerPolicy;\n img.onload = () => resolve(img);\n img.onerror = reject;\n });\n}\nfunction useImage(options, asyncStateOptions = {}) {\n const state = useAsyncState(\n () => loadImage(toValue(options)),\n void 0,\n {\n resetOnExecute: true,\n ...asyncStateOptions\n }\n );\n watch(\n () => toValue(options),\n () => state.execute(asyncStateOptions.delay),\n { deep: true }\n );\n return state;\n}\n\nconst ARRIVED_STATE_THRESHOLD_PIXELS = 1;\nfunction useScroll(element, options = {}) {\n const {\n throttle = 0,\n idle = 200,\n onStop = noop,\n onScroll = noop,\n offset = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n },\n eventListenerOptions = {\n capture: false,\n passive: true\n },\n behavior = \"auto\",\n window = defaultWindow,\n onError = (e) => {\n console.error(e);\n }\n } = options;\n const internalX = ref(0);\n const internalY = ref(0);\n const x = computed({\n get() {\n return internalX.value;\n },\n set(x2) {\n scrollTo(x2, void 0);\n }\n });\n const y = computed({\n get() {\n return internalY.value;\n },\n set(y2) {\n scrollTo(void 0, y2);\n }\n });\n function scrollTo(_x, _y) {\n var _a, _b, _c, _d;\n if (!window)\n return;\n const _element = toValue(element);\n if (!_element)\n return;\n (_c = _element instanceof Document ? window.document.body : _element) == null ? void 0 : _c.scrollTo({\n top: (_a = toValue(_y)) != null ? _a : y.value,\n left: (_b = toValue(_x)) != null ? _b : x.value,\n behavior: toValue(behavior)\n });\n const scrollContainer = ((_d = _element == null ? void 0 : _element.document) == null ? void 0 : _d.documentElement) || (_element == null ? void 0 : _element.documentElement) || _element;\n if (x != null)\n internalX.value = scrollContainer.scrollLeft;\n if (y != null)\n internalY.value = scrollContainer.scrollTop;\n }\n const isScrolling = ref(false);\n const arrivedState = reactive({\n left: true,\n right: false,\n top: true,\n bottom: false\n });\n const directions = reactive({\n left: false,\n right: false,\n top: false,\n bottom: false\n });\n const onScrollEnd = (e) => {\n if (!isScrolling.value)\n return;\n isScrolling.value = false;\n directions.left = false;\n directions.right = false;\n directions.top = false;\n directions.bottom = false;\n onStop(e);\n };\n const onScrollEndDebounced = useDebounceFn(onScrollEnd, throttle + idle);\n const setArrivedState = (target) => {\n var _a;\n if (!window)\n return;\n const el = ((_a = target == null ? void 0 : target.document) == null ? void 0 : _a.documentElement) || (target == null ? void 0 : target.documentElement) || unrefElement(target);\n const { display, flexDirection } = getComputedStyle(el);\n const scrollLeft = el.scrollLeft;\n directions.left = scrollLeft < internalX.value;\n directions.right = scrollLeft > internalX.value;\n const left = Math.abs(scrollLeft) <= (offset.left || 0);\n const right = Math.abs(scrollLeft) + el.clientWidth >= el.scrollWidth - (offset.right || 0) - ARRIVED_STATE_THRESHOLD_PIXELS;\n if (display === \"flex\" && flexDirection === \"row-reverse\") {\n arrivedState.left = right;\n arrivedState.right = left;\n } else {\n arrivedState.left = left;\n arrivedState.right = right;\n }\n internalX.value = scrollLeft;\n let scrollTop = el.scrollTop;\n if (target === window.document && !scrollTop)\n scrollTop = window.document.body.scrollTop;\n directions.top = scrollTop < internalY.value;\n directions.bottom = scrollTop > internalY.value;\n const top = Math.abs(scrollTop) <= (offset.top || 0);\n const bottom = Math.abs(scrollTop) + el.clientHeight >= el.scrollHeight - (offset.bottom || 0) - ARRIVED_STATE_THRESHOLD_PIXELS;\n if (display === \"flex\" && flexDirection === \"column-reverse\") {\n arrivedState.top = bottom;\n arrivedState.bottom = top;\n } else {\n arrivedState.top = top;\n arrivedState.bottom = bottom;\n }\n internalY.value = scrollTop;\n };\n const onScrollHandler = (e) => {\n var _a;\n if (!window)\n return;\n const eventTarget = (_a = e.target.documentElement) != null ? _a : e.target;\n setArrivedState(eventTarget);\n isScrolling.value = true;\n onScrollEndDebounced(e);\n onScroll(e);\n };\n useEventListener(\n element,\n \"scroll\",\n throttle ? useThrottleFn(onScrollHandler, throttle, true, false) : onScrollHandler,\n eventListenerOptions\n );\n tryOnMounted(() => {\n try {\n const _element = toValue(element);\n if (!_element)\n return;\n setArrivedState(_element);\n } catch (e) {\n onError(e);\n }\n });\n useEventListener(\n element,\n \"scrollend\",\n onScrollEnd,\n eventListenerOptions\n );\n return {\n x,\n y,\n isScrolling,\n arrivedState,\n directions,\n measure() {\n const _element = toValue(element);\n if (window && _element)\n setArrivedState(_element);\n }\n };\n}\n\nfunction resolveElement(el) {\n if (typeof Window !== \"undefined\" && el instanceof Window)\n return el.document.documentElement;\n if (typeof Document !== \"undefined\" && el instanceof Document)\n return el.documentElement;\n return el;\n}\n\nfunction useInfiniteScroll(element, onLoadMore, options = {}) {\n var _a;\n const {\n direction = \"bottom\",\n interval = 100,\n canLoadMore = () => true\n } = options;\n const state = reactive(useScroll(\n element,\n {\n ...options,\n offset: {\n [direction]: (_a = options.distance) != null ? _a : 0,\n ...options.offset\n }\n }\n ));\n const promise = ref();\n const isLoading = computed(() => !!promise.value);\n const observedElement = computed(() => {\n return resolveElement(toValue(element));\n });\n const isElementVisible = useElementVisibility(observedElement);\n function checkAndLoad() {\n state.measure();\n if (!observedElement.value || !isElementVisible.value || !canLoadMore(observedElement.value))\n return;\n const { scrollHeight, clientHeight, scrollWidth, clientWidth } = observedElement.value;\n const isNarrower = direction === \"bottom\" || direction === \"top\" ? scrollHeight <= clientHeight : scrollWidth <= clientWidth;\n if (state.arrivedState[direction] || isNarrower) {\n if (!promise.value) {\n promise.value = Promise.all([\n onLoadMore(state),\n new Promise((resolve) => setTimeout(resolve, interval))\n ]).finally(() => {\n promise.value = null;\n nextTick(() => checkAndLoad());\n });\n }\n }\n }\n watch(\n () => [state.arrivedState[direction], isElementVisible.value],\n checkAndLoad,\n { immediate: true }\n );\n return {\n isLoading,\n reset() {\n nextTick(() => checkAndLoad());\n }\n };\n}\n\nconst defaultEvents = [\"mousedown\", \"mouseup\", \"keydown\", \"keyup\"];\nfunction useKeyModifier(modifier, options = {}) {\n const {\n events = defaultEvents,\n document = defaultDocument,\n initial = null\n } = options;\n const state = ref(initial);\n if (document) {\n events.forEach((listenerEvent) => {\n useEventListener(document, listenerEvent, (evt) => {\n if (typeof evt.getModifierState === \"function\")\n state.value = evt.getModifierState(modifier);\n });\n });\n }\n return state;\n}\n\nfunction useLocalStorage(key, initialValue, options = {}) {\n const { window = defaultWindow } = options;\n return useStorage(key, initialValue, window == null ? void 0 : window.localStorage, options);\n}\n\nconst DefaultMagicKeysAliasMap = {\n ctrl: \"control\",\n command: \"meta\",\n cmd: \"meta\",\n option: \"alt\",\n up: \"arrowup\",\n down: \"arrowdown\",\n left: \"arrowleft\",\n right: \"arrowright\"\n};\n\nfunction useMagicKeys(options = {}) {\n const {\n reactive: useReactive = false,\n target = defaultWindow,\n aliasMap = DefaultMagicKeysAliasMap,\n passive = true,\n onEventFired = noop\n } = options;\n const current = reactive(/* @__PURE__ */ new Set());\n const obj = {\n toJSON() {\n return {};\n },\n current\n };\n const refs = useReactive ? reactive(obj) : obj;\n const metaDeps = /* @__PURE__ */ new Set();\n const usedKeys = /* @__PURE__ */ new Set();\n function setRefs(key, value) {\n if (key in refs) {\n if (useReactive)\n refs[key] = value;\n else\n refs[key].value = value;\n }\n }\n function reset() {\n current.clear();\n for (const key of usedKeys)\n setRefs(key, false);\n }\n function updateRefs(e, value) {\n var _a, _b;\n const key = (_a = e.key) == null ? void 0 : _a.toLowerCase();\n const code = (_b = e.code) == null ? void 0 : _b.toLowerCase();\n const values = [code, key].filter(Boolean);\n if (key) {\n if (value)\n current.add(key);\n else\n current.delete(key);\n }\n for (const key2 of values) {\n usedKeys.add(key2);\n setRefs(key2, value);\n }\n if (key === \"meta\" && !value) {\n metaDeps.forEach((key2) => {\n current.delete(key2);\n setRefs(key2, false);\n });\n metaDeps.clear();\n } else if (typeof e.getModifierState === \"function\" && e.getModifierState(\"Meta\") && value) {\n [...current, ...values].forEach((key2) => metaDeps.add(key2));\n }\n }\n useEventListener(target, \"keydown\", (e) => {\n updateRefs(e, true);\n return onEventFired(e);\n }, { passive });\n useEventListener(target, \"keyup\", (e) => {\n updateRefs(e, false);\n return onEventFired(e);\n }, { passive });\n useEventListener(\"blur\", reset, { passive: true });\n useEventListener(\"focus\", reset, { passive: true });\n const proxy = new Proxy(\n refs,\n {\n get(target2, prop, rec) {\n if (typeof prop !== \"string\")\n return Reflect.get(target2, prop, rec);\n prop = prop.toLowerCase();\n if (prop in aliasMap)\n prop = aliasMap[prop];\n if (!(prop in refs)) {\n if (/[+_-]/.test(prop)) {\n const keys = prop.split(/[+_-]/g).map((i) => i.trim());\n refs[prop] = computed(() => keys.every((key) => toValue(proxy[key])));\n } else {\n refs[prop] = ref(false);\n }\n }\n const r = Reflect.get(target2, prop, rec);\n return useReactive ? toValue(r) : r;\n }\n }\n );\n return proxy;\n}\n\nfunction usingElRef(source, cb) {\n if (toValue(source))\n cb(toValue(source));\n}\nfunction timeRangeToArray(timeRanges) {\n let ranges = [];\n for (let i = 0; i < timeRanges.length; ++i)\n ranges = [...ranges, [timeRanges.start(i), timeRanges.end(i)]];\n return ranges;\n}\nfunction tracksToArray(tracks) {\n return Array.from(tracks).map(({ label, kind, language, mode, activeCues, cues, inBandMetadataTrackDispatchType }, id) => ({ id, label, kind, language, mode, activeCues, cues, inBandMetadataTrackDispatchType }));\n}\nconst defaultOptions = {\n src: \"\",\n tracks: []\n};\nfunction useMediaControls(target, options = {}) {\n target = toRef(target);\n options = {\n ...defaultOptions,\n ...options\n };\n const {\n document = defaultDocument\n } = options;\n const currentTime = ref(0);\n const duration = ref(0);\n const seeking = ref(false);\n const volume = ref(1);\n const waiting = ref(false);\n const ended = ref(false);\n const playing = ref(false);\n const rate = ref(1);\n const stalled = ref(false);\n const buffered = ref([]);\n const tracks = ref([]);\n const selectedTrack = ref(-1);\n const isPictureInPicture = ref(false);\n const muted = ref(false);\n const supportsPictureInPicture = document && \"pictureInPictureEnabled\" in document;\n const sourceErrorEvent = createEventHook();\n const disableTrack = (track) => {\n usingElRef(target, (el) => {\n if (track) {\n const id = typeof track === \"number\" ? track : track.id;\n el.textTracks[id].mode = \"disabled\";\n } else {\n for (let i = 0; i < el.textTracks.length; ++i)\n el.textTracks[i].mode = \"disabled\";\n }\n selectedTrack.value = -1;\n });\n };\n const enableTrack = (track, disableTracks = true) => {\n usingElRef(target, (el) => {\n const id = typeof track === \"number\" ? track : track.id;\n if (disableTracks)\n disableTrack();\n el.textTracks[id].mode = \"showing\";\n selectedTrack.value = id;\n });\n };\n const togglePictureInPicture = () => {\n return new Promise((resolve, reject) => {\n usingElRef(target, async (el) => {\n if (supportsPictureInPicture) {\n if (!isPictureInPicture.value) {\n el.requestPictureInPicture().then(resolve).catch(reject);\n } else {\n document.exitPictureInPicture().then(resolve).catch(reject);\n }\n }\n });\n });\n };\n watchEffect(() => {\n if (!document)\n return;\n const el = toValue(target);\n if (!el)\n return;\n const src = toValue(options.src);\n let sources = [];\n if (!src)\n return;\n if (typeof src === \"string\")\n sources = [{ src }];\n else if (Array.isArray(src))\n sources = src;\n else if (isObject(src))\n sources = [src];\n el.querySelectorAll(\"source\").forEach((e) => {\n e.removeEventListener(\"error\", sourceErrorEvent.trigger);\n e.remove();\n });\n sources.forEach(({ src: src2, type }) => {\n const source = document.createElement(\"source\");\n source.setAttribute(\"src\", src2);\n source.setAttribute(\"type\", type || \"\");\n source.addEventListener(\"error\", sourceErrorEvent.trigger);\n el.appendChild(source);\n });\n el.load();\n });\n tryOnScopeDispose(() => {\n const el = toValue(target);\n if (!el)\n return;\n el.querySelectorAll(\"source\").forEach((e) => e.removeEventListener(\"error\", sourceErrorEvent.trigger));\n });\n watch([target, volume], () => {\n const el = toValue(target);\n if (!el)\n return;\n el.volume = volume.value;\n });\n watch([target, muted], () => {\n const el = toValue(target);\n if (!el)\n return;\n el.muted = muted.value;\n });\n watch([target, rate], () => {\n const el = toValue(target);\n if (!el)\n return;\n el.playbackRate = rate.value;\n });\n watchEffect(() => {\n if (!document)\n return;\n const textTracks = toValue(options.tracks);\n const el = toValue(target);\n if (!textTracks || !textTracks.length || !el)\n return;\n el.querySelectorAll(\"track\").forEach((e) => e.remove());\n textTracks.forEach(({ default: isDefault, kind, label, src, srcLang }, i) => {\n const track = document.createElement(\"track\");\n track.default = isDefault || false;\n track.kind = kind;\n track.label = label;\n track.src = src;\n track.srclang = srcLang;\n if (track.default)\n selectedTrack.value = i;\n el.appendChild(track);\n });\n });\n const { ignoreUpdates: ignoreCurrentTimeUpdates } = watchIgnorable(currentTime, (time) => {\n const el = toValue(target);\n if (!el)\n return;\n el.currentTime = time;\n });\n const { ignoreUpdates: ignorePlayingUpdates } = watchIgnorable(playing, (isPlaying) => {\n const el = toValue(target);\n if (!el)\n return;\n if (isPlaying)\n el.play();\n else\n el.pause();\n });\n useEventListener(target, \"timeupdate\", () => ignoreCurrentTimeUpdates(() => currentTime.value = toValue(target).currentTime));\n useEventListener(target, \"durationchange\", () => duration.value = toValue(target).duration);\n useEventListener(target, \"progress\", () => buffered.value = timeRangeToArray(toValue(target).buffered));\n useEventListener(target, \"seeking\", () => seeking.value = true);\n useEventListener(target, \"seeked\", () => seeking.value = false);\n useEventListener(target, [\"waiting\", \"loadstart\"], () => {\n waiting.value = true;\n ignorePlayingUpdates(() => playing.value = false);\n });\n useEventListener(target, \"loadeddata\", () => waiting.value = false);\n useEventListener(target, \"playing\", () => {\n waiting.value = false;\n ended.value = false;\n ignorePlayingUpdates(() => playing.value = true);\n });\n useEventListener(target, \"ratechange\", () => rate.value = toValue(target).playbackRate);\n useEventListener(target, \"stalled\", () => stalled.value = true);\n useEventListener(target, \"ended\", () => ended.value = true);\n useEventListener(target, \"pause\", () => ignorePlayingUpdates(() => playing.value = false));\n useEventListener(target, \"play\", () => ignorePlayingUpdates(() => playing.value = true));\n useEventListener(target, \"enterpictureinpicture\", () => isPictureInPicture.value = true);\n useEventListener(target, \"leavepictureinpicture\", () => isPictureInPicture.value = false);\n useEventListener(target, \"volumechange\", () => {\n const el = toValue(target);\n if (!el)\n return;\n volume.value = el.volume;\n muted.value = el.muted;\n });\n const listeners = [];\n const stop = watch([target], () => {\n const el = toValue(target);\n if (!el)\n return;\n stop();\n listeners[0] = useEventListener(el.textTracks, \"addtrack\", () => tracks.value = tracksToArray(el.textTracks));\n listeners[1] = useEventListener(el.textTracks, \"removetrack\", () => tracks.value = tracksToArray(el.textTracks));\n listeners[2] = useEventListener(el.textTracks, \"change\", () => tracks.value = tracksToArray(el.textTracks));\n });\n tryOnScopeDispose(() => listeners.forEach((listener) => listener()));\n return {\n currentTime,\n duration,\n waiting,\n seeking,\n ended,\n stalled,\n buffered,\n playing,\n rate,\n // Volume\n volume,\n muted,\n // Tracks\n tracks,\n selectedTrack,\n enableTrack,\n disableTrack,\n // Picture in Picture\n supportsPictureInPicture,\n togglePictureInPicture,\n isPictureInPicture,\n // Events\n onSourceError: sourceErrorEvent.on\n };\n}\n\nfunction getMapVue2Compat() {\n const data = shallowReactive({});\n return {\n get: (key) => data[key],\n set: (key, value) => set(data, key, value),\n has: (key) => hasOwn(data, key),\n delete: (key) => del(data, key),\n clear: () => {\n Object.keys(data).forEach((key) => {\n del(data, key);\n });\n }\n };\n}\nfunction useMemoize(resolver, options) {\n const initCache = () => {\n if (options == null ? void 0 : options.cache)\n return shallowReactive(options.cache);\n if (isVue2)\n return getMapVue2Compat();\n return shallowReactive(/* @__PURE__ */ new Map());\n };\n const cache = initCache();\n const generateKey = (...args) => (options == null ? void 0 : options.getKey) ? options.getKey(...args) : JSON.stringify(args);\n const _loadData = (key, ...args) => {\n cache.set(key, resolver(...args));\n return cache.get(key);\n };\n const loadData = (...args) => _loadData(generateKey(...args), ...args);\n const deleteData = (...args) => {\n cache.delete(generateKey(...args));\n };\n const clearData = () => {\n cache.clear();\n };\n const memoized = (...args) => {\n const key = generateKey(...args);\n if (cache.has(key))\n return cache.get(key);\n return _loadData(key, ...args);\n };\n memoized.load = loadData;\n memoized.delete = deleteData;\n memoized.clear = clearData;\n memoized.generateKey = generateKey;\n memoized.cache = cache;\n return memoized;\n}\n\nfunction useMemory(options = {}) {\n const memory = ref();\n const isSupported = useSupported(() => typeof performance !== \"undefined\" && \"memory\" in performance);\n if (isSupported.value) {\n const { interval = 1e3 } = options;\n useIntervalFn(() => {\n memory.value = performance.memory;\n }, interval, { immediate: options.immediate, immediateCallback: options.immediateCallback });\n }\n return { isSupported, memory };\n}\n\nconst UseMouseBuiltinExtractors = {\n page: (event) => [event.pageX, event.pageY],\n client: (event) => [event.clientX, event.clientY],\n screen: (event) => [event.screenX, event.screenY],\n movement: (event) => event instanceof Touch ? null : [event.movementX, event.movementY]\n};\nfunction useMouse(options = {}) {\n const {\n type = \"page\",\n touch = true,\n resetOnTouchEnds = false,\n initialValue = { x: 0, y: 0 },\n window = defaultWindow,\n target = window,\n scroll = true,\n eventFilter\n } = options;\n let _prevMouseEvent = null;\n const x = ref(initialValue.x);\n const y = ref(initialValue.y);\n const sourceType = ref(null);\n const extractor = typeof type === \"function\" ? type : UseMouseBuiltinExtractors[type];\n const mouseHandler = (event) => {\n const result = extractor(event);\n _prevMouseEvent = event;\n if (result) {\n [x.value, y.value] = result;\n sourceType.value = \"mouse\";\n }\n };\n const touchHandler = (event) => {\n if (event.touches.length > 0) {\n const result = extractor(event.touches[0]);\n if (result) {\n [x.value, y.value] = result;\n sourceType.value = \"touch\";\n }\n }\n };\n const scrollHandler = () => {\n if (!_prevMouseEvent || !window)\n return;\n const pos = extractor(_prevMouseEvent);\n if (_prevMouseEvent instanceof MouseEvent && pos) {\n x.value = pos[0] + window.scrollX;\n y.value = pos[1] + window.scrollY;\n }\n };\n const reset = () => {\n x.value = initialValue.x;\n y.value = initialValue.y;\n };\n const mouseHandlerWrapper = eventFilter ? (event) => eventFilter(() => mouseHandler(event), {}) : (event) => mouseHandler(event);\n const touchHandlerWrapper = eventFilter ? (event) => eventFilter(() => touchHandler(event), {}) : (event) => touchHandler(event);\n const scrollHandlerWrapper = eventFilter ? () => eventFilter(() => scrollHandler(), {}) : () => scrollHandler();\n if (target) {\n const listenerOptions = { passive: true };\n useEventListener(target, [\"mousemove\", \"dragover\"], mouseHandlerWrapper, listenerOptions);\n if (touch && type !== \"movement\") {\n useEventListener(target, [\"touchstart\", \"touchmove\"], touchHandlerWrapper, listenerOptions);\n if (resetOnTouchEnds)\n useEventListener(target, \"touchend\", reset, listenerOptions);\n }\n if (scroll && type === \"page\")\n useEventListener(window, \"scroll\", scrollHandlerWrapper, { passive: true });\n }\n return {\n x,\n y,\n sourceType\n };\n}\n\nfunction useMouseInElement(target, options = {}) {\n const {\n handleOutside = true,\n window = defaultWindow\n } = options;\n const type = options.type || \"page\";\n const { x, y, sourceType } = useMouse(options);\n const targetRef = ref(target != null ? target : window == null ? void 0 : window.document.body);\n const elementX = ref(0);\n const elementY = ref(0);\n const elementPositionX = ref(0);\n const elementPositionY = ref(0);\n const elementHeight = ref(0);\n const elementWidth = ref(0);\n const isOutside = ref(true);\n let stop = () => {\n };\n if (window) {\n stop = watch(\n [targetRef, x, y],\n () => {\n const el = unrefElement(targetRef);\n if (!el || !(el instanceof HTMLElement))\n return;\n const {\n left,\n top,\n width,\n height\n } = el.getBoundingClientRect();\n elementPositionX.value = left + (type === \"page\" ? window.pageXOffset : 0);\n elementPositionY.value = top + (type === \"page\" ? window.pageYOffset : 0);\n elementHeight.value = height;\n elementWidth.value = width;\n const elX = x.value - elementPositionX.value;\n const elY = y.value - elementPositionY.value;\n isOutside.value = width === 0 || height === 0 || elX < 0 || elY < 0 || elX > width || elY > height;\n if (handleOutside || !isOutside.value) {\n elementX.value = elX;\n elementY.value = elY;\n }\n },\n { immediate: true }\n );\n useEventListener(document, \"mouseleave\", () => {\n isOutside.value = true;\n });\n }\n return {\n x,\n y,\n sourceType,\n elementX,\n elementY,\n elementPositionX,\n elementPositionY,\n elementHeight,\n elementWidth,\n isOutside,\n stop\n };\n}\n\nfunction useMousePressed(options = {}) {\n const {\n touch = true,\n drag = true,\n capture = false,\n initialValue = false,\n window = defaultWindow\n } = options;\n const pressed = ref(initialValue);\n const sourceType = ref(null);\n if (!window) {\n return {\n pressed,\n sourceType\n };\n }\n const onPressed = (srcType) => () => {\n pressed.value = true;\n sourceType.value = srcType;\n };\n const onReleased = () => {\n pressed.value = false;\n sourceType.value = null;\n };\n const target = computed(() => unrefElement(options.target) || window);\n useEventListener(target, \"mousedown\", onPressed(\"mouse\"), { passive: true, capture });\n useEventListener(window, \"mouseleave\", onReleased, { passive: true, capture });\n useEventListener(window, \"mouseup\", onReleased, { passive: true, capture });\n if (drag) {\n useEventListener(target, \"dragstart\", onPressed(\"mouse\"), { passive: true, capture });\n useEventListener(window, \"drop\", onReleased, { passive: true, capture });\n useEventListener(window, \"dragend\", onReleased, { passive: true, capture });\n }\n if (touch) {\n useEventListener(target, \"touchstart\", onPressed(\"touch\"), { passive: true, capture });\n useEventListener(window, \"touchend\", onReleased, { passive: true, capture });\n useEventListener(window, \"touchcancel\", onReleased, { passive: true, capture });\n }\n return {\n pressed,\n sourceType\n };\n}\n\nfunction useNavigatorLanguage(options = {}) {\n const { window = defaultWindow } = options;\n const navigator = window == null ? void 0 : window.navigator;\n const isSupported = useSupported(() => navigator && \"language\" in navigator);\n const language = ref(navigator == null ? void 0 : navigator.language);\n useEventListener(window, \"languagechange\", () => {\n if (navigator)\n language.value = navigator.language;\n });\n return {\n isSupported,\n language\n };\n}\n\nfunction useNetwork(options = {}) {\n const { window = defaultWindow } = options;\n const navigator = window == null ? void 0 : window.navigator;\n const isSupported = useSupported(() => navigator && \"connection\" in navigator);\n const isOnline = ref(true);\n const saveData = ref(false);\n const offlineAt = ref(void 0);\n const onlineAt = ref(void 0);\n const downlink = ref(void 0);\n const downlinkMax = ref(void 0);\n const rtt = ref(void 0);\n const effectiveType = ref(void 0);\n const type = ref(\"unknown\");\n const connection = isSupported.value && navigator.connection;\n function updateNetworkInformation() {\n if (!navigator)\n return;\n isOnline.value = navigator.onLine;\n offlineAt.value = isOnline.value ? void 0 : Date.now();\n onlineAt.value = isOnline.value ? Date.now() : void 0;\n if (connection) {\n downlink.value = connection.downlink;\n downlinkMax.value = connection.downlinkMax;\n effectiveType.value = connection.effectiveType;\n rtt.value = connection.rtt;\n saveData.value = connection.saveData;\n type.value = connection.type;\n }\n }\n if (window) {\n useEventListener(window, \"offline\", () => {\n isOnline.value = false;\n offlineAt.value = Date.now();\n });\n useEventListener(window, \"online\", () => {\n isOnline.value = true;\n onlineAt.value = Date.now();\n });\n }\n if (connection)\n useEventListener(connection, \"change\", updateNetworkInformation, false);\n updateNetworkInformation();\n return {\n isSupported,\n isOnline,\n saveData,\n offlineAt,\n onlineAt,\n downlink,\n downlinkMax,\n effectiveType,\n rtt,\n type\n };\n}\n\nfunction useNow(options = {}) {\n const {\n controls: exposeControls = false,\n interval = \"requestAnimationFrame\"\n } = options;\n const now = ref(/* @__PURE__ */ new Date());\n const update = () => now.value = /* @__PURE__ */ new Date();\n const controls = interval === \"requestAnimationFrame\" ? useRafFn(update, { immediate: true }) : useIntervalFn(update, interval, { immediate: true });\n if (exposeControls) {\n return {\n now,\n ...controls\n };\n } else {\n return now;\n }\n}\n\nfunction useObjectUrl(object) {\n const url = ref();\n const release = () => {\n if (url.value)\n URL.revokeObjectURL(url.value);\n url.value = void 0;\n };\n watch(\n () => toValue(object),\n (newObject) => {\n release();\n if (newObject)\n url.value = URL.createObjectURL(newObject);\n },\n { immediate: true }\n );\n tryOnScopeDispose(release);\n return readonly(url);\n}\n\nfunction useClamp(value, min, max) {\n if (typeof value === \"function\" || isReadonly(value))\n return computed(() => clamp(toValue(value), toValue(min), toValue(max)));\n const _value = ref(value);\n return computed({\n get() {\n return _value.value = clamp(_value.value, toValue(min), toValue(max));\n },\n set(value2) {\n _value.value = clamp(value2, toValue(min), toValue(max));\n }\n });\n}\n\nfunction useOffsetPagination(options) {\n const {\n total = Number.POSITIVE_INFINITY,\n pageSize = 10,\n page = 1,\n onPageChange = noop,\n onPageSizeChange = noop,\n onPageCountChange = noop\n } = options;\n const currentPageSize = useClamp(pageSize, 1, Number.POSITIVE_INFINITY);\n const pageCount = computed(() => Math.max(\n 1,\n Math.ceil(toValue(total) / toValue(currentPageSize))\n ));\n const currentPage = useClamp(page, 1, pageCount);\n const isFirstPage = computed(() => currentPage.value === 1);\n const isLastPage = computed(() => currentPage.value === pageCount.value);\n if (isRef(page)) {\n syncRef(page, currentPage, {\n direction: isReadonly(page) ? \"ltr\" : \"both\"\n });\n }\n if (isRef(pageSize)) {\n syncRef(pageSize, currentPageSize, {\n direction: isReadonly(pageSize) ? \"ltr\" : \"both\"\n });\n }\n function prev() {\n currentPage.value--;\n }\n function next() {\n currentPage.value++;\n }\n const returnValue = {\n currentPage,\n currentPageSize,\n pageCount,\n isFirstPage,\n isLastPage,\n prev,\n next\n };\n watch(currentPage, () => {\n onPageChange(reactive(returnValue));\n });\n watch(currentPageSize, () => {\n onPageSizeChange(reactive(returnValue));\n });\n watch(pageCount, () => {\n onPageCountChange(reactive(returnValue));\n });\n return returnValue;\n}\n\nfunction useOnline(options = {}) {\n const { isOnline } = useNetwork(options);\n return isOnline;\n}\n\nfunction usePageLeave(options = {}) {\n const { window = defaultWindow } = options;\n const isLeft = ref(false);\n const handler = (event) => {\n if (!window)\n return;\n event = event || window.event;\n const from = event.relatedTarget || event.toElement;\n isLeft.value = !from;\n };\n if (window) {\n useEventListener(window, \"mouseout\", handler, { passive: true });\n useEventListener(window.document, \"mouseleave\", handler, { passive: true });\n useEventListener(window.document, \"mouseenter\", handler, { passive: true });\n }\n return isLeft;\n}\n\nfunction useScreenOrientation(options = {}) {\n const {\n window = defaultWindow\n } = options;\n const isSupported = useSupported(() => window && \"screen\" in window && \"orientation\" in window.screen);\n const screenOrientation = isSupported.value ? window.screen.orientation : {};\n const orientation = ref(screenOrientation.type);\n const angle = ref(screenOrientation.angle || 0);\n if (isSupported.value) {\n useEventListener(window, \"orientationchange\", () => {\n orientation.value = screenOrientation.type;\n angle.value = screenOrientation.angle;\n });\n }\n const lockOrientation = (type) => {\n if (isSupported.value && typeof screenOrientation.lock === \"function\")\n return screenOrientation.lock(type);\n return Promise.reject(new Error(\"Not supported\"));\n };\n const unlockOrientation = () => {\n if (isSupported.value && typeof screenOrientation.unlock === \"function\")\n screenOrientation.unlock();\n };\n return {\n isSupported,\n orientation,\n angle,\n lockOrientation,\n unlockOrientation\n };\n}\n\nfunction useParallax(target, options = {}) {\n const {\n deviceOrientationTiltAdjust = (i) => i,\n deviceOrientationRollAdjust = (i) => i,\n mouseTiltAdjust = (i) => i,\n mouseRollAdjust = (i) => i,\n window = defaultWindow\n } = options;\n const orientation = reactive(useDeviceOrientation({ window }));\n const screenOrientation = reactive(useScreenOrientation({ window }));\n const {\n elementX: x,\n elementY: y,\n elementWidth: width,\n elementHeight: height\n } = useMouseInElement(target, { handleOutside: false, window });\n const source = computed(() => {\n if (orientation.isSupported && (orientation.alpha != null && orientation.alpha !== 0 || orientation.gamma != null && orientation.gamma !== 0)) {\n return \"deviceOrientation\";\n }\n return \"mouse\";\n });\n const roll = computed(() => {\n if (source.value === \"deviceOrientation\") {\n let value;\n switch (screenOrientation.orientation) {\n case \"landscape-primary\":\n value = orientation.gamma / 90;\n break;\n case \"landscape-secondary\":\n value = -orientation.gamma / 90;\n break;\n case \"portrait-primary\":\n value = -orientation.beta / 90;\n break;\n case \"portrait-secondary\":\n value = orientation.beta / 90;\n break;\n default:\n value = -orientation.beta / 90;\n }\n return deviceOrientationRollAdjust(value);\n } else {\n const value = -(y.value - height.value / 2) / height.value;\n return mouseRollAdjust(value);\n }\n });\n const tilt = computed(() => {\n if (source.value === \"deviceOrientation\") {\n let value;\n switch (screenOrientation.orientation) {\n case \"landscape-primary\":\n value = orientation.beta / 90;\n break;\n case \"landscape-secondary\":\n value = -orientation.beta / 90;\n break;\n case \"portrait-primary\":\n value = orientation.gamma / 90;\n break;\n case \"portrait-secondary\":\n value = -orientation.gamma / 90;\n break;\n default:\n value = orientation.gamma / 90;\n }\n return deviceOrientationTiltAdjust(value);\n } else {\n const value = (x.value - width.value / 2) / width.value;\n return mouseTiltAdjust(value);\n }\n });\n return { roll, tilt, source };\n}\n\nfunction useParentElement(element = useCurrentElement()) {\n const parentElement = shallowRef();\n const update = () => {\n const el = unrefElement(element);\n if (el)\n parentElement.value = el.parentElement;\n };\n tryOnMounted(update);\n watch(() => toValue(element), update);\n return parentElement;\n}\n\nfunction usePerformanceObserver(options, callback) {\n const {\n window = defaultWindow,\n immediate = true,\n ...performanceOptions\n } = options;\n const isSupported = useSupported(() => window && \"PerformanceObserver\" in window);\n let observer;\n const stop = () => {\n observer == null ? void 0 : observer.disconnect();\n };\n const start = () => {\n if (isSupported.value) {\n stop();\n observer = new PerformanceObserver(callback);\n observer.observe(performanceOptions);\n }\n };\n tryOnScopeDispose(stop);\n if (immediate)\n start();\n return {\n isSupported,\n start,\n stop\n };\n}\n\nconst defaultState = {\n x: 0,\n y: 0,\n pointerId: 0,\n pressure: 0,\n tiltX: 0,\n tiltY: 0,\n width: 0,\n height: 0,\n twist: 0,\n pointerType: null\n};\nconst keys = /* @__PURE__ */ Object.keys(defaultState);\nfunction usePointer(options = {}) {\n const {\n target = defaultWindow\n } = options;\n const isInside = ref(false);\n const state = ref(options.initialValue || {});\n Object.assign(state.value, defaultState, state.value);\n const handler = (event) => {\n isInside.value = true;\n if (options.pointerTypes && !options.pointerTypes.includes(event.pointerType))\n return;\n state.value = objectPick(event, keys, false);\n };\n if (target) {\n const listenerOptions = { passive: true };\n useEventListener(target, [\"pointerdown\", \"pointermove\", \"pointerup\"], handler, listenerOptions);\n useEventListener(target, \"pointerleave\", () => isInside.value = false, listenerOptions);\n }\n return {\n ...toRefs(state),\n isInside\n };\n}\n\nfunction usePointerLock(target, options = {}) {\n const { document = defaultDocument } = options;\n const isSupported = useSupported(() => document && \"pointerLockElement\" in document);\n const element = ref();\n const triggerElement = ref();\n let targetElement;\n if (isSupported.value) {\n useEventListener(document, \"pointerlockchange\", () => {\n var _a;\n const currentElement = (_a = document.pointerLockElement) != null ? _a : element.value;\n if (targetElement && currentElement === targetElement) {\n element.value = document.pointerLockElement;\n if (!element.value)\n targetElement = triggerElement.value = null;\n }\n });\n useEventListener(document, \"pointerlockerror\", () => {\n var _a;\n const currentElement = (_a = document.pointerLockElement) != null ? _a : element.value;\n if (targetElement && currentElement === targetElement) {\n const action = document.pointerLockElement ? \"release\" : \"acquire\";\n throw new Error(`Failed to ${action} pointer lock.`);\n }\n });\n }\n async function lock(e) {\n var _a;\n if (!isSupported.value)\n throw new Error(\"Pointer Lock API is not supported by your browser.\");\n triggerElement.value = e instanceof Event ? e.currentTarget : null;\n targetElement = e instanceof Event ? (_a = unrefElement(target)) != null ? _a : triggerElement.value : unrefElement(e);\n if (!targetElement)\n throw new Error(\"Target element undefined.\");\n targetElement.requestPointerLock();\n return await until(element).toBe(targetElement);\n }\n async function unlock() {\n if (!element.value)\n return false;\n document.exitPointerLock();\n await until(element).toBeNull();\n return true;\n }\n return {\n isSupported,\n element,\n triggerElement,\n lock,\n unlock\n };\n}\n\nfunction usePointerSwipe(target, options = {}) {\n const targetRef = toRef(target);\n const {\n threshold = 50,\n onSwipe,\n onSwipeEnd,\n onSwipeStart,\n disableTextSelect = false\n } = options;\n const posStart = reactive({ x: 0, y: 0 });\n const updatePosStart = (x, y) => {\n posStart.x = x;\n posStart.y = y;\n };\n const posEnd = reactive({ x: 0, y: 0 });\n const updatePosEnd = (x, y) => {\n posEnd.x = x;\n posEnd.y = y;\n };\n const distanceX = computed(() => posStart.x - posEnd.x);\n const distanceY = computed(() => posStart.y - posEnd.y);\n const { max, abs } = Math;\n const isThresholdExceeded = computed(() => max(abs(distanceX.value), abs(distanceY.value)) >= threshold);\n const isSwiping = ref(false);\n const isPointerDown = ref(false);\n const direction = computed(() => {\n if (!isThresholdExceeded.value)\n return \"none\";\n if (abs(distanceX.value) > abs(distanceY.value)) {\n return distanceX.value > 0 ? \"left\" : \"right\";\n } else {\n return distanceY.value > 0 ? \"up\" : \"down\";\n }\n });\n const eventIsAllowed = (e) => {\n var _a, _b, _c;\n const isReleasingButton = e.buttons === 0;\n const isPrimaryButton = e.buttons === 1;\n return (_c = (_b = (_a = options.pointerTypes) == null ? void 0 : _a.includes(e.pointerType)) != null ? _b : isReleasingButton || isPrimaryButton) != null ? _c : true;\n };\n const stops = [\n useEventListener(target, \"pointerdown\", (e) => {\n if (!eventIsAllowed(e))\n return;\n isPointerDown.value = true;\n const eventTarget = e.target;\n eventTarget == null ? void 0 : eventTarget.setPointerCapture(e.pointerId);\n const { clientX: x, clientY: y } = e;\n updatePosStart(x, y);\n updatePosEnd(x, y);\n onSwipeStart == null ? void 0 : onSwipeStart(e);\n }),\n useEventListener(target, \"pointermove\", (e) => {\n if (!eventIsAllowed(e))\n return;\n if (!isPointerDown.value)\n return;\n const { clientX: x, clientY: y } = e;\n updatePosEnd(x, y);\n if (!isSwiping.value && isThresholdExceeded.value)\n isSwiping.value = true;\n if (isSwiping.value)\n onSwipe == null ? void 0 : onSwipe(e);\n }),\n useEventListener(target, \"pointerup\", (e) => {\n if (!eventIsAllowed(e))\n return;\n if (isSwiping.value)\n onSwipeEnd == null ? void 0 : onSwipeEnd(e, direction.value);\n isPointerDown.value = false;\n isSwiping.value = false;\n })\n ];\n tryOnMounted(() => {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n (_b = (_a = targetRef.value) == null ? void 0 : _a.style) == null ? void 0 : _b.setProperty(\"touch-action\", \"none\");\n if (disableTextSelect) {\n (_d = (_c = targetRef.value) == null ? void 0 : _c.style) == null ? void 0 : _d.setProperty(\"-webkit-user-select\", \"none\");\n (_f = (_e = targetRef.value) == null ? void 0 : _e.style) == null ? void 0 : _f.setProperty(\"-ms-user-select\", \"none\");\n (_h = (_g = targetRef.value) == null ? void 0 : _g.style) == null ? void 0 : _h.setProperty(\"user-select\", \"none\");\n }\n });\n const stop = () => stops.forEach((s) => s());\n return {\n isSwiping: readonly(isSwiping),\n direction: readonly(direction),\n posStart: readonly(posStart),\n posEnd: readonly(posEnd),\n distanceX,\n distanceY,\n stop\n };\n}\n\nfunction usePreferredColorScheme(options) {\n const isLight = useMediaQuery(\"(prefers-color-scheme: light)\", options);\n const isDark = useMediaQuery(\"(prefers-color-scheme: dark)\", options);\n return computed(() => {\n if (isDark.value)\n return \"dark\";\n if (isLight.value)\n return \"light\";\n return \"no-preference\";\n });\n}\n\nfunction usePreferredContrast(options) {\n const isMore = useMediaQuery(\"(prefers-contrast: more)\", options);\n const isLess = useMediaQuery(\"(prefers-contrast: less)\", options);\n const isCustom = useMediaQuery(\"(prefers-contrast: custom)\", options);\n return computed(() => {\n if (isMore.value)\n return \"more\";\n if (isLess.value)\n return \"less\";\n if (isCustom.value)\n return \"custom\";\n return \"no-preference\";\n });\n}\n\nfunction usePreferredLanguages(options = {}) {\n const { window = defaultWindow } = options;\n if (!window)\n return ref([\"en\"]);\n const navigator = window.navigator;\n const value = ref(navigator.languages);\n useEventListener(window, \"languagechange\", () => {\n value.value = navigator.languages;\n });\n return value;\n}\n\nfunction usePreferredReducedMotion(options) {\n const isReduced = useMediaQuery(\"(prefers-reduced-motion: reduce)\", options);\n return computed(() => {\n if (isReduced.value)\n return \"reduce\";\n return \"no-preference\";\n });\n}\n\nfunction usePrevious(value, initialValue) {\n const previous = shallowRef(initialValue);\n watch(\n toRef(value),\n (_, oldValue) => {\n previous.value = oldValue;\n },\n { flush: \"sync\" }\n );\n return readonly(previous);\n}\n\nconst topVarName = \"--vueuse-safe-area-top\";\nconst rightVarName = \"--vueuse-safe-area-right\";\nconst bottomVarName = \"--vueuse-safe-area-bottom\";\nconst leftVarName = \"--vueuse-safe-area-left\";\nfunction useScreenSafeArea() {\n const top = ref(\"\");\n const right = ref(\"\");\n const bottom = ref(\"\");\n const left = ref(\"\");\n if (isClient) {\n const topCssVar = useCssVar(topVarName);\n const rightCssVar = useCssVar(rightVarName);\n const bottomCssVar = useCssVar(bottomVarName);\n const leftCssVar = useCssVar(leftVarName);\n topCssVar.value = \"env(safe-area-inset-top, 0px)\";\n rightCssVar.value = \"env(safe-area-inset-right, 0px)\";\n bottomCssVar.value = \"env(safe-area-inset-bottom, 0px)\";\n leftCssVar.value = \"env(safe-area-inset-left, 0px)\";\n update();\n useEventListener(\"resize\", useDebounceFn(update));\n }\n function update() {\n top.value = getValue(topVarName);\n right.value = getValue(rightVarName);\n bottom.value = getValue(bottomVarName);\n left.value = getValue(leftVarName);\n }\n return {\n top,\n right,\n bottom,\n left,\n update\n };\n}\nfunction getValue(position) {\n return getComputedStyle(document.documentElement).getPropertyValue(position);\n}\n\nfunction useScriptTag(src, onLoaded = noop, options = {}) {\n const {\n immediate = true,\n manual = false,\n type = \"text/javascript\",\n async = true,\n crossOrigin,\n referrerPolicy,\n noModule,\n defer,\n document = defaultDocument,\n attrs = {}\n } = options;\n const scriptTag = ref(null);\n let _promise = null;\n const loadScript = (waitForScriptLoad) => new Promise((resolve, reject) => {\n const resolveWithElement = (el2) => {\n scriptTag.value = el2;\n resolve(el2);\n return el2;\n };\n if (!document) {\n resolve(false);\n return;\n }\n let shouldAppend = false;\n let el = document.querySelector(`script[src=\"${toValue(src)}\"]`);\n if (!el) {\n el = document.createElement(\"script\");\n el.type = type;\n el.async = async;\n el.src = toValue(src);\n if (defer)\n el.defer = defer;\n if (crossOrigin)\n el.crossOrigin = crossOrigin;\n if (noModule)\n el.noModule = noModule;\n if (referrerPolicy)\n el.referrerPolicy = referrerPolicy;\n Object.entries(attrs).forEach(([name, value]) => el == null ? void 0 : el.setAttribute(name, value));\n shouldAppend = true;\n } else if (el.hasAttribute(\"data-loaded\")) {\n resolveWithElement(el);\n }\n el.addEventListener(\"error\", (event) => reject(event));\n el.addEventListener(\"abort\", (event) => reject(event));\n el.addEventListener(\"load\", () => {\n el.setAttribute(\"data-loaded\", \"true\");\n onLoaded(el);\n resolveWithElement(el);\n });\n if (shouldAppend)\n el = document.head.appendChild(el);\n if (!waitForScriptLoad)\n resolveWithElement(el);\n });\n const load = (waitForScriptLoad = true) => {\n if (!_promise)\n _promise = loadScript(waitForScriptLoad);\n return _promise;\n };\n const unload = () => {\n if (!document)\n return;\n _promise = null;\n if (scriptTag.value)\n scriptTag.value = null;\n const el = document.querySelector(`script[src=\"${toValue(src)}\"]`);\n if (el)\n document.head.removeChild(el);\n };\n if (immediate && !manual)\n tryOnMounted(load);\n if (!manual)\n tryOnUnmounted(unload);\n return { scriptTag, load, unload };\n}\n\nfunction checkOverflowScroll(ele) {\n const style = window.getComputedStyle(ele);\n if (style.overflowX === \"scroll\" || style.overflowY === \"scroll\" || style.overflowX === \"auto\" && ele.clientWidth < ele.scrollWidth || style.overflowY === \"auto\" && ele.clientHeight < ele.scrollHeight) {\n return true;\n } else {\n const parent = ele.parentNode;\n if (!parent || parent.tagName === \"BODY\")\n return false;\n return checkOverflowScroll(parent);\n }\n}\nfunction preventDefault(rawEvent) {\n const e = rawEvent || window.event;\n const _target = e.target;\n if (checkOverflowScroll(_target))\n return false;\n if (e.touches.length > 1)\n return true;\n if (e.preventDefault)\n e.preventDefault();\n return false;\n}\nconst elInitialOverflow = /* @__PURE__ */ new WeakMap();\nfunction useScrollLock(element, initialState = false) {\n const isLocked = ref(initialState);\n let stopTouchMoveListener = null;\n let initialOverflow = \"\";\n watch(toRef(element), (el) => {\n const target = resolveElement(toValue(el));\n if (target) {\n const ele = target;\n if (!elInitialOverflow.get(ele))\n elInitialOverflow.set(ele, ele.style.overflow);\n if (ele.style.overflow !== \"hidden\")\n initialOverflow = ele.style.overflow;\n if (ele.style.overflow === \"hidden\")\n return isLocked.value = true;\n if (isLocked.value)\n return ele.style.overflow = \"hidden\";\n }\n }, {\n immediate: true\n });\n const lock = () => {\n const el = resolveElement(toValue(element));\n if (!el || isLocked.value)\n return;\n if (isIOS) {\n stopTouchMoveListener = useEventListener(\n el,\n \"touchmove\",\n (e) => {\n preventDefault(e);\n },\n { passive: false }\n );\n }\n el.style.overflow = \"hidden\";\n isLocked.value = true;\n };\n const unlock = () => {\n const el = resolveElement(toValue(element));\n if (!el || !isLocked.value)\n return;\n if (isIOS)\n stopTouchMoveListener == null ? void 0 : stopTouchMoveListener();\n el.style.overflow = initialOverflow;\n elInitialOverflow.delete(el);\n isLocked.value = false;\n };\n tryOnScopeDispose(unlock);\n return computed({\n get() {\n return isLocked.value;\n },\n set(v) {\n if (v)\n lock();\n else unlock();\n }\n });\n}\n\nfunction useSessionStorage(key, initialValue, options = {}) {\n const { window = defaultWindow } = options;\n return useStorage(key, initialValue, window == null ? void 0 : window.sessionStorage, options);\n}\n\nfunction useShare(shareOptions = {}, options = {}) {\n const { navigator = defaultNavigator } = options;\n const _navigator = navigator;\n const isSupported = useSupported(() => _navigator && \"canShare\" in _navigator);\n const share = async (overrideOptions = {}) => {\n if (isSupported.value) {\n const data = {\n ...toValue(shareOptions),\n ...toValue(overrideOptions)\n };\n let granted = true;\n if (data.files && _navigator.canShare)\n granted = _navigator.canShare({ files: data.files });\n if (granted)\n return _navigator.share(data);\n }\n };\n return {\n isSupported,\n share\n };\n}\n\nconst defaultSortFn = (source, compareFn) => source.sort(compareFn);\nconst defaultCompare = (a, b) => a - b;\nfunction useSorted(...args) {\n var _a, _b, _c, _d;\n const [source] = args;\n let compareFn = defaultCompare;\n let options = {};\n if (args.length === 2) {\n if (typeof args[1] === \"object\") {\n options = args[1];\n compareFn = (_a = options.compareFn) != null ? _a : defaultCompare;\n } else {\n compareFn = (_b = args[1]) != null ? _b : defaultCompare;\n }\n } else if (args.length > 2) {\n compareFn = (_c = args[1]) != null ? _c : defaultCompare;\n options = (_d = args[2]) != null ? _d : {};\n }\n const {\n dirty = false,\n sortFn = defaultSortFn\n } = options;\n if (!dirty)\n return computed(() => sortFn([...toValue(source)], compareFn));\n watchEffect(() => {\n const result = sortFn(toValue(source), compareFn);\n if (isRef(source))\n source.value = result;\n else\n source.splice(0, source.length, ...result);\n });\n return source;\n}\n\nfunction useSpeechRecognition(options = {}) {\n const {\n interimResults = true,\n continuous = true,\n maxAlternatives = 1,\n window = defaultWindow\n } = options;\n const lang = toRef(options.lang || \"en-US\");\n const isListening = ref(false);\n const isFinal = ref(false);\n const result = ref(\"\");\n const error = shallowRef(void 0);\n const toggle = (value = !isListening.value) => {\n isListening.value = value;\n };\n const start = () => {\n isListening.value = true;\n };\n const stop = () => {\n isListening.value = false;\n };\n const SpeechRecognition = window && (window.SpeechRecognition || window.webkitSpeechRecognition);\n const isSupported = useSupported(() => SpeechRecognition);\n let recognition;\n if (isSupported.value) {\n recognition = new SpeechRecognition();\n recognition.continuous = continuous;\n recognition.interimResults = interimResults;\n recognition.lang = toValue(lang);\n recognition.maxAlternatives = maxAlternatives;\n recognition.onstart = () => {\n isFinal.value = false;\n };\n watch(lang, (lang2) => {\n if (recognition && !isListening.value)\n recognition.lang = lang2;\n });\n recognition.onresult = (event) => {\n const currentResult = event.results[event.resultIndex];\n const { transcript } = currentResult[0];\n isFinal.value = currentResult.isFinal;\n result.value = transcript;\n error.value = void 0;\n };\n recognition.onerror = (event) => {\n error.value = event;\n };\n recognition.onend = () => {\n isListening.value = false;\n recognition.lang = toValue(lang);\n };\n watch(isListening, () => {\n if (isListening.value)\n recognition.start();\n else\n recognition.stop();\n });\n }\n tryOnScopeDispose(() => {\n isListening.value = false;\n });\n return {\n isSupported,\n isListening,\n isFinal,\n recognition,\n result,\n error,\n toggle,\n start,\n stop\n };\n}\n\nfunction useSpeechSynthesis(text, options = {}) {\n const {\n pitch = 1,\n rate = 1,\n volume = 1,\n window = defaultWindow\n } = options;\n const synth = window && window.speechSynthesis;\n const isSupported = useSupported(() => synth);\n const isPlaying = ref(false);\n const status = ref(\"init\");\n const spokenText = toRef(text || \"\");\n const lang = toRef(options.lang || \"en-US\");\n const error = shallowRef(void 0);\n const toggle = (value = !isPlaying.value) => {\n isPlaying.value = value;\n };\n const bindEventsForUtterance = (utterance2) => {\n utterance2.lang = toValue(lang);\n utterance2.voice = toValue(options.voice) || null;\n utterance2.pitch = toValue(pitch);\n utterance2.rate = toValue(rate);\n utterance2.volume = volume;\n utterance2.onstart = () => {\n isPlaying.value = true;\n status.value = \"play\";\n };\n utterance2.onpause = () => {\n isPlaying.value = false;\n status.value = \"pause\";\n };\n utterance2.onresume = () => {\n isPlaying.value = true;\n status.value = \"play\";\n };\n utterance2.onend = () => {\n isPlaying.value = false;\n status.value = \"end\";\n };\n utterance2.onerror = (event) => {\n error.value = event;\n };\n };\n const utterance = computed(() => {\n isPlaying.value = false;\n status.value = \"init\";\n const newUtterance = new SpeechSynthesisUtterance(spokenText.value);\n bindEventsForUtterance(newUtterance);\n return newUtterance;\n });\n const speak = () => {\n synth.cancel();\n if (utterance)\n synth.speak(utterance.value);\n };\n const stop = () => {\n synth.cancel();\n isPlaying.value = false;\n };\n if (isSupported.value) {\n bindEventsForUtterance(utterance.value);\n watch(lang, (lang2) => {\n if (utterance.value && !isPlaying.value)\n utterance.value.lang = lang2;\n });\n if (options.voice) {\n watch(options.voice, () => {\n synth.cancel();\n });\n }\n watch(isPlaying, () => {\n if (isPlaying.value)\n synth.resume();\n else\n synth.pause();\n });\n }\n tryOnScopeDispose(() => {\n isPlaying.value = false;\n });\n return {\n isSupported,\n isPlaying,\n status,\n utterance,\n error,\n stop,\n toggle,\n speak\n };\n}\n\nfunction useStepper(steps, initialStep) {\n const stepsRef = ref(steps);\n const stepNames = computed(() => Array.isArray(stepsRef.value) ? stepsRef.value : Object.keys(stepsRef.value));\n const index = ref(stepNames.value.indexOf(initialStep != null ? initialStep : stepNames.value[0]));\n const current = computed(() => at(index.value));\n const isFirst = computed(() => index.value === 0);\n const isLast = computed(() => index.value === stepNames.value.length - 1);\n const next = computed(() => stepNames.value[index.value + 1]);\n const previous = computed(() => stepNames.value[index.value - 1]);\n function at(index2) {\n if (Array.isArray(stepsRef.value))\n return stepsRef.value[index2];\n return stepsRef.value[stepNames.value[index2]];\n }\n function get(step) {\n if (!stepNames.value.includes(step))\n return;\n return at(stepNames.value.indexOf(step));\n }\n function goTo(step) {\n if (stepNames.value.includes(step))\n index.value = stepNames.value.indexOf(step);\n }\n function goToNext() {\n if (isLast.value)\n return;\n index.value++;\n }\n function goToPrevious() {\n if (isFirst.value)\n return;\n index.value--;\n }\n function goBackTo(step) {\n if (isAfter(step))\n goTo(step);\n }\n function isNext(step) {\n return stepNames.value.indexOf(step) === index.value + 1;\n }\n function isPrevious(step) {\n return stepNames.value.indexOf(step) === index.value - 1;\n }\n function isCurrent(step) {\n return stepNames.value.indexOf(step) === index.value;\n }\n function isBefore(step) {\n return index.value < stepNames.value.indexOf(step);\n }\n function isAfter(step) {\n return index.value > stepNames.value.indexOf(step);\n }\n return {\n steps: stepsRef,\n stepNames,\n index,\n current,\n next,\n previous,\n isFirst,\n isLast,\n at,\n get,\n goTo,\n goToNext,\n goToPrevious,\n goBackTo,\n isNext,\n isPrevious,\n isCurrent,\n isBefore,\n isAfter\n };\n}\n\nfunction useStorageAsync(key, initialValue, storage, options = {}) {\n var _a;\n const {\n flush = \"pre\",\n deep = true,\n listenToStorageChanges = true,\n writeDefaults = true,\n mergeDefaults = false,\n shallow,\n window = defaultWindow,\n eventFilter,\n onError = (e) => {\n console.error(e);\n }\n } = options;\n const rawInit = toValue(initialValue);\n const type = guessSerializerType(rawInit);\n const data = (shallow ? shallowRef : ref)(initialValue);\n const serializer = (_a = options.serializer) != null ? _a : StorageSerializers[type];\n if (!storage) {\n try {\n storage = getSSRHandler(\"getDefaultStorageAsync\", () => {\n var _a2;\n return (_a2 = defaultWindow) == null ? void 0 : _a2.localStorage;\n })();\n } catch (e) {\n onError(e);\n }\n }\n async function read(event) {\n if (!storage || event && event.key !== key)\n return;\n try {\n const rawValue = event ? event.newValue : await storage.getItem(key);\n if (rawValue == null) {\n data.value = rawInit;\n if (writeDefaults && rawInit !== null)\n await storage.setItem(key, await serializer.write(rawInit));\n } else if (mergeDefaults) {\n const value = await serializer.read(rawValue);\n if (typeof mergeDefaults === \"function\")\n data.value = mergeDefaults(value, rawInit);\n else if (type === \"object\" && !Array.isArray(value))\n data.value = { ...rawInit, ...value };\n else data.value = value;\n } else {\n data.value = await serializer.read(rawValue);\n }\n } catch (e) {\n onError(e);\n }\n }\n read();\n if (window && listenToStorageChanges)\n useEventListener(window, \"storage\", (e) => Promise.resolve().then(() => read(e)));\n if (storage) {\n watchWithFilter(\n data,\n async () => {\n try {\n if (data.value == null)\n await storage.removeItem(key);\n else\n await storage.setItem(key, await serializer.write(data.value));\n } catch (e) {\n onError(e);\n }\n },\n {\n flush,\n deep,\n eventFilter\n }\n );\n }\n return data;\n}\n\nlet _id = 0;\nfunction useStyleTag(css, options = {}) {\n const isLoaded = ref(false);\n const {\n document = defaultDocument,\n immediate = true,\n manual = false,\n id = `vueuse_styletag_${++_id}`\n } = options;\n const cssRef = ref(css);\n let stop = () => {\n };\n const load = () => {\n if (!document)\n return;\n const el = document.getElementById(id) || document.createElement(\"style\");\n if (!el.isConnected) {\n el.id = id;\n if (options.media)\n el.media = options.media;\n document.head.appendChild(el);\n }\n if (isLoaded.value)\n return;\n stop = watch(\n cssRef,\n (value) => {\n el.textContent = value;\n },\n { immediate: true }\n );\n isLoaded.value = true;\n };\n const unload = () => {\n if (!document || !isLoaded.value)\n return;\n stop();\n document.head.removeChild(document.getElementById(id));\n isLoaded.value = false;\n };\n if (immediate && !manual)\n tryOnMounted(load);\n if (!manual)\n tryOnScopeDispose(unload);\n return {\n id,\n css: cssRef,\n unload,\n load,\n isLoaded: readonly(isLoaded)\n };\n}\n\nfunction useSwipe(target, options = {}) {\n const {\n threshold = 50,\n onSwipe,\n onSwipeEnd,\n onSwipeStart,\n passive = true,\n window = defaultWindow\n } = options;\n const coordsStart = reactive({ x: 0, y: 0 });\n const coordsEnd = reactive({ x: 0, y: 0 });\n const diffX = computed(() => coordsStart.x - coordsEnd.x);\n const diffY = computed(() => coordsStart.y - coordsEnd.y);\n const { max, abs } = Math;\n const isThresholdExceeded = computed(() => max(abs(diffX.value), abs(diffY.value)) >= threshold);\n const isSwiping = ref(false);\n const direction = computed(() => {\n if (!isThresholdExceeded.value)\n return \"none\";\n if (abs(diffX.value) > abs(diffY.value)) {\n return diffX.value > 0 ? \"left\" : \"right\";\n } else {\n return diffY.value > 0 ? \"up\" : \"down\";\n }\n });\n const getTouchEventCoords = (e) => [e.touches[0].clientX, e.touches[0].clientY];\n const updateCoordsStart = (x, y) => {\n coordsStart.x = x;\n coordsStart.y = y;\n };\n const updateCoordsEnd = (x, y) => {\n coordsEnd.x = x;\n coordsEnd.y = y;\n };\n let listenerOptions;\n const isPassiveEventSupported = checkPassiveEventSupport(window == null ? void 0 : window.document);\n if (!passive)\n listenerOptions = isPassiveEventSupported ? { passive: false, capture: true } : { capture: true };\n else\n listenerOptions = isPassiveEventSupported ? { passive: true } : { capture: false };\n const onTouchEnd = (e) => {\n if (isSwiping.value)\n onSwipeEnd == null ? void 0 : onSwipeEnd(e, direction.value);\n isSwiping.value = false;\n };\n const stops = [\n useEventListener(target, \"touchstart\", (e) => {\n if (e.touches.length !== 1)\n return;\n if (listenerOptions.capture && !listenerOptions.passive)\n e.preventDefault();\n const [x, y] = getTouchEventCoords(e);\n updateCoordsStart(x, y);\n updateCoordsEnd(x, y);\n onSwipeStart == null ? void 0 : onSwipeStart(e);\n }, listenerOptions),\n useEventListener(target, \"touchmove\", (e) => {\n if (e.touches.length !== 1)\n return;\n const [x, y] = getTouchEventCoords(e);\n updateCoordsEnd(x, y);\n if (!isSwiping.value && isThresholdExceeded.value)\n isSwiping.value = true;\n if (isSwiping.value)\n onSwipe == null ? void 0 : onSwipe(e);\n }, listenerOptions),\n useEventListener(target, [\"touchend\", \"touchcancel\"], onTouchEnd, listenerOptions)\n ];\n const stop = () => stops.forEach((s) => s());\n return {\n isPassiveEventSupported,\n isSwiping,\n direction,\n coordsStart,\n coordsEnd,\n lengthX: diffX,\n lengthY: diffY,\n stop\n };\n}\nfunction checkPassiveEventSupport(document) {\n if (!document)\n return false;\n let supportsPassive = false;\n const optionsBlock = {\n get passive() {\n supportsPassive = true;\n return false;\n }\n };\n document.addEventListener(\"x\", noop, optionsBlock);\n document.removeEventListener(\"x\", noop);\n return supportsPassive;\n}\n\nfunction useTemplateRefsList() {\n const refs = ref([]);\n refs.value.set = (el) => {\n if (el)\n refs.value.push(el);\n };\n onBeforeUpdate(() => {\n refs.value.length = 0;\n });\n return refs;\n}\n\nfunction useTextDirection(options = {}) {\n const {\n document = defaultDocument,\n selector = \"html\",\n observe = false,\n initialValue = \"ltr\"\n } = options;\n function getValue() {\n var _a, _b;\n return (_b = (_a = document == null ? void 0 : document.querySelector(selector)) == null ? void 0 : _a.getAttribute(\"dir\")) != null ? _b : initialValue;\n }\n const dir = ref(getValue());\n tryOnMounted(() => dir.value = getValue());\n if (observe && document) {\n useMutationObserver(\n document.querySelector(selector),\n () => dir.value = getValue(),\n { attributes: true }\n );\n }\n return computed({\n get() {\n return dir.value;\n },\n set(v) {\n var _a, _b;\n dir.value = v;\n if (!document)\n return;\n if (dir.value)\n (_a = document.querySelector(selector)) == null ? void 0 : _a.setAttribute(\"dir\", dir.value);\n else\n (_b = document.querySelector(selector)) == null ? void 0 : _b.removeAttribute(\"dir\");\n }\n });\n}\n\nfunction getRangesFromSelection(selection) {\n var _a;\n const rangeCount = (_a = selection.rangeCount) != null ? _a : 0;\n return Array.from({ length: rangeCount }, (_, i) => selection.getRangeAt(i));\n}\nfunction useTextSelection(options = {}) {\n const {\n window = defaultWindow\n } = options;\n const selection = ref(null);\n const text = computed(() => {\n var _a, _b;\n return (_b = (_a = selection.value) == null ? void 0 : _a.toString()) != null ? _b : \"\";\n });\n const ranges = computed(() => selection.value ? getRangesFromSelection(selection.value) : []);\n const rects = computed(() => ranges.value.map((range) => range.getBoundingClientRect()));\n function onSelectionChange() {\n selection.value = null;\n if (window)\n selection.value = window.getSelection();\n }\n if (window)\n useEventListener(window.document, \"selectionchange\", onSelectionChange);\n return {\n text,\n rects,\n ranges,\n selection\n };\n}\n\nfunction useTextareaAutosize(options) {\n var _a;\n const textarea = ref(options == null ? void 0 : options.element);\n const input = ref(options == null ? void 0 : options.input);\n const styleProp = (_a = options == null ? void 0 : options.styleProp) != null ? _a : \"height\";\n const textareaScrollHeight = ref(1);\n const textareaOldWidth = ref(0);\n function triggerResize() {\n var _a2;\n if (!textarea.value)\n return;\n let height = \"\";\n textarea.value.style[styleProp] = \"1px\";\n textareaScrollHeight.value = (_a2 = textarea.value) == null ? void 0 : _a2.scrollHeight;\n const _styleTarget = toValue(options == null ? void 0 : options.styleTarget);\n if (_styleTarget)\n _styleTarget.style[styleProp] = `${textareaScrollHeight.value}px`;\n else\n height = `${textareaScrollHeight.value}px`;\n textarea.value.style[styleProp] = height;\n }\n watch([input, textarea], () => nextTick(triggerResize), { immediate: true });\n watch(textareaScrollHeight, () => {\n var _a2;\n return (_a2 = options == null ? void 0 : options.onResize) == null ? void 0 : _a2.call(options);\n });\n useResizeObserver(textarea, ([{ contentRect }]) => {\n if (textareaOldWidth.value === contentRect.width)\n return;\n textareaOldWidth.value = contentRect.width;\n triggerResize();\n });\n if (options == null ? void 0 : options.watch)\n watch(options.watch, triggerResize, { immediate: true, deep: true });\n return {\n textarea,\n input,\n triggerResize\n };\n}\n\nfunction useThrottledRefHistory(source, options = {}) {\n const { throttle = 200, trailing = true } = options;\n const filter = throttleFilter(throttle, trailing);\n const history = useRefHistory(source, { ...options, eventFilter: filter });\n return {\n ...history\n };\n}\n\nconst DEFAULT_UNITS = [\n { max: 6e4, value: 1e3, name: \"second\" },\n { max: 276e4, value: 6e4, name: \"minute\" },\n { max: 72e6, value: 36e5, name: \"hour\" },\n { max: 5184e5, value: 864e5, name: \"day\" },\n { max: 24192e5, value: 6048e5, name: \"week\" },\n { max: 28512e6, value: 2592e6, name: \"month\" },\n { max: Number.POSITIVE_INFINITY, value: 31536e6, name: \"year\" }\n];\nconst DEFAULT_MESSAGES = {\n justNow: \"just now\",\n past: (n) => n.match(/\\d/) ? `${n} ago` : n,\n future: (n) => n.match(/\\d/) ? `in ${n}` : n,\n month: (n, past) => n === 1 ? past ? \"last month\" : \"next month\" : `${n} month${n > 1 ? \"s\" : \"\"}`,\n year: (n, past) => n === 1 ? past ? \"last year\" : \"next year\" : `${n} year${n > 1 ? \"s\" : \"\"}`,\n day: (n, past) => n === 1 ? past ? \"yesterday\" : \"tomorrow\" : `${n} day${n > 1 ? \"s\" : \"\"}`,\n week: (n, past) => n === 1 ? past ? \"last week\" : \"next week\" : `${n} week${n > 1 ? \"s\" : \"\"}`,\n hour: (n) => `${n} hour${n > 1 ? \"s\" : \"\"}`,\n minute: (n) => `${n} minute${n > 1 ? \"s\" : \"\"}`,\n second: (n) => `${n} second${n > 1 ? \"s\" : \"\"}`,\n invalid: \"\"\n};\nfunction DEFAULT_FORMATTER(date) {\n return date.toISOString().slice(0, 10);\n}\nfunction useTimeAgo(time, options = {}) {\n const {\n controls: exposeControls = false,\n updateInterval = 3e4\n } = options;\n const { now, ...controls } = useNow({ interval: updateInterval, controls: true });\n const timeAgo = computed(() => formatTimeAgo(new Date(toValue(time)), options, toValue(now)));\n if (exposeControls) {\n return {\n timeAgo,\n ...controls\n };\n } else {\n return timeAgo;\n }\n}\nfunction formatTimeAgo(from, options = {}, now = Date.now()) {\n var _a;\n const {\n max,\n messages = DEFAULT_MESSAGES,\n fullDateFormatter = DEFAULT_FORMATTER,\n units = DEFAULT_UNITS,\n showSecond = false,\n rounding = \"round\"\n } = options;\n const roundFn = typeof rounding === \"number\" ? (n) => +n.toFixed(rounding) : Math[rounding];\n const diff = +now - +from;\n const absDiff = Math.abs(diff);\n function getValue(diff2, unit) {\n return roundFn(Math.abs(diff2) / unit.value);\n }\n function format(diff2, unit) {\n const val = getValue(diff2, unit);\n const past = diff2 > 0;\n const str = applyFormat(unit.name, val, past);\n return applyFormat(past ? \"past\" : \"future\", str, past);\n }\n function applyFormat(name, val, isPast) {\n const formatter = messages[name];\n if (typeof formatter === \"function\")\n return formatter(val, isPast);\n return formatter.replace(\"{0}\", val.toString());\n }\n if (absDiff < 6e4 && !showSecond)\n return messages.justNow;\n if (typeof max === \"number\" && absDiff > max)\n return fullDateFormatter(new Date(from));\n if (typeof max === \"string\") {\n const unitMax = (_a = units.find((i) => i.name === max)) == null ? void 0 : _a.max;\n if (unitMax && absDiff > unitMax)\n return fullDateFormatter(new Date(from));\n }\n for (const [idx, unit] of units.entries()) {\n const val = getValue(diff, unit);\n if (val <= 0 && units[idx - 1])\n return format(diff, units[idx - 1]);\n if (absDiff < unit.max)\n return format(diff, unit);\n }\n return messages.invalid;\n}\n\nfunction useTimeoutPoll(fn, interval, timeoutPollOptions) {\n const { start } = useTimeoutFn(loop, interval, { immediate: false });\n const isActive = ref(false);\n async function loop() {\n if (!isActive.value)\n return;\n await fn();\n start();\n }\n function resume() {\n if (!isActive.value) {\n isActive.value = true;\n loop();\n }\n }\n function pause() {\n isActive.value = false;\n }\n if (timeoutPollOptions == null ? void 0 : timeoutPollOptions.immediate)\n resume();\n tryOnScopeDispose(pause);\n return {\n isActive,\n pause,\n resume\n };\n}\n\nfunction useTimestamp(options = {}) {\n const {\n controls: exposeControls = false,\n offset = 0,\n immediate = true,\n interval = \"requestAnimationFrame\",\n callback\n } = options;\n const ts = ref(timestamp() + offset);\n const update = () => ts.value = timestamp() + offset;\n const cb = callback ? () => {\n update();\n callback(ts.value);\n } : update;\n const controls = interval === \"requestAnimationFrame\" ? useRafFn(cb, { immediate }) : useIntervalFn(cb, interval, { immediate });\n if (exposeControls) {\n return {\n timestamp: ts,\n ...controls\n };\n } else {\n return ts;\n }\n}\n\nfunction useTitle(newTitle = null, options = {}) {\n var _a, _b, _c;\n const {\n document = defaultDocument,\n restoreOnUnmount = (t) => t\n } = options;\n const originalTitle = (_a = document == null ? void 0 : document.title) != null ? _a : \"\";\n const title = toRef((_b = newTitle != null ? newTitle : document == null ? void 0 : document.title) != null ? _b : null);\n const isReadonly = newTitle && typeof newTitle === \"function\";\n function format(t) {\n if (!(\"titleTemplate\" in options))\n return t;\n const template = options.titleTemplate || \"%s\";\n return typeof template === \"function\" ? template(t) : toValue(template).replace(/%s/g, t);\n }\n watch(\n title,\n (t, o) => {\n if (t !== o && document)\n document.title = format(typeof t === \"string\" ? t : \"\");\n },\n { immediate: true }\n );\n if (options.observe && !options.titleTemplate && document && !isReadonly) {\n useMutationObserver(\n (_c = document.head) == null ? void 0 : _c.querySelector(\"title\"),\n () => {\n if (document && document.title !== title.value)\n title.value = format(document.title);\n },\n { childList: true }\n );\n }\n tryOnBeforeUnmount(() => {\n if (restoreOnUnmount) {\n const restoredTitle = restoreOnUnmount(originalTitle, title.value || \"\");\n if (restoredTitle != null && document)\n document.title = restoredTitle;\n }\n });\n return title;\n}\n\nconst _TransitionPresets = {\n easeInSine: [0.12, 0, 0.39, 0],\n easeOutSine: [0.61, 1, 0.88, 1],\n easeInOutSine: [0.37, 0, 0.63, 1],\n easeInQuad: [0.11, 0, 0.5, 0],\n easeOutQuad: [0.5, 1, 0.89, 1],\n easeInOutQuad: [0.45, 0, 0.55, 1],\n easeInCubic: [0.32, 0, 0.67, 0],\n easeOutCubic: [0.33, 1, 0.68, 1],\n easeInOutCubic: [0.65, 0, 0.35, 1],\n easeInQuart: [0.5, 0, 0.75, 0],\n easeOutQuart: [0.25, 1, 0.5, 1],\n easeInOutQuart: [0.76, 0, 0.24, 1],\n easeInQuint: [0.64, 0, 0.78, 0],\n easeOutQuint: [0.22, 1, 0.36, 1],\n easeInOutQuint: [0.83, 0, 0.17, 1],\n easeInExpo: [0.7, 0, 0.84, 0],\n easeOutExpo: [0.16, 1, 0.3, 1],\n easeInOutExpo: [0.87, 0, 0.13, 1],\n easeInCirc: [0.55, 0, 1, 0.45],\n easeOutCirc: [0, 0.55, 0.45, 1],\n easeInOutCirc: [0.85, 0, 0.15, 1],\n easeInBack: [0.36, 0, 0.66, -0.56],\n easeOutBack: [0.34, 1.56, 0.64, 1],\n easeInOutBack: [0.68, -0.6, 0.32, 1.6]\n};\nconst TransitionPresets = /* @__PURE__ */ Object.assign({}, { linear: identity }, _TransitionPresets);\nfunction createEasingFunction([p0, p1, p2, p3]) {\n const a = (a1, a2) => 1 - 3 * a2 + 3 * a1;\n const b = (a1, a2) => 3 * a2 - 6 * a1;\n const c = (a1) => 3 * a1;\n const calcBezier = (t, a1, a2) => ((a(a1, a2) * t + b(a1, a2)) * t + c(a1)) * t;\n const getSlope = (t, a1, a2) => 3 * a(a1, a2) * t * t + 2 * b(a1, a2) * t + c(a1);\n const getTforX = (x) => {\n let aGuessT = x;\n for (let i = 0; i < 4; ++i) {\n const currentSlope = getSlope(aGuessT, p0, p2);\n if (currentSlope === 0)\n return aGuessT;\n const currentX = calcBezier(aGuessT, p0, p2) - x;\n aGuessT -= currentX / currentSlope;\n }\n return aGuessT;\n };\n return (x) => p0 === p1 && p2 === p3 ? x : calcBezier(getTforX(x), p1, p3);\n}\nfunction lerp(a, b, alpha) {\n return a + alpha * (b - a);\n}\nfunction toVec(t) {\n return (typeof t === \"number\" ? [t] : t) || [];\n}\nfunction executeTransition(source, from, to, options = {}) {\n var _a, _b;\n const fromVal = toValue(from);\n const toVal = toValue(to);\n const v1 = toVec(fromVal);\n const v2 = toVec(toVal);\n const duration = (_a = toValue(options.duration)) != null ? _a : 1e3;\n const startedAt = Date.now();\n const endAt = Date.now() + duration;\n const trans = typeof options.transition === \"function\" ? options.transition : (_b = toValue(options.transition)) != null ? _b : identity;\n const ease = typeof trans === \"function\" ? trans : createEasingFunction(trans);\n return new Promise((resolve) => {\n source.value = fromVal;\n const tick = () => {\n var _a2;\n if ((_a2 = options.abort) == null ? void 0 : _a2.call(options)) {\n resolve();\n return;\n }\n const now = Date.now();\n const alpha = ease((now - startedAt) / duration);\n const arr = toVec(source.value).map((n, i) => lerp(v1[i], v2[i], alpha));\n if (Array.isArray(source.value))\n source.value = arr.map((n, i) => {\n var _a3, _b2;\n return lerp((_a3 = v1[i]) != null ? _a3 : 0, (_b2 = v2[i]) != null ? _b2 : 0, alpha);\n });\n else if (typeof source.value === \"number\")\n source.value = arr[0];\n if (now < endAt) {\n requestAnimationFrame(tick);\n } else {\n source.value = toVal;\n resolve();\n }\n };\n tick();\n });\n}\nfunction useTransition(source, options = {}) {\n let currentId = 0;\n const sourceVal = () => {\n const v = toValue(source);\n return typeof v === \"number\" ? v : v.map(toValue);\n };\n const outputRef = ref(sourceVal());\n watch(sourceVal, async (to) => {\n var _a, _b;\n if (toValue(options.disabled))\n return;\n const id = ++currentId;\n if (options.delay)\n await promiseTimeout(toValue(options.delay));\n if (id !== currentId)\n return;\n const toVal = Array.isArray(to) ? to.map(toValue) : toValue(to);\n (_a = options.onStarted) == null ? void 0 : _a.call(options);\n await executeTransition(outputRef, outputRef.value, toVal, {\n ...options,\n abort: () => {\n var _a2;\n return id !== currentId || ((_a2 = options.abort) == null ? void 0 : _a2.call(options));\n }\n });\n (_b = options.onFinished) == null ? void 0 : _b.call(options);\n }, { deep: true });\n watch(() => toValue(options.disabled), (disabled) => {\n if (disabled) {\n currentId++;\n outputRef.value = sourceVal();\n }\n });\n tryOnScopeDispose(() => {\n currentId++;\n });\n return computed(() => toValue(options.disabled) ? sourceVal() : outputRef.value);\n}\n\nfunction useUrlSearchParams(mode = \"history\", options = {}) {\n const {\n initialValue = {},\n removeNullishValues = true,\n removeFalsyValues = false,\n write: enableWrite = true,\n window = defaultWindow\n } = options;\n if (!window)\n return reactive(initialValue);\n const state = reactive({});\n function getRawParams() {\n if (mode === \"history\") {\n return window.location.search || \"\";\n } else if (mode === \"hash\") {\n const hash = window.location.hash || \"\";\n const index = hash.indexOf(\"?\");\n return index > 0 ? hash.slice(index) : \"\";\n } else {\n return (window.location.hash || \"\").replace(/^#/, \"\");\n }\n }\n function constructQuery(params) {\n const stringified = params.toString();\n if (mode === \"history\")\n return `${stringified ? `?${stringified}` : \"\"}${window.location.hash || \"\"}`;\n if (mode === \"hash-params\")\n return `${window.location.search || \"\"}${stringified ? `#${stringified}` : \"\"}`;\n const hash = window.location.hash || \"#\";\n const index = hash.indexOf(\"?\");\n if (index > 0)\n return `${hash.slice(0, index)}${stringified ? `?${stringified}` : \"\"}`;\n return `${hash}${stringified ? `?${stringified}` : \"\"}`;\n }\n function read() {\n return new URLSearchParams(getRawParams());\n }\n function updateState(params) {\n const unusedKeys = new Set(Object.keys(state));\n for (const key of params.keys()) {\n const paramsForKey = params.getAll(key);\n state[key] = paramsForKey.length > 1 ? paramsForKey : params.get(key) || \"\";\n unusedKeys.delete(key);\n }\n Array.from(unusedKeys).forEach((key) => delete state[key]);\n }\n const { pause, resume } = pausableWatch(\n state,\n () => {\n const params = new URLSearchParams(\"\");\n Object.keys(state).forEach((key) => {\n const mapEntry = state[key];\n if (Array.isArray(mapEntry))\n mapEntry.forEach((value) => params.append(key, value));\n else if (removeNullishValues && mapEntry == null)\n params.delete(key);\n else if (removeFalsyValues && !mapEntry)\n params.delete(key);\n else\n params.set(key, mapEntry);\n });\n write(params);\n },\n { deep: true }\n );\n function write(params, shouldUpdate) {\n pause();\n if (shouldUpdate)\n updateState(params);\n window.history.replaceState(\n window.history.state,\n window.document.title,\n window.location.pathname + constructQuery(params)\n );\n resume();\n }\n function onChanged() {\n if (!enableWrite)\n return;\n write(read(), true);\n }\n useEventListener(window, \"popstate\", onChanged, false);\n if (mode !== \"history\")\n useEventListener(window, \"hashchange\", onChanged, false);\n const initial = read();\n if (initial.keys().next().value)\n updateState(initial);\n else\n Object.assign(state, initialValue);\n return state;\n}\n\nfunction useUserMedia(options = {}) {\n var _a, _b;\n const enabled = ref((_a = options.enabled) != null ? _a : false);\n const autoSwitch = ref((_b = options.autoSwitch) != null ? _b : true);\n const constraints = ref(options.constraints);\n const { navigator = defaultNavigator } = options;\n const isSupported = useSupported(() => {\n var _a2;\n return (_a2 = navigator == null ? void 0 : navigator.mediaDevices) == null ? void 0 : _a2.getUserMedia;\n });\n const stream = shallowRef();\n function getDeviceOptions(type) {\n switch (type) {\n case \"video\": {\n if (constraints.value)\n return constraints.value.video || false;\n break;\n }\n case \"audio\": {\n if (constraints.value)\n return constraints.value.audio || false;\n break;\n }\n }\n }\n async function _start() {\n if (!isSupported.value || stream.value)\n return;\n stream.value = await navigator.mediaDevices.getUserMedia({\n video: getDeviceOptions(\"video\"),\n audio: getDeviceOptions(\"audio\")\n });\n return stream.value;\n }\n function _stop() {\n var _a2;\n (_a2 = stream.value) == null ? void 0 : _a2.getTracks().forEach((t) => t.stop());\n stream.value = void 0;\n }\n function stop() {\n _stop();\n enabled.value = false;\n }\n async function start() {\n await _start();\n if (stream.value)\n enabled.value = true;\n return stream.value;\n }\n async function restart() {\n _stop();\n return await start();\n }\n watch(\n enabled,\n (v) => {\n if (v)\n _start();\n else _stop();\n },\n { immediate: true }\n );\n watch(\n constraints,\n () => {\n if (autoSwitch.value && stream.value)\n restart();\n },\n { immediate: true }\n );\n tryOnScopeDispose(() => {\n stop();\n });\n return {\n isSupported,\n stream,\n start,\n stop,\n restart,\n constraints,\n enabled,\n autoSwitch\n };\n}\n\nfunction useVModel(props, key, emit, options = {}) {\n var _a, _b, _c, _d, _e;\n const {\n clone = false,\n passive = false,\n eventName,\n deep = false,\n defaultValue,\n shouldEmit\n } = options;\n const vm = getCurrentInstance();\n const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a.bind(vm)) || ((_c = (_b = vm == null ? void 0 : vm.proxy) == null ? void 0 : _b.$emit) == null ? void 0 : _c.bind(vm == null ? void 0 : vm.proxy));\n let event = eventName;\n if (!key) {\n if (isVue2) {\n const modelOptions = (_e = (_d = vm == null ? void 0 : vm.proxy) == null ? void 0 : _d.$options) == null ? void 0 : _e.model;\n key = (modelOptions == null ? void 0 : modelOptions.value) || \"value\";\n if (!eventName)\n event = (modelOptions == null ? void 0 : modelOptions.event) || \"input\";\n } else {\n key = \"modelValue\";\n }\n }\n event = event || `update:${key.toString()}`;\n const cloneFn = (val) => !clone ? val : typeof clone === \"function\" ? clone(val) : cloneFnJSON(val);\n const getValue = () => isDef(props[key]) ? cloneFn(props[key]) : defaultValue;\n const triggerEmit = (value) => {\n if (shouldEmit) {\n if (shouldEmit(value))\n _emit(event, value);\n } else {\n _emit(event, value);\n }\n };\n if (passive) {\n const initialValue = getValue();\n const proxy = ref(initialValue);\n let isUpdating = false;\n watch(\n () => props[key],\n (v) => {\n if (!isUpdating) {\n isUpdating = true;\n proxy.value = cloneFn(v);\n nextTick(() => isUpdating = false);\n }\n }\n );\n watch(\n proxy,\n (v) => {\n if (!isUpdating && (v !== props[key] || deep))\n triggerEmit(v);\n },\n { deep }\n );\n return proxy;\n } else {\n return computed({\n get() {\n return getValue();\n },\n set(value) {\n triggerEmit(value);\n }\n });\n }\n}\n\nfunction useVModels(props, emit, options = {}) {\n const ret = {};\n for (const key in props) {\n ret[key] = useVModel(\n props,\n key,\n emit,\n options\n );\n }\n return ret;\n}\n\nfunction useVibrate(options) {\n const {\n pattern = [],\n interval = 0,\n navigator = defaultNavigator\n } = options || {};\n const isSupported = useSupported(() => typeof navigator !== \"undefined\" && \"vibrate\" in navigator);\n const patternRef = toRef(pattern);\n let intervalControls;\n const vibrate = (pattern2 = patternRef.value) => {\n if (isSupported.value)\n navigator.vibrate(pattern2);\n };\n const stop = () => {\n if (isSupported.value)\n navigator.vibrate(0);\n intervalControls == null ? void 0 : intervalControls.pause();\n };\n if (interval > 0) {\n intervalControls = useIntervalFn(\n vibrate,\n interval,\n {\n immediate: false,\n immediateCallback: false\n }\n );\n }\n return {\n isSupported,\n pattern,\n intervalControls,\n vibrate,\n stop\n };\n}\n\nfunction useVirtualList(list, options) {\n const { containerStyle, wrapperProps, scrollTo, calculateRange, currentList, containerRef } = \"itemHeight\" in options ? useVerticalVirtualList(options, list) : useHorizontalVirtualList(options, list);\n return {\n list: currentList,\n scrollTo,\n containerProps: {\n ref: containerRef,\n onScroll: () => {\n calculateRange();\n },\n style: containerStyle\n },\n wrapperProps\n };\n}\nfunction useVirtualListResources(list) {\n const containerRef = ref(null);\n const size = useElementSize(containerRef);\n const currentList = ref([]);\n const source = shallowRef(list);\n const state = ref({ start: 0, end: 10 });\n return { state, source, currentList, size, containerRef };\n}\nfunction createGetViewCapacity(state, source, itemSize) {\n return (containerSize) => {\n if (typeof itemSize === \"number\")\n return Math.ceil(containerSize / itemSize);\n const { start = 0 } = state.value;\n let sum = 0;\n let capacity = 0;\n for (let i = start; i < source.value.length; i++) {\n const size = itemSize(i);\n sum += size;\n capacity = i;\n if (sum > containerSize)\n break;\n }\n return capacity - start;\n };\n}\nfunction createGetOffset(source, itemSize) {\n return (scrollDirection) => {\n if (typeof itemSize === \"number\")\n return Math.floor(scrollDirection / itemSize) + 1;\n let sum = 0;\n let offset = 0;\n for (let i = 0; i < source.value.length; i++) {\n const size = itemSize(i);\n sum += size;\n if (sum >= scrollDirection) {\n offset = i;\n break;\n }\n }\n return offset + 1;\n };\n}\nfunction createCalculateRange(type, overscan, getOffset, getViewCapacity, { containerRef, state, currentList, source }) {\n return () => {\n const element = containerRef.value;\n if (element) {\n const offset = getOffset(type === \"vertical\" ? element.scrollTop : element.scrollLeft);\n const viewCapacity = getViewCapacity(type === \"vertical\" ? element.clientHeight : element.clientWidth);\n const from = offset - overscan;\n const to = offset + viewCapacity + overscan;\n state.value = {\n start: from < 0 ? 0 : from,\n end: to > source.value.length ? source.value.length : to\n };\n currentList.value = source.value.slice(state.value.start, state.value.end).map((ele, index) => ({\n data: ele,\n index: index + state.value.start\n }));\n }\n };\n}\nfunction createGetDistance(itemSize, source) {\n return (index) => {\n if (typeof itemSize === \"number\") {\n const size2 = index * itemSize;\n return size2;\n }\n const size = source.value.slice(0, index).reduce((sum, _, i) => sum + itemSize(i), 0);\n return size;\n };\n}\nfunction useWatchForSizes(size, list, containerRef, calculateRange) {\n watch([size.width, size.height, list, containerRef], () => {\n calculateRange();\n });\n}\nfunction createComputedTotalSize(itemSize, source) {\n return computed(() => {\n if (typeof itemSize === \"number\")\n return source.value.length * itemSize;\n return source.value.reduce((sum, _, index) => sum + itemSize(index), 0);\n });\n}\nconst scrollToDictionaryForElementScrollKey = {\n horizontal: \"scrollLeft\",\n vertical: \"scrollTop\"\n};\nfunction createScrollTo(type, calculateRange, getDistance, containerRef) {\n return (index) => {\n if (containerRef.value) {\n containerRef.value[scrollToDictionaryForElementScrollKey[type]] = getDistance(index);\n calculateRange();\n }\n };\n}\nfunction useHorizontalVirtualList(options, list) {\n const resources = useVirtualListResources(list);\n const { state, source, currentList, size, containerRef } = resources;\n const containerStyle = { overflowX: \"auto\" };\n const { itemWidth, overscan = 5 } = options;\n const getViewCapacity = createGetViewCapacity(state, source, itemWidth);\n const getOffset = createGetOffset(source, itemWidth);\n const calculateRange = createCalculateRange(\"horizontal\", overscan, getOffset, getViewCapacity, resources);\n const getDistanceLeft = createGetDistance(itemWidth, source);\n const offsetLeft = computed(() => getDistanceLeft(state.value.start));\n const totalWidth = createComputedTotalSize(itemWidth, source);\n useWatchForSizes(size, list, containerRef, calculateRange);\n const scrollTo = createScrollTo(\"horizontal\", calculateRange, getDistanceLeft, containerRef);\n const wrapperProps = computed(() => {\n return {\n style: {\n height: \"100%\",\n width: `${totalWidth.value - offsetLeft.value}px`,\n marginLeft: `${offsetLeft.value}px`,\n display: \"flex\"\n }\n };\n });\n return {\n scrollTo,\n calculateRange,\n wrapperProps,\n containerStyle,\n currentList,\n containerRef\n };\n}\nfunction useVerticalVirtualList(options, list) {\n const resources = useVirtualListResources(list);\n const { state, source, currentList, size, containerRef } = resources;\n const containerStyle = { overflowY: \"auto\" };\n const { itemHeight, overscan = 5 } = options;\n const getViewCapacity = createGetViewCapacity(state, source, itemHeight);\n const getOffset = createGetOffset(source, itemHeight);\n const calculateRange = createCalculateRange(\"vertical\", overscan, getOffset, getViewCapacity, resources);\n const getDistanceTop = createGetDistance(itemHeight, source);\n const offsetTop = computed(() => getDistanceTop(state.value.start));\n const totalHeight = createComputedTotalSize(itemHeight, source);\n useWatchForSizes(size, list, containerRef, calculateRange);\n const scrollTo = createScrollTo(\"vertical\", calculateRange, getDistanceTop, containerRef);\n const wrapperProps = computed(() => {\n return {\n style: {\n width: \"100%\",\n height: `${totalHeight.value - offsetTop.value}px`,\n marginTop: `${offsetTop.value}px`\n }\n };\n });\n return {\n calculateRange,\n scrollTo,\n containerStyle,\n wrapperProps,\n currentList,\n containerRef\n };\n}\n\nfunction useWakeLock(options = {}) {\n const {\n navigator = defaultNavigator,\n document = defaultDocument\n } = options;\n const requestedType = ref(false);\n const sentinel = shallowRef(null);\n const documentVisibility = useDocumentVisibility({ document });\n const isSupported = useSupported(() => navigator && \"wakeLock\" in navigator);\n const isActive = computed(() => !!sentinel.value && documentVisibility.value === \"visible\");\n if (isSupported.value) {\n useEventListener(sentinel, \"release\", () => {\n var _a, _b;\n requestedType.value = (_b = (_a = sentinel.value) == null ? void 0 : _a.type) != null ? _b : false;\n });\n whenever(\n () => documentVisibility.value === \"visible\" && (document == null ? void 0 : document.visibilityState) === \"visible\" && requestedType.value,\n (type) => {\n requestedType.value = false;\n forceRequest(type);\n }\n );\n }\n async function forceRequest(type) {\n var _a;\n await ((_a = sentinel.value) == null ? void 0 : _a.release());\n sentinel.value = isSupported.value ? await navigator.wakeLock.request(type) : null;\n }\n async function request(type) {\n if (documentVisibility.value === \"visible\")\n await forceRequest(type);\n else\n requestedType.value = type;\n }\n async function release() {\n requestedType.value = false;\n const s = sentinel.value;\n sentinel.value = null;\n await (s == null ? void 0 : s.release());\n }\n return {\n sentinel,\n isSupported,\n isActive,\n request,\n forceRequest,\n release\n };\n}\n\nfunction useWebNotification(options = {}) {\n const {\n window = defaultWindow,\n requestPermissions: _requestForPermissions = true\n } = options;\n const defaultWebNotificationOptions = options;\n const isSupported = useSupported(() => {\n if (!window || !(\"Notification\" in window))\n return false;\n try {\n new Notification(\"\");\n } catch (e) {\n return false;\n }\n return true;\n });\n const permissionGranted = ref(isSupported.value && \"permission\" in Notification && Notification.permission === \"granted\");\n const notification = ref(null);\n const ensurePermissions = async () => {\n if (!isSupported.value)\n return;\n if (!permissionGranted.value && Notification.permission !== \"denied\") {\n const result = await Notification.requestPermission();\n if (result === \"granted\")\n permissionGranted.value = true;\n }\n return permissionGranted.value;\n };\n const { on: onClick, trigger: clickTrigger } = createEventHook();\n const { on: onShow, trigger: showTrigger } = createEventHook();\n const { on: onError, trigger: errorTrigger } = createEventHook();\n const { on: onClose, trigger: closeTrigger } = createEventHook();\n const show = async (overrides) => {\n if (!isSupported.value || !permissionGranted.value)\n return;\n const options2 = Object.assign({}, defaultWebNotificationOptions, overrides);\n notification.value = new Notification(options2.title || \"\", options2);\n notification.value.onclick = clickTrigger;\n notification.value.onshow = showTrigger;\n notification.value.onerror = errorTrigger;\n notification.value.onclose = closeTrigger;\n return notification.value;\n };\n const close = () => {\n if (notification.value)\n notification.value.close();\n notification.value = null;\n };\n if (_requestForPermissions)\n tryOnMounted(ensurePermissions);\n tryOnScopeDispose(close);\n if (isSupported.value && window) {\n const document = window.document;\n useEventListener(document, \"visibilitychange\", (e) => {\n e.preventDefault();\n if (document.visibilityState === \"visible\") {\n close();\n }\n });\n }\n return {\n isSupported,\n notification,\n ensurePermissions,\n permissionGranted,\n show,\n close,\n onClick,\n onShow,\n onError,\n onClose\n };\n}\n\nconst DEFAULT_PING_MESSAGE = \"ping\";\nfunction resolveNestedOptions(options) {\n if (options === true)\n return {};\n return options;\n}\nfunction useWebSocket(url, options = {}) {\n const {\n onConnected,\n onDisconnected,\n onError,\n onMessage,\n immediate = true,\n autoClose = true,\n protocols = []\n } = options;\n const data = ref(null);\n const status = ref(\"CLOSED\");\n const wsRef = ref();\n const urlRef = toRef(url);\n let heartbeatPause;\n let heartbeatResume;\n let explicitlyClosed = false;\n let retried = 0;\n let bufferedData = [];\n let pongTimeoutWait;\n const _sendBuffer = () => {\n if (bufferedData.length && wsRef.value && status.value === \"OPEN\") {\n for (const buffer of bufferedData)\n wsRef.value.send(buffer);\n bufferedData = [];\n }\n };\n const resetHeartbeat = () => {\n clearTimeout(pongTimeoutWait);\n pongTimeoutWait = void 0;\n };\n const close = (code = 1e3, reason) => {\n if (!isClient || !wsRef.value)\n return;\n explicitlyClosed = true;\n resetHeartbeat();\n heartbeatPause == null ? void 0 : heartbeatPause();\n wsRef.value.close(code, reason);\n wsRef.value = void 0;\n };\n const send = (data2, useBuffer = true) => {\n if (!wsRef.value || status.value !== \"OPEN\") {\n if (useBuffer)\n bufferedData.push(data2);\n return false;\n }\n _sendBuffer();\n wsRef.value.send(data2);\n return true;\n };\n const _init = () => {\n if (explicitlyClosed || typeof urlRef.value === \"undefined\")\n return;\n const ws = new WebSocket(urlRef.value, protocols);\n wsRef.value = ws;\n status.value = \"CONNECTING\";\n ws.onopen = () => {\n status.value = \"OPEN\";\n onConnected == null ? void 0 : onConnected(ws);\n heartbeatResume == null ? void 0 : heartbeatResume();\n _sendBuffer();\n };\n ws.onclose = (ev) => {\n status.value = \"CLOSED\";\n onDisconnected == null ? void 0 : onDisconnected(ws, ev);\n if (!explicitlyClosed && options.autoReconnect) {\n const {\n retries = -1,\n delay = 1e3,\n onFailed\n } = resolveNestedOptions(options.autoReconnect);\n retried += 1;\n if (typeof retries === \"number\" && (retries < 0 || retried < retries))\n setTimeout(_init, delay);\n else if (typeof retries === \"function\" && retries())\n setTimeout(_init, delay);\n else\n onFailed == null ? void 0 : onFailed();\n }\n };\n ws.onerror = (e) => {\n onError == null ? void 0 : onError(ws, e);\n };\n ws.onmessage = (e) => {\n if (options.heartbeat) {\n resetHeartbeat();\n const {\n message = DEFAULT_PING_MESSAGE,\n responseMessage = message\n } = resolveNestedOptions(options.heartbeat);\n if (e.data === responseMessage)\n return;\n }\n data.value = e.data;\n onMessage == null ? void 0 : onMessage(ws, e);\n };\n };\n if (options.heartbeat) {\n const {\n message = DEFAULT_PING_MESSAGE,\n interval = 1e3,\n pongTimeout = 1e3\n } = resolveNestedOptions(options.heartbeat);\n const { pause, resume } = useIntervalFn(\n () => {\n send(message, false);\n if (pongTimeoutWait != null)\n return;\n pongTimeoutWait = setTimeout(() => {\n close();\n explicitlyClosed = false;\n }, pongTimeout);\n },\n interval,\n { immediate: false }\n );\n heartbeatPause = pause;\n heartbeatResume = resume;\n }\n if (autoClose) {\n if (isClient)\n useEventListener(\"beforeunload\", () => close());\n tryOnScopeDispose(close);\n }\n const open = () => {\n if (!isClient && !isWorker)\n return;\n close();\n explicitlyClosed = false;\n retried = 0;\n _init();\n };\n if (immediate)\n open();\n watch(urlRef, open);\n return {\n data,\n status,\n close,\n send,\n open,\n ws: wsRef\n };\n}\n\nfunction useWebWorker(arg0, workerOptions, options) {\n const {\n window = defaultWindow\n } = options != null ? options : {};\n const data = ref(null);\n const worker = shallowRef();\n const post = (...args) => {\n if (!worker.value)\n return;\n worker.value.postMessage(...args);\n };\n const terminate = function terminate2() {\n if (!worker.value)\n return;\n worker.value.terminate();\n };\n if (window) {\n if (typeof arg0 === \"string\")\n worker.value = new Worker(arg0, workerOptions);\n else if (typeof arg0 === \"function\")\n worker.value = arg0();\n else\n worker.value = arg0;\n worker.value.onmessage = (e) => {\n data.value = e.data;\n };\n tryOnScopeDispose(() => {\n if (worker.value)\n worker.value.terminate();\n });\n }\n return {\n data,\n post,\n terminate,\n worker\n };\n}\n\nfunction jobRunner(userFunc) {\n return (e) => {\n const userFuncArgs = e.data[0];\n return Promise.resolve(userFunc.apply(void 0, userFuncArgs)).then((result) => {\n postMessage([\"SUCCESS\", result]);\n }).catch((error) => {\n postMessage([\"ERROR\", error]);\n });\n };\n}\n\nfunction depsParser(deps, localDeps) {\n if (deps.length === 0 && localDeps.length === 0)\n return \"\";\n const depsString = deps.map((dep) => `'${dep}'`).toString();\n const depsFunctionString = localDeps.filter((dep) => typeof dep === \"function\").map((fn) => {\n const str = fn.toString();\n if (str.trim().startsWith(\"function\")) {\n return str;\n } else {\n const name = fn.name;\n return `const ${name} = ${str}`;\n }\n }).join(\";\");\n const importString = `importScripts(${depsString});`;\n return `${depsString.trim() === \"\" ? \"\" : importString} ${depsFunctionString}`;\n}\n\nfunction createWorkerBlobUrl(fn, deps, localDeps) {\n const blobCode = `${depsParser(deps, localDeps)}; onmessage=(${jobRunner})(${fn})`;\n const blob = new Blob([blobCode], { type: \"text/javascript\" });\n const url = URL.createObjectURL(blob);\n return url;\n}\n\nfunction useWebWorkerFn(fn, options = {}) {\n const {\n dependencies = [],\n localDependencies = [],\n timeout,\n window = defaultWindow\n } = options;\n const worker = ref();\n const workerStatus = ref(\"PENDING\");\n const promise = ref({});\n const timeoutId = ref();\n const workerTerminate = (status = \"PENDING\") => {\n if (worker.value && worker.value._url && window) {\n worker.value.terminate();\n URL.revokeObjectURL(worker.value._url);\n promise.value = {};\n worker.value = void 0;\n window.clearTimeout(timeoutId.value);\n workerStatus.value = status;\n }\n };\n workerTerminate();\n tryOnScopeDispose(workerTerminate);\n const generateWorker = () => {\n const blobUrl = createWorkerBlobUrl(fn, dependencies, localDependencies);\n const newWorker = new Worker(blobUrl);\n newWorker._url = blobUrl;\n newWorker.onmessage = (e) => {\n const { resolve = () => {\n }, reject = () => {\n } } = promise.value;\n const [status, result] = e.data;\n switch (status) {\n case \"SUCCESS\":\n resolve(result);\n workerTerminate(status);\n break;\n default:\n reject(result);\n workerTerminate(\"ERROR\");\n break;\n }\n };\n newWorker.onerror = (e) => {\n const { reject = () => {\n } } = promise.value;\n e.preventDefault();\n reject(e);\n workerTerminate(\"ERROR\");\n };\n if (timeout) {\n timeoutId.value = setTimeout(\n () => workerTerminate(\"TIMEOUT_EXPIRED\"),\n timeout\n );\n }\n return newWorker;\n };\n const callWorker = (...fnArgs) => new Promise((resolve, reject) => {\n var _a;\n promise.value = {\n resolve,\n reject\n };\n (_a = worker.value) == null ? void 0 : _a.postMessage([[...fnArgs]]);\n workerStatus.value = \"RUNNING\";\n });\n const workerFn = (...fnArgs) => {\n if (workerStatus.value === \"RUNNING\") {\n console.error(\n \"[useWebWorkerFn] You can only run one instance of the worker at a time.\"\n );\n return Promise.reject();\n }\n worker.value = generateWorker();\n return callWorker(...fnArgs);\n };\n return {\n workerFn,\n workerStatus,\n workerTerminate\n };\n}\n\nfunction useWindowFocus(options = {}) {\n const { window = defaultWindow } = options;\n if (!window)\n return ref(false);\n const focused = ref(window.document.hasFocus());\n useEventListener(window, \"blur\", () => {\n focused.value = false;\n });\n useEventListener(window, \"focus\", () => {\n focused.value = true;\n });\n return focused;\n}\n\nfunction useWindowScroll(options = {}) {\n const { window = defaultWindow, behavior = \"auto\" } = options;\n if (!window) {\n return {\n x: ref(0),\n y: ref(0)\n };\n }\n const internalX = ref(window.scrollX);\n const internalY = ref(window.scrollY);\n const x = computed({\n get() {\n return internalX.value;\n },\n set(x2) {\n scrollTo({ left: x2, behavior });\n }\n });\n const y = computed({\n get() {\n return internalY.value;\n },\n set(y2) {\n scrollTo({ top: y2, behavior });\n }\n });\n useEventListener(\n window,\n \"scroll\",\n () => {\n internalX.value = window.scrollX;\n internalY.value = window.scrollY;\n },\n {\n capture: false,\n passive: true\n }\n );\n return { x, y };\n}\n\nfunction useWindowSize(options = {}) {\n const {\n window = defaultWindow,\n initialWidth = Number.POSITIVE_INFINITY,\n initialHeight = Number.POSITIVE_INFINITY,\n listenOrientation = true,\n includeScrollbar = true,\n type = \"inner\"\n } = options;\n const width = ref(initialWidth);\n const height = ref(initialHeight);\n const update = () => {\n if (window) {\n if (type === \"outer\") {\n width.value = window.outerWidth;\n height.value = window.outerHeight;\n } else if (includeScrollbar) {\n width.value = window.innerWidth;\n height.value = window.innerHeight;\n } else {\n width.value = window.document.documentElement.clientWidth;\n height.value = window.document.documentElement.clientHeight;\n }\n }\n };\n update();\n tryOnMounted(update);\n useEventListener(\"resize\", update, { passive: true });\n if (listenOrientation) {\n const matches = useMediaQuery(\"(orientation: portrait)\");\n watch(matches, () => update());\n }\n return { width, height };\n}\n\nexport { DefaultMagicKeysAliasMap, StorageSerializers, TransitionPresets, computedAsync as asyncComputed, breakpointsAntDesign, breakpointsBootstrapV5, breakpointsMasterCss, breakpointsPrimeFlex, breakpointsQuasar, breakpointsSematic, breakpointsTailwind, breakpointsVuetify, breakpointsVuetifyV2, breakpointsVuetifyV3, cloneFnJSON, computedAsync, computedInject, createFetch, createReusableTemplate, createTemplatePromise, createUnrefFn, customStorageEventName, defaultDocument, defaultLocation, defaultNavigator, defaultWindow, executeTransition, formatTimeAgo, getSSRHandler, mapGamepadToXbox360Controller, onClickOutside, onKeyDown, onKeyPressed, onKeyStroke, onKeyUp, onLongPress, onStartTyping, setSSRHandler, templateRef, unrefElement, useActiveElement, useAnimate, useAsyncQueue, useAsyncState, useBase64, useBattery, useBluetooth, useBreakpoints, useBroadcastChannel, useBrowserLocation, useCached, useClipboard, useClipboardItems, useCloned, useColorMode, useConfirmDialog, useCssVar, useCurrentElement, useCycleList, useDark, useDebouncedRefHistory, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDisplayMedia, useDocumentVisibility, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementHover, useElementSize, useElementVisibility, useEventBus, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetch, useFileDialog, useFileSystemAccess, useFocus, useFocusWithin, useFps, useFullscreen, useGamepad, useGeolocation, useIdle, useImage, useInfiniteScroll, useIntersectionObserver, useKeyModifier, useLocalStorage, useMagicKeys, useManualRefHistory, useMediaControls, useMediaQuery, useMemoize, useMemory, useMounted, useMouse, useMouseInElement, useMousePressed, useMutationObserver, useNavigatorLanguage, useNetwork, useNow, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, useParallax, useParentElement, usePerformanceObserver, usePermission, usePointer, usePointerLock, usePointerSwipe, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePreferredReducedMotion, usePrevious, useRafFn, useRefHistory, useResizeObserver, useScreenOrientation, useScreenSafeArea, useScriptTag, useScroll, useScrollLock, useSessionStorage, useShare, useSorted, useSpeechRecognition, useSpeechSynthesis, useStepper, useStorage, useStorageAsync, useStyleTag, useSupported, useSwipe, useTemplateRefsList, useTextDirection, useTextSelection, useTextareaAutosize, useThrottledRefHistory, useTimeAgo, useTimeoutPoll, useTimestamp, useTitle, useTransition, useUrlSearchParams, useUserMedia, useVModel, useVModels, useVibrate, useVirtualList, useWakeLock, useWebNotification, useWebSocket, useWebWorker, useWebWorkerFn, useWindowFocus, useWindowScroll, useWindowSize };\n","!function(e,t){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define([],t):\"object\"==typeof exports?exports.FitAddon=t():e.FitAddon=t()}(self,(()=>(()=>{\"use strict\";var e={};return(()=>{var t=e;Object.defineProperty(t,\"__esModule\",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const r=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(i.getPropertyValue(\"height\")),s=Math.max(0,parseInt(i.getPropertyValue(\"width\"))),n=window.getComputedStyle(this._terminal.element),l=o-(parseInt(n.getPropertyValue(\"padding-top\"))+parseInt(n.getPropertyValue(\"padding-bottom\"))),a=s-(parseInt(n.getPropertyValue(\"padding-right\"))+parseInt(n.getPropertyValue(\"padding-left\")))-r;return{cols:Math.max(2,Math.floor(a/t.css.cell.width)),rows:Math.max(1,Math.floor(l/t.css.cell.height))}}}})(),e})()));\n//# sourceMappingURL=addon-fit.js.map","!function(e,t){if(\"object\"==typeof exports&&\"object\"==typeof module)module.exports=t();else if(\"function\"==typeof define&&define.amd)define([],t);else{var i=t();for(var s in i)(\"object\"==typeof exports?exports:e)[s]=i[s]}}(globalThis,(()=>(()=>{\"use strict\";var e={4567:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.AccessibilityManager=void 0;const n=i(9042),o=i(9924),a=i(844),h=i(4725),c=i(2585),l=i(3656);let d=t.AccessibilityManager=class extends a.Disposable{constructor(e,t,i,s){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=\"\",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(\"div\"),this._accessibilityContainer.classList.add(\"xterm-accessibility\"),this._rowContainer=this._coreBrowserService.mainDocument.createElement(\"div\"),this._rowContainer.setAttribute(\"role\",\"list\"),this._rowContainer.classList.add(\"xterm-accessibility-tree\"),this._rowElements=[];for(let e=0;ethis._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(\"focus\",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(\"focus\",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(\"div\"),this._liveRegion.classList.add(\"live-region\"),this._liveRegion.setAttribute(\"aria-live\",\"assertive\"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error(\"Cannot enable accessibility before Terminal.open\");this._terminal.element.insertAdjacentElement(\"afterbegin\",this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(\"\\n\")))),this.register(this._terminal.onA11yTab((e=>this._handleTab(e)))),this.register(this._terminal.onKey((e=>this._handleKey(e.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,l.addDisposableDomListener)(document,\"selectionchange\",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,a.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,\"\\n\"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent=\"\",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){const i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){const e=i.lines.get(i.ydisp+r),t=[],n=e?.translateToString(!0,void 0,void 0,t)||\"\",o=(i.ydisp+r+1).toString(),a=this._rowElements[r];a&&(0===n.length?(a.innerText=\" \",this._rowColumns.set(a,[0,1])):(a.textContent=n,this._rowColumns.set(a,t)),a.setAttribute(\"aria-posinset\",o),a.setAttribute(\"aria-setsize\",s))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=\"\")}_handleBoundaryFocus(e,t){const i=e.target,s=this._rowElements[0===t?1:this._rowElements.length-2];if(i.getAttribute(\"aria-posinset\")===(0===t?\"1\":`${this._terminal.buffer.lines.length}`))return;if(e.relatedTarget!==s)return;let r,n;if(0===t?(r=i,n=this._rowElements.pop(),this._rowContainer.removeChild(n)):(r=this._rowElements.shift(),n=i,this._rowContainer.removeChild(r)),r.removeEventListener(\"focus\",this._topBoundaryFocusListener),n.removeEventListener(\"focus\",this._bottomBoundaryFocusListener),0===t){const e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(\"afterbegin\",e)}else{const e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(\"focus\",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(\"focus\",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(0===this._rowElements.length)return;const e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error(\"anchorNode and/or focusNode are null\");let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;const s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:s.textContent?.length??0}),!this._rowContainer.contains(i.node))return;const r=({node:e,offset:t})=>{const i=e instanceof Text?e.parentNode:e;let s=parseInt(i?.getAttribute(\"aria-posinset\"),10)-1;if(isNaN(s))return console.warn(\"row is invalid. Race condition?\"),null;const r=this._rowColumns.get(i);if(!r)return console.warn(\"columns is null. Race condition?\"),null;let n=t=this._terminal.cols&&(++s,n=0),{row:s,column:n}},n=r(t),o=r(i);if(n&&o){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error(\"invalid range\");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(\"focus\",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;ee;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(\"focus\",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const e=this._coreBrowserService.mainDocument.createElement(\"div\");return e.setAttribute(\"role\",\"listitem\"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e{function i(e){return e.replace(/\\r?\\n/g,\"\\r\")}function s(e,t){return t?\"\u001b[200~\"+e+\"\u001b[201~\":e}function r(e,t,r,n){e=s(e=i(e),r.decPrivateModes.bracketedPasteMode&&!0!==n.rawOptions.ignoreBracketedPasteMode),r.triggerDataEvent(e,!0),t.value=\"\"}function n(e,t,i){const s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width=\"20px\",t.style.height=\"20px\",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex=\"1000\",t.focus()}Object.defineProperty(t,\"__esModule\",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=i,t.bracketTextForPaste=s,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(\"text/plain\",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,i,s){e.stopPropagation(),e.clipboardData&&r(e.clipboardData.getData(\"text/plain\"),t,i,s)},t.paste=r,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(e,t,i,s,r){n(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}},7239:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.ColorContrastCache=void 0;const s=i(1505);t.ColorContrastCache=class{constructor(){this._color=new s.TwoKeyMap,this._css=new s.TwoKeyMap}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,i,s){e.addEventListener(t,i,s);let r=!1;return{dispose:()=>{r||(r=!0,e.removeEventListener(t,i,s))}}}},3551:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.Linkifier=void 0;const n=i(3656),o=i(8460),a=i(844),h=i(2585),c=i(4725);let l=t.Linkifier=class extends a.Disposable{get currentLink(){return this._currentLink}constructor(e,t,i,s,r){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,a.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,a.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,n.addDisposableDomListener)(this._element,\"mouseleave\",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,n.addDisposableDomListener)(this._element,\"mousemove\",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,\"mousedown\",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,\"mouseup\",this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;const i=e.composedPath();for(let e=0;e{e?.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(const[s,r]of this._linkProviderService.linkProviders.entries())if(t){const t=this._activeProviderReplies?.get(s);t&&(i=this._checkLinkProviderResult(s,e,i))}else r.provideLinks(e.y,(t=>{if(this._isMouseOut)return;const r=t?.map((e=>({link:e})));this._activeProviderReplies?.set(s,r),i=this._checkLinkProviderResult(s,e,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,t){const i=new Set;for(let s=0;se?this._bufferService.cols:s.link.range.end.x;for(let e=n;e<=o;e++){if(i.has(e)){r.splice(t--,1);break}i.add(e)}}}}_checkLinkProviderResult(e,t,i){if(!this._activeProviderReplies)return i;const s=this._activeProviderReplies.get(e);let r=!1;for(let t=0;tthis._linkAtPosition(e.link,t)));e&&(i=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let e=0;ethis._linkAtPosition(e.link,t)));if(s){i=!0,this._handleNewLink(s);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,a.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;const t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(\"xterm-cursor-pointer\",e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((e=>{if(!this._currentLink)return;const t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(t,i),this._lastMouseEvent)){const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(\"xterm-cursor-pointer\")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){const i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(\"xterm-cursor-pointer\")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){const i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t,i){const s=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};t.Linkifier=l=s([r(1,c.IMouseService),r(2,c.IRenderService),r(3,h.IBufferService),r(4,c.ILinkProviderService)],l)},9042:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=\"Terminal input\",t.tooMuchOutput=\"Too much output to announce, navigate to rows manually to read\"},3730:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.OscLinkProvider=void 0;const n=i(511),o=i(2585);let a=t.OscLinkProvider=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){const i=this._bufferService.buffer.lines.get(e-1);if(!i)return void t(void 0);const s=[],r=this._optionsService.rawOptions.linkHandler,o=new n.CellData,a=i.getTrimmedLength();let c=-1,l=-1,d=!1;for(let t=0;tr?r.activate(e,t,n):h(0,t),hover:(e,t)=>r?.hover?.(e,t,n),leave:(e,t)=>r?.leave?.(e,t,n)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(l=t,c=o.extended.urlId):(l=-1,c=-1)}}t(s)}};function h(e,t){if(confirm(`Do you want to navigate to ${t}?\\n\\nWARNING: This link could potentially be dangerous`)){const e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(\"Opening link blocked as opener could not be cleared\")}}t.OscLinkProvider=a=s([r(0,o.IBufferService),r(1,o.IOptionsService),r(2,o.IOscLinkService)],a)},6193:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.Terminal=void 0;const s=i(3614),r=i(3656),n=i(3551),o=i(9042),a=i(3730),h=i(1680),c=i(3107),l=i(5744),d=i(2950),_=i(1296),u=i(428),f=i(4269),v=i(5114),p=i(8934),g=i(3230),m=i(9312),S=i(4725),C=i(6731),b=i(8055),w=i(8969),y=i(8460),E=i(844),k=i(6114),L=i(8437),D=i(2584),R=i(7399),x=i(5941),A=i(9074),B=i(2585),T=i(5435),M=i(4567),O=i(779);class P extends w.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=k,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new E.MutableDisposable),this._onCursorMove=this.register(new y.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new y.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new y.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new y.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new y.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new y.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new y.EventEmitter),this._onBlur=this.register(new y.EventEmitter),this._onA11yCharEmitter=this.register(new y.EventEmitter),this._onA11yTabEmitter=this.register(new y.EventEmitter),this._onWillOpen=this.register(new y.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(B.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(O.LinkProviderService),this._instantiationService.setService(S.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(a.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((e=>this._reportWindowsOptions(e)))),this.register(this._inputHandler.onColor((e=>this._handleColorEvent(e)))),this.register((0,y.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,y.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,y.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,y.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,E.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(e){if(this._themeService)for(const t of e){let e,i=\"\";switch(t.index){case 256:e=\"foreground\",i=\"10\";break;case 257:e=\"background\",i=\"11\";break;case 258:e=\"cursor\",i=\"12\";break;default:e=\"ansi\",i=\"4;\"+t.index}switch(t.type){case 0:const s=b.color.toColorRGB(\"ansi\"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${D.C0.ESC}]${i};${(0,x.toRgbString)(s)}${D.C1_ESCAPED.ST}`);break;case 1:if(\"ansi\"===e)this._themeService.modifyColors((e=>e.ansi[t.index]=b.channels.toColor(...t.color)));else{const i=e;this._themeService.modifyColors((e=>e[i]=b.channels.toColor(...t.color)))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(M.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+\"[I\"),this.element.classList.add(\"focus\"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=\"\",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(D.C0.ESC+\"[O\"),this.element.classList.remove(\"focus\"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;const i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+\"px\",this.textarea.style.top=o+\"px\",this.textarea.style.width=n+\"px\",this.textarea.style.height=s+\"px\",this.textarea.style.lineHeight=s+\"px\",this.textarea.style.zIndex=\"-5\"}_initGlobal(){this._bindKeys(),this.register((0,r.addDisposableDomListener)(this.element,\"copy\",(e=>{this.hasSelection()&&(0,s.copyHandler)(e,this._selectionService)})));const e=e=>(0,s.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,r.addDisposableDomListener)(this.textarea,\"paste\",e)),this.register((0,r.addDisposableDomListener)(this.element,\"paste\",e)),k.isFirefox?this.register((0,r.addDisposableDomListener)(this.element,\"mousedown\",(e=>{2===e.button&&(0,s.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,r.addDisposableDomListener)(this.element,\"contextmenu\",(e=>{(0,s.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),k.isLinux&&this.register((0,r.addDisposableDomListener)(this.element,\"auxclick\",(e=>{1===e.button&&(0,s.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,r.addDisposableDomListener)(this.textarea,\"keyup\",(e=>this._keyUp(e)),!0)),this.register((0,r.addDisposableDomListener)(this.textarea,\"keydown\",(e=>this._keyDown(e)),!0)),this.register((0,r.addDisposableDomListener)(this.textarea,\"keypress\",(e=>this._keyPress(e)),!0)),this.register((0,r.addDisposableDomListener)(this.textarea,\"compositionstart\",(()=>this._compositionHelper.compositionstart()))),this.register((0,r.addDisposableDomListener)(this.textarea,\"compositionupdate\",(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,r.addDisposableDomListener)(this.textarea,\"compositionend\",(()=>this._compositionHelper.compositionend()))),this.register((0,r.addDisposableDomListener)(this.textarea,\"input\",(e=>this._inputEvent(e)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(e){if(!e)throw new Error(\"Terminal requires a parent element.\");if(e.isConnected||this._logService.debug(\"Terminal.open was called on an element that was not attached to the DOM\"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(\"div\"),this.element.dir=\"ltr\",this.element.classList.add(\"terminal\"),this.element.classList.add(\"xterm\"),e.appendChild(this.element);const t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(\"div\"),this._viewportElement.classList.add(\"xterm-viewport\"),t.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement(\"div\"),this._viewportScrollArea.classList.add(\"xterm-scroll-area\"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement(\"div\"),this.screenElement.classList.add(\"xterm-screen\"),this.register((0,r.addDisposableDomListener)(this.screenElement,\"mousemove\",(e=>this.updateCursorStyle(e)))),this._helperContainer=this._document.createElement(\"div\"),this._helperContainer.classList.add(\"xterm-helpers\"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement(\"textarea\"),this.textarea.classList.add(\"xterm-helper-textarea\"),this.textarea.setAttribute(\"aria-label\",o.promptLabel),k.isChromeOS||this.textarea.setAttribute(\"aria-multiline\",\"false\"),this.textarea.setAttribute(\"autocorrect\",\"off\"),this.textarea.setAttribute(\"autocapitalize\",\"off\"),this.textarea.setAttribute(\"spellcheck\",\"false\"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(v.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??\"undefined\"!=typeof window?window.document:null)),this._instantiationService.setService(S.ICoreBrowserService,this._coreBrowserService),this.register((0,r.addDisposableDomListener)(this.textarea,\"focus\",(e=>this._handleTextAreaFocus(e)))),this.register((0,r.addDisposableDomListener)(this.textarea,\"blur\",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(S.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(C.ThemeService),this._instantiationService.setService(S.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(f.CharacterJoinerService),this._instantiationService.setService(S.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(g.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(S.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=this._document.createElement(\"div\"),this._compositionView.classList.add(\"composition-view\"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(p.MouseService),this._instantiationService.setService(S.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(n.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(h.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(m.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(S.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,r.addDisposableDomListener)(this._viewportElement,\"scroll\",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(c.BufferDecorationRenderer,this.screenElement)),this.register((0,r.addDisposableDomListener)(this.element,\"mousedown\",(e=>this._selectionService.handleMouseDown(e)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(\"enable-mouse-events\")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(M.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(\"screenReaderMode\",(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(l.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(\"overviewRulerWidth\",(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(l.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(_.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const e=this,t=this.element;function i(t){const i=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!i)return!1;let s,r;switch(t.overrideType||t.type){case\"mousemove\":r=32,void 0===t.buttons?(s=3,void 0!==t.button&&(s=t.button<3?t.button:3)):s=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case\"mouseup\":r=0,s=t.button<3?t.button:3;break;case\"mousedown\":r=1,s=t.button<3?t.button:3;break;case\"wheel\":if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t))return!1;if(0===e.viewport.getLinesScrolled(t))return!1;r=t.deltaY<0?0:1,s=4;break;default:return!1}return!(void 0===r||void 0===s||s>4)&&e.coreMouseService.triggerMouseEvent({col:i.col,row:i.row,x:i.x,y:i.y,button:s,action:r,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}const s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:e=>(i(e),e.buttons||(this._document.removeEventListener(\"mouseup\",s.mouseup),s.mousedrag&&this._document.removeEventListener(\"mousemove\",s.mousedrag)),this.cancel(e)),wheel:e=>(i(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&i(e)},mousemove:e=>{e.buttons||i(e)}};this.register(this.coreMouseService.onProtocolChange((e=>{e?(\"debug\"===this.optionsService.rawOptions.logLevel&&this._logService.debug(\"Binding to mouse events:\",this.coreMouseService.explainEvents(e)),this.element.classList.add(\"enable-mouse-events\"),this._selectionService.disable()):(this._logService.debug(\"Unbinding from mouse events.\"),this.element.classList.remove(\"enable-mouse-events\"),this._selectionService.enable()),8&e?s.mousemove||(t.addEventListener(\"mousemove\",n.mousemove),s.mousemove=n.mousemove):(t.removeEventListener(\"mousemove\",s.mousemove),s.mousemove=null),16&e?s.wheel||(t.addEventListener(\"wheel\",n.wheel,{passive:!1}),s.wheel=n.wheel):(t.removeEventListener(\"wheel\",s.wheel),s.wheel=null),2&e?s.mouseup||(s.mouseup=n.mouseup):(this._document.removeEventListener(\"mouseup\",s.mouseup),s.mouseup=null),4&e?s.mousedrag||(s.mousedrag=n.mousedrag):(this._document.removeEventListener(\"mousemove\",s.mousedrag),s.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,r.addDisposableDomListener)(t,\"mousedown\",(e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return i(e),s.mouseup&&this._document.addEventListener(\"mouseup\",s.mouseup),s.mousedrag&&this._document.addEventListener(\"mousemove\",s.mousedrag),this.cancel(e)}))),this.register((0,r.addDisposableDomListener)(t,\"wheel\",(e=>{if(!s.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){const t=this.viewport.getLinesScrolled(e);if(0===t)return;const i=D.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?\"O\":\"[\")+(e.deltaY<0?\"A\":\"B\");let s=\"\";for(let e=0;e{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,r.addDisposableDomListener)(t,\"touchmove\",(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(\"column-select\"):this.element.classList.remove(\"column-select\")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,i=0){1===i?(super.scrollLines(e,t,i),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,s.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error(\"Terminal must be opened first\");const t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error(\"Terminal must be opened first\");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,i){this._selectionService.setSelection(e,t,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:\"\"}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;const t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||\"Dead\"!==e.key&&\"AltGraph\"!==e.key||(this._unprocessedDeadKey=!0);const i=(0,R.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===i.type||2===i.type){const t=this.rows-1;return this.scrollLines(2===i.type?-t:t),this.cancel(e,!0)}return 1===i.type&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(i.key!==D.C0.ETX&&i.key!==D.C0.CR||(this.textarea.value=\"\"),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){const i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(\"AltGraph\");return\"keypress\"===t.type?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&\"insertText\"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e{Object.defineProperty(t,\"__esModule\",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t;const s=Date.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){const e=s-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),t)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;const e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.Viewport=void 0;const n=i(3656),o=i(4725),a=i(8460),h=i(844),c=i(2585);let l=t.Viewport=class extends h.Disposable{constructor(e,t,i,s,r,o,h,c){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=i,this._optionsService=s,this._charSizeService=r,this._renderService=o,this._coreBrowserService=h,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new a.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,n.addDisposableDomListener)(this._viewportElement,\"scroll\",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(c.colors),this.register(c.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(\"scrollback\",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+\"px\")}const e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||-1===this._smoothScrollState.origin||-1===this._smoothScrollState.target)return;const e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){const i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&i0&&(i=e),s=\"\"}}return{bufferElements:r,cursorElement:i}}getLinesScrolled(e){if(0===e.deltaY||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){const i=this._optionsService.rawOptions.fastScrollModifier;return\"alt\"===i&&t.altKey||\"ctrl\"===i&&t.ctrlKey||\"shift\"===i&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){const t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=l=s([r(2,c.IBufferService),r(3,c.IOptionsService),r(4,o.ICharSizeService),r(5,o.IRenderService),r(6,o.ICoreBrowserService),r(7,o.IThemeService)],l)},3107:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.BufferDecorationRenderer=void 0;const n=i(4725),o=i(844),a=i(2585);let h=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,i,s,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=s,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(\"div\"),this._container.classList.add(\"xterm-decoration-container\"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((e=>this._removeDecoration(e)))),this.register((0,o.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){const t=this._coreBrowserService.mainDocument.createElement(\"div\");t.classList.add(\"xterm-decoration\"),t.classList.toggle(\"xterm-decoration-top-layer\",\"top\"===e?.options?.layer),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+\"px\",t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+\"px\",t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display=\"none\"),this._refreshXPosition(e,t),t}_refreshStyle(e){const t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=\"none\",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose((()=>{this._decorationElements.delete(e),i.remove()}))),i.style.top=t*this._renderService.dimensions.css.cell.height+\"px\",i.style.display=this._altBufferIsActive?\"none\":\"block\",e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;const i=e.options.x??0;\"right\"===(e.options.anchor||\"left\")?t.style.right=i?i*this._renderService.dimensions.css.cell.width+\"px\":\"\":t.style.left=i?i*this._renderService.dimensions.css.cell.width+\"px\":\"\"}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=h=s([r(1,a.IBufferService),r(2,n.ICoreBrowserService),r(3,a.IDecorationService),r(4,n.IRenderService)],h)},5871:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(const t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||\"full\"]&&t<=e.endBufferLine+this._linePadding[i||\"full\"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.OverviewRulerRenderer=void 0;const n=i(5871),o=i(4725),a=i(844),h=i(2585),c={full:0,left:0,center:0,right:0},l={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0};let _=t.OverviewRulerRenderer=class extends a.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,i,s,r,o,h){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=o,this._coreBrowserService=h,this._colorZoneStore=new n.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(\"canvas\"),this._canvas.classList.add(\"xterm-decoration-overview-ruler\"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);const c=this._canvas.getContext(\"2d\");if(!c)throw new Error(\"Ctx cannot be null\");this._ctx=c,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,a.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?\"none\":\"block\"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(\"overviewRulerWidth\",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);l.full=this._canvas.width,l.left=e,l.center=t,l.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=l.left,d.right=l.left+l.center}_refreshDrawHeightConstants(){c.full=Math.round(2*this._coreBrowserService.dpr);const e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);c.left=t,c.center=t,c.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*c.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1;const e=this._colorZoneStore.zones;for(const t of e)\"full\"!==t.position&&this._renderColorZone(t);for(const t of e)\"full\"===t.position&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||\"full\"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-c[e.position||\"full\"]/2),l[e.position||\"full\"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+c[e.position||\"full\"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=_=s([r(2,h.IBufferService),r(3,h.IDecorationService),r(4,o.IRenderService),r(5,h.IOptionsService),r(6,o.ICoreBrowserService)],_)},2950:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.CompositionHelper=void 0;const n=i(4725),o=i(2585),a=i(2584);let h=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=\"\"}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=\"\",this._dataAlreadySent=\"\",this._compositionView.classList.add(\"active\")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(\"active\"),this._isComposing=!1,e){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const e=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const t=this._textarea.value,i=t.replace(e,\"\");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.lengththis.updateCompositionElements(!0)),0)}}};t.CompositionHelper=h=s([r(2,o.IBufferService),r(3,o.IOptionsService),r(4,o.ICoreService),r(5,n.IRenderService)],h)},9806:(e,t)=>{function i(e,t,i){const s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue(\"padding-left\")),o=parseInt(r.getPropertyValue(\"padding-top\"));return[t.clientX-s.left-n,t.clientY-s.top-o]}Object.defineProperty(t,\"__esModule\",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=i,t.getCoords=function(e,t,s,r,n,o,a,h,c){if(!o)return;const l=i(e,t,s);return l?(l[0]=Math.ceil((l[0]+(c?a/2:0))/a),l[1]=Math.ceil(l[1]/h),l[0]=Math.min(Math.max(l[0],1),r+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),n),l):void 0}},9504:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.moveToCellSequence=void 0;const s=i(2584);function r(e,t,i,s){const r=e-n(e,i),a=t-n(t,i),l=Math.abs(r-a)-function(e,t,i){let s=0;const r=e-n(e,i),a=t-n(t,i);for(let n=0;n=0&&et?\"A\":\"B\"}function a(e,t,i,s,r,n){let o=e,a=t,h=\"\";for(;o!==i||a!==s;)o+=r?1:-1,r&&o>n.cols-1?(h+=n.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!r&&o<0&&(h+=n.buffer.translateBufferLineToString(a,!1,0,e+1),o=n.cols-1,e=o,a--);return h+n.buffer.translateBufferLineToString(a,!1,e,o)}function h(e,t){const i=t?\"O\":\"[\";return s.C0.ESC+i+e}function c(e,t){e=Math.floor(e);let i=\"\";for(let s=0;s0?s-n(s,o):t;const _=s,u=function(e,t,i,s,o,a){let h;return h=r(i,s,o,a).length>0?s-n(s,o):t,e=i&&he?\"D\":\"C\",c(Math.abs(o-e),h(d,s));d=l>t?\"D\":\"C\";const _=Math.abs(l-t);return c(function(e,t){return t.cols-e}(l>t?e:o,i)+(_-1)*i.cols+1+((l>t?o:e)-1),h(d,s))}},1296:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.DomRenderer=void 0;const n=i(3787),o=i(2550),a=i(2223),h=i(6171),c=i(6052),l=i(4725),d=i(8055),_=i(8460),u=i(844),f=i(2585),v=\"xterm-dom-renderer-owner-\",p=\"xterm-rows\",g=\"xterm-fg-\",m=\"xterm-bg-\",S=\"xterm-focus\",C=\"xterm-selection\";let b=1,w=t.DomRenderer=class extends u.Disposable{constructor(e,t,i,s,r,a,l,d,f,g,m,S,w){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=s,this._viewportElement=r,this._helperContainer=a,this._linkifier2=l,this._charSizeService=f,this._optionsService=g,this._bufferService=m,this._coreBrowserService=S,this._themeService=w,this._terminalClass=b++,this._rowElements=[],this._selectionRenderModel=(0,c.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new _.EventEmitter).event,this._rowContainer=this._document.createElement(\"div\"),this._rowContainer.classList.add(p),this._rowContainer.style.lineHeight=\"normal\",this._rowContainer.setAttribute(\"aria-hidden\",\"true\"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(\"div\"),this._selectionContainer.classList.add(C),this._selectionContainer.setAttribute(\"aria-hidden\",\"true\"),this.dimensions=(0,h.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((e=>this._injectCss(e)))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(n.DomRendererRowFactory,document),this._element.classList.add(v+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((e=>this._handleLinkHover(e)))),this.register(this._linkifier2.onHideLinkUnderline((e=>this._handleLinkLeave(e)))),this.register((0,u.toDisposable)((()=>{this._element.classList.remove(v+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=\"hidden\";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(\"style\"),this._screenElement.appendChild(this._dimensionsStyleElement));const t=`${this._terminalSelector} .${p} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(\"style\"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${p} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${p} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const i=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${p}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${p}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${p}.${S} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${p} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${C} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${C} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${C} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(const[i,s]of e.ansi.entries())t+=`${this._terminalSelector} .${g}${i} { color: ${s.css}; }${this._terminalSelector} .${g}${i}.xterm-dim { color: ${d.color.multiplyOpacity(s,.5).css}; }${this._terminalSelector} .${m}${i} { background-color: ${s.css}; }`;t+=`${this._terminalSelector} .${g}${a.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${g}${a.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${m}${a.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){const e=this.dimensions.css.cell.width-this._widthCache.get(\"W\",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){const e=this._document.createElement(\"div\");this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(S),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(S),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,i);const s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(n>=this._bufferService.rows||o<0)return;const a=this._document.createDocumentFragment();if(i){const i=e[0]>t[0];a.appendChild(this._createSelectionElement(n,i?t[0]:e[0],i?e[0]:t[0],o-n+1))}else{const i=s===n?e[0]:0,h=n===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,i,h));const c=o-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,c)),n!==o){const e=r===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,i,s=1){const r=this._document.createElement(\"div\"),n=t*this.dimensions.css.cell.width;let o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),r.style.height=s*this.dimensions.css.cell.height+\"px\",r.style.top=e*this.dimensions.css.cell.height+\"px\",r.style.left=`${n}px`,r.style.width=`${o}px`,r}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const e of this._rowElements)e.replaceChildren()}renderRows(e,t){const i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){const e=h+i.ydisp,t=this._rowElements[h],c=i.lines.get(e);if(!t||!c)break;t.replaceChildren(...this._rowFactory.createRow(c,e,e===s,o,a,r,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${v}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,s,r,n){i<0&&(e=0),s<0&&(t=0);const o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),s=Math.max(Math.min(s,o),0),r=Math.min(r,this._bufferService.cols);const a=this._bufferService.buffer,h=a.ybase+a.y,c=Math.min(a.x,r-1),l=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=i;o<=s;++o){const u=o+a.ydisp,f=this._rowElements[o],v=a.lines.get(u);if(!f||!v)break;f.replaceChildren(...this._rowFactory.createRow(v,u,u===h,d,_,c,l,this.dimensions.css.cell.width,this._widthCache,n?o===i?e:0:-1,n?(o===s?t:r)-1:-1))}}};t.DomRenderer=w=s([r(7,f.IInstantiationService),r(8,l.ICharSizeService),r(9,f.IOptionsService),r(10,f.IBufferService),r(11,l.ICoreBrowserService),r(12,l.IThemeService)],w)},3787:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.DomRendererRowFactory=void 0;const n=i(2223),o=i(643),a=i(511),h=i(2585),c=i(8055),l=i(4725),d=i(4269),_=i(6171),u=i(3734);let f=t.DomRendererRowFactory=class{constructor(e,t,i,s,r,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=o,this._workCell=new a.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,a,h,l,_,f,p){const g=[],m=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors;let C,b=e.getNoBgTrimmedLength();i&&b0&&M===m[0][0]){O=!0;const t=m.shift();I=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),P=t[1]-1,b=I.getWidth()}const H=this._isCellInSelection(M,t),F=i&&M===a,W=T&&M>=f&&M<=p;let U=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,(e=>{U=!0}));let N=I.getChars()||o.WHITESPACE_CELL_CHAR;if(\" \"===N&&(I.isUnderline()||I.isOverline())&&(N=\" \"),A=b*l-_.get(N,I.isBold(),I.isItalic()),C){if(w&&(H&&x||!H&&!x&&I.bg===E)&&(H&&x&&S.selectionForeground||I.fg===k)&&I.extended.ext===L&&W===D&&A===R&&!F&&!O&&!U){I.isInvisible()?y+=o.WHITESPACE_CELL_CHAR:y+=N,w++;continue}w&&(C.textContent=y),C=this._document.createElement(\"span\"),w=0,y=\"\"}else C=this._document.createElement(\"span\");if(E=I.bg,k=I.fg,L=I.extended.ext,D=W,R=A,x=H,O&&a>=M&&a<=P&&(a=M),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized)if(B.push(\"xterm-cursor\"),this._coreBrowserService.isFocused)h&&B.push(\"xterm-cursor-blink\"),B.push(\"bar\"===s?\"xterm-cursor-bar\":\"underline\"===s?\"xterm-cursor-underline\":\"xterm-cursor-block\");else if(r)switch(r){case\"outline\":B.push(\"xterm-cursor-outline\");break;case\"block\":B.push(\"xterm-cursor-block\");break;case\"bar\":B.push(\"xterm-cursor-bar\");break;case\"underline\":B.push(\"xterm-cursor-underline\")}if(I.isBold()&&B.push(\"xterm-bold\"),I.isItalic()&&B.push(\"xterm-italic\"),I.isDim()&&B.push(\"xterm-dim\"),y=I.isInvisible()?o.WHITESPACE_CELL_CHAR:I.getChars()||o.WHITESPACE_CELL_CHAR,I.isUnderline()&&(B.push(`xterm-underline-${I.extended.underlineStyle}`),\" \"===y&&(y=\" \"),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())C.style.textDecorationColor=`rgb(${u.AttributeData.toColorRGB(I.getUnderlineColor()).join(\",\")})`;else{let e=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&e<8&&(e+=8),C.style.textDecorationColor=S.ansi[e].css}I.isOverline()&&(B.push(\"xterm-overline\"),\" \"===y&&(y=\" \")),I.isStrikethrough()&&B.push(\"xterm-strikethrough\"),W&&(C.style.textDecoration=\"underline\");let $=I.getFgColor(),j=I.getFgColorMode(),z=I.getBgColor(),K=I.getBgColorMode();const q=!!I.isInverse();if(q){const e=$;$=z,z=e;const t=j;j=K,K=t}let V,G,X,J=!1;switch(this._decorationService.forEachDecorationAtCell(M,t,void 0,(e=>{\"top\"!==e.options.layer&&J||(e.backgroundColorRGB&&(K=50331648,z=e.backgroundColorRGB.rgba>>8&16777215,V=e.backgroundColorRGB),e.foregroundColorRGB&&(j=50331648,$=e.foregroundColorRGB.rgba>>8&16777215,G=e.foregroundColorRGB),J=\"top\"===e.options.layer)})),!J&&H&&(V=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,z=V.rgba>>8&16777215,K=50331648,J=!0,S.selectionForeground&&(j=50331648,$=S.selectionForeground.rgba>>8&16777215,G=S.selectionForeground)),J&&B.push(\"xterm-decoration-top\"),K){case 16777216:case 33554432:X=S.ansi[z],B.push(`xterm-bg-${z}`);break;case 50331648:X=c.channels.toColor(z>>16,z>>8&255,255&z),this._addStyle(C,`background-color:#${v((z>>>0).toString(16),\"0\",6)}`);break;default:q?(X=S.foreground,B.push(`xterm-bg-${n.INVERTED_DEFAULT_COLOR}`)):X=S.background}switch(V||I.isDim()&&(V=c.color.multiplyOpacity(X,.5)),j){case 16777216:case 33554432:I.isBold()&&$<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&($+=8),this._applyMinimumContrast(C,X,S.ansi[$],I,V,void 0)||B.push(`xterm-fg-${$}`);break;case 50331648:const e=c.channels.toColor($>>16&255,$>>8&255,255&$);this._applyMinimumContrast(C,X,e,I,V,G)||this._addStyle(C,`color:#${v($.toString(16),\"0\",6)}`);break;default:this._applyMinimumContrast(C,X,S.foreground,I,V,G)||q&&B.push(`xterm-fg-${n.INVERTED_DEFAULT_COLOR}`)}B.length&&(C.className=B.join(\" \"),B.length=0),F||O||U?C.textContent=y:w++,A!==this.defaultSpacing&&(C.style.letterSpacing=`${A}px`),g.push(C),M=P}return C&&w&&(C.textContent=y),g}_applyMinimumContrast(e,t,i,s,r,n){if(1===this._optionsService.rawOptions.minimumContrastRatio||(0,_.treatGlyphAsBackgroundColor)(s.getCode()))return!1;const o=this._getContrastCache(s);let a;if(r||n||(a=o.getColor(t.rgba,i.rgba)),void 0===a){const e=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=c.color.ensureContrastRatio(r||t,n||i,e),o.setColor((r||t).rgba,(n||i).rgba,a??null)}return!!a&&(this._addStyle(e,`color:${a.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(\"style\",`${e.getAttribute(\"style\")||\"\"}${t};`)}_isCellInSelection(e,t){const i=this._selectionStart,s=this._selectionEnd;return!(!i||!s)&&(this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t=i[0]&&e=i[0])}};function v(e,t,i){for(;e.length{Object.defineProperty(t,\"__esModule\",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font=\"\",this._fontSize=0,this._weight=\"normal\",this._weightBold=\"bold\",this._measureElements=[],this._container=e.createElement(\"div\"),this._container.classList.add(\"xterm-width-cache-measure-container\"),this._container.setAttribute(\"aria-hidden\",\"true\"),this._container.style.whiteSpace=\"pre\",this._container.style.fontKerning=\"none\";const i=e.createElement(\"span\");i.classList.add(\"xterm-char-measure-element\");const s=e.createElement(\"span\");s.classList.add(\"xterm-char-measure-element\"),s.style.fontWeight=\"bold\";const r=e.createElement(\"span\");r.classList.add(\"xterm-char-measure-element\"),r.style.fontStyle=\"italic\";const n=e.createElement(\"span\");n.classList.add(\"xterm-char-measure-element\"),n.style.fontWeight=\"bold\",n.style.fontStyle=\"italic\",this._measureElements=[i,s,r,n],this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(n),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,i){let s=0;if(!t&&!i&&1===e.length&&(s=e.charCodeAt(0))<256){if(-9999!==this._flat[s])return this._flat[s];const t=this._measure(e,0);return t>0&&(this._flat[s]=t),t}let r=e;t&&(r+=\"B\"),i&&(r+=\"I\");let n=this._holey.get(r);if(void 0===n){let s=0;t&&(s|=1),i&&(s|=2),n=this._measure(e,s),n>0&&this._holey.set(r,n)}return n}_measure(e,t){const i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}}},2223:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const s=i(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=s.isFirefox||s.isLegacyEdge?\"bottom\":\"ideographic\"},6171:(e,t)=>{function i(e){return 57508<=e&&e<=57558}function s(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,\"__esModule\",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw new Error(\"value must not be falsy\");return e},t.isPowerlineGlyph=i,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=s,t.allowRescaling=function(e,t,r,n){return 1===t&&r>Math.ceil(1.5*n)&&void 0!==e&&e>255&&!s(e)&&!i(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return i(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,i=0){return(e-(2*Math.round(t)-i))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.createSelectionRenderModel=void 0;class i{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1])return void this.clear();const r=e.buffers.active.ydisp,n=t[1]-r,o=i[1]-r,a=Math.max(n,0),h=Math.min(o,e.rows-1);a>=e.rows||h<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=i[0])}isCellSelected(e,t,i){return!!this.hasSelection&&(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i=this.startCol&&t=this.startCol)}}t.createSelectionRenderModel=function(){return new i}},456:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.CharSizeService=void 0;const n=i(2585),o=i(8460),a=i(844);let h=t.CharSizeService=class extends a.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new l(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange([\"fontFamily\",\"fontSize\"],(()=>this.measure())))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=h=s([r(2,n.IOptionsService)],h);class c extends a.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){void 0!==e&&e>0&&void 0!==t&&t>0&&(this._result.width=e,this._result.height=t)}}class l extends c{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,this._measureElement=this._document.createElement(\"span\"),this._measureElement.classList.add(\"xterm-char-measure-element\"),this._measureElement.textContent=\"W\".repeat(32),this._measureElement.setAttribute(\"aria-hidden\",\"true\"),this._measureElement.style.whiteSpace=\"pre\",this._measureElement.style.fontKerning=\"none\",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends c{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(\"2d\");const t=this._ctx.measureText(\"W\");if(!(\"width\"in t&&\"fontBoundingBoxAscent\"in t&&\"fontBoundingBoxDescent\"in t))throw new Error(\"Required font metrics not supported\")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const e=this._ctx.measureText(\"W\");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const n=i(3734),o=i(643),a=i(511),h=i(2585);class c extends n.AttributeData{constructor(e,t,i){super(),this.content=0,this.combinedData=\"\",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error(\"not implemented\")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=c;let l=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new a.CellData}register(e){const t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t1){const e=this._getJoinedRanges(s,a,n,t,r);for(let t=0;t1){const e=this._getJoinedRanges(s,a,n,t,r);for(let t=0;t{Object.defineProperty(t,\"__esModule\",{value:!0}),t.CoreBrowserService=void 0;const s=i(844),r=i(8460),n=i(3656);class o extends s.Disposable{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new a(this._window),this._onDprChange=this.register(new r.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new r.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,r.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener(\"focus\",(()=>this._isFocused=!0)),this._textarea.addEventListener(\"blur\",(()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=o;class a extends s.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new s.MutableDisposable),this._onDprChange=this.register(new r.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,s.toDisposable)((()=>this.clearListener())))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,n.addDisposableDomListener)(this._parentWindow,\"resize\",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.LinkProviderService=void 0;const s=i(844);class r extends s.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,s.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{const t=this.linkProviders.indexOf(e);-1!==t&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=r},8934:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.MouseService=void 0;const n=i(4725),o=i(9806);let a=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,s,r){return(0,o.getCoords)(window,e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){const i=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};t.MouseService=a=s([r(0,n.IRenderService),r(1,n.ICharSizeService)],a)},3230:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.RenderService=void 0;const n=i(6193),o=i(4725),a=i(8460),h=i(844),c=i(7226),l=i(2585);let d=t.RenderService=class extends h.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,i,s,r,o,l,d){super(),this._rowCount=e,this._charSizeService=s,this._renderer=this.register(new h.MutableDisposable),this._pausedResizeTask=new c.DebouncedIdleTask,this._observerDisposable=this.register(new h.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new a.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new a.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new a.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new a.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new n.RenderDebouncer(((e,t)=>this._renderRows(e,t)),l),this.register(this._renderDebouncer),this.register(l.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(o.onResize((()=>this._fullRefresh()))),this.register(o.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(i.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(r.onDecorationRegistered((()=>this._fullRefresh()))),this.register(r.onDecorationRemoved((()=>this._fullRefresh()))),this.register(i.onMultipleOptionChange([\"customGlyphs\",\"drawBoldTextInBrightColors\",\"letterSpacing\",\"lineHeight\",\"fontFamily\",\"fontSize\",\"fontWeight\",\"fontWeightBold\",\"minimumContrastRatio\",\"rescaleOverlappingGlyphs\"],(()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()}))),this.register(i.onMultipleOptionChange([\"cursorBlink\",\"cursorStyle\"],(()=>this.refreshRows(o.buffer.y,o.buffer.y,!0)))),this.register(d.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(l.window,t),this.register(l.onWindowChange((e=>this._registerIntersectionObserver(e,t))))}_registerIntersectionObserver(e,t){if(\"IntersectionObserver\"in e){const i=new e.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});i.observe(t),this._observerDisposable.value=(0,h.toDisposable)((()=>i.disconnect()))}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,i=!1){this._isPaused?this._needsFullRefresh=!0:(i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((e=>this.refreshRows(e.start,e.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.value?.handleSelectionChanged(e,t,i)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=s([r(2,l.IOptionsService),r(3,o.ICharSizeService),r(4,l.IDecorationService),r(5,l.IBufferService),r(6,o.ICoreBrowserService),r(7,o.IThemeService)],d)},9312:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.SelectionService=void 0;const n=i(9806),o=i(9504),a=i(456),h=i(4725),c=i(8460),l=i(844),d=i(6114),_=i(4841),u=i(511),f=i(2585),v=String.fromCharCode(160),p=new RegExp(v,\"g\");let g=t.SelectionService=class extends l.Disposable{constructor(e,t,i,s,r,n,o,h,d){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseService=n,this._optionsService=o,this._renderService=h,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new u.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new c.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new c.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new c.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new c.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((e=>this._handleTrim(e))),this.register(this._bufferService.buffers.onBufferActivate((e=>this._handleBufferActivate(e)))),this.enable(),this._model=new a.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,l.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return\"\";const i=this._bufferService.buffer,s=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return\"\";const r=e[0]e.replace(p,\" \"))).join(d.isWindows?\"\\r\\n\":\"\\n\")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),d.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})}_isClickInSelection(e){const t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!!(i&&s&&t)&&this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){const i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!(!i||!s)&&this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){const i=this._linkifier.currentLink?.link?.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=(0,_.getRangeLength)(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const s=this._getMouseBufferCoords(e);return!!s&&(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){const t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1];const i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(\"mousemove\",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(\"mouseup\",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(\"mousemove\",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(\"mouseup\",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){const t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;const t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const i=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){const t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){const e=(0,o.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);i?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,i)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((e=>this._handleTrim(e)))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){const r=e.loadCell(s,this._workCell).getChars().length;0===this._workCell.getWidth()?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;const r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;const o=r.translateBufferLineToString(e[1],!1);let a=this._convertViewportColToCharacterIndex(n,e[0]),h=a;const c=e[0]-a;let l=0,d=0,_=0,u=0;if(\" \"===o.charAt(a)){for(;a>0&&\" \"===o.charAt(a-1);)a--;for(;h1&&(u+=s-1,h+=s-1);t>0&&a>0&&!this._isCharWordSeparator(n.loadCell(t-1,this._workCell));){n.loadCell(t-1,this._workCell);const e=this._workCell.getChars().length;0===this._workCell.getWidth()?(l++,t--):e>1&&(_+=e-1,a-=e-1),a--,t--}for(;i1&&(u+=e-1,h+=e-1),h++,i++}}h++;let f=a+c-l+_,v=Math.min(this._bufferService.cols,h-a+l+d-_-u);if(t||\"\"!==o.slice(a,h).trim()){if(i&&0===f&&32!==n.getCodePoint(0)){const t=r.lines.get(e[1]-1);if(t&&n.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){const t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){const e=this._bufferService.cols-t.start;f-=e,v+=e}}}if(s&&f+v===this._bufferService.cols&&32!==n.getCodePoint(this._bufferService.cols-1)){const t=r.lines.get(e[1]+1);if(t?.isWrapped&&32!==t.getCodePoint(0)){const t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(v+=t.length)}}return{start:f,length:v}}}_selectWordAt(e,t){const i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){const t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){const t=this._bufferService.buffer.getWrappedRangeForLine(e),i={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,_.getRangeLength)(i,this._bufferService.cols)}};t.SelectionService=g=s([r(3,f.IBufferService),r(4,f.ICoreService),r(5,h.IMouseService),r(6,f.IOptionsService),r(7,h.IRenderService),r(8,h.ICoreBrowserService)],g)},4725:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const s=i(8343);t.ICharSizeService=(0,s.createDecorator)(\"CharSizeService\"),t.ICoreBrowserService=(0,s.createDecorator)(\"CoreBrowserService\"),t.IMouseService=(0,s.createDecorator)(\"MouseService\"),t.IRenderService=(0,s.createDecorator)(\"RenderService\"),t.ISelectionService=(0,s.createDecorator)(\"SelectionService\"),t.ICharacterJoinerService=(0,s.createDecorator)(\"CharacterJoinerService\"),t.IThemeService=(0,s.createDecorator)(\"ThemeService\"),t.ILinkProviderService=(0,s.createDecorator)(\"LinkProviderService\")},6731:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const n=i(7239),o=i(8055),a=i(8460),h=i(844),c=i(2585),l=o.css.toColor(\"#ffffff\"),d=o.css.toColor(\"#000000\"),_=o.css.toColor(\"#ffffff\"),u=o.css.toColor(\"#000000\"),f={css:\"rgba(255, 255, 255, 0.3)\",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const e=[o.css.toColor(\"#2e3436\"),o.css.toColor(\"#cc0000\"),o.css.toColor(\"#4e9a06\"),o.css.toColor(\"#c4a000\"),o.css.toColor(\"#3465a4\"),o.css.toColor(\"#75507b\"),o.css.toColor(\"#06989a\"),o.css.toColor(\"#d3d7cf\"),o.css.toColor(\"#555753\"),o.css.toColor(\"#ef2929\"),o.css.toColor(\"#8ae234\"),o.css.toColor(\"#fce94f\"),o.css.toColor(\"#729fcf\"),o.css.toColor(\"#ad7fa8\"),o.css.toColor(\"#34e2e2\"),o.css.toColor(\"#eeeeec\")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){const s=t[i/36%6|0],r=t[i/6%6|0],n=t[i%6];e.push({css:o.channels.toCss(s,r,n),rgba:o.channels.toRgba(s,r,n)})}for(let t=0;t<24;t++){const i=8+10*t;e.push({css:o.channels.toCss(i,i,i),rgba:o.channels.toRgba(i,i,i)})}return e})());let v=t.ThemeService=class extends h.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new n.ColorContrastCache,this._halfContrastCache=new n.ColorContrastCache,this._onChangeColors=this.register(new a.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:l,background:d,cursor:_,cursorAccent:u,selectionForeground:void 0,selectionBackgroundTransparent:f,selectionBackgroundOpaque:o.color.blend(d,f),selectionInactiveBackgroundTransparent:f,selectionInactiveBackgroundOpaque:o.color.blend(d,f),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange(\"minimumContrastRatio\",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange(\"theme\",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(e={}){const i=this._colors;if(i.foreground=p(e.foreground,l),i.background=p(e.background,d),i.cursor=p(e.cursor,_),i.cursorAccent=p(e.cursorAccent,u),i.selectionBackgroundTransparent=p(e.selectionBackground,f),i.selectionBackgroundOpaque=o.color.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=p(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=o.color.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?p(e.selectionForeground,o.NULL_COLOR):void 0,i.selectionForeground===o.NULL_COLOR&&(i.selectionForeground=void 0),o.color.isOpaque(i.selectionBackgroundTransparent)){const e=.3;i.selectionBackgroundTransparent=o.color.opacity(i.selectionBackgroundTransparent,e)}if(o.color.isOpaque(i.selectionInactiveBackgroundTransparent)){const e=.3;i.selectionInactiveBackgroundTransparent=o.color.opacity(i.selectionInactiveBackgroundTransparent,e)}if(i.ansi=t.DEFAULT_ANSI_COLORS.slice(),i.ansi[0]=p(e.black,t.DEFAULT_ANSI_COLORS[0]),i.ansi[1]=p(e.red,t.DEFAULT_ANSI_COLORS[1]),i.ansi[2]=p(e.green,t.DEFAULT_ANSI_COLORS[2]),i.ansi[3]=p(e.yellow,t.DEFAULT_ANSI_COLORS[3]),i.ansi[4]=p(e.blue,t.DEFAULT_ANSI_COLORS[4]),i.ansi[5]=p(e.magenta,t.DEFAULT_ANSI_COLORS[5]),i.ansi[6]=p(e.cyan,t.DEFAULT_ANSI_COLORS[6]),i.ansi[7]=p(e.white,t.DEFAULT_ANSI_COLORS[7]),i.ansi[8]=p(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),i.ansi[9]=p(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),i.ansi[10]=p(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),i.ansi[11]=p(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),i.ansi[12]=p(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),i.ansi[13]=p(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),i.ansi[14]=p(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),i.ansi[15]=p(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){const s=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let r=0;r{Object.defineProperty(t,\"__esModule\",{value:!0}),t.CircularList=void 0;const s=i(8460),r=i(844);class n extends r.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new s.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new s.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new s.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;const t=new Array(e);for(let i=0;ithis._length)for(let t=this._length;t=e;t--)this._array[this._getCyclicIndex(t+i.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;tthis._maxLength){const e=this._length+i.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error(\"start argument out of range\");if(e+i<0)throw new Error(\"Cannot shift elements in list beyond index 0\");if(i>0){for(let s=t-1;s>=0;s--)this.set(e+s+i,this.get(e+s));const s=e+t+i-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s{Object.defineProperty(t,\"__esModule\",{value:!0}),t.clone=void 0,t.clone=function e(t,i=5){if(\"object\"!=typeof t)return t;const s=Array.isArray(t)?[]:{};for(const r in t)s[r]=i<=1?t[r]:t[r]&&e(t[r],i-1);return s}},8055:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let i=0,s=0,r=0,n=0;var o,a,h,c,l;function d(e){const t=e.toString(16);return t.length<2?\"0\"+t:t}function _(e,t){return e>>0},e.toColor=function(t,i,s,r){return{css:e.toCss(t,i,s,r),rgba:e.toRgba(t,i,s,r)}}}(o||(t.channels=o={})),function(e){function t(e,t){return n=Math.round(255*t),[i,s,r]=l.toChannels(e.rgba),{css:o.toCss(i,s,r,n),rgba:o.toRgba(i,s,r,n)}}e.blend=function(e,t){if(n=(255&t.rgba)/255,1===n)return{css:t.css,rgba:t.rgba};const a=t.rgba>>24&255,h=t.rgba>>16&255,c=t.rgba>>8&255,l=e.rgba>>24&255,d=e.rgba>>16&255,_=e.rgba>>8&255;return i=l+Math.round((a-l)*n),s=d+Math.round((h-d)*n),r=_+Math.round((c-_)*n),{css:o.toCss(i,s,r),rgba:o.toRgba(i,s,r)}},e.isOpaque=function(e){return 255==(255&e.rgba)},e.ensureContrastRatio=function(e,t,i){const s=l.ensureContrastRatio(e.rgba,t.rgba,i);if(s)return o.toColor(s>>24&255,s>>16&255,s>>8&255)},e.opaque=function(e){const t=(255|e.rgba)>>>0;return[i,s,r]=l.toChannels(t),{css:o.toCss(i,s,r),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,i){return n=255&e.rgba,t(e,n*i/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(a||(t.color=a={})),function(e){let t,a;try{const e=document.createElement(\"canvas\");e.width=1,e.height=1;const i=e.getContext(\"2d\",{willReadFrequently:!0});i&&(t=i,t.globalCompositeOperation=\"copy\",a=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\\da-f]{3,8}/i))switch(e.length){case 4:return i=parseInt(e.slice(1,2).repeat(2),16),s=parseInt(e.slice(2,3).repeat(2),16),r=parseInt(e.slice(3,4).repeat(2),16),o.toColor(i,s,r);case 5:return i=parseInt(e.slice(1,2).repeat(2),16),s=parseInt(e.slice(2,3).repeat(2),16),r=parseInt(e.slice(3,4).repeat(2),16),n=parseInt(e.slice(4,5).repeat(2),16),o.toColor(i,s,r,n);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}const h=e.match(/rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*(,\\s*(0|1|\\d?\\.(\\d+))\\s*)?\\)/);if(h)return i=parseInt(h[1]),s=parseInt(h[2]),r=parseInt(h[3]),n=Math.round(255*(void 0===h[5]?1:parseFloat(h[5]))),o.toColor(i,s,r,n);if(!t||!a)throw new Error(\"css.toColor: Unsupported css format\");if(t.fillStyle=a,t.fillStyle=e,\"string\"!=typeof t.fillStyle)throw new Error(\"css.toColor: Unsupported css format\");if(t.fillRect(0,0,1,1),[i,s,r,n]=t.getImageData(0,0,1,1).data,255!==n)throw new Error(\"css.toColor: Unsupported css format\");return{rgba:o.toRgba(i,s,r,n),css:e}}}(h||(t.css=h={})),function(e){function t(e,t,i){const s=e/255,r=t/255,n=i/255;return.2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(c||(t.rgb=c={})),function(e){function t(e,t,i){const s=e>>24&255,r=e>>16&255,n=e>>8&255;let o=t>>24&255,a=t>>16&255,h=t>>8&255,l=_(c.relativeLuminance2(o,a,h),c.relativeLuminance2(s,r,n));for(;l0||a>0||h>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),h-=Math.max(0,Math.ceil(.1*h)),l=_(c.relativeLuminance2(o,a,h),c.relativeLuminance2(s,r,n));return(o<<24|a<<16|h<<8|255)>>>0}function a(e,t,i){const s=e>>24&255,r=e>>16&255,n=e>>8&255;let o=t>>24&255,a=t>>16&255,h=t>>8&255,l=_(c.relativeLuminance2(o,a,h),c.relativeLuminance2(s,r,n));for(;l>>0}e.blend=function(e,t){if(n=(255&t)/255,1===n)return t;const a=t>>24&255,h=t>>16&255,c=t>>8&255,l=e>>24&255,d=e>>16&255,_=e>>8&255;return i=l+Math.round((a-l)*n),s=d+Math.round((h-d)*n),r=_+Math.round((c-_)*n),o.toRgba(i,s,r)},e.ensureContrastRatio=function(e,i,s){const r=c.relativeLuminance(e>>8),n=c.relativeLuminance(i>>8);if(_(r,n)>8));if(o_(r,c.relativeLuminance(t>>8))?n:t}return n}const o=a(e,i,s),h=_(r,c.relativeLuminance(o>>8));if(h_(r,c.relativeLuminance(n>>8))?o:n}return o}},e.reduceLuminance=t,e.increaseLuminance=a,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(l||(t.rgba=l={})),t.toPaddedHex=d,t.contrastRatio=_},8969:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.CoreTerminal=void 0;const s=i(844),r=i(2585),n=i(4348),o=i(7866),a=i(744),h=i(7302),c=i(6975),l=i(8460),d=i(1753),_=i(1480),u=i(7994),f=i(9282),v=i(5435),p=i(5981),g=i(2660);let m=!1;class S extends s.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new l.EventEmitter),this._onScroll.event((e=>{this._onScrollApi?.fire(e.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(const t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new s.MutableDisposable),this._onBinary=this.register(new l.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new l.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new l.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new l.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new l.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new l.EventEmitter),this._instantiationService=new n.InstantiationService,this.optionsService=this.register(new h.OptionsService(e)),this._instantiationService.setService(r.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(a.BufferService)),this._instantiationService.setService(r.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(o.LogService)),this._instantiationService.setService(r.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(c.CoreService)),this._instantiationService.setService(r.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(r.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(_.UnicodeService)),this._instantiationService.setService(r.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(u.CharsetService),this._instantiationService.setService(r.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(g.OscLinkService),this._instantiationService.setService(r.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new v.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,l.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,l.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,l.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,l.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange([\"windowsMode\",\"windowsPty\"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new p.WriteBuffer(((e,t)=>this._inputHandler.parse(e,t)))),this.register((0,l.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=r.LogLevelEnum.WARN&&!m&&(this._logService.warn(\"writeSync is unreliable and will be removed soon.\"),m=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,a.MINIMUM_COLS),t=Math.max(t,a.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,i){this._bufferService.scrollLines(e,t,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){const t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1;const t=this.optionsService.rawOptions.windowsPty;t&&void 0!==t.buildNumber&&void 0!==t.buildNumber?e=!!(\"conpty\"===t.backend&&t.buildNumber<21376):this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const e=[];e.push(this.onLineFeed(f.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:\"H\"},(()=>((0,f.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,s.toDisposable)((()=>{for(const t of e)t.dispose()}))}}}t.CoreTerminal=S},8460:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed)for(let t=0;tt.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},5435:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const n=i(2584),o=i(7116),a=i(2015),h=i(844),c=i(482),l=i(8437),d=i(8460),_=i(643),u=i(511),f=i(3734),v=i(2585),p=i(1480),g=i(6242),m=i(6351),S=i(5941),C={\"(\":0,\")\":1,\"*\":2,\"+\":3,\"-\":1,\".\":2},b=131072;function w(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var y;!function(e){e[e.GET_WIN_SIZE_PIXELS=0]=\"GET_WIN_SIZE_PIXELS\",e[e.GET_CELL_SIZE_PIXELS=1]=\"GET_CELL_SIZE_PIXELS\"}(y||(t.WindowsOptionsReportType=y={}));let E=0;class k extends h.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,i,s,r,h,_,f,v=new a.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=h,this._coreMouseService=_,this._unicodeService=f,this._parser=v,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new c.StringToUtf32,this._utf8Decoder=new c.Utf8ToUtf32,this._workCell=new u.CellData,this._windowTitle=\"\",this._iconName=\"\",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=l.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=l.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new L(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._parser.setCsiHandlerFallback(((e,t)=>{this._logService.debug(\"Unknown CSI code: \",{identifier:this._parser.identToString(e),params:t.toArray()})})),this._parser.setEscHandlerFallback((e=>{this._logService.debug(\"Unknown ESC code: \",{identifier:this._parser.identToString(e)})})),this._parser.setExecuteHandlerFallback((e=>{this._logService.debug(\"Unknown EXECUTE code: \",{code:e})})),this._parser.setOscHandlerFallback(((e,t,i)=>{this._logService.debug(\"Unknown OSC code: \",{identifier:e,action:t,data:i})})),this._parser.setDcsHandlerFallback(((e,t,i)=>{\"HOOK\"===t&&(i=i.toArray()),this._logService.debug(\"Unknown DCS code: \",{identifier:this._parser.identToString(e),action:t,payload:i})})),this._parser.setPrintHandler(((e,t,i)=>this.print(e,t,i))),this._parser.registerCsiHandler({final:\"@\"},(e=>this.insertChars(e))),this._parser.registerCsiHandler({intermediates:\" \",final:\"@\"},(e=>this.scrollLeft(e))),this._parser.registerCsiHandler({final:\"A\"},(e=>this.cursorUp(e))),this._parser.registerCsiHandler({intermediates:\" \",final:\"A\"},(e=>this.scrollRight(e))),this._parser.registerCsiHandler({final:\"B\"},(e=>this.cursorDown(e))),this._parser.registerCsiHandler({final:\"C\"},(e=>this.cursorForward(e))),this._parser.registerCsiHandler({final:\"D\"},(e=>this.cursorBackward(e))),this._parser.registerCsiHandler({final:\"E\"},(e=>this.cursorNextLine(e))),this._parser.registerCsiHandler({final:\"F\"},(e=>this.cursorPrecedingLine(e))),this._parser.registerCsiHandler({final:\"G\"},(e=>this.cursorCharAbsolute(e))),this._parser.registerCsiHandler({final:\"H\"},(e=>this.cursorPosition(e))),this._parser.registerCsiHandler({final:\"I\"},(e=>this.cursorForwardTab(e))),this._parser.registerCsiHandler({final:\"J\"},(e=>this.eraseInDisplay(e,!1))),this._parser.registerCsiHandler({prefix:\"?\",final:\"J\"},(e=>this.eraseInDisplay(e,!0))),this._parser.registerCsiHandler({final:\"K\"},(e=>this.eraseInLine(e,!1))),this._parser.registerCsiHandler({prefix:\"?\",final:\"K\"},(e=>this.eraseInLine(e,!0))),this._parser.registerCsiHandler({final:\"L\"},(e=>this.insertLines(e))),this._parser.registerCsiHandler({final:\"M\"},(e=>this.deleteLines(e))),this._parser.registerCsiHandler({final:\"P\"},(e=>this.deleteChars(e))),this._parser.registerCsiHandler({final:\"S\"},(e=>this.scrollUp(e))),this._parser.registerCsiHandler({final:\"T\"},(e=>this.scrollDown(e))),this._parser.registerCsiHandler({final:\"X\"},(e=>this.eraseChars(e))),this._parser.registerCsiHandler({final:\"Z\"},(e=>this.cursorBackwardTab(e))),this._parser.registerCsiHandler({final:\"`\"},(e=>this.charPosAbsolute(e))),this._parser.registerCsiHandler({final:\"a\"},(e=>this.hPositionRelative(e))),this._parser.registerCsiHandler({final:\"b\"},(e=>this.repeatPrecedingCharacter(e))),this._parser.registerCsiHandler({final:\"c\"},(e=>this.sendDeviceAttributesPrimary(e))),this._parser.registerCsiHandler({prefix:\">\",final:\"c\"},(e=>this.sendDeviceAttributesSecondary(e))),this._parser.registerCsiHandler({final:\"d\"},(e=>this.linePosAbsolute(e))),this._parser.registerCsiHandler({final:\"e\"},(e=>this.vPositionRelative(e))),this._parser.registerCsiHandler({final:\"f\"},(e=>this.hVPosition(e))),this._parser.registerCsiHandler({final:\"g\"},(e=>this.tabClear(e))),this._parser.registerCsiHandler({final:\"h\"},(e=>this.setMode(e))),this._parser.registerCsiHandler({prefix:\"?\",final:\"h\"},(e=>this.setModePrivate(e))),this._parser.registerCsiHandler({final:\"l\"},(e=>this.resetMode(e))),this._parser.registerCsiHandler({prefix:\"?\",final:\"l\"},(e=>this.resetModePrivate(e))),this._parser.registerCsiHandler({final:\"m\"},(e=>this.charAttributes(e))),this._parser.registerCsiHandler({final:\"n\"},(e=>this.deviceStatus(e))),this._parser.registerCsiHandler({prefix:\"?\",final:\"n\"},(e=>this.deviceStatusPrivate(e))),this._parser.registerCsiHandler({intermediates:\"!\",final:\"p\"},(e=>this.softReset(e))),this._parser.registerCsiHandler({intermediates:\" \",final:\"q\"},(e=>this.setCursorStyle(e))),this._parser.registerCsiHandler({final:\"r\"},(e=>this.setScrollRegion(e))),this._parser.registerCsiHandler({final:\"s\"},(e=>this.saveCursor(e))),this._parser.registerCsiHandler({final:\"t\"},(e=>this.windowOptions(e))),this._parser.registerCsiHandler({final:\"u\"},(e=>this.restoreCursor(e))),this._parser.registerCsiHandler({intermediates:\"'\",final:\"}\"},(e=>this.insertColumns(e))),this._parser.registerCsiHandler({intermediates:\"'\",final:\"~\"},(e=>this.deleteColumns(e))),this._parser.registerCsiHandler({intermediates:'\"',final:\"q\"},(e=>this.selectProtected(e))),this._parser.registerCsiHandler({intermediates:\"$\",final:\"p\"},(e=>this.requestMode(e,!0))),this._parser.registerCsiHandler({prefix:\"?\",intermediates:\"$\",final:\"p\"},(e=>this.requestMode(e,!1))),this._parser.setExecuteHandler(n.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(n.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(n.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(n.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(n.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(n.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(n.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(n.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(n.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(n.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new g.OscHandler((e=>(this.setTitle(e),this.setIconName(e),!0)))),this._parser.registerOscHandler(1,new g.OscHandler((e=>this.setIconName(e)))),this._parser.registerOscHandler(2,new g.OscHandler((e=>this.setTitle(e)))),this._parser.registerOscHandler(4,new g.OscHandler((e=>this.setOrReportIndexedColor(e)))),this._parser.registerOscHandler(8,new g.OscHandler((e=>this.setHyperlink(e)))),this._parser.registerOscHandler(10,new g.OscHandler((e=>this.setOrReportFgColor(e)))),this._parser.registerOscHandler(11,new g.OscHandler((e=>this.setOrReportBgColor(e)))),this._parser.registerOscHandler(12,new g.OscHandler((e=>this.setOrReportCursorColor(e)))),this._parser.registerOscHandler(104,new g.OscHandler((e=>this.restoreIndexedColor(e)))),this._parser.registerOscHandler(110,new g.OscHandler((e=>this.restoreFgColor(e)))),this._parser.registerOscHandler(111,new g.OscHandler((e=>this.restoreBgColor(e)))),this._parser.registerOscHandler(112,new g.OscHandler((e=>this.restoreCursorColor(e)))),this._parser.registerEscHandler({final:\"7\"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:\"8\"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:\"D\"},(()=>this.index())),this._parser.registerEscHandler({final:\"E\"},(()=>this.nextLine())),this._parser.registerEscHandler({final:\"H\"},(()=>this.tabSet())),this._parser.registerEscHandler({final:\"M\"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:\"=\"},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:\">\"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:\"c\"},(()=>this.fullReset())),this._parser.registerEscHandler({final:\"n\"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:\"o\"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:\"|\"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:\"}\"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:\"~\"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:\"%\",final:\"@\"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:\"%\",final:\"G\"},(()=>this.selectDefaultCharset()));for(const e in o.CHARSETS)this._parser.registerEscHandler({intermediates:\"(\",final:e},(()=>this.selectCharset(\"(\"+e))),this._parser.registerEscHandler({intermediates:\")\",final:e},(()=>this.selectCharset(\")\"+e))),this._parser.registerEscHandler({intermediates:\"*\",final:e},(()=>this.selectCharset(\"*\"+e))),this._parser.registerEscHandler({intermediates:\"+\",final:e},(()=>this.selectCharset(\"+\"+e))),this._parser.registerEscHandler({intermediates:\"-\",final:e},(()=>this.selectCharset(\"-\"+e))),this._parser.registerEscHandler({intermediates:\".\",final:e},(()=>this.selectCharset(\".\"+e))),this._parser.registerEscHandler({intermediates:\"/\",final:e},(()=>this.selectCharset(\"/\"+e)));this._parser.registerEscHandler({intermediates:\"#\",final:\"8\"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((e=>(this._logService.error(\"Parsing error: \",e),e))),this._parser.registerDcsHandler({intermediates:\"$\",final:\"q\"},new m.DcsHandler(((e,t)=>this.requestStatusString(e,t))))}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=v.LogLevelEnum.WARN&&Promise.race([e,new Promise(((e,t)=>setTimeout((()=>t(\"#SLOW_TIMEOUT\")),5e3)))]).catch((e=>{if(\"#SLOW_TIMEOUT\"!==e)throw e;console.warn(\"async parser handler taking longer than 5000 ms\")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0;const o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>b&&(n=this._parseStack.position+b)}if(this._logService.logLevel<=v.LogLevelEnum.DEBUG&&this._logService.debug(\"parsing data\"+(\"string\"==typeof e?` \"${e}\"`:` \"${Array.prototype.map.call(e,(e=>String.fromCharCode(e))).join(\"\")}\"`),\"string\"==typeof e?e.split(\"\").map((e=>e.charCodeAt(0))):e),this._parseBuffer.lengthb)for(let t=n;t0&&2===f.getWidth(this._activeBuffer.x-1)&&f.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let v=this._parser.precedingJoinState;for(let g=t;ga)if(h){const e=f;let t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&f instanceof l.BufferLine&&f.copyCellsFrom(e,t,0,m,!1);t=0;)f.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}else if(d&&(f.insertCells(this._activeBuffer.x,r-m,this._activeBuffer.getNullCell(u)),2===f.getWidth(a-1)&&f.setCellFromCodepoint(a-1,_.NULL_CELL_CODE,_.NULL_CELL_WIDTH,u)),f.setCellFromCodepoint(this._activeBuffer.x++,s,r,u),r>0)for(;--r;)f.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=v,this._activeBuffer.x0&&0===f.getWidth(this._activeBuffer.x)&&!f.hasContent(this._activeBuffer.x)&&f.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return\"t\"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,(e=>!w(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new m.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new g.OscHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){const t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){const t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){const t=e.params[0];return 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){const t=e.params[0];return 1===t&&(this._curAttrData.bg|=536870912),2!==t&&0!==t||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,s=!1,r=!1){const n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){const i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){let i;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);i=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 3:const e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let h=a;for(let e=1;e0||(this._is(\"xterm\")||this._is(\"rxvt-unicode\")||this._is(\"screen\")?this._coreService.triggerDataEvent(n.C0.ESC+\"[?1;2c\"):this._is(\"linux\")&&this._coreService.triggerDataEvent(n.C0.ESC+\"[?6c\")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(\"xterm\")?this._coreService.triggerDataEvent(n.C0.ESC+\"[>0;276;0c\"):this._is(\"rxvt-unicode\")?this._coreService.triggerDataEvent(n.C0.ESC+\"[>85;95;0c\"):this._is(\"linux\")?this._coreService.triggerDataEvent(e.params[0]+\"c\"):this._is(\"screen\")&&this._coreService.triggerDataEvent(n.C0.ESC+\"[>83;40003;0c\")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+\"\").indexOf(e)}setMode(e){for(let t=0;te?1:2,u=e.params[0];return f=u,v=t?2===u?4:4===u?_(o.modes.insertMode):12===u?3:20===u?_(d.convertEol):0:1===u?_(i.applicationCursorKeys):3===u?d.windowOptions.setWinLines?80===h?2:132===h?1:0:0:6===u?_(i.origin):7===u?_(i.wraparound):8===u?3:9===u?_(\"X10\"===s):12===u?_(d.cursorBlink):25===u?_(!o.isCursorHidden):45===u?_(i.reverseWraparound):66===u?_(i.applicationKeypad):67===u?4:1e3===u?_(\"VT200\"===s):1002===u?_(\"DRAG\"===s):1003===u?_(\"ANY\"===s):1004===u?_(i.sendFocus):1005===u?4:1006===u?_(\"SGR\"===r):1015===u?4:1016===u?_(\"SGR_PIXELS\"===r):1048===u?1:47===u||1047===u||1049===u?_(c===l):2004===u?_(i.bracketedPasteMode):0,o.triggerDataEvent(`${n.C0.ESC}[${t?\"\":\"?\"}${f};${v}$y`),!0;var f,v}_updateAttrColor(e,t,i,s,r){return 2===t?(e|=50331648,e&=-16777216,e|=f.AttributeData.fromColorRGB([i,s,r])):5===t&&(e&=-50331904,e|=33554432|255&i),e}_extractColor(e,t,i){const s=[0,0,-1,0,0,0];let r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){const i=e.getSubParams(t+n);let o=0;do{5===s[1]&&(r=1),s[n+o+1+r]=i[o]}while(++o=2||2===s[1]&&n+r>=5)break;s[1]&&(r=1)}while(++n+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=l.DEFAULT_ATTR_DATA.fg,e.bg=l.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;const t=e.length;let i;const s=this._curAttrData;for(let r=0;r=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777224|i-90):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777224|i-100):0===i?this._processSGR0(s):1===i?s.fg|=134217728:3===i?s.bg|=67108864:4===i?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):5===i?s.fg|=536870912:7===i?s.fg|=67108864:8===i?s.fg|=1073741824:9===i?s.fg|=2147483648:2===i?s.bg|=134217728:21===i?this._processUnderline(2,s):22===i?(s.fg&=-134217729,s.bg&=-134217729):23===i?s.bg&=-67108865:24===i?(s.fg&=-268435457,this._processUnderline(0,s)):25===i?s.fg&=-536870913:27===i?s.fg&=-67108865:28===i?s.fg&=-1073741825:29===i?s.fg&=2147483647:39===i?(s.fg&=-67108864,s.fg|=16777215&l.DEFAULT_ATTR_DATA.fg):49===i?(s.bg&=-67108864,s.bg|=16777215&l.DEFAULT_ATTR_DATA.bg):38===i||48===i||58===i?r+=this._extractColor(e,r,s):53===i?s.bg|=1073741824:55===i?s.bg&=-1073741825:59===i?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):100===i?(s.fg&=-67108864,s.fg|=16777215&l.DEFAULT_ATTR_DATA.fg,s.bg&=-67108864,s.bg|=16777215&l.DEFAULT_ATTR_DATA.bg):this._logService.debug(\"Unknown SGR attribute: %d.\",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);break;case 6:const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${n.C0.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=l.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){const t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle=\"block\";break;case 3:case 4:this._optionsService.options.cursorStyle=\"underline\";break;case 5:case 6:this._optionsService.options.cursorStyle=\"bar\"}const i=t%2==1;return this._optionsService.options.cursorBlink=i,!0}setScrollRegion(e){const t=e.params[0]||1;let i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||0===i)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!w(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;const t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(y.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(y.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){const t=[],i=e.split(\";\");for(;i.length>1;){const e=i.shift(),s=i.shift();if(/^\\d+$/.exec(e)){const i=parseInt(e);if(D(i))if(\"?\"===s)t.push({type:0,index:i});else{const e=(0,S.parseColor)(s);e&&t.push({type:1,index:i,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){const t=e.split(\";\");return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&this._finishHyperlink())}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();const i=e.split(\":\");let s;const r=i.findIndex((e=>e.startsWith(\"id=\")));return-1!==r&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){const i=e.split(\";\");for(let e=0;e=this._specialColors.length);++e,++t)if(\"?\"===i[e])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{const s=(0,S.parseColor)(i[e]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;const t=[],i=e.split(\";\");for(let e=0;e=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=l.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=l.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){const e=new u.CellData;e.content=1<<22|\"E\".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${n.C0.ESC}${e}${n.C0.ESC}\\\\`),!0))('\"q'===e?`P1$r${this._curAttrData.isProtected()?1:0}\"q`:'\"p'===e?'P1$r61;1\"p':\"r\"===e?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:\"m\"===e?\"P1$r0m\":\" q\"===e?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:\"P0$r\")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=k;let L=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){ethis.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(E=e,e=t,t=E),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function D(e){return 0<=e&&e<256}L=s([r(0,v.IBufferService)],L)},844:(e,t)=>{function i(e){for(const t of e)t.dispose();e.length=0}Object.defineProperty(t,\"__esModule\",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){const t=this._disposables.indexOf(e);-1!==t&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=i,t.getDisposeArrayDisposable=function(e){return{dispose:()=>i(e)}}},1505:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class i{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=i,t.FourKeyMap=class{constructor(){this._data=new i}set(e,t,s,r,n){this._data.get(e,t)||this._data.set(e,t,new i),this._data.get(e,t).set(s,r,n)}get(e,t,i,s){return this._data.get(e,t)?.get(i,s)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=\"undefined\"!=typeof process&&\"title\"in process;const i=t.isNode?\"node\":navigator.userAgent,s=t.isNode?\"node\":navigator.platform;t.isFirefox=i.includes(\"Firefox\"),t.isLegacyEdge=i.includes(\"Edge\"),t.isSafari=/^((?!chrome|android).)*safari/i.test(i),t.getSafariVersion=function(){if(!t.isSafari)return 0;const e=i.match(/Version\\/(\\d+)/);return null===e||e.length<2?0:parseInt(e[1])},t.isMac=[\"Macintosh\",\"MacIntel\",\"MacPPC\",\"Mac68K\"].includes(s),t.isIpad=\"iPad\"===s,t.isIphone=\"iPhone\"===s,t.isWindows=[\"Windows\",\"Win16\",\"Win32\",\"WinCE\"].includes(s),t.isLinux=s.indexOf(\"Linux\")>=0,t.isChromeOS=/\\bCrOS\\b/.test(i)},6106:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.SortedList=void 0;let i=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){0!==this._array.length?(i=this._search(this._getKey(e)),this._array.splice(i,0,e)):this._array.push(e)}delete(e){if(0===this._array.length)return!1;const t=this._getKey(e);if(void 0===t)return!1;if(i=this._search(t),-1===i)return!1;if(this._getKey(this._array[i])!==t)return!1;do{if(this._array[i]===e)return this._array.splice(i,1),!0}while(++i=this._array.length)&&this._getKey(this._array[i])===e))do{yield this._array[i]}while(++i=this._array.length)&&this._getKey(this._array[i])===e))do{t(this._array[i])}while(++i=t;){let s=t+i>>1;const r=this._getKey(this._array[s]);if(r>e)i=s-1;else{if(!(r0&&this._getKey(this._array[s-1])===e;)s--;return s}t=s+1}}return t}}},7226:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const s=i(6114);class r{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ir)return s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),void this._start();s=r}this.clear()}}class n extends r{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){const t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!s.isNode&&\"requestIdleCallback\"in window?class extends r{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.updateWindowsModeWrappedState=void 0;const s=i(643);t.updateWindowsModeWrappedState=function(e){const t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),i=t?.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&i&&(r.isWrapped=i[s.CHAR_DATA_CODE_INDEX]!==s.NULL_CELL_CODE&&i[s.CHAR_DATA_CODE_INDEX]!==s.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class i{constructor(){this.fg=0,this.bg=0,this.extended=new s}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){const e=new i;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return 50331648==(50331648&this.fg)}isBgRGB(){return 50331648==(50331648&this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return 0==(50331648&this.fg)}isBgDefault(){return 0==(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?50331648==(50331648&this.extended.underlineColor):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?0==(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=i;class s{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){const e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new s(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}}t.ExtendedAttrs=s},9092:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const s=i(6349),r=i(7226),n=i(3734),o=i(8437),a=i(4634),h=i(511),c=i(643),l=i(4863),d=i(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=o.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=h.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]),this._whitespaceCell=h.CellData.fromCharData([0,c.WHITESPACE_CELL_CHAR,c.WHITESPACE_CELL_WIDTH,c.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new r.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new s.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new n.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new n.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new o.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const e=this.ybase+this.y-this.ydisp;return e>=0&&et.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:i}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=o.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new s.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){const i=this.getNullCell(o.DEFAULT_ATTR_DATA);let s=0;const r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new o.BufferLine(e,i)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){const e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&\"conpty\"===e.backend&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){const i=(0,a.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(o.DEFAULT_ATTR_DATA));if(i.length>0){const s=(0,a.reflowLargerCreateNewLayout)(this.lines,i);(0,a.reflowLargerApplyNewLayout)(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){const s=this.getNullCell(o.DEFAULT_ATTR_DATA);let r=i;for(;r-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length=0;n--){let h=this.lines.get(n);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;const c=[h];for(;h.isWrapped&&n>0;)h=this.lines.get(--n),c.unshift(h);const l=this.ybase+this.y;if(l>=n&&l0&&(s.push({start:n+c.length+r,newLines:v}),r+=v.length),c.push(...v);let p=_.length-1,g=_[p];0===g&&(p--,g=_[p]);let m=c.length-u-1,S=d;for(;m>=0;){const e=Math.min(S,g);if(void 0===c[p])break;if(c[p].copyCellsFrom(c[m],S-e,g-e,e,!0),g-=e,0===g&&(p--,g=_[p]),S-=e,0===S){m--;const e=Math.max(m,0);S=(0,a.getWrappedLineTrimmedLength)(c,e,this._cols)}}for(let t=0;t0;)0===this.ybase?this.y0){const e=[],t=[];for(let e=0;e=0;c--)if(a&&a.start>n+h){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(c--,a.newLines[e]);c++,e.push({index:n+1,amount:a.newLines.length}),h+=a.newLines.length,a=s[++o]}else this.lines.set(c,t[n--]);let c=0;for(let t=e.length-1;t>=0;t--)e[t].index+=c,this.lines.onInsertEmitter.fire(e[t]),c+=e[t].amount;const l=Math.max(0,i+r-this.lines.maxLength);l>0&&this.lines.onTrimEmitter.fire(l)}}translateBufferLineToString(e,t,i=0,s){const r=this.lines.get(e);return r?r.translateToString(t,i,s):\"\"}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=e,t.line<0&&t.dispose()}))),t.register(this.lines.onInsert((e=>{t.line>=e.index&&(t.line+=e.amount)}))),t.register(this.lines.onDelete((e=>{t.line>=e.index&&t.linee.index&&(t.line-=e.amount)}))),t.register(t.onDispose((()=>this._removeMarker(t)))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const s=i(3734),r=i(511),n=i(643),o=i(482);t.DEFAULT_ATTR_DATA=Object.freeze(new s.AttributeData);let a=0;class h{constructor(e,t,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const s=t||r.CellData.fromCharData([0,n.NULL_CELL_CHAR,n.NULL_CELL_WIDTH,n.NULL_CELL_CODE]);for(let t=0;t>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]}set(e,t){this._data[3*e+1]=t[n.CHAR_DATA_ATTR_INDEX],t[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[n.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,o.stringFromCodePoint)(2097151&t):\"\"}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return a=3*e,t.content=this._data[a+0],t.fg=this._data[a+1],t.bg=this._data[a+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,i,s){268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=t|i<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,t,i){let s=this._data[3*e+0];2097152&s?this._combined[e]+=(0,o.stringFromCodePoint)(t):2097151&s?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&s)+(0,o.stringFromCodePoint)(t),s&=-2097152,s|=2097152):s=t|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[3*e+0]=s}insertCells(e,t,i){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,i),t=0;--i)this.setCell(e+t+i,this.loadCell(e+i,s));for(let s=0;sthis.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const e=new Uint32Array(i);e.set(this._data),this._data=e}for(let i=this.length;i=e&&delete this._combined[s]}const s=Object.keys(this._extendedAttrs);for(let t=0;t=e&&delete this._extendedAttrs[i]}}return this.length=e,4*i*2=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,i,s,r){const n=e._data;if(r)for(let r=s-1;r>=0;r--){for(let e=0;e<3;e++)this._data[3*(i+r)+e]=n[3*(t+r)+e];268435456&n[3*(t+r)+2]&&(this._extendedAttrs[i+r]=e._extendedAttrs[t+r])}else for(let r=0;r=t&&(this._combined[r-t+i]=e._combined[r])}}translateToString(e,t,i,s){t=t??0,i=i??this.length,e&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let r=\"\";for(;t>22||1}return s&&s.push(t),r}}t.BufferLine=h},4841:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}},4634:(e,t)=>{function i(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();const s=!e[t].hasContent(i-1)&&1===e[t].getWidth(i-1),r=2===e[t+1].getWidth(0);return s&&r?i-1:i}Object.defineProperty(t,\"__esModule\",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,s,r,n){const o=[];for(let a=0;a=a&&r0&&(e>d||0===l[e].getTrimmedLength());e--)v++;v>0&&(o.push(a+l.length-v),o.push(v)),a+=l.length-1}return o},t.reflowLargerCreateNewLayout=function(e,t){const i=[];let s=0,r=t[s],n=0;for(let o=0;oi(e,r,t))).reduce(((e,t)=>e+t));let o=0,a=0,h=0;for(;hc&&(o-=c,a++);const l=2===e[a].getWidth(o-1);l&&o--;const d=l?s-1:s;r.push(d),h+=d}return r},t.getWrappedLineTrimmedLength=i},5295:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.BufferSet=void 0;const s=i(8460),r=i(844),n=i(9092);class o extends r.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new s.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange(\"scrollback\",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange(\"tabStopWidth\",(()=>this.setupTabStops())))}reset(){this._normal=new n.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new n.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=o},511:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.CellData=void 0;const s=i(482),r=i(643),n=i(3734);class o extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=\"\"}static fromCharData(e){const t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,s.stringFromCodePoint)(2097151&this.content):\"\"}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[r.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[r.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[r.CHAR_DATA_CHAR_INDEX].length){const i=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){const s=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|e[r.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[r.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[r.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[r.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[r.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},643:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=\"\",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=\" \",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.Marker=void 0;const s=i(8460),r=i(844);class n{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=n._nextId++,this._onDispose=this.register(new s.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,r.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=n,n._nextId=1},7116:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={\"`\":\"◆\",a:\"▒\",b:\"␉\",c:\"␌\",d:\"␍\",e:\"␊\",f:\"°\",g:\"±\",h:\"␤\",i:\"␋\",j:\"┘\",k:\"┐\",l:\"┌\",m:\"└\",n:\"┼\",o:\"⎺\",p:\"⎻\",q:\"─\",r:\"⎼\",s:\"⎽\",t:\"├\",u:\"┤\",v:\"┴\",w:\"┬\",x:\"│\",y:\"≤\",z:\"≥\",\"{\":\"π\",\"|\":\"≠\",\"}\":\"£\",\"~\":\"·\"},t.CHARSETS.A={\"#\":\"£\"},t.CHARSETS.B=void 0,t.CHARSETS[4]={\"#\":\"£\",\"@\":\"¾\",\"[\":\"ij\",\"\\\\\":\"½\",\"]\":\"|\",\"{\":\"¨\",\"|\":\"f\",\"}\":\"¼\",\"~\":\"´\"},t.CHARSETS.C=t.CHARSETS[5]={\"[\":\"Ä\",\"\\\\\":\"Ö\",\"]\":\"Å\",\"^\":\"Ü\",\"`\":\"é\",\"{\":\"ä\",\"|\":\"ö\",\"}\":\"å\",\"~\":\"ü\"},t.CHARSETS.R={\"#\":\"£\",\"@\":\"à\",\"[\":\"°\",\"\\\\\":\"ç\",\"]\":\"§\",\"{\":\"é\",\"|\":\"ù\",\"}\":\"è\",\"~\":\"¨\"},t.CHARSETS.Q={\"@\":\"à\",\"[\":\"â\",\"\\\\\":\"ç\",\"]\":\"ê\",\"^\":\"î\",\"`\":\"ô\",\"{\":\"é\",\"|\":\"ù\",\"}\":\"è\",\"~\":\"û\"},t.CHARSETS.K={\"@\":\"§\",\"[\":\"Ä\",\"\\\\\":\"Ö\",\"]\":\"Ü\",\"{\":\"ä\",\"|\":\"ö\",\"}\":\"ü\",\"~\":\"ß\"},t.CHARSETS.Y={\"#\":\"£\",\"@\":\"§\",\"[\":\"°\",\"\\\\\":\"ç\",\"]\":\"é\",\"`\":\"ù\",\"{\":\"à\",\"|\":\"ò\",\"}\":\"è\",\"~\":\"ì\"},t.CHARSETS.E=t.CHARSETS[6]={\"@\":\"Ä\",\"[\":\"Æ\",\"\\\\\":\"Ø\",\"]\":\"Å\",\"^\":\"Ü\",\"`\":\"ä\",\"{\":\"æ\",\"|\":\"ø\",\"}\":\"å\",\"~\":\"ü\"},t.CHARSETS.Z={\"#\":\"£\",\"@\":\"§\",\"[\":\"¡\",\"\\\\\":\"Ñ\",\"]\":\"¿\",\"{\":\"°\",\"|\":\"ñ\",\"}\":\"ç\"},t.CHARSETS.H=t.CHARSETS[7]={\"@\":\"É\",\"[\":\"Ä\",\"\\\\\":\"Ö\",\"]\":\"Å\",\"^\":\"Ü\",\"`\":\"é\",\"{\":\"ä\",\"|\":\"ö\",\"}\":\"å\",\"~\":\"ü\"},t.CHARSETS[\"=\"]={\"#\":\"ù\",\"@\":\"à\",\"[\":\"é\",\"\\\\\":\"ç\",\"]\":\"ê\",\"^\":\"î\",_:\"è\",\"`\":\"ô\",\"{\":\"ä\",\"|\":\"ö\",\"}\":\"ü\",\"~\":\"û\"}},2584:(e,t)=>{var i,s,r;Object.defineProperty(t,\"__esModule\",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(e){e.NUL=\"\\0\",e.SOH=\"\u0001\",e.STX=\"\u0002\",e.ETX=\"\u0003\",e.EOT=\"\u0004\",e.ENQ=\"\u0005\",e.ACK=\"\u0006\",e.BEL=\"\u0007\",e.BS=\"\\b\",e.HT=\"\\t\",e.LF=\"\\n\",e.VT=\"\\v\",e.FF=\"\\f\",e.CR=\"\\r\",e.SO=\"\u000e\",e.SI=\"\u000f\",e.DLE=\"\u0010\",e.DC1=\"\u0011\",e.DC2=\"\u0012\",e.DC3=\"\u0013\",e.DC4=\"\u0014\",e.NAK=\"\u0015\",e.SYN=\"\u0016\",e.ETB=\"\u0017\",e.CAN=\"\u0018\",e.EM=\"\u0019\",e.SUB=\"\u001a\",e.ESC=\"\u001b\",e.FS=\"\u001c\",e.GS=\"\u001d\",e.RS=\"\u001e\",e.US=\"\u001f\",e.SP=\" \",e.DEL=\"\"}(i||(t.C0=i={})),function(e){e.PAD=\"€\",e.HOP=\"\",e.BPH=\"‚\",e.NBH=\"ƒ\",e.IND=\"„\",e.NEL=\"…\",e.SSA=\"†\",e.ESA=\"‡\",e.HTS=\"ˆ\",e.HTJ=\"‰\",e.VTS=\"Š\",e.PLD=\"‹\",e.PLU=\"Œ\",e.RI=\"\",e.SS2=\"Ž\",e.SS3=\"\",e.DCS=\"\",e.PU1=\"‘\",e.PU2=\"’\",e.STS=\"“\",e.CCH=\"”\",e.MW=\"•\",e.SPA=\"–\",e.EPA=\"—\",e.SOS=\"˜\",e.SGCI=\"™\",e.SCI=\"š\",e.CSI=\"›\",e.ST=\"œ\",e.OSC=\"\",e.PM=\"ž\",e.APC=\"Ÿ\"}(s||(t.C1=s={})),function(e){e.ST=`${i.ESC}\\\\`}(r||(t.C1_ESCAPED=r={}))},7399:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.evaluateKeyboardEvent=void 0;const s=i(2584),r={48:[\"0\",\")\"],49:[\"1\",\"!\"],50:[\"2\",\"@\"],51:[\"3\",\"#\"],52:[\"4\",\"$\"],53:[\"5\",\"%\"],54:[\"6\",\"^\"],55:[\"7\",\"&\"],56:[\"8\",\"*\"],57:[\"9\",\"(\"],186:[\";\",\":\"],187:[\"=\",\"+\"],188:[\",\",\"<\"],189:[\"-\",\"_\"],190:[\".\",\">\"],191:[\"/\",\"?\"],192:[\"`\",\"~\"],219:[\"[\",\"{\"],220:[\"\\\\\",\"|\"],221:[\"]\",\"}\"],222:[\"'\",'\"']};t.evaluateKeyboardEvent=function(e,t,i,n){const o={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:\"UIKeyInputUpArrow\"===e.key?o.key=t?s.C0.ESC+\"OA\":s.C0.ESC+\"[A\":\"UIKeyInputLeftArrow\"===e.key?o.key=t?s.C0.ESC+\"OD\":s.C0.ESC+\"[D\":\"UIKeyInputRightArrow\"===e.key?o.key=t?s.C0.ESC+\"OC\":s.C0.ESC+\"[C\":\"UIKeyInputDownArrow\"===e.key&&(o.key=t?s.C0.ESC+\"OB\":s.C0.ESC+\"[B\");break;case 8:o.key=e.ctrlKey?\"\\b\":s.C0.DEL,e.altKey&&(o.key=s.C0.ESC+o.key);break;case 9:if(e.shiftKey){o.key=s.C0.ESC+\"[Z\";break}o.key=s.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?s.C0.ESC+s.C0.CR:s.C0.CR,o.cancel=!0;break;case 27:o.key=s.C0.ESC,e.altKey&&(o.key=s.C0.ESC+s.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;a?(o.key=s.C0.ESC+\"[1;\"+(a+1)+\"D\",o.key===s.C0.ESC+\"[1;3D\"&&(o.key=s.C0.ESC+(i?\"b\":\"[1;5D\"))):o.key=t?s.C0.ESC+\"OD\":s.C0.ESC+\"[D\";break;case 39:if(e.metaKey)break;a?(o.key=s.C0.ESC+\"[1;\"+(a+1)+\"C\",o.key===s.C0.ESC+\"[1;3C\"&&(o.key=s.C0.ESC+(i?\"f\":\"[1;5C\"))):o.key=t?s.C0.ESC+\"OC\":s.C0.ESC+\"[C\";break;case 38:if(e.metaKey)break;a?(o.key=s.C0.ESC+\"[1;\"+(a+1)+\"A\",i||o.key!==s.C0.ESC+\"[1;3A\"||(o.key=s.C0.ESC+\"[1;5A\")):o.key=t?s.C0.ESC+\"OA\":s.C0.ESC+\"[A\";break;case 40:if(e.metaKey)break;a?(o.key=s.C0.ESC+\"[1;\"+(a+1)+\"B\",i||o.key!==s.C0.ESC+\"[1;3B\"||(o.key=s.C0.ESC+\"[1;5B\")):o.key=t?s.C0.ESC+\"OB\":s.C0.ESC+\"[B\";break;case 45:e.shiftKey||e.ctrlKey||(o.key=s.C0.ESC+\"[2~\");break;case 46:o.key=a?s.C0.ESC+\"[3;\"+(a+1)+\"~\":s.C0.ESC+\"[3~\";break;case 36:o.key=a?s.C0.ESC+\"[1;\"+(a+1)+\"H\":t?s.C0.ESC+\"OH\":s.C0.ESC+\"[H\";break;case 35:o.key=a?s.C0.ESC+\"[1;\"+(a+1)+\"F\":t?s.C0.ESC+\"OF\":s.C0.ESC+\"[F\";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=s.C0.ESC+\"[5;\"+(a+1)+\"~\":o.key=s.C0.ESC+\"[5~\";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=s.C0.ESC+\"[6;\"+(a+1)+\"~\":o.key=s.C0.ESC+\"[6~\";break;case 112:o.key=a?s.C0.ESC+\"[1;\"+(a+1)+\"P\":s.C0.ESC+\"OP\";break;case 113:o.key=a?s.C0.ESC+\"[1;\"+(a+1)+\"Q\":s.C0.ESC+\"OQ\";break;case 114:o.key=a?s.C0.ESC+\"[1;\"+(a+1)+\"R\":s.C0.ESC+\"OR\";break;case 115:o.key=a?s.C0.ESC+\"[1;\"+(a+1)+\"S\":s.C0.ESC+\"OS\";break;case 116:o.key=a?s.C0.ESC+\"[15;\"+(a+1)+\"~\":s.C0.ESC+\"[15~\";break;case 117:o.key=a?s.C0.ESC+\"[17;\"+(a+1)+\"~\":s.C0.ESC+\"[17~\";break;case 118:o.key=a?s.C0.ESC+\"[18;\"+(a+1)+\"~\":s.C0.ESC+\"[18~\";break;case 119:o.key=a?s.C0.ESC+\"[19;\"+(a+1)+\"~\":s.C0.ESC+\"[19~\";break;case 120:o.key=a?s.C0.ESC+\"[20;\"+(a+1)+\"~\":s.C0.ESC+\"[20~\";break;case 121:o.key=a?s.C0.ESC+\"[21;\"+(a+1)+\"~\":s.C0.ESC+\"[21~\";break;case 122:o.key=a?s.C0.ESC+\"[23;\"+(a+1)+\"~\":s.C0.ESC+\"[23~\";break;case 123:o.key=a?s.C0.ESC+\"[24;\"+(a+1)+\"~\":s.C0.ESC+\"[24~\";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(i&&!n||!e.altKey||e.metaKey)!i||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?o.key=e.key:e.key&&e.ctrlKey&&(\"_\"===e.key&&(o.key=s.C0.US),\"@\"===e.key&&(o.key=s.C0.NUL)):65===e.keyCode&&(o.type=1);else{const t=r[e.keyCode],i=t?.[e.shiftKey?1:0];if(i)o.key=s.C0.ESC+i;else if(e.keyCode>=65&&e.keyCode<=90){const t=e.ctrlKey?e.keyCode-64:e.keyCode+32;let i=String.fromCharCode(t);e.shiftKey&&(i=i.toUpperCase()),o.key=s.C0.ESC+i}else if(32===e.keyCode)o.key=s.C0.ESC+(e.ctrlKey?s.C0.NUL:\" \");else if(\"Dead\"===e.key&&e.code.startsWith(\"Key\")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),o.key=s.C0.ESC+t,o.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?o.key=s.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?o.key=s.C0.DEL:219===e.keyCode?o.key=s.C0.ESC:220===e.keyCode?o.key=s.C0.FS:221===e.keyCode&&(o.key=s.C0.GS)}return o}},482:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,i=e.length){let s=\"\";for(let r=t;r65535?(t-=65536,s+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):s+=String.fromCharCode(t)}return s},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){const i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){const i=e.charCodeAt(r++);56320<=i&&i<=57343?t[s++]=1024*(this._interim-55296)+i-56320+65536:(t[s++]=this._interim,t[s++]=i),this._interim=0}for(let n=r;n=i)return this._interim=r,s;const o=e.charCodeAt(n);56320<=o&&o<=57343?t[s++]=1024*(r-55296)+o-56320+65536:(t[s++]=r,t[s++]=o)}else 65279!==r&&(t[s++]=r)}return s}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){const i=e.length;if(!i)return 0;let s,r,n,o,a=0,h=0,c=0;if(this.interim[0]){let s=!1,r=this.interim[0];r&=192==(224&r)?31:224==(240&r)?15:7;let n,o=0;for(;(n=63&this.interim[++o])&&o<4;)r<<=6,r|=n;const h=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,l=h-o;for(;c=i)return 0;if(n=e[c++],128!=(192&n)){c--,s=!0;break}this.interim[o++]=n,r<<=6,r|=63&n}s||(2===h?r<128?c--:t[a++]=r:3===h?r<2048||r>=55296&&r<=57343||65279===r||(t[a++]=r):r<65536||r>1114111||(t[a++]=r)),this.interim.fill(0)}const l=i-4;let d=c;for(;d=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(h=(31&s)<<6|63&r,h<128){d--;continue}t[a++]=h}else if(224==(240&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,a;if(n=e[d++],128!=(192&n)){d--;continue}if(h=(15&s)<<12|(63&r)<<6|63&n,h<2048||h>=55296&&h<=57343||65279===h)continue;t[a++]=h}else if(240==(248&s)){if(d>=i)return this.interim[0]=s,a;if(r=e[d++],128!=(192&r)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,a;if(n=e[d++],128!=(192&n)){d--;continue}if(d>=i)return this.interim[0]=s,this.interim[1]=r,this.interim[2]=n,a;if(o=e[d++],128!=(192&o)){d--;continue}if(h=(7&s)<<18|(63&r)<<12|(63&n)<<6|63&o,h<65536||h>1114111)continue;t[a++]=h}}return a}}},225:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.UnicodeV6=void 0;const s=i(1480),r=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],n=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let o;t.UnicodeV6=class{constructor(){if(this.version=\"6\",!o){o=new Uint8Array(65536),o.fill(1),o[0]=0,o.fill(0,1,32),o.fill(0,127,160),o.fill(2,4352,4448),o[9001]=2,o[9002]=2,o.fill(2,11904,42192),o[12351]=1,o.fill(2,44032,55204),o.fill(2,63744,64256),o.fill(2,65040,65050),o.fill(2,65072,65136),o.fill(2,65280,65377),o.fill(2,65504,65511);for(let e=0;et[r][1])return!1;for(;r>=s;)if(i=s+r>>1,e>t[i][1])s=i+1;else{if(!(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=0===i&&0!==t;if(r){const e=s.UnicodeService.extractWidth(t);0===e?r=!1:e>i&&(i=e)}return s.UnicodeService.createPropertyValue(0,i,r)}}},5981:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.WriteBuffer=void 0;const s=i(8460),r=i(844);class n extends r.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new s.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let i;for(this._isSyncWriting=!0;i=this._writeBuffer.shift();){this._action(i);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw new Error(\"write data discarded, use flow control to avoid losing data\");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){const i=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],s=this._action(e,t);if(s){const e=e=>Date.now()-i>=12?setTimeout((()=>this._innerWrite(0,e))):this._innerWrite(i,e);return void s.catch((e=>(queueMicrotask((()=>{throw e})),Promise.resolve(!1)))).then(e)}const r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-i>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=n},5941:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.toRgbString=t.parseColor=void 0;const i=/^([\\da-f])\\/([\\da-f])\\/([\\da-f])$|^([\\da-f]{2})\\/([\\da-f]{2})\\/([\\da-f]{2})$|^([\\da-f]{3})\\/([\\da-f]{3})\\/([\\da-f]{3})$|^([\\da-f]{4})\\/([\\da-f]{4})\\/([\\da-f]{4})$/,s=/^[\\da-f]+$/;function r(e,t){const i=e.toString(16),s=i.length<2?\"0\"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(0===t.indexOf(\"rgb:\")){t=t.slice(4);const e=i.exec(t);if(e){const t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(0===t.indexOf(\"#\")&&(t=t.slice(1),s.exec(t)&&[3,6,9,12].includes(t.length))){const e=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){const r=parseInt(t.slice(e*s,e*s+e),16);i[s]=1===e?r<<4:2===e?r:3===e?r>>4:r>>8}return i}},t.toRgbString=function(e,t=16){const[i,s,n]=e;return`rgb:${r(i,t)}/${r(s,t)}/${r(n,t)}`}},5770:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const s=i(482),r=i(8742),n=i(5770),o=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=o,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t);else this._handlerFb(this._ident,\"HOOK\",t)}put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._ident,\"PUT\",(0,s.utf32ToString)(e,t,i))}unhook(e,t=!0){if(this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].unhook(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,\"UNHOOK\",e);this._active=o,this._ident=0}};const a=new r.Params;a.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data=\"\",this._params=a,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():a,this._data=\"\",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,s.utf32ToString)(e,t,i),this._data.length>n.PAYLOAD_LIMIT&&(this._data=\"\",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then((e=>(this._params=a,this._data=\"\",this._hitLimit=!1,e)));return this._params=a,this._data=\"\",this._hitLimit=!1,t}}},2015:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const s=i(844),r=i(8742),n=i(6242),o=i(6351);class a{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,s){this.table[t<<8|e]=i<<4|s}addMany(e,t,i,s){for(let r=0;rt)),i=(e,i)=>t.slice(e,i),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));const n=i(0,14);let o;for(o in e.setDefault(1,0),e.addMany(s,0,2,0),n)e.addMany([24,26,153,154],o,3,0),e.addMany(i(128,144),o,3,0),e.addMany(i(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(h,0,2,0),e.add(h,8,5,8),e.add(h,6,0,6),e.add(h,11,0,11),e.add(h,13,13,13),e}();class c extends s.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new r.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,i)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,s.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new n.OscParser),this._dcsParser=this.register(new o.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:\"\\\\\"},(()=>!0))}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error(\"only one byte as prefix supported\");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error(\"prefix must be in range 0x3c .. 0x3f\")}if(e.intermediates){if(e.intermediates.length>2)throw new Error(\"only two bytes as intermediates are supported\");for(let t=0;ts||s>47)throw new Error(\"intermediate must be in range 0x20 .. 0x2f\");i<<=8,i|=s}}if(1!==e.final.length)throw new Error(\"final must be a single byte\");const s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=s,i}identToString(e){const t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join(\"\")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){const i=this._identifier(e,[48,126]);void 0===this._escHandlers[i]&&(this._escHandlers[i]=[]);const s=this._escHandlers[i];return s.push(t),{dispose:()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){const i=this._identifier(e);void 0===this._csiHandlers[i]&&(this._csiHandlers[i]=[]);const s=this._csiHandlers[i];return s.push(t),{dispose:()=>{const e=s.indexOf(t);-1!==e&&s.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s,r=0,n=0,o=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===i||1===this._parseStack.state)throw this._parseStack.state=1,new Error(\"improper continuation due to previous async handler, giving up parsing\");const t=this._parseStack.handlers;let n=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===i&&n>-1)for(;n>=0&&(s=t[n](this._params),!0!==s);n--)if(s instanceof Promise)return this._parseStack.handlerPos=n,s;this._parseStack.handlers=[];break;case 4:if(!1===i&&n>-1)for(;n>=0&&(s=t[n](),!0!==s);n--)if(s instanceof Promise)return this._parseStack.handlerPos=n,s;this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],s=this._dcsParser.unhook(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],s=this._oscParser.end(24!==r&&26!==r,i),s)return s;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let i=o;i>4){case 2:for(let s=i+1;;++s){if(s>=t||(r=e[s])<32||r>126&&r=t||(r=e[s])<32||r>126&&r=t||(r=e[s])<32||r>126&&r=t||(r=e[s])<32||r>126&&r=0&&(s=o[a](this._params),!0!==s);a--)if(s instanceof Promise)return this._preserveStack(3,o,a,n,i),s;a<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do{switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}}while(++i47&&r<60);i--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:const c=this._escHandlers[this._collect<<8|r];let l=c?c.length-1:-1;for(;l>=0&&(s=c[l](),!0!==s);l--)if(s instanceof Promise)return this._preserveStack(4,c,l,n,i),s;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let s=i+1;;++s)if(s>=t||24===(r=e[s])||26===r||27===r||r>127&&r=t||(r=e[s])<32||r>127&&r{Object.defineProperty(t,\"__esModule\",{value:!0}),t.OscHandler=t.OscParser=void 0;const s=i(5770),r=i(482),n=[];t.OscParser=class{constructor(){this._state=0,this._active=n,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const i=this._handlers[e];return i.push(t),{dispose:()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=n}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=n,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||n,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,\"START\")}_put(e,t,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i);else this._handlerFb(this._id,\"PUT\",(0,r.utf32ToString)(e,t,i))}start(){this.reset(),this._state=1}put(e,t,i){if(3!==this._state){if(1===this._state)for(;t0&&this._put(e,t,i)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&!1===i){for(;s>=0&&(i=this._active[s].end(e),!0!==i);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,\"END\",e);this._active=n,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data=\"\",this._hitLimit=!1}start(){this._data=\"\",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=(0,r.utf32ToString)(e,t,i),this._data.length>s.PAYLOAD_LIMIT&&(this._data=\"\",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then((e=>(this._data=\"\",this._hitLimit=!1,e)));return this._data=\"\",this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.Params=void 0;const i=2147483647;class s{static fromArray(e){const t=new s;if(!e.length)return t;for(let i=Array.isArray(e[0])?1:0;i256)throw new Error(\"maxSubParamsLength must not be greater than 256\");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const e=new s(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){const e=[];for(let t=0;t>8,s=255&this._subParamsIdx[t];s-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error(\"values lesser than -1 are not allowed\");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>i?i:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error(\"values lesser than -1 are not allowed\");this._subParams[this._subParamsLength++]=e>i?i:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){const t=this._subParamsIdx[e]>>8,i=255&this._subParamsIdx[e];return i-t>0?this._subParams.subarray(t,i):null}getSubParamsAll(){const e={};for(let t=0;t>8,s=255&this._subParamsIdx[t];s-i>0&&(e[t]=this._subParams.slice(i,s))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const s=this._digitIsSub?this._subParams:this.params,r=s[t-1];s[t-1]=~r?Math.min(10*r+e,i):e}}t.Params=s},5741:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){const i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i{Object.defineProperty(t,\"__esModule\",{value:!0}),t.BufferApiView=void 0;const s=i(3785),r=i(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){const t=this._buffer.lines.get(e);if(t)return new s.BufferLineApiView(t)}getNullCell(){return new r.CellData}}},3785:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.BufferLineApiView=void 0;const s=i(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new s.CellData)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}}},8285:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.BufferNamespaceApi=void 0;const s=i(8771),r=i(8460),n=i(844);class o extends n.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new r.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new s.BufferApiView(this._core.buffers.normal,\"normal\"),this._alternate=new s.BufferApiView(this._core.buffers.alt,\"alternate\"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error(\"Active buffer is neither normal nor alternate\")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=o},7975:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,(e=>t(e.toArray())))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,((e,i)=>t(e,i.toArray())))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const n=i(8460),o=i(844),a=i(5295),h=i(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let c=t.BufferService=class extends o.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new n.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new a.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){const i=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;const r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(0===i.scrollTop){const e=i.lines.isFull;n===i.lines.length-1?e?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),e?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const e=n-r+1;i.lines.shiftElements(r+1,e-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t,i){const s=this.buffer;if(e<0){if(0===s.ydisp)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const r=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),r!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};t.BufferService=c=s([r(0,h.IOptionsService)],c)},7994:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.CoreMouseService=void 0;const n=i(2585),o=i(8460),a=i(844),h={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function c(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(i|=64,i|=e.action):(i|=3&e.button,4&e.button&&(i|=64),8&e.button&&(i|=128),32===e.action?i|=32:0!==e.action||t||(i|=3)),i}const l=String.fromCharCode,d={DEFAULT:e=>{const t=[c(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?\"\":`\u001b[M${l(t[0])}${l(t[1])}${l(t[2])}`},SGR:e=>{const t=0===e.action&&4!==e.button?\"m\":\"M\";return`\u001b[<${c(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{const t=0===e.action&&4!==e.button?\"m\":\"M\";return`\u001b[<${c(e,!0)};${e.x};${e.y}${t}`}};let _=t.CoreMouseService=class extends a.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol=\"\",this._activeEncoding=\"\",this._lastEvent=null,this._onProtocolChange=this.register(new o.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const e of Object.keys(h))this.addProtocol(e,h[e]);for(const e of Object.keys(d))this.addEncoding(e,d[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol \"${e}\"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding \"${e}\"`);this._activeEncoding=e}reset(){this.activeProtocol=\"NONE\",this.activeEncoding=\"DEFAULT\",this._lastEvent=null}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,\"SGR_PIXELS\"===this._activeEncoding))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;const t=this._encodings[this._activeEncoding](e);return t&&(\"DEFAULT\"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x)return!1;if(e.y!==t.y)return!1}else{if(e.col!==t.col)return!1;if(e.row!==t.row)return!1}return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=_=s([r(0,n.IBufferService),r(1,n.ICoreService)],_)},6975:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.CoreService=void 0;const n=i(1439),o=i(8460),a=i(844),h=i(2585),c=Object.freeze({insertMode:!1}),l=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let d=t.CoreService=class extends a.Disposable{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new o.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new o.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new o.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new o.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,n.clone)(c),this.decPrivateModes=(0,n.clone)(l)}reset(){this.modes=(0,n.clone)(c),this.decPrivateModes=(0,n.clone)(l)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;const i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data \"${e}\"`,(()=>e.split(\"\").map((e=>e.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary \"${e}\"`,(()=>e.split(\"\").map((e=>e.charCodeAt(0))))),this._onBinary.fire(e))}};t.CoreService=d=s([r(0,h.IBufferService),r(1,h.ILogService),r(2,h.IOptionsService)],d)},9074:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.DecorationService=void 0;const s=i(8055),r=i(8460),n=i(844),o=i(6106);let a=0,h=0;class c extends n.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new o.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new r.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new r.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,n.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;const t=new l(e);if(t){const e=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(const e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let s=0,r=0;for(const n of this._decorations.getKeyIterator(t))s=n.options.x??0,r=s+(n.options.width??1),e>=s&&e{a=t.options.x??0,h=a+(t.options.width??1),e>=a&&e{Object.defineProperty(t,\"__esModule\",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const s=i(2585),r=i(8343);class n{constructor(...e){this._entries=new Map;for(const[t,i]of e)this.set(t,i)}set(e,t){const i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(const[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=n,t.InstantiationService=class{constructor(){this._services=new n,this._services.set(s.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){const i=(0,r.getServiceDependencies)(e).sort(((e,t)=>e.index-t.index)),s=[];for(const t of i){const i=this._services.get(t.id);if(!i)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id}.`);s.push(i)}const n=i.length>0?i[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...[...t,...s])}}},7866:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=i(844),o=i(2585),a={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF};let h,c=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(\"logLevel\",(()=>this._updateLogLevel()))),h=this}_updateLogLevel(){this._logLevel=a[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tJSON.stringify(e))).join(\", \")})`);const t=s.apply(this,e);return h.trace(`GlyphRenderer#${s.name} return`,t),t}}},7302:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const s=i(8460),r=i(844),n=i(6114);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:\"block\",cursorWidth:1,cursorInactiveStyle:\"outline\",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:\"alt\",fastScrollSensitivity:5,fontFamily:\"courier-new, courier, monospace\",fontSize:15,fontWeight:\"normal\",fontWeightBold:\"bold\",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:\"info\",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:n.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:\" ()[]{}',\\\"`\",altClickMovesCursor:!0,convertEol:!1,termName:\"xterm\",cancelEvents:!1,overviewRulerWidth:0};const o=[\"normal\",\"bold\",\"100\",\"200\",\"300\",\"400\",\"500\",\"600\",\"700\",\"800\",\"900\"];class a extends r.Disposable{constructor(e){super(),this._onOptionChange=this.register(new s.EventEmitter),this.onOptionChange=this._onOptionChange.event;const i={...t.DEFAULT_OPTIONS};for(const t in e)if(t in i)try{const s=e[t];i[t]=this._sanitizeAndValidateOption(t,s)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,r.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(e,t){return this.onOptionChange((i=>{i===e&&t(this.rawOptions[e])}))}onMultipleOptionChange(e,t){return this.onOptionChange((i=>{-1!==e.indexOf(i)&&t()}))}_setupOptions(){const e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key \"${e}\"`);return this.rawOptions[e]},i=(e,i)=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key \"${e}\"`);i=this._sanitizeAndValidateOption(e,i),this.rawOptions[e]!==i&&(this.rawOptions[e]=i,this._onOptionChange.fire(e))};for(const t in this.rawOptions){const s={get:e.bind(this,t),set:i.bind(this,t)};Object.defineProperty(this.options,t,s)}}_sanitizeAndValidateOption(e,i){switch(e){case\"cursorStyle\":if(i||(i=t.DEFAULT_OPTIONS[e]),!function(e){return\"block\"===e||\"underline\"===e||\"bar\"===e}(i))throw new Error(`\"${i}\" is not a valid value for ${e}`);break;case\"wordSeparator\":i||(i=t.DEFAULT_OPTIONS[e]);break;case\"fontWeight\":case\"fontWeightBold\":if(\"number\"==typeof i&&1<=i&&i<=1e3)break;i=o.includes(i)?i:t.DEFAULT_OPTIONS[e];break;case\"cursorWidth\":i=Math.floor(i);case\"lineHeight\":case\"tabStopWidth\":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case\"minimumContrastRatio\":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case\"scrollback\":if((i=Math.min(i,4294967295))<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case\"fastScrollSensitivity\":case\"scrollSensitivity\":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case\"rows\":case\"cols\":if(!i&&0!==i)throw new Error(`${e} must be numeric, value: ${i}`);break;case\"windowsPty\":i=i??{}}return i}}t.OptionsService=a},2660:function(e,t,i){var s=this&&this.__decorate||function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},r=this&&this.__param||function(e,t){return function(i,s){t(i,s,e)}};Object.defineProperty(t,\"__esModule\",{value:!0}),t.OscLinkService=void 0;const n=i(2585);let o=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){const t=this._bufferService.buffer;if(void 0===e.id){const i=t.addMarker(t.ybase+t.y),s={data:e,id:this._nextId++,lines:[i]};return i.onDispose((()=>this._removeMarkerFromLink(s,i))),this._dataByLinkId.set(s.id,s),s.id}const i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;const n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose((()=>this._removeMarkerFromLink(o,n))),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){const i=this._dataByLinkId.get(e);if(i&&i.lines.every((e=>e.line!==t))){const e=this._bufferService.buffer.addMarker(t);i.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(i,e)))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){const i=e.lines.indexOf(t);-1!==i&&(e.lines.splice(i,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=o=s([r(0,n.IBufferService)],o)},8343:(e,t)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const i=\"di$target\",s=\"di$dependencies\";t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[s]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);const r=function(e,t,n){if(3!==arguments.length)throw new Error(\"@IServiceName-decorator can only be used to decorate a parameter\");!function(e,t,r){t[i]===t?t[s].push({id:e,index:r}):(t[s]=[{id:e,index:r}],t[i]=t)}(r,e,n)};return r.toString=()=>e,t.serviceRegistry.set(e,r),r}},2585:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const s=i(8343);var r;t.IBufferService=(0,s.createDecorator)(\"BufferService\"),t.ICoreMouseService=(0,s.createDecorator)(\"CoreMouseService\"),t.ICoreService=(0,s.createDecorator)(\"CoreService\"),t.ICharsetService=(0,s.createDecorator)(\"CharsetService\"),t.IInstantiationService=(0,s.createDecorator)(\"InstantiationService\"),function(e){e[e.TRACE=0]=\"TRACE\",e[e.DEBUG=1]=\"DEBUG\",e[e.INFO=2]=\"INFO\",e[e.WARN=3]=\"WARN\",e[e.ERROR=4]=\"ERROR\",e[e.OFF=5]=\"OFF\"}(r||(t.LogLevelEnum=r={})),t.ILogService=(0,s.createDecorator)(\"LogService\"),t.IOptionsService=(0,s.createDecorator)(\"OptionsService\"),t.IOscLinkService=(0,s.createDecorator)(\"OscLinkService\"),t.IUnicodeService=(0,s.createDecorator)(\"UnicodeService\"),t.IDecorationService=(0,s.createDecorator)(\"DecorationService\")},1480:(e,t,i)=>{Object.defineProperty(t,\"__esModule\",{value:!0}),t.UnicodeService=void 0;const s=i(8460),r=i(225);class n{static extractShouldJoin(e){return 0!=(1&e)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,i=!1){return(16777215&e)<<3|(3&t)<<1|(i?1:0)}constructor(){this._providers=Object.create(null),this._active=\"\",this._onChange=new s.EventEmitter,this.onChange=this._onChange.event;const e=new r.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version \"${e}\"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,i=0;const s=e.length;for(let r=0;r=s)return t+this.wcwidth(o);const i=e.charCodeAt(r);56320<=i&&i<=57343?o=1024*(o-55296)+i-56320+65536:t+=this.wcwidth(i)}const a=this.charProperties(o,i);let h=n.extractWidth(a);n.extractShouldJoin(a)&&(h-=n.extractWidth(i)),t+=h,i=a}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}}t.UnicodeService=n}},t={};function i(s){var r=t[s];if(void 0!==r)return r.exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,i),n.exports}var s={};return(()=>{var e=s;Object.defineProperty(e,\"__esModule\",{value:!0}),e.Terminal=void 0;const t=i(9042),r=i(3236),n=i(844),o=i(5741),a=i(8285),h=i(7975),c=i(7090),l=[\"cols\",\"rows\"];class d extends n.Disposable{constructor(e){super(),this._core=this.register(new r.Terminal(e)),this._addonManager=this.register(new o.AddonManager),this._publicOptions={...this._core.options};const t=e=>this._core.options[e],i=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(const e in this._core.options){const s={get:t.bind(this,e),set:i.bind(this,e)};Object.defineProperty(this._publicOptions,e,s)}}_checkReadonlyOptions(e){if(l.includes(e))throw new Error(`Option \"${e}\" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error(\"You must set the allowProposedApi option to true to use proposed API\")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new h.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new c.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new a.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const e=this._core.coreService.decPrivateModes;let t=\"none\";switch(this._core.coreMouseService.activeProtocol){case\"X10\":t=\"x10\";break;case\"VT200\":t=\"vt200\";break;case\"DRAG\":t=\"drag\";break;case\"ANY\":t=\"any\"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(const t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(\"\\r\\n\",t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(const t of e)if(t===1/0||isNaN(t)||t%1!=0)throw new Error(\"This API only accepts integers\")}_verifyPositiveIntegers(...e){for(const t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw new Error(\"This API only accepts positive integers\")}}e.Terminal=d})(),s})()));\n//# sourceMappingURL=xterm.js.map","import { FitAddon } from '@xterm/addon-fit'\nimport { Terminal } from '@xterm/xterm'\nimport { debounce } from 'lodash'\nimport { markRaw, onMounted, onUnmounted, Ref } from 'vue'\nimport '@xterm/xterm/css/xterm.css'\n\nexport function useTerminal(element: Ref) {\n const fitAddon = new FitAddon()\n const terminal = markRaw(\n new Terminal({\n convertEol: true\n })\n )\n terminal.loadAddon(fitAddon)\n\n terminal.attachCustomKeyEventHandler((event) => {\n if (event.type === 'keydown' && (event.ctrlKey || event.metaKey)) {\n if (event.key === 'c' || event.key === 'v') {\n // Allow default browser copy/paste handling\n return false\n }\n }\n return true\n })\n\n onMounted(async () => {\n terminal.open(element.value)\n })\n\n onUnmounted(() => {\n terminal.dispose()\n })\n\n return {\n terminal,\n useAutoSize(\n root: Ref,\n autoRows: boolean = true,\n autoCols: boolean = true,\n onResize?: () => void\n ) {\n const ensureValidRows = (rows: number | undefined) => {\n if (rows == null || isNaN(rows)) {\n return root.value?.clientHeight / 20\n }\n return rows\n }\n\n const ensureValidCols = (cols: number | undefined): number => {\n if (cols == null || isNaN(cols)) {\n // Sometimes this is NaN if so, estimate.\n return root.value?.clientWidth / 8\n }\n return cols\n }\n\n const resize = () => {\n const dims = fitAddon.proposeDimensions()\n // Sometimes propose returns NaN, so we may need to estimate.\n terminal.resize(\n autoCols ? ensureValidCols(dims?.cols) : terminal.cols,\n autoRows ? ensureValidRows(dims?.rows) : terminal.rows\n )\n onResize?.()\n }\n\n const resizeObserver = new ResizeObserver(debounce(resize, 25))\n\n onMounted(async () => {\n resizeObserver.observe(root.value)\n resize()\n })\n\n onUnmounted(() => {\n resizeObserver.disconnect()\n })\n\n return { resize }\n }\n }\n}\n","\n\n\n\n\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-progressspinner {\\n position: relative;\\n margin: 0 auto;\\n width: 100px;\\n height: 100px;\\n display: inline-block;\\n}\\n\\n.p-progressspinner::before {\\n content: \\\"\\\";\\n display: block;\\n padding-top: 100%;\\n}\\n\\n.p-progressspinner-spin {\\n height: 100%;\\n transform-origin: center center;\\n width: 100%;\\n position: absolute;\\n top: 0;\\n bottom: 0;\\n left: 0;\\n right: 0;\\n margin: auto;\\n animation: p-progressspinner-rotate 2s linear infinite;\\n}\\n\\n.p-progressspinner-circle {\\n stroke-dasharray: 89, 200;\\n stroke-dashoffset: 0;\\n stroke: \".concat(dt('progressspinner.color.1'), \";\\n animation: p-progressspinner-dash 1.5s ease-in-out infinite, p-progressspinner-color 6s ease-in-out infinite;\\n stroke-linecap: round;\\n}\\n\\n@keyframes p-progressspinner-rotate {\\n 100% {\\n transform: rotate(360deg);\\n }\\n}\\n@keyframes p-progressspinner-dash {\\n 0% {\\n stroke-dasharray: 1, 200;\\n stroke-dashoffset: 0;\\n }\\n 50% {\\n stroke-dasharray: 89, 200;\\n stroke-dashoffset: -35px;\\n }\\n 100% {\\n stroke-dasharray: 89, 200;\\n stroke-dashoffset: -124px;\\n }\\n}\\n@keyframes p-progressspinner-color {\\n 100%,\\n 0% {\\n stroke: \").concat(dt('progressspinner.color.1'), \";\\n }\\n 40% {\\n stroke: \").concat(dt('progressspinner.color.2'), \";\\n }\\n 66% {\\n stroke: \").concat(dt('progressspinner.color.3'), \";\\n }\\n 80%,\\n 90% {\\n stroke: \").concat(dt('progressspinner.color.4'), \";\\n }\\n}\\n\");\n};\nvar classes = {\n root: 'p-progressspinner',\n spin: 'p-progressspinner-spin',\n circle: 'p-progressspinner-circle'\n};\nvar ProgressSpinnerStyle = BaseStyle.extend({\n name: 'progressspinner',\n theme: theme,\n classes: classes\n});\n\nexport { ProgressSpinnerStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseComponent from '@primevue/core/basecomponent';\nimport ProgressSpinnerStyle from 'primevue/progressspinner/style';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode } from 'vue';\n\nvar script$1 = {\n name: 'BaseProgressSpinner',\n \"extends\": BaseComponent,\n props: {\n strokeWidth: {\n type: String,\n \"default\": '2'\n },\n fill: {\n type: String,\n \"default\": 'none'\n },\n animationDuration: {\n type: String,\n \"default\": '2s'\n }\n },\n style: ProgressSpinnerStyle,\n provide: function provide() {\n return {\n $pcProgressSpinner: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'ProgressSpinner',\n \"extends\": script$1,\n inheritAttrs: false,\n computed: {\n svgStyle: function svgStyle() {\n return {\n 'animation-duration': this.animationDuration\n };\n }\n }\n};\n\nvar _hoisted_1 = [\"fill\", \"stroke-width\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root'),\n role: \"progressbar\"\n }, _ctx.ptmi('root')), [(openBlock(), createElementBlock(\"svg\", mergeProps({\n \"class\": _ctx.cx('spin'),\n viewBox: \"25 25 50 50\",\n style: $options.svgStyle\n }, _ctx.ptm('spin')), [createElementVNode(\"circle\", mergeProps({\n \"class\": _ctx.cx('circle'),\n cx: \"50\",\n cy: \"50\",\n r: \"20\",\n fill: _ctx.fill,\n \"stroke-width\": _ctx.strokeWidth,\n strokeMiterlimit: \"10\"\n }, _ctx.ptm('circle')), null, 16, _hoisted_1)], 16))], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n\n\n","\n\n\n\n\n","import { useI18n } from 'vue-i18n'\nimport { markRaw } from 'vue'\nimport { BottomPanelExtension } from '@/types/extensionTypes'\nimport LogsTerminal from '@/components/bottomPanel/tabs/terminal/LogsTerminal.vue'\nimport CommandTerminal from '@/components/bottomPanel/tabs/terminal/CommandTerminal.vue'\n\nexport const useLogsTerminalTab = (): BottomPanelExtension => {\n const { t } = useI18n()\n return {\n id: 'logs-terminal',\n title: t('g.logs'),\n component: markRaw(LogsTerminal),\n type: 'vue'\n }\n}\n\nexport const useCommandTerminalTab = (): BottomPanelExtension => {\n const { t } = useI18n()\n return {\n id: 'command-terminal',\n title: t('g.terminal'),\n component: markRaw(CommandTerminal),\n type: 'vue'\n }\n}\n","import type { BottomPanelExtension } from '@/types/extensionTypes'\nimport { defineStore } from 'pinia'\nimport { computed, ref } from 'vue'\nimport { useCommandStore } from '@/stores/commandStore'\nimport {\n useLogsTerminalTab,\n useCommandTerminalTab\n} from '@/hooks/bottomPanelTabs/terminalTabs'\nimport { ComfyExtension } from '@/types/comfy'\nimport { isElectron } from '@/utils/envUtil'\n\nexport const useBottomPanelStore = defineStore('bottomPanel', () => {\n const bottomPanelVisible = ref(false)\n const toggleBottomPanel = () => {\n // If there are no tabs, don't show the bottom panel\n if (bottomPanelTabs.value.length === 0) {\n return\n }\n bottomPanelVisible.value = !bottomPanelVisible.value\n }\n\n const bottomPanelTabs = ref([])\n const activeBottomPanelTabId = ref(null)\n const activeBottomPanelTab = computed(() => {\n return (\n bottomPanelTabs.value.find(\n (tab) => tab.id === activeBottomPanelTabId.value\n ) ?? null\n )\n })\n const setActiveTab = (tabId: string) => {\n activeBottomPanelTabId.value = tabId\n }\n const toggleBottomPanelTab = (tabId: string) => {\n if (activeBottomPanelTabId.value === tabId && bottomPanelVisible.value) {\n bottomPanelVisible.value = false\n } else {\n activeBottomPanelTabId.value = tabId\n bottomPanelVisible.value = true\n }\n }\n const registerBottomPanelTab = (tab: BottomPanelExtension) => {\n bottomPanelTabs.value = [...bottomPanelTabs.value, tab]\n if (bottomPanelTabs.value.length === 1) {\n activeBottomPanelTabId.value = tab.id\n }\n useCommandStore().registerCommand({\n id: `Workspace.ToggleBottomPanelTab.${tab.id}`,\n icon: 'pi pi-list',\n label: `Toggle ${tab.title} Bottom Panel`,\n function: () => toggleBottomPanelTab(tab.id)\n })\n }\n\n const registerCoreBottomPanelTabs = () => {\n registerBottomPanelTab(useLogsTerminalTab())\n if (isElectron()) {\n registerBottomPanelTab(useCommandTerminalTab())\n }\n }\n\n const registerExtensionBottomPanelTabs = (extension: ComfyExtension) => {\n if (extension.bottomPanelTabs) {\n extension.bottomPanelTabs.forEach(registerBottomPanelTab)\n }\n }\n\n return {\n bottomPanelVisible,\n toggleBottomPanel,\n bottomPanelTabs,\n activeBottomPanelTab,\n activeBottomPanelTabId,\n setActiveTab,\n toggleBottomPanelTab,\n registerBottomPanelTab,\n registerCoreBottomPanelTabs,\n registerExtensionBottomPanelTabs\n }\n})\n","import { ComfyWidgets, ComfyWidgetConstructor } from '@/scripts/widgets'\nimport { defineStore } from 'pinia'\nimport { ref, computed } from 'vue'\nimport type { BaseInputSpec } from './nodeDefStore'\n\nexport const useWidgetStore = defineStore('widget', () => {\n const coreWidgets = ComfyWidgets\n const customWidgets = ref>({})\n const widgets = computed(() => ({\n ...customWidgets.value,\n ...coreWidgets\n }))\n\n function getWidgetType(type: string, inputName: string) {\n if (type === 'COMBO') {\n return 'COMBO'\n } else if (`${type}:${inputName}` in widgets.value) {\n return `${type}:${inputName}`\n } else if (type in widgets.value) {\n return type\n } else {\n return null\n }\n }\n\n function inputIsWidget(spec: BaseInputSpec) {\n return getWidgetType(spec.type, spec.name) !== null\n }\n\n function registerCustomWidgets(\n newWidgets: Record\n ) {\n customWidgets.value = {\n ...customWidgets.value,\n ...newWidgets\n }\n }\n\n return {\n widgets,\n getWidgetType,\n inputIsWidget,\n registerCustomWidgets\n }\n})\n","import { ref, computed, markRaw } from 'vue'\nimport { defineStore } from 'pinia'\nimport type { ComfyExtension } from '@/types/comfy'\nimport { useKeybindingStore } from './keybindingStore'\nimport { useCommandStore } from './commandStore'\nimport { useSettingStore } from './settingStore'\nimport { app } from '@/scripts/app'\nimport { useMenuItemStore } from './menuItemStore'\nimport { useBottomPanelStore } from './workspace/bottomPanelStore'\nimport { useWidgetStore } from './widgetStore'\n\nexport const useExtensionStore = defineStore('extension', () => {\n // For legacy reasons, the name uniquely identifies an extension\n const extensionByName = ref>({})\n const extensions = computed(() => Object.values(extensionByName.value))\n // Not using computed because disable extension requires reloading of the page.\n // Dynamically update this list won't affect extensions that are already loaded.\n const disabledExtensionNames = ref>(new Set())\n\n // Disabled extension names that are currently not in the extension list.\n // If a node pack is disabled in the backend, we shouldn't remove the configuration\n // of the frontend extension disable list, in case the node pack is re-enabled.\n const inactiveDisabledExtensionNames = computed(() => {\n return Array.from(disabledExtensionNames.value).filter(\n (name) => !(name in extensionByName.value)\n )\n })\n\n const isExtensionEnabled = (name: string) =>\n !disabledExtensionNames.value.has(name)\n const enabledExtensions = computed(() => {\n return extensions.value.filter((ext) => isExtensionEnabled(ext.name))\n })\n\n function registerExtension(extension: ComfyExtension) {\n if (!extension.name) {\n throw new Error(\"Extensions must have a 'name' property.\")\n }\n\n if (extensionByName.value[extension.name]) {\n throw new Error(`Extension named '${extension.name}' already registered.`)\n }\n\n if (disabledExtensionNames.value.has(extension.name)) {\n console.log(`Extension ${extension.name} is disabled.`)\n }\n\n extensionByName.value[extension.name] = markRaw(extension)\n useKeybindingStore().loadExtensionKeybindings(extension)\n useCommandStore().loadExtensionCommands(extension)\n useMenuItemStore().loadExtensionMenuCommands(extension)\n useSettingStore().loadExtensionSettings(extension)\n useBottomPanelStore().registerExtensionBottomPanelTabs(extension)\n if (extension.getCustomWidgets) {\n // TODO(huchenlei): We should deprecate the async return value of\n // getCustomWidgets.\n ;(async () => {\n if (extension.getCustomWidgets) {\n const widgets = await extension.getCustomWidgets(app)\n useWidgetStore().registerCustomWidgets(widgets)\n }\n })()\n }\n /*\n * Extensions are currently stored in both extensionStore and app.extensions.\n * Legacy jest tests still depend on app.extensions being populated.\n */\n app.extensions.push(extension)\n }\n\n function loadDisabledExtensionNames() {\n disabledExtensionNames.value = new Set(\n useSettingStore().get('Comfy.Extension.Disabled')\n )\n // pysssss.Locking is replaced by pin/unpin in ComfyUI core.\n // https://github.com/Comfy-Org/litegraph.js/pull/117\n disabledExtensionNames.value.add('pysssss.Locking')\n // pysssss.SnapToGrid is replaced by Comfy.Graph.AlwaysSnapToGrid in ComfyUI core.\n // pysssss.SnapToGrid tries to write global app.shiftDown state, which is no longer\n // allowed since v1.3.12.\n // https://github.com/Comfy-Org/ComfyUI_frontend/issues/1176\n disabledExtensionNames.value.add('pysssss.SnapToGrid')\n }\n\n // Some core extensions are registered before the store is initialized, e.g.\n // colorPalette.\n // Register them manually here so the state of app.extensions and\n // extensionByName are in sync.\n for (const ext of app.extensions) {\n extensionByName.value[ext.name] = markRaw(ext)\n }\n\n return {\n extensions,\n enabledExtensions,\n inactiveDisabledExtensionNames,\n isExtensionEnabled,\n registerExtension,\n loadDisabledExtensionNames\n }\n})\n","import { AboutPageBadge } from '@/types/comfy'\nimport { defineStore } from 'pinia'\nimport { computed } from 'vue'\nimport { useSystemStatsStore } from './systemStatsStore'\nimport { useExtensionStore } from './extensionStore'\nimport { electronAPI, isElectron } from '@/utils/envUtil'\n\nexport const useAboutPanelStore = defineStore('aboutPanel', () => {\n const frontendVersion = __COMFYUI_FRONTEND_VERSION__\n const extensionStore = useExtensionStore()\n const systemStatsStore = useSystemStatsStore()\n const coreVersion = computed(\n () => systemStatsStore?.systemStats?.system?.comfyui_version ?? ''\n )\n\n const coreBadges = computed(() => [\n // In electron, the ComfyUI is packaged without the git repo,\n // so the python server's API doesn't have the version info.\n {\n label: `ComfyUI ${\n isElectron()\n ? 'v' + electronAPI().getComfyUIVersion()\n : coreVersion.value\n }`,\n url: 'https://github.com/comfyanonymous/ComfyUI',\n icon: 'pi pi-github'\n },\n {\n label: `ComfyUI_frontend v${frontendVersion}`,\n url: 'https://github.com/Comfy-Org/ComfyUI_frontend',\n icon: 'pi pi-github'\n },\n {\n label: 'Discord',\n url: 'https://www.comfy.org/discord',\n icon: 'pi pi-discord'\n },\n { label: 'ComfyOrg', url: 'https://www.comfy.org/', icon: 'pi pi-globe' }\n ])\n\n const allBadges = computed(() => [\n ...coreBadges.value,\n ...extensionStore.extensions.flatMap((e) => e.aboutPageBadges ?? [])\n ])\n\n return {\n badges: allBadges\n }\n})\n","import BaseIcon from '@primevue/icons/baseicon';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode } from 'vue';\n\nvar script = {\n name: 'ChevronLeftIcon',\n \"extends\": BaseIcon\n};\n\nvar _hoisted_1 = /*#__PURE__*/createElementVNode(\"path\", {\n d: \"M9.61296 13C9.50997 13.0005 9.40792 12.9804 9.3128 12.9409C9.21767 12.9014 9.13139 12.8433 9.05902 12.7701L3.83313 7.54416C3.68634 7.39718 3.60388 7.19795 3.60388 6.99022C3.60388 6.78249 3.68634 6.58325 3.83313 6.43628L9.05902 1.21039C9.20762 1.07192 9.40416 0.996539 9.60724 1.00012C9.81032 1.00371 10.0041 1.08597 10.1477 1.22959C10.2913 1.37322 10.3736 1.56698 10.3772 1.77005C10.3808 1.97313 10.3054 2.16968 10.1669 2.31827L5.49496 6.99022L10.1669 11.6622C10.3137 11.8091 10.3962 12.0084 10.3962 12.2161C10.3962 12.4238 10.3137 12.6231 10.1669 12.7701C10.0945 12.8433 10.0083 12.9014 9.91313 12.9409C9.81801 12.9804 9.71596 13.0005 9.61296 13Z\",\n fill: \"currentColor\"\n}, null, -1);\nvar _hoisted_2 = [_hoisted_1];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"svg\", mergeProps({\n width: \"14\",\n height: \"14\",\n viewBox: \"0 0 14 14\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, _ctx.pti()), _hoisted_2, 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseIcon from '@primevue/icons/baseicon';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode } from 'vue';\n\nvar script = {\n name: 'ChevronRightIcon',\n \"extends\": BaseIcon\n};\n\nvar _hoisted_1 = /*#__PURE__*/createElementVNode(\"path\", {\n d: \"M4.38708 13C4.28408 13.0005 4.18203 12.9804 4.08691 12.9409C3.99178 12.9014 3.9055 12.8433 3.83313 12.7701C3.68634 12.6231 3.60388 12.4238 3.60388 12.2161C3.60388 12.0084 3.68634 11.8091 3.83313 11.6622L8.50507 6.99022L3.83313 2.31827C3.69467 2.16968 3.61928 1.97313 3.62287 1.77005C3.62645 1.56698 3.70872 1.37322 3.85234 1.22959C3.99596 1.08597 4.18972 1.00371 4.3928 1.00012C4.59588 0.996539 4.79242 1.07192 4.94102 1.21039L10.1669 6.43628C10.3137 6.58325 10.3962 6.78249 10.3962 6.99022C10.3962 7.19795 10.3137 7.39718 10.1669 7.54416L4.94102 12.7701C4.86865 12.8433 4.78237 12.9014 4.68724 12.9409C4.59212 12.9804 4.49007 13.0005 4.38708 13Z\",\n fill: \"currentColor\"\n}, null, -1);\nvar _hoisted_2 = [_hoisted_1];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"svg\", mergeProps({\n width: \"14\",\n height: \"14\",\n viewBox: \"0 0 14 14\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, _ctx.pti()), _hoisted_2, 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-tabview-tablist-container {\\n position: relative;\\n}\\n\\n.p-tabview-scrollable > .p-tabview-tablist-container {\\n overflow: hidden;\\n}\\n\\n.p-tabview-tablist-scroll-container {\\n overflow-x: auto;\\n overflow-y: hidden;\\n scroll-behavior: smooth;\\n scrollbar-width: none;\\n overscroll-behavior: contain auto;\\n}\\n\\n.p-tabview-tablist-scroll-container::-webkit-scrollbar {\\n display: none;\\n}\\n\\n.p-tabview-tablist {\\n display: flex;\\n margin: 0;\\n padding: 0;\\n list-style-type: none;\\n flex: 1 1 auto;\\n background: \".concat(dt('tabview.tab.list.background'), \";\\n border: 1px solid \").concat(dt('tabview.tab.list.border.color'), \";\\n border-width: 0 0 1px 0;\\n position: relative;\\n}\\n\\n.p-tabview-tab-header {\\n cursor: pointer;\\n user-select: none;\\n display: flex;\\n align-items: center;\\n text-decoration: none;\\n position: relative;\\n overflow: hidden;\\n border-style: solid;\\n border-width: 0 0 1px 0;\\n border-color: transparent transparent \").concat(dt('tabview.tab.border.color'), \" transparent;\\n color: \").concat(dt('tabview.tab.color'), \";\\n padding: 1rem 1.125rem;\\n font-weight: 600;\\n border-top-right-radius: \").concat(dt('border.radius.md'), \";\\n border-top-left-radius: \").concat(dt('border.radius.md'), \";\\n transition: color \").concat(dt('tabview.transition.duration'), \", outline-color \").concat(dt('tabview.transition.duration'), \";\\n margin: 0 0 -1px 0;\\n outline-color: transparent;\\n}\\n\\n.p-tabview-tablist-item:not(.p-disabled) .p-tabview-tab-header:focus-visible {\\n outline: \").concat(dt('focus.ring.width'), \" \").concat(dt('focus.ring.style'), \" \").concat(dt('focus.ring.color'), \";\\n outline-offset: -1px;\\n}\\n\\n.p-tabview-tablist-item:not(.p-highlight):not(.p-disabled):hover > .p-tabview-tab-header {\\n color: \").concat(dt('tabview.tab.hover.color'), \";\\n}\\n\\n.p-tabview-tablist-item.p-highlight > .p-tabview-tab-header {\\n color: \").concat(dt('tabview.tab.active.color'), \";\\n}\\n\\n.p-tabview-tab-title {\\n line-height: 1;\\n white-space: nowrap;\\n}\\n\\n.p-tabview-next-button,\\n.p-tabview-prev-button {\\n position: absolute;\\n top: 0;\\n margin: 0;\\n padding: 0;\\n z-index: 2;\\n height: 100%;\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n background: \").concat(dt('tabview.nav.button.background'), \";\\n color: \").concat(dt('tabview.nav.button.color'), \";\\n width: 2.5rem;\\n border-radius: 0;\\n outline-color: transparent;\\n transition: color \").concat(dt('tabview.transition.duration'), \", outline-color \").concat(dt('tabview.transition.duration'), \";\\n box-shadow: \").concat(dt('tabview.nav.button.shadow'), \";\\n border: none;\\n cursor: pointer;\\n user-select: none;\\n}\\n\\n.p-tabview-next-button:focus-visible,\\n.p-tabview-prev-button:focus-visible {\\n outline: \").concat(dt('focus.ring.width'), \" \").concat(dt('focus.ring.style'), \" \").concat(dt('focus.ring.color'), \";\\n outline-offset: \").concat(dt('focus.ring.offset'), \";\\n}\\n\\n.p-tabview-next-button:hover,\\n.p-tabview-prev-button:hover {\\n color: \").concat(dt('tabview.nav.button.hover.color'), \";\\n}\\n\\n.p-tabview-prev-button {\\n left: 0;\\n}\\n\\n.p-tabview-next-button {\\n right: 0;\\n}\\n\\n.p-tabview-panels {\\n background: \").concat(dt('tabview.tab.panel.background'), \";\\n color: \").concat(dt('tabview.tab.panel.color'), \";\\n padding: 0.875rem 1.125rem 1.125rem 1.125rem;\\n}\\n\\n.p-tabview-ink-bar {\\n z-index: 1;\\n display: block;\\n position: absolute;\\n bottom: -1px;\\n height: 1px;\\n background: \").concat(dt('tabview.tab.active.border.color'), \";\\n transition: 250ms cubic-bezier(0.35, 0, 0.25, 1);\\n}\\n\");\n};\nvar classes = {\n root: function root(_ref2) {\n var props = _ref2.props;\n return ['p-tabview p-component', {\n 'p-tabview-scrollable': props.scrollable\n }];\n },\n navContainer: 'p-tabview-tablist-container',\n prevButton: 'p-tabview-prev-button',\n navContent: 'p-tabview-tablist-scroll-container',\n nav: 'p-tabview-tablist',\n tab: {\n header: function header(_ref3) {\n var instance = _ref3.instance,\n tab = _ref3.tab,\n index = _ref3.index;\n return ['p-tabview-tablist-item', instance.getTabProp(tab, 'headerClass'), {\n 'p-tabview-tablist-item-active': instance.d_activeIndex === index,\n 'p-disabled': instance.getTabProp(tab, 'disabled')\n }];\n },\n headerAction: 'p-tabview-tab-header',\n headerTitle: 'p-tabview-tab-title',\n content: function content(_ref4) {\n var instance = _ref4.instance,\n tab = _ref4.tab;\n return ['p-tabview-panel', instance.getTabProp(tab, 'contentClass')];\n }\n },\n inkbar: 'p-tabview-ink-bar',\n nextButton: 'p-tabview-next-button',\n panelContainer: 'p-tabview-panels'\n};\nvar TabViewStyle = BaseStyle.extend({\n name: 'tabview',\n theme: theme,\n classes: classes\n});\n\nexport { TabViewStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { UniqueComponentId } from '@primevue/core/utils';\nimport { getWidth, getAttribute, findSingle, focus, getOffset } from '@primeuix/utils/dom';\nimport ChevronLeftIcon from '@primevue/icons/chevronleft';\nimport ChevronRightIcon from '@primevue/icons/chevronright';\nimport Ripple from 'primevue/ripple';\nimport { mergeProps, resolveDirective, openBlock, createElementBlock, createElementVNode, withDirectives, renderSlot, createBlock, resolveDynamicComponent, createCommentVNode, Fragment, renderList, toDisplayString, vShow } from 'vue';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport TabViewStyle from 'primevue/tabview/style';\n\nvar script$1 = {\n name: 'BaseTabView',\n \"extends\": BaseComponent,\n props: {\n activeIndex: {\n type: Number,\n \"default\": 0\n },\n lazy: {\n type: Boolean,\n \"default\": false\n },\n scrollable: {\n type: Boolean,\n \"default\": false\n },\n tabindex: {\n type: Number,\n \"default\": 0\n },\n selectOnFocus: {\n type: Boolean,\n \"default\": false\n },\n prevButtonProps: {\n type: null,\n \"default\": null\n },\n nextButtonProps: {\n type: null,\n \"default\": null\n },\n prevIcon: {\n type: String,\n \"default\": undefined\n },\n nextIcon: {\n type: String,\n \"default\": undefined\n }\n },\n style: TabViewStyle,\n provide: function provide() {\n return {\n $pcTabs: undefined,\n // Backwards compatible to prevent component from breaking\n $pcTabView: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'TabView',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['update:activeIndex', 'tab-change', 'tab-click'],\n data: function data() {\n return {\n id: this.$attrs.id,\n d_activeIndex: this.activeIndex,\n isPrevButtonDisabled: true,\n isNextButtonDisabled: false\n };\n },\n watch: {\n '$attrs.id': function $attrsId(newValue) {\n this.id = newValue || UniqueComponentId();\n },\n activeIndex: function activeIndex(newValue) {\n this.d_activeIndex = newValue;\n this.scrollInView({\n index: newValue\n });\n }\n },\n mounted: function mounted() {\n console.warn('Deprecated since v4. Use Tabs component instead.');\n this.id = this.id || UniqueComponentId();\n this.updateInkBar();\n this.scrollable && this.updateButtonState();\n },\n updated: function updated() {\n this.updateInkBar();\n this.scrollable && this.updateButtonState();\n },\n methods: {\n isTabPanel: function isTabPanel(child) {\n return child.type.name === 'TabPanel';\n },\n isTabActive: function isTabActive(index) {\n return this.d_activeIndex === index;\n },\n getTabProp: function getTabProp(tab, name) {\n return tab.props ? tab.props[name] : undefined;\n },\n getKey: function getKey(tab, index) {\n return this.getTabProp(tab, 'header') || index;\n },\n getTabHeaderActionId: function getTabHeaderActionId(index) {\n return \"\".concat(this.id, \"_\").concat(index, \"_header_action\");\n },\n getTabContentId: function getTabContentId(index) {\n return \"\".concat(this.id, \"_\").concat(index, \"_content\");\n },\n getTabPT: function getTabPT(tab, key, index) {\n var count = this.tabs.length;\n var tabMetaData = {\n props: tab.props,\n parent: {\n instance: this,\n props: this.$props,\n state: this.$data\n },\n context: {\n index: index,\n count: count,\n first: index === 0,\n last: index === count - 1,\n active: this.isTabActive(index)\n }\n };\n return mergeProps(this.ptm(\"tabpanel.\".concat(key), {\n tabpanel: tabMetaData\n }), this.ptm(\"tabpanel.\".concat(key), tabMetaData), this.ptmo(this.getTabProp(tab, 'pt'), key, tabMetaData));\n },\n onScroll: function onScroll(event) {\n this.scrollable && this.updateButtonState();\n event.preventDefault();\n },\n onPrevButtonClick: function onPrevButtonClick() {\n var content = this.$refs.content;\n var width = getWidth(content);\n var pos = content.scrollLeft - width;\n content.scrollLeft = pos <= 0 ? 0 : pos;\n },\n onNextButtonClick: function onNextButtonClick() {\n var content = this.$refs.content;\n var width = getWidth(content) - this.getVisibleButtonWidths();\n var pos = content.scrollLeft + width;\n var lastPos = content.scrollWidth - width;\n content.scrollLeft = pos >= lastPos ? lastPos : pos;\n },\n onTabClick: function onTabClick(event, tab, index) {\n this.changeActiveIndex(event, tab, index);\n this.$emit('tab-click', {\n originalEvent: event,\n index: index\n });\n },\n onTabKeyDown: function onTabKeyDown(event, tab, index) {\n switch (event.code) {\n case 'ArrowLeft':\n this.onTabArrowLeftKey(event);\n break;\n case 'ArrowRight':\n this.onTabArrowRightKey(event);\n break;\n case 'Home':\n this.onTabHomeKey(event);\n break;\n case 'End':\n this.onTabEndKey(event);\n break;\n case 'PageDown':\n this.onPageDownKey(event);\n break;\n case 'PageUp':\n this.onPageUpKey(event);\n break;\n case 'Enter':\n case 'NumpadEnter':\n case 'Space':\n this.onTabEnterKey(event, tab, index);\n break;\n }\n },\n onTabArrowRightKey: function onTabArrowRightKey(event) {\n var nextHeaderAction = this.findNextHeaderAction(event.target.parentElement);\n nextHeaderAction ? this.changeFocusedTab(event, nextHeaderAction) : this.onTabHomeKey(event);\n event.preventDefault();\n },\n onTabArrowLeftKey: function onTabArrowLeftKey(event) {\n var prevHeaderAction = this.findPrevHeaderAction(event.target.parentElement);\n prevHeaderAction ? this.changeFocusedTab(event, prevHeaderAction) : this.onTabEndKey(event);\n event.preventDefault();\n },\n onTabHomeKey: function onTabHomeKey(event) {\n var firstHeaderAction = this.findFirstHeaderAction();\n this.changeFocusedTab(event, firstHeaderAction);\n event.preventDefault();\n },\n onTabEndKey: function onTabEndKey(event) {\n var lastHeaderAction = this.findLastHeaderAction();\n this.changeFocusedTab(event, lastHeaderAction);\n event.preventDefault();\n },\n onPageDownKey: function onPageDownKey(event) {\n this.scrollInView({\n index: this.$refs.nav.children.length - 2\n });\n event.preventDefault();\n },\n onPageUpKey: function onPageUpKey(event) {\n this.scrollInView({\n index: 0\n });\n event.preventDefault();\n },\n onTabEnterKey: function onTabEnterKey(event, tab, index) {\n this.changeActiveIndex(event, tab, index);\n event.preventDefault();\n },\n findNextHeaderAction: function findNextHeaderAction(tabElement) {\n var selfCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var headerElement = selfCheck ? tabElement : tabElement.nextElementSibling;\n return headerElement ? getAttribute(headerElement, 'data-p-disabled') || getAttribute(headerElement, 'data-pc-section') === 'inkbar' ? this.findNextHeaderAction(headerElement) : findSingle(headerElement, '[data-pc-section=\"headeraction\"]') : null;\n },\n findPrevHeaderAction: function findPrevHeaderAction(tabElement) {\n var selfCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var headerElement = selfCheck ? tabElement : tabElement.previousElementSibling;\n return headerElement ? getAttribute(headerElement, 'data-p-disabled') || getAttribute(headerElement, 'data-pc-section') === 'inkbar' ? this.findPrevHeaderAction(headerElement) : findSingle(headerElement, '[data-pc-section=\"headeraction\"]') : null;\n },\n findFirstHeaderAction: function findFirstHeaderAction() {\n return this.findNextHeaderAction(this.$refs.nav.firstElementChild, true);\n },\n findLastHeaderAction: function findLastHeaderAction() {\n return this.findPrevHeaderAction(this.$refs.nav.lastElementChild, true);\n },\n changeActiveIndex: function changeActiveIndex(event, tab, index) {\n if (!this.getTabProp(tab, 'disabled') && this.d_activeIndex !== index) {\n this.d_activeIndex = index;\n this.$emit('update:activeIndex', index);\n this.$emit('tab-change', {\n originalEvent: event,\n index: index\n });\n this.scrollInView({\n index: index\n });\n }\n },\n changeFocusedTab: function changeFocusedTab(event, element) {\n if (element) {\n focus(element);\n this.scrollInView({\n element: element\n });\n if (this.selectOnFocus) {\n var index = parseInt(element.parentElement.dataset.pcIndex, 10);\n var tab = this.tabs[index];\n this.changeActiveIndex(event, tab, index);\n }\n }\n },\n scrollInView: function scrollInView(_ref) {\n var element = _ref.element,\n _ref$index = _ref.index,\n index = _ref$index === void 0 ? -1 : _ref$index;\n var currentElement = element || this.$refs.nav.children[index];\n if (currentElement) {\n currentElement.scrollIntoView && currentElement.scrollIntoView({\n block: 'nearest'\n });\n }\n },\n updateInkBar: function updateInkBar() {\n var tabHeader = this.$refs.nav.children[this.d_activeIndex];\n this.$refs.inkbar.style.width = getWidth(tabHeader) + 'px';\n this.$refs.inkbar.style.left = getOffset(tabHeader).left - getOffset(this.$refs.nav).left + 'px';\n },\n updateButtonState: function updateButtonState() {\n var content = this.$refs.content;\n var scrollLeft = content.scrollLeft,\n scrollWidth = content.scrollWidth;\n var width = getWidth(content);\n this.isPrevButtonDisabled = scrollLeft === 0;\n this.isNextButtonDisabled = parseInt(scrollLeft) === scrollWidth - width;\n },\n getVisibleButtonWidths: function getVisibleButtonWidths() {\n var _this$$refs = this.$refs,\n prevBtn = _this$$refs.prevBtn,\n nextBtn = _this$$refs.nextBtn;\n return [prevBtn, nextBtn].reduce(function (acc, el) {\n return el ? acc + getWidth(el) : acc;\n }, 0);\n }\n },\n computed: {\n tabs: function tabs() {\n var _this = this;\n return this.$slots[\"default\"]().reduce(function (tabs, child) {\n if (_this.isTabPanel(child)) {\n tabs.push(child);\n } else if (child.children && child.children instanceof Array) {\n child.children.forEach(function (nestedChild) {\n if (_this.isTabPanel(nestedChild)) {\n tabs.push(nestedChild);\n }\n });\n }\n return tabs;\n }, []);\n },\n prevButtonAriaLabel: function prevButtonAriaLabel() {\n return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.previous : undefined;\n },\n nextButtonAriaLabel: function nextButtonAriaLabel() {\n return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.next : undefined;\n }\n },\n directives: {\n ripple: Ripple\n },\n components: {\n ChevronLeftIcon: ChevronLeftIcon,\n ChevronRightIcon: ChevronRightIcon\n }\n};\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar _hoisted_1 = [\"tabindex\", \"aria-label\"];\nvar _hoisted_2 = [\"data-p-active\", \"data-p-disabled\", \"data-pc-index\"];\nvar _hoisted_3 = [\"id\", \"tabindex\", \"aria-disabled\", \"aria-selected\", \"aria-controls\", \"onClick\", \"onKeydown\"];\nvar _hoisted_4 = [\"tabindex\", \"aria-label\"];\nvar _hoisted_5 = [\"id\", \"aria-labelledby\", \"data-pc-index\", \"data-p-active\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _directive_ripple = resolveDirective(\"ripple\");\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root'),\n role: \"tablist\"\n }, _ctx.ptmi('root')), [createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('navContainer')\n }, _ctx.ptm('navContainer')), [_ctx.scrollable && !$data.isPrevButtonDisabled ? withDirectives((openBlock(), createElementBlock(\"button\", mergeProps({\n key: 0,\n ref: \"prevBtn\",\n type: \"button\",\n \"class\": _ctx.cx('prevButton'),\n tabindex: _ctx.tabindex,\n \"aria-label\": $options.prevButtonAriaLabel,\n onClick: _cache[0] || (_cache[0] = function () {\n return $options.onPrevButtonClick && $options.onPrevButtonClick.apply($options, arguments);\n })\n }, _objectSpread(_objectSpread({}, _ctx.prevButtonProps), _ctx.ptm('prevButton')), {\n \"data-pc-group-section\": \"navbutton\"\n }), [renderSlot(_ctx.$slots, \"previcon\", {}, function () {\n return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.prevIcon ? 'span' : 'ChevronLeftIcon'), mergeProps({\n \"aria-hidden\": \"true\",\n \"class\": _ctx.prevIcon\n }, _ctx.ptm('prevIcon')), null, 16, [\"class\"]))];\n })], 16, _hoisted_1)), [[_directive_ripple]]) : createCommentVNode(\"\", true), createElementVNode(\"div\", mergeProps({\n ref: \"content\",\n \"class\": _ctx.cx('navContent'),\n onScroll: _cache[1] || (_cache[1] = function () {\n return $options.onScroll && $options.onScroll.apply($options, arguments);\n })\n }, _ctx.ptm('navContent')), [createElementVNode(\"ul\", mergeProps({\n ref: \"nav\",\n \"class\": _ctx.cx('nav')\n }, _ctx.ptm('nav')), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.tabs, function (tab, index) {\n return openBlock(), createElementBlock(\"li\", mergeProps({\n key: $options.getKey(tab, index),\n style: $options.getTabProp(tab, 'headerStyle'),\n \"class\": _ctx.cx('tab.header', {\n tab: tab,\n index: index\n }),\n role: \"presentation\",\n ref_for: true\n }, _objectSpread(_objectSpread(_objectSpread({}, $options.getTabProp(tab, 'headerProps')), $options.getTabPT(tab, 'root', index)), $options.getTabPT(tab, 'header', index)), {\n \"data-pc-name\": \"tabpanel\",\n \"data-p-active\": $data.d_activeIndex === index,\n \"data-p-disabled\": $options.getTabProp(tab, 'disabled'),\n \"data-pc-index\": index\n }), [withDirectives((openBlock(), createElementBlock(\"a\", mergeProps({\n id: $options.getTabHeaderActionId(index),\n \"class\": _ctx.cx('tab.headerAction'),\n tabindex: $options.getTabProp(tab, 'disabled') || !$options.isTabActive(index) ? -1 : _ctx.tabindex,\n role: \"tab\",\n \"aria-disabled\": $options.getTabProp(tab, 'disabled'),\n \"aria-selected\": $options.isTabActive(index),\n \"aria-controls\": $options.getTabContentId(index),\n onClick: function onClick($event) {\n return $options.onTabClick($event, tab, index);\n },\n onKeydown: function onKeydown($event) {\n return $options.onTabKeyDown($event, tab, index);\n },\n ref_for: true\n }, _objectSpread(_objectSpread({}, $options.getTabProp(tab, 'headerActionProps')), $options.getTabPT(tab, 'headerAction', index))), [tab.props && tab.props.header ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('tab.headerTitle'),\n ref_for: true\n }, $options.getTabPT(tab, 'headerTitle', index)), toDisplayString(tab.props.header), 17)) : createCommentVNode(\"\", true), tab.children && tab.children.header ? (openBlock(), createBlock(resolveDynamicComponent(tab.children.header), {\n key: 1\n })) : createCommentVNode(\"\", true)], 16, _hoisted_3)), [[_directive_ripple]])], 16, _hoisted_2);\n }), 128)), createElementVNode(\"li\", mergeProps({\n ref: \"inkbar\",\n \"class\": _ctx.cx('inkbar'),\n role: \"presentation\",\n \"aria-hidden\": \"true\"\n }, _ctx.ptm('inkbar')), null, 16)], 16)], 16), _ctx.scrollable && !$data.isNextButtonDisabled ? withDirectives((openBlock(), createElementBlock(\"button\", mergeProps({\n key: 1,\n ref: \"nextBtn\",\n type: \"button\",\n \"class\": _ctx.cx('nextButton'),\n tabindex: _ctx.tabindex,\n \"aria-label\": $options.nextButtonAriaLabel,\n onClick: _cache[2] || (_cache[2] = function () {\n return $options.onNextButtonClick && $options.onNextButtonClick.apply($options, arguments);\n })\n }, _objectSpread(_objectSpread({}, _ctx.nextButtonProps), _ctx.ptm('nextButton')), {\n \"data-pc-group-section\": \"navbutton\"\n }), [renderSlot(_ctx.$slots, \"nexticon\", {}, function () {\n return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.nextIcon ? 'span' : 'ChevronRightIcon'), mergeProps({\n \"aria-hidden\": \"true\",\n \"class\": _ctx.nextIcon\n }, _ctx.ptm('nextIcon')), null, 16, [\"class\"]))];\n })], 16, _hoisted_4)), [[_directive_ripple]]) : createCommentVNode(\"\", true)], 16), createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('panelContainer')\n }, _ctx.ptm('panelContainer')), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.tabs, function (tab, index) {\n return openBlock(), createElementBlock(Fragment, {\n key: $options.getKey(tab, index)\n }, [(_ctx.lazy ? $options.isTabActive(index) : true) ? withDirectives((openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n id: $options.getTabContentId(index),\n style: $options.getTabProp(tab, 'contentStyle'),\n \"class\": _ctx.cx('tab.content', {\n tab: tab\n }),\n role: \"tabpanel\",\n \"aria-labelledby\": $options.getTabHeaderActionId(index),\n ref_for: true\n }, _objectSpread(_objectSpread(_objectSpread({}, $options.getTabProp(tab, 'contentProps')), $options.getTabPT(tab, 'root', index)), $options.getTabPT(tab, 'content', index)), {\n \"data-pc-name\": \"tabpanel\",\n \"data-pc-index\": index,\n \"data-p-active\": $data.d_activeIndex === index\n }), [(openBlock(), createBlock(resolveDynamicComponent(tab)))], 16, _hoisted_5)), [[vShow, _ctx.lazy ? true : $options.isTabActive(index)]]) : createCommentVNode(\"\", true)], 64);\n }), 128))], 16)], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n","\n\n\n","\n\n\n","import BaseIcon from '@primevue/icons/baseicon';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode } from 'vue';\n\nvar script = {\n name: 'ExclamationTriangleIcon',\n \"extends\": BaseIcon\n};\n\nvar _hoisted_1 = /*#__PURE__*/createElementVNode(\"path\", {\n d: \"M13.4018 13.1893H0.598161C0.49329 13.189 0.390283 13.1615 0.299143 13.1097C0.208003 13.0578 0.131826 12.9832 0.0780112 12.8932C0.0268539 12.8015 0 12.6982 0 12.5931C0 12.4881 0.0268539 12.3848 0.0780112 12.293L6.47985 1.08982C6.53679 1.00399 6.61408 0.933574 6.70484 0.884867C6.7956 0.836159 6.897 0.810669 7 0.810669C7.103 0.810669 7.2044 0.836159 7.29516 0.884867C7.38592 0.933574 7.46321 1.00399 7.52015 1.08982L13.922 12.293C13.9731 12.3848 14 12.4881 14 12.5931C14 12.6982 13.9731 12.8015 13.922 12.8932C13.8682 12.9832 13.792 13.0578 13.7009 13.1097C13.6097 13.1615 13.5067 13.189 13.4018 13.1893ZM1.63046 11.989H12.3695L7 2.59425L1.63046 11.989Z\",\n fill: \"currentColor\"\n}, null, -1);\nvar _hoisted_2 = /*#__PURE__*/createElementVNode(\"path\", {\n d: \"M6.99996 8.78801C6.84143 8.78594 6.68997 8.72204 6.57787 8.60993C6.46576 8.49782 6.40186 8.34637 6.39979 8.18784V5.38703C6.39979 5.22786 6.46302 5.0752 6.57557 4.96265C6.68813 4.85009 6.84078 4.78686 6.99996 4.78686C7.15914 4.78686 7.31179 4.85009 7.42435 4.96265C7.5369 5.0752 7.60013 5.22786 7.60013 5.38703V8.18784C7.59806 8.34637 7.53416 8.49782 7.42205 8.60993C7.30995 8.72204 7.15849 8.78594 6.99996 8.78801Z\",\n fill: \"currentColor\"\n}, null, -1);\nvar _hoisted_3 = /*#__PURE__*/createElementVNode(\"path\", {\n d: \"M6.99996 11.1887C6.84143 11.1866 6.68997 11.1227 6.57787 11.0106C6.46576 10.8985 6.40186 10.7471 6.39979 10.5885V10.1884C6.39979 10.0292 6.46302 9.87658 6.57557 9.76403C6.68813 9.65147 6.84078 9.58824 6.99996 9.58824C7.15914 9.58824 7.31179 9.65147 7.42435 9.76403C7.5369 9.87658 7.60013 10.0292 7.60013 10.1884V10.5885C7.59806 10.7471 7.53416 10.8985 7.42205 11.0106C7.30995 11.1227 7.15849 11.1866 6.99996 11.1887Z\",\n fill: \"currentColor\"\n}, null, -1);\nvar _hoisted_4 = [_hoisted_1, _hoisted_2, _hoisted_3];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"svg\", mergeProps({\n width: \"14\",\n height: \"14\",\n viewBox: \"0 0 14 14\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, _ctx.pti()), _hoisted_4, 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseIcon from '@primevue/icons/baseicon';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode } from 'vue';\n\nvar script = {\n name: 'InfoCircleIcon',\n \"extends\": BaseIcon\n};\n\nvar _hoisted_1 = /*#__PURE__*/createElementVNode(\"path\", {\n \"fill-rule\": \"evenodd\",\n \"clip-rule\": \"evenodd\",\n d: \"M3.11101 12.8203C4.26215 13.5895 5.61553 14 7 14C8.85652 14 10.637 13.2625 11.9497 11.9497C13.2625 10.637 14 8.85652 14 7C14 5.61553 13.5895 4.26215 12.8203 3.11101C12.0511 1.95987 10.9579 1.06266 9.67879 0.532846C8.3997 0.00303296 6.99224 -0.13559 5.63437 0.134506C4.2765 0.404603 3.02922 1.07129 2.05026 2.05026C1.07129 3.02922 0.404603 4.2765 0.134506 5.63437C-0.13559 6.99224 0.00303296 8.3997 0.532846 9.67879C1.06266 10.9579 1.95987 12.0511 3.11101 12.8203ZM3.75918 2.14976C4.71846 1.50879 5.84628 1.16667 7 1.16667C8.5471 1.16667 10.0308 1.78125 11.1248 2.87521C12.2188 3.96918 12.8333 5.45291 12.8333 7C12.8333 8.15373 12.4912 9.28154 11.8502 10.2408C11.2093 11.2001 10.2982 11.9478 9.23232 12.3893C8.16642 12.8308 6.99353 12.9463 5.86198 12.7212C4.73042 12.4962 3.69102 11.9406 2.87521 11.1248C2.05941 10.309 1.50384 9.26958 1.27876 8.13803C1.05367 7.00647 1.16919 5.83358 1.61071 4.76768C2.05222 3.70178 2.79989 2.79074 3.75918 2.14976ZM7.00002 4.8611C6.84594 4.85908 6.69873 4.79698 6.58977 4.68801C6.48081 4.57905 6.4187 4.43185 6.41669 4.27776V3.88888C6.41669 3.73417 6.47815 3.58579 6.58754 3.4764C6.69694 3.367 6.84531 3.30554 7.00002 3.30554C7.15473 3.30554 7.3031 3.367 7.4125 3.4764C7.52189 3.58579 7.58335 3.73417 7.58335 3.88888V4.27776C7.58134 4.43185 7.51923 4.57905 7.41027 4.68801C7.30131 4.79698 7.1541 4.85908 7.00002 4.8611ZM7.00002 10.6945C6.84594 10.6925 6.69873 10.6304 6.58977 10.5214C6.48081 10.4124 6.4187 10.2652 6.41669 10.1111V6.22225C6.41669 6.06754 6.47815 5.91917 6.58754 5.80977C6.69694 5.70037 6.84531 5.63892 7.00002 5.63892C7.15473 5.63892 7.3031 5.70037 7.4125 5.80977C7.52189 5.91917 7.58335 6.06754 7.58335 6.22225V10.1111C7.58134 10.2652 7.51923 10.4124 7.41027 10.5214C7.30131 10.6304 7.1541 10.6925 7.00002 10.6945Z\",\n fill: \"currentColor\"\n}, null, -1);\nvar _hoisted_2 = [_hoisted_1];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"svg\", mergeProps({\n width: \"14\",\n height: \"14\",\n viewBox: \"0 0 14 14\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, _ctx.pti()), _hoisted_2, 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-message {\\n border-radius: \".concat(dt('message.border.radius'), \";\\n outline-width: \").concat(dt('message.border.width'), \";\\n outline-style: solid;\\n}\\n\\n.p-message-content {\\n display: flex;\\n align-items: center;\\n padding: \").concat(dt('message.content.padding'), \";\\n gap: \").concat(dt('message.content.gap'), \";\\n height: 100%;\\n}\\n\\n.p-message-icon {\\n flex-shrink: 0;\\n}\\n\\n.p-message-close-button {\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n flex-shrink: 0;\\n margin: 0 0 0 auto;\\n overflow: hidden;\\n position: relative;\\n width: \").concat(dt('message.close.button.width'), \";\\n height: \").concat(dt('message.close.button.height'), \";\\n border-radius: \").concat(dt('message.close.button.border.radius'), \";\\n background: transparent;\\n transition: background \").concat(dt('message.transition.duration'), \", color \").concat(dt('message.transition.duration'), \", outline-color \").concat(dt('message.transition.duration'), \", box-shadow \").concat(dt('message.transition.duration'), \", opacity 0.3s;\\n outline-color: transparent;\\n color: inherit;\\n padding: 0;\\n border: none;\\n cursor: pointer;\\n user-select: none;\\n}\\n\\n.p-message-close-icon {\\n font-size: \").concat(dt('message.close.icon.size'), \";\\n width: \").concat(dt('message.close.icon.size'), \";\\n height: \").concat(dt('message.close.icon.size'), \";\\n}\\n\\n.p-message-close-button:focus-visible {\\n outline-width: \").concat(dt('message.close.button.focus.ring.width'), \";\\n outline-style: \").concat(dt('message.close.button.focus.ring.style'), \";\\n outline-offset: \").concat(dt('message.close.button.focus.ring.offset'), \";\\n}\\n\\n.p-message-info {\\n background: \").concat(dt('message.info.background'), \";\\n outline-color: \").concat(dt('message.info.border.color'), \";\\n color: \").concat(dt('message.info.color'), \";\\n box-shadow: \").concat(dt('message.info.shadow'), \";\\n}\\n\\n.p-message-info .p-message-close-button:focus-visible {\\n outline-color: \").concat(dt('message.info.close.button.focus.ring.color'), \";\\n box-shadow: \").concat(dt('message.info.close.button.focus.ring.shadow'), \";\\n}\\n\\n.p-message-info .p-message-close-button:hover {\\n background: \").concat(dt('message.info.close.button.hover.background'), \";\\n}\\n\\n.p-message-success {\\n background: \").concat(dt('message.success.background'), \";\\n outline-color: \").concat(dt('message.success.border.color'), \";\\n color: \").concat(dt('message.success.color'), \";\\n box-shadow: \").concat(dt('message.success.shadow'), \";\\n}\\n\\n.p-message-success .p-message-close-button:focus-visible {\\n outline-color: \").concat(dt('message.success.close.button.focus.ring.color'), \";\\n box-shadow: \").concat(dt('message.success.close.button.focus.ring.shadow'), \";\\n}\\n\\n.p-message-success .p-message-close-button:hover {\\n background: \").concat(dt('message.success.close.button.hover.background'), \";\\n}\\n\\n.p-message-warn {\\n background: \").concat(dt('message.warn.background'), \";\\n outline-color: \").concat(dt('message.warn.border.color'), \";\\n color: \").concat(dt('message.warn.color'), \";\\n box-shadow: \").concat(dt('message.warn.shadow'), \";\\n}\\n\\n.p-message-warn .p-message-close-button:focus-visible {\\n outline-color: \").concat(dt('message.warn.close.button.focus.ring.color'), \";\\n box-shadow: \").concat(dt('message.warn.close.button.focus.ring.shadow'), \";\\n}\\n\\n.p-message-warn .p-message-close-button:hover {\\n background: \").concat(dt('message.warn.close.button.hover.background'), \";\\n}\\n\\n.p-message-error {\\n background: \").concat(dt('message.error.background'), \";\\n outline-color: \").concat(dt('message.error.border.color'), \";\\n color: \").concat(dt('message.error.color'), \";\\n box-shadow: \").concat(dt('message.error.shadow'), \";\\n}\\n\\n.p-message-error .p-message-close-button:focus-visible {\\n outline-color: \").concat(dt('message.error.close.button.focus.ring.color'), \";\\n box-shadow: \").concat(dt('message.error.close.button.focus.ring.shadow'), \";\\n}\\n\\n.p-message-error .p-message-close-button:hover {\\n background: \").concat(dt('message.error.close.button.hover.background'), \";\\n}\\n\\n.p-message-secondary {\\n background: \").concat(dt('message.secondary.background'), \";\\n outline-color: \").concat(dt('message.secondary.border.color'), \";\\n color: \").concat(dt('message.secondary.color'), \";\\n box-shadow: \").concat(dt('message.secondary.shadow'), \";\\n}\\n\\n.p-message-secondary .p-message-close-button:focus-visible {\\n outline-color: \").concat(dt('message.secondary.close.button.focus.ring.color'), \";\\n box-shadow: \").concat(dt('message.secondary.close.button.focus.ring.shadow'), \";\\n}\\n\\n.p-message-secondary .p-message-close-button:hover {\\n background: \").concat(dt('message.secondary.close.button.hover.background'), \";\\n}\\n\\n.p-message-contrast {\\n background: \").concat(dt('message.contrast.background'), \";\\n outline-color: \").concat(dt('message.contrast.border.color'), \";\\n color: \").concat(dt('message.contrast.color'), \";\\n box-shadow: \").concat(dt('message.contrast.shadow'), \";\\n}\\n\\n.p-message-contrast .p-message-close-button:focus-visible {\\n outline-color: \").concat(dt('message.contrast.close.button.focus.ring.color'), \";\\n box-shadow: \").concat(dt('message.contrast.close.button.focus.ring.shadow'), \";\\n}\\n\\n.p-message-contrast .p-message-close-button:hover {\\n background: \").concat(dt('message.contrast.close.button.hover.background'), \";\\n}\\n\\n.p-message-text {\\n font-size: \").concat(dt('message.text.font.size'), \";\\n font-weight: \").concat(dt('message.text.font.weight'), \";\\n}\\n\\n.p-message-icon {\\n font-size: \").concat(dt('message.icon.size'), \";\\n width: \").concat(dt('message.icon.size'), \";\\n height: \").concat(dt('message.icon.size'), \";\\n}\\n\\n.p-message-enter-from {\\n opacity: 0;\\n}\\n\\n.p-message-enter-active {\\n transition: opacity 0.3s;\\n}\\n\\n.p-message.p-message-leave-from {\\n max-height: 1000px;\\n}\\n\\n.p-message.p-message-leave-to {\\n max-height: 0;\\n opacity: 0;\\n margin: 0;\\n}\\n\\n.p-message-leave-active {\\n overflow: hidden;\\n transition: max-height 0.45s cubic-bezier(0, 1, 0, 1), opacity 0.3s, margin 0.3s;\\n}\\n\\n.p-message-leave-active .p-message-close-button {\\n opacity: 0;\\n}\\n\");\n};\nvar classes = {\n root: function root(_ref2) {\n var props = _ref2.props;\n return 'p-message p-component p-message-' + props.severity;\n },\n content: 'p-message-content',\n icon: 'p-message-icon',\n text: 'p-message-text',\n closeButton: 'p-message-close-button',\n closeIcon: 'p-message-close-icon'\n};\nvar MessageStyle = BaseStyle.extend({\n name: 'message',\n theme: theme,\n classes: classes\n});\n\nexport { MessageStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import CheckIcon from '@primevue/icons/check';\nimport ExclamationTriangleIcon from '@primevue/icons/exclamationtriangle';\nimport InfoCircleIcon from '@primevue/icons/infocircle';\nimport TimesIcon from '@primevue/icons/times';\nimport TimesCircleIcon from '@primevue/icons/timescircle';\nimport Ripple from 'primevue/ripple';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport MessageStyle from 'primevue/message/style';\nimport { resolveComponent, resolveDirective, openBlock, createBlock, Transition, mergeProps, withCtx, withDirectives, createElementVNode, renderSlot, createElementBlock, resolveDynamicComponent, createCommentVNode, vShow } from 'vue';\n\nvar script$1 = {\n name: 'BaseMessage',\n \"extends\": BaseComponent,\n props: {\n severity: {\n type: String,\n \"default\": 'info'\n },\n closable: {\n type: Boolean,\n \"default\": false\n },\n life: {\n type: Number,\n \"default\": null\n },\n icon: {\n type: String,\n \"default\": undefined\n },\n closeIcon: {\n type: String,\n \"default\": undefined\n },\n closeButtonProps: {\n type: null,\n \"default\": null\n }\n },\n style: MessageStyle,\n provide: function provide() {\n return {\n $pcMessage: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'Message',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['close', 'life-end'],\n timeout: null,\n data: function data() {\n return {\n visible: true\n };\n },\n mounted: function mounted() {\n var _this = this;\n if (this.life) {\n setTimeout(function () {\n _this.visible = false;\n _this.$emit('life-end');\n }, this.life);\n }\n },\n methods: {\n close: function close(event) {\n this.visible = false;\n this.$emit('close', event);\n }\n },\n computed: {\n iconComponent: function iconComponent() {\n return {\n info: InfoCircleIcon,\n success: CheckIcon,\n warn: ExclamationTriangleIcon,\n error: TimesCircleIcon\n }[this.severity];\n },\n closeAriaLabel: function closeAriaLabel() {\n return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : undefined;\n }\n },\n directives: {\n ripple: Ripple\n },\n components: {\n TimesIcon: TimesIcon,\n InfoCircleIcon: InfoCircleIcon,\n CheckIcon: CheckIcon,\n ExclamationTriangleIcon: ExclamationTriangleIcon,\n TimesCircleIcon: TimesCircleIcon\n }\n};\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar _hoisted_1 = [\"aria-label\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_TimesIcon = resolveComponent(\"TimesIcon\");\n var _directive_ripple = resolveDirective(\"ripple\");\n return openBlock(), createBlock(Transition, mergeProps({\n name: \"p-message\",\n appear: \"\"\n }, _ctx.ptmi('transition')), {\n \"default\": withCtx(function () {\n return [withDirectives(createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('root'),\n role: \"alert\",\n \"aria-live\": \"assertive\",\n \"aria-atomic\": \"true\"\n }, _ctx.ptm('root')), [_ctx.$slots.container ? renderSlot(_ctx.$slots, \"container\", {\n key: 0,\n closeCallback: $options.close\n }) : (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 1,\n \"class\": _ctx.cx('content')\n }, _ctx.ptm('content')), [renderSlot(_ctx.$slots, \"icon\", {\n \"class\": \"p-message-icon\"\n }, function () {\n return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon ? 'span' : null), mergeProps({\n \"class\": [_ctx.cx('icon'), _ctx.icon]\n }, _ctx.ptm('icon')), null, 16, [\"class\"]))];\n }), _ctx.$slots[\"default\"] ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n \"class\": [\"p-message-text\", _ctx.cx('text')]\n }, _ctx.ptm('text')), [renderSlot(_ctx.$slots, \"default\")], 16)) : createCommentVNode(\"\", true), _ctx.closable ? withDirectives((openBlock(), createElementBlock(\"button\", mergeProps({\n key: 1,\n \"class\": _ctx.cx('closeButton'),\n \"aria-label\": $options.closeAriaLabel,\n type: \"button\",\n onClick: _cache[0] || (_cache[0] = function ($event) {\n return $options.close($event);\n })\n }, _objectSpread(_objectSpread({}, _ctx.closeButtonProps), _ctx.ptm('closeButton'))), [renderSlot(_ctx.$slots, \"closeicon\", {}, function () {\n return [_ctx.closeIcon ? (openBlock(), createElementBlock(\"i\", mergeProps({\n key: 0,\n \"class\": [_ctx.cx('closeIcon'), _ctx.closeIcon]\n }, _ctx.ptm('closeIcon')), null, 16)) : (openBlock(), createBlock(_component_TimesIcon, mergeProps({\n key: 1,\n \"class\": [_ctx.cx('closeIcon'), _ctx.closeIcon]\n }, _ctx.ptm('closeIcon')), null, 16, [\"class\"]))];\n })], 16, _hoisted_1)), [[_directive_ripple]]) : createCommentVNode(\"\", true)], 16))], 16), [[vShow, $data.visible]])];\n }),\n _: 3\n }, 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n","import { api } from '@/scripts/api'\nimport { defineStore } from 'pinia'\nimport { computed, ref, watchEffect } from 'vue'\nimport type { User as UserConfig } from '@/types/apiTypes'\n\nexport interface User {\n userId: string\n username: string\n}\n\nexport const useUserStore = defineStore('user', () => {\n /**\n * The user config. null if not loaded.\n */\n const userConfig = ref(null)\n /**\n * The current user id. null if not logged in or in single user mode.\n */\n const currentUserId = ref(null)\n const isMultiUserServer = computed(\n () => userConfig.value && 'users' in userConfig.value\n )\n const needsLogin = computed(\n () => !currentUserId.value && isMultiUserServer.value\n )\n const users = computed(() =>\n Object.entries(userConfig.value?.users ?? {}).map(([userId, username]) => ({\n userId,\n username\n }))\n )\n const currentUser = computed(\n () =>\n users.value.find((user) => user.userId === currentUserId.value) ?? null\n )\n const initialized = computed(() => userConfig.value !== null)\n\n /**\n * Initialize the user store.\n */\n async function initialize() {\n userConfig.value = await api.getUserConfig()\n currentUserId.value = localStorage['Comfy.userId']\n }\n\n /**\n * Create a new user.\n *\n * @param username - The username.\n * @returns The new user.\n */\n async function createUser(username: string): Promise {\n const resp = await api.createUser(username)\n const data = await resp.json()\n if (resp.status >= 300) {\n throw new Error(\n data.error ??\n 'Error creating user: ' + resp.status + ' ' + resp.statusText\n )\n }\n return {\n userId: data,\n username\n }\n }\n\n /**\n * Login the current user.\n *\n * @param user - The user.\n */\n async function login({\n userId,\n username\n }: {\n userId: string\n username: string\n }) {\n currentUserId.value = userId\n localStorage['Comfy.userId'] = userId\n localStorage['Comfy.userName'] = username\n }\n\n watchEffect(() => {\n if (isMultiUserServer.value && currentUserId.value) {\n api.user = currentUserId.value\n }\n })\n\n /**\n * Logout the current user.\n */\n async function logout() {\n delete localStorage['Comfy.userId']\n delete localStorage['Comfy.userName']\n }\n\n return {\n users,\n currentUser,\n isMultiUserServer,\n needsLogin,\n initialized,\n initialize,\n createUser,\n login,\n logout\n }\n})\n","\n\n\n\n","import type { TreeNode } from 'primevue/treenode'\n\nexport function buildTree(items: T[], key: (item: T) => string[]): TreeNode {\n const root: TreeNode = {\n key: 'root',\n label: 'root',\n children: []\n }\n\n const map: Record = {\n root: root\n }\n\n for (const item of items) {\n const keys = key(item)\n let parent = root\n for (let i = 0; i < keys.length; i++) {\n const k = keys[i]\n // 'a/b/c/' represents an empty folder 'c' in folder 'b' in folder 'a'\n // 'a/b/c/' is split into ['a', 'b', 'c', '']\n if (k === '' && i === keys.length - 1) break\n\n const id = parent.key + '/' + k\n if (!map[id]) {\n const node: TreeNode = {\n key: id,\n label: k,\n leaf: false,\n children: []\n }\n map[id] = node\n parent.children?.push(node)\n }\n parent = map[id]\n }\n parent.leaf = keys[keys.length - 1] !== ''\n parent.data = item\n }\n return root\n}\n\nexport function flattenTree(tree: TreeNode): T[] {\n const result: T[] = []\n const stack: TreeNode[] = [tree]\n while (stack.length) {\n const node = stack.pop()!\n if (node.leaf && node.data) result.push(node.data)\n stack.push(...(node.children || []))\n }\n return result\n}\n\n/**\n * Sort the children of the node recursively.\n * @param node - The node to sort.\n * @param options - The options for sorting.\n * @param options.groupLeaf - Whether to group leaf nodes together.\n * @returns The sorted node.\n */\nexport function sortedTree(\n node: TreeNode,\n {\n groupLeaf = false\n }: {\n groupLeaf?: boolean\n } = {}\n): TreeNode {\n const newNode: TreeNode = {\n ...node\n }\n\n if (node.children) {\n if (groupLeaf) {\n // Split children into folders and files\n const folders = node.children.filter((child) => !child.leaf)\n const files = node.children.filter((child) => child.leaf)\n\n // Sort folders and files separately by label\n const sortedFolders = folders.sort((a, b) =>\n (a.label ?? '').localeCompare(b.label ?? '')\n )\n const sortedFiles = files.sort((a, b) =>\n (a.label ?? '').localeCompare(b.label ?? '')\n )\n\n // Recursively sort folder children\n newNode.children = [\n ...sortedFolders.map((folder) =>\n sortedTree(folder, { groupLeaf: true })\n ),\n ...sortedFiles\n ]\n } else {\n const sortedChildren = [...node.children].sort((a, b) =>\n (a.label ?? '').localeCompare(b.label ?? '')\n )\n newNode.children = [\n ...sortedChildren.map((child) =>\n sortedTree(child, { groupLeaf: false })\n )\n ]\n }\n }\n\n return newNode\n}\n\nexport const findNodeByKey = (root: TreeNode, key: string): TreeNode | null => {\n if (root.key === key) {\n return root\n }\n if (!root.children) {\n return null\n }\n for (const child of root.children) {\n const result = findNodeByKey(child, key)\n if (result) {\n return result\n }\n }\n return null\n}\n","\n\n\n\n\n\n\n","\n\n\n","import { inject } from 'vue';\n\nvar PrimeVueToastSymbol = Symbol();\nfunction useToast() {\n var PrimeVueToast = inject(PrimeVueToastSymbol);\n if (!PrimeVueToast) {\n throw new Error('No PrimeVue Toast provided!');\n }\n return PrimeVueToast;\n}\n\nexport { PrimeVueToastSymbol, useToast };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n","\n\n\n","import { useClipboard } from '@vueuse/core'\nimport { useToast } from 'primevue/usetoast'\n\nexport function useCopyToClipboard() {\n const { copy, isSupported } = useClipboard()\n const toast = useToast()\n\n const copyToClipboard = async (text: string) => {\n if (isSupported) {\n try {\n await copy(text)\n toast.add({\n severity: 'success',\n summary: 'Success',\n detail: 'Copied to clipboard',\n life: 3000\n })\n } catch (err) {\n toast.add({\n severity: 'error',\n summary: 'Error',\n detail: 'Failed to copy report'\n })\n }\n } else {\n toast.add({\n severity: 'error',\n summary: 'Error',\n detail: 'Clipboard API not supported in your browser'\n })\n }\n }\n\n return {\n copyToClipboard\n }\n}\n","\n\n\n\n\n","\n\n\n\n\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-floatlabel {\\n display: block;\\n position: relative;\\n}\\n\\n.p-floatlabel label {\\n position: absolute;\\n pointer-events: none;\\n top: 50%;\\n margin-top: -.5rem;\\n transition-property: all;\\n transition-timing-function: ease;\\n line-height: 1;\\n left: 0.75rem;\\n color: \".concat(dt('floatlabel.color'), \";\\n transition-duration: \").concat(dt('floatlabel.transition.duration'), \";\\n}\\n\\n.p-floatlabel:has(textarea) label {\\n top: 1rem;\\n}\\n\\n.p-floatlabel:has(input:focus) label,\\n.p-floatlabel:has(input.p-filled) label,\\n.p-floatlabel:has(input:-webkit-autofill) label,\\n.p-floatlabel:has(textarea:focus) label,\\n.p-floatlabel:has(textarea.p-filled) label,\\n.p-floatlabel:has(.p-inputwrapper-focus) label,\\n.p-floatlabel:has(.p-inputwrapper-filled) label {\\n top: -.75rem;\\n font-size: 12px;\\n color: \").concat(dt('floatlabel.focus.color'), \";\\n}\\n\\n.p-floatlabel .p-placeholder,\\n.p-floatlabel input::placeholder,\\n.p-floatlabel .p-inputtext::placeholder {\\n opacity: 0;\\n transition-property: all;\\n transition-timing-function: ease;\\n}\\n\\n.p-floatlabel .p-focus .p-placeholder,\\n.p-floatlabel input:focus::placeholder,\\n.p-floatlabel .p-inputtext:focus::placeholder {\\n opacity: 1;\\n transition-property: all;\\n transition-timing-function: ease;\\n}\\n\\n.p-floatlabel > .p-invalid + label {\\n color: \").concat(dt('floatlabel.invalid.color'), \";\\n}\\n\");\n};\nvar classes = {\n root: 'p-floatlabel'\n};\nvar FloatLabelStyle = BaseStyle.extend({\n name: 'floatlabel',\n theme: theme,\n classes: classes\n});\n\nexport { FloatLabelStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseComponent from '@primevue/core/basecomponent';\nimport FloatLabelStyle from 'primevue/floatlabel/style';\nimport { openBlock, createElementBlock, mergeProps, renderSlot } from 'vue';\n\nvar script$1 = {\n name: 'BaseFloatLabel',\n \"extends\": BaseComponent,\n props: {},\n style: FloatLabelStyle,\n provide: function provide() {\n return {\n $pcFloatLabel: this,\n $parentInstance: this\n };\n }\n};\n\nvar script = {\n name: 'FloatLabel',\n \"extends\": script$1,\n inheritAttrs: false\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"span\", mergeProps({\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root')), [renderSlot(_ctx.$slots, \"default\")], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n","\n\n\n\n\n","import { createI18n } from 'vue-i18n'\nimport en from './locales/en/main.json'\nimport zh from './locales/zh/main.json'\nimport ru from './locales/ru/main.json'\nimport ja from './locales/ja/main.json'\nimport ko from './locales/ko/main.json'\nimport enNodes from './locales/en/nodeDefs.json'\nimport zhNodes from './locales/zh/nodeDefs.json'\nimport ruNodes from './locales/ru/nodeDefs.json'\nimport jaNodes from './locales/ja/nodeDefs.json'\nimport koNodes from './locales/ko/nodeDefs.json'\nimport enCommands from './locales/en/commands.json'\nimport zhCommands from './locales/zh/commands.json'\nimport ruCommands from './locales/ru/commands.json'\nimport jaCommands from './locales/ja/commands.json'\nimport koCommands from './locales/ko/commands.json'\n\nfunction buildLocale(main: M, nodes: N, commands: C) {\n return {\n ...main,\n nodeDefs: nodes,\n commands: commands\n }\n}\n\nconst messages = {\n en: buildLocale(en, enNodes, enCommands),\n zh: buildLocale(zh, zhNodes, zhCommands),\n ru: buildLocale(ru, ruNodes, ruCommands),\n ja: buildLocale(ja, jaNodes, jaCommands),\n ko: buildLocale(ko, koNodes, koCommands)\n}\n\nexport const i18n = createI18n({\n // Must set `false`, as Vue I18n Legacy API is for Vue 2\n legacy: false,\n locale: navigator.language.split('-')[0] || 'en',\n fallbackLocale: 'en',\n messages,\n // Ignore warnings for locale options as each option is in its own language.\n // e.g. \"English\", \"中文\", \"Русский\", \"日本語\", \"한국어\"\n missingWarn: /^(?!settingsDialog\\.Comfy_Locale\\.options\\.).+/,\n fallbackWarn: /^(?!settingsDialog\\.Comfy_Locale\\.options\\.).+/\n})\n\n/** Convenience shorthand: i18n.global */\nexport const { t, te } = i18n.global\n\n/**\n * Safe translation function that returns the fallback message if the key is not found.\n *\n * @param key - The key to translate.\n * @param fallbackMessage - The fallback message to use if the key is not found.\n */\nexport function st(key: string, fallbackMessage: string) {\n return te(key) ? t(key) : fallbackMessage\n}\n","// This module is mocked in tests-ui/\n// Import vue components here to avoid tests-ui/ reporting errors\n// about importing primevue components.\nimport { useDialogStore, type ShowDialogOptions } from '@/stores/dialogStore'\nimport LoadWorkflowWarning from '@/components/dialog/content/LoadWorkflowWarning.vue'\nimport MissingModelsWarning from '@/components/dialog/content/MissingModelsWarning.vue'\nimport SettingDialogContent from '@/components/dialog/content/SettingDialogContent.vue'\nimport SettingDialogHeader from '@/components/dialog/header/SettingDialogHeader.vue'\nimport type { ExecutionErrorWsMessage } from '@/types/apiTypes'\nimport ExecutionErrorDialogContent from '@/components/dialog/content/ExecutionErrorDialogContent.vue'\nimport TemplateWorkflowsContent from '@/components/templates/TemplateWorkflowsContent.vue'\nimport PromptDialogContent from '@/components/dialog/content/PromptDialogContent.vue'\nimport ConfirmationDialogContent from '@/components/dialog/content/ConfirmationDialogContent.vue'\nimport { t } from '@/i18n'\nimport type { MissingNodeType } from '@/types/comfy'\n\nexport function showLoadWorkflowWarning(props: {\n missingNodeTypes: MissingNodeType[]\n [key: string]: any\n}) {\n const dialogStore = useDialogStore()\n dialogStore.showDialog({\n key: 'global-load-workflow-warning',\n component: LoadWorkflowWarning,\n props\n })\n}\n\nexport function showMissingModelsWarning(props: {\n missingModels: any[]\n paths: Record\n [key: string]: any\n}) {\n const dialogStore = useDialogStore()\n dialogStore.showDialog({\n key: 'global-missing-models-warning',\n component: MissingModelsWarning,\n props\n })\n}\n\nexport function showSettingsDialog() {\n useDialogStore().showDialog({\n key: 'global-settings',\n headerComponent: SettingDialogHeader,\n component: SettingDialogContent\n })\n}\n\nexport function showExecutionErrorDialog(error: ExecutionErrorWsMessage) {\n useDialogStore().showDialog({\n key: 'global-execution-error',\n component: ExecutionErrorDialogContent,\n props: {\n error\n }\n })\n}\n\nexport function showTemplateWorkflowsDialog() {\n useDialogStore().showDialog({\n key: 'global-template-workflows',\n title: t('templateWorkflows.title'),\n component: TemplateWorkflowsContent\n })\n}\n\nexport async function showPromptDialog({\n title,\n message,\n defaultValue = ''\n}: {\n title: string\n message: string\n defaultValue?: string\n}): Promise {\n const dialogStore = useDialogStore()\n\n return new Promise((resolve) => {\n dialogStore.showDialog({\n key: 'global-prompt',\n title,\n component: PromptDialogContent,\n props: {\n message,\n defaultValue,\n onConfirm: (value: string) => {\n resolve(value)\n }\n },\n dialogComponentProps: {\n onClose: () => {\n resolve(null)\n }\n }\n })\n })\n}\n\nexport type ConfirmationDialogType =\n | 'overwrite'\n | 'delete'\n | 'dirtyClose'\n | 'reinstall'\n\n/**\n *\n * @returns `true` if the user confirms the dialog,\n * `false` if denied (e.g. no in yes/no/cancel), or\n * `null` if the dialog is cancelled or closed\n */\nexport async function showConfirmationDialog({\n title,\n type,\n message,\n itemList = []\n}: {\n /** Dialog heading */\n title: string\n /** Pre-configured dialog type */\n type: ConfirmationDialogType\n /** The main message body */\n message: string\n /** Displayed as an unorderd list immediately below the message body */\n itemList?: string[]\n}): Promise {\n return new Promise((resolve) => {\n const options: ShowDialogOptions = {\n key: 'global-prompt',\n title,\n component: ConfirmationDialogContent,\n props: {\n message,\n type,\n itemList,\n onConfirm: resolve\n },\n dialogComponentProps: {\n onClose: () => resolve(null)\n }\n }\n\n useDialogStore().showDialog(options)\n })\n}\n","// @ts-strict-ignore\nimport { api } from './api'\nimport { ComfyDialog as _ComfyDialog } from './ui/dialog'\nimport { toggleSwitch } from './ui/toggleSwitch'\nimport { ComfySettingsDialog } from './ui/settings'\nimport { ComfyApp, app } from './app'\nimport { TaskItem, type StatusWsMessageStatus } from '@/types/apiTypes'\nimport { showSettingsDialog } from '@/services/dialogService'\nimport { useSettingStore } from '@/stores/settingStore'\nimport { useCommandStore } from '@/stores/commandStore'\nimport { useWorkspaceStore } from '@/stores/workspaceStore'\n\nexport const ComfyDialog = _ComfyDialog\n\ntype Position2D = {\n x: number\n y: number\n}\n\ntype Props = {\n parent?: HTMLElement\n $?: (el: HTMLElement) => void\n dataset?: DOMStringMap\n style?: Partial\n for?: string\n textContent?: string\n [key: string]: any\n}\n\ntype Children = Element[] | Element | string | string[]\n\ntype ElementType = K extends keyof HTMLElementTagNameMap\n ? HTMLElementTagNameMap[K]\n : HTMLElement\n\nexport function $el(\n tag: TTag,\n propsOrChildren?: Children | Props,\n children?: Children\n): ElementType {\n const split = tag.split('.')\n const element = document.createElement(split.shift() as string)\n if (split.length > 0) {\n element.classList.add(...split)\n }\n\n if (propsOrChildren) {\n if (typeof propsOrChildren === 'string') {\n propsOrChildren = { textContent: propsOrChildren }\n } else if (propsOrChildren instanceof Element) {\n propsOrChildren = [propsOrChildren]\n }\n if (Array.isArray(propsOrChildren)) {\n element.append(...propsOrChildren)\n } else {\n const {\n parent,\n $: cb,\n dataset,\n style,\n ...rest\n } = propsOrChildren as Props\n\n if (rest.for) {\n element.setAttribute('for', rest.for)\n }\n\n if (style) {\n Object.assign(element.style, style)\n }\n\n if (dataset) {\n Object.assign(element.dataset, dataset)\n }\n\n Object.assign(element, rest)\n if (children) {\n element.append(...(Array.isArray(children) ? children : [children]))\n }\n\n if (parent) {\n parent.append(element)\n }\n\n if (cb) {\n cb(element)\n }\n }\n }\n return element as ElementType\n}\n\nfunction dragElement(dragEl, settings): () => void {\n var posDiffX = 0,\n posDiffY = 0,\n posStartX = 0,\n posStartY = 0,\n newPosX = 0,\n newPosY = 0\n if (dragEl.getElementsByClassName('drag-handle')[0]) {\n // if present, the handle is where you move the DIV from:\n dragEl.getElementsByClassName('drag-handle')[0].onmousedown = dragMouseDown\n } else {\n // otherwise, move the DIV from anywhere inside the DIV:\n dragEl.onmousedown = dragMouseDown\n }\n\n // When the element resizes (e.g. view queue) ensure it is still in the windows bounds\n const resizeObserver = new ResizeObserver(() => {\n ensureInBounds()\n }).observe(dragEl)\n\n function ensureInBounds() {\n try {\n newPosX = Math.min(\n document.body.clientWidth - dragEl.clientWidth,\n Math.max(0, dragEl.offsetLeft)\n )\n newPosY = Math.min(\n document.body.clientHeight - dragEl.clientHeight,\n Math.max(0, dragEl.offsetTop)\n )\n\n positionElement()\n } catch (exception) {\n // robust\n }\n }\n\n function positionElement() {\n if (dragEl.style.display === 'none') return\n\n const halfWidth = document.body.clientWidth / 2\n const anchorRight = newPosX + dragEl.clientWidth / 2 > halfWidth\n\n // set the element's new position:\n if (anchorRight) {\n dragEl.style.left = 'unset'\n dragEl.style.right =\n document.body.clientWidth - newPosX - dragEl.clientWidth + 'px'\n } else {\n dragEl.style.left = newPosX + 'px'\n dragEl.style.right = 'unset'\n }\n\n dragEl.style.top = newPosY + 'px'\n dragEl.style.bottom = 'unset'\n\n if (savePos) {\n localStorage.setItem(\n 'Comfy.MenuPosition',\n JSON.stringify({\n x: dragEl.offsetLeft,\n y: dragEl.offsetTop\n })\n )\n }\n }\n\n function restorePos() {\n let posString = localStorage.getItem('Comfy.MenuPosition')\n if (posString) {\n const pos = JSON.parse(posString) as Position2D\n newPosX = pos.x\n newPosY = pos.y\n positionElement()\n ensureInBounds()\n }\n }\n\n let savePos = undefined\n settings.addSetting({\n id: 'Comfy.MenuPosition',\n category: ['Comfy', 'Menu', 'MenuPosition'],\n name: \"Save legacy menu's position\",\n type: 'boolean',\n defaultValue: savePos,\n onChange(value) {\n if (savePos === undefined && value) {\n restorePos()\n }\n savePos = value\n }\n })\n\n function dragMouseDown(e) {\n e = e || window.event\n e.preventDefault()\n // get the mouse cursor position at startup:\n posStartX = e.clientX\n posStartY = e.clientY\n document.onmouseup = closeDragElement\n // call a function whenever the cursor moves:\n document.onmousemove = elementDrag\n }\n\n function elementDrag(e) {\n e = e || window.event\n e.preventDefault()\n\n dragEl.classList.add('comfy-menu-manual-pos')\n\n // calculate the new cursor position:\n posDiffX = e.clientX - posStartX\n posDiffY = e.clientY - posStartY\n posStartX = e.clientX\n posStartY = e.clientY\n\n newPosX = Math.min(\n document.body.clientWidth - dragEl.clientWidth,\n Math.max(0, dragEl.offsetLeft + posDiffX)\n )\n newPosY = Math.min(\n document.body.clientHeight - dragEl.clientHeight,\n Math.max(0, dragEl.offsetTop + posDiffY)\n )\n\n positionElement()\n }\n\n window.addEventListener('resize', () => {\n ensureInBounds()\n })\n\n function closeDragElement() {\n // stop moving when mouse button is released:\n document.onmouseup = null\n document.onmousemove = null\n }\n\n return restorePos\n}\n\nclass ComfyList {\n #type\n #text\n #reverse\n element: HTMLDivElement\n button?: HTMLButtonElement\n\n constructor(text, type?, reverse?) {\n this.#text = text\n this.#type = type || text.toLowerCase()\n this.#reverse = reverse || false\n this.element = $el('div.comfy-list') as HTMLDivElement\n this.element.style.display = 'none'\n }\n\n get visible() {\n return this.element.style.display !== 'none'\n }\n\n async load() {\n const items = await api.getItems(this.#type)\n this.element.replaceChildren(\n ...Object.keys(items).flatMap((section) => [\n $el('h4', {\n textContent: section\n }),\n $el('div.comfy-list-items', [\n ...(this.#reverse ? items[section].reverse() : items[section]).map(\n (item: TaskItem) => {\n // Allow items to specify a custom remove action (e.g. for interrupt current prompt)\n const removeAction =\n 'remove' in item\n ? item.remove\n : {\n name: 'Delete',\n cb: () => api.deleteItem(this.#type, item.prompt[1])\n }\n return $el('div', { textContent: item.prompt[0] + ': ' }, [\n $el('button', {\n textContent: 'Load',\n onclick: async () => {\n await app.loadGraphData(\n item.prompt[3].extra_pnginfo.workflow,\n true,\n false\n )\n if ('outputs' in item) {\n app.nodeOutputs = {}\n for (const [key, value] of Object.entries(item.outputs)) {\n const realKey = item['meta']?.[key]?.display_node ?? key\n app.nodeOutputs[realKey] = value\n }\n }\n }\n }),\n $el('button', {\n textContent: removeAction.name,\n onclick: async () => {\n await removeAction.cb()\n await this.update()\n }\n })\n ])\n }\n )\n ])\n ]),\n $el('div.comfy-list-actions', [\n $el('button', {\n textContent: 'Clear ' + this.#text,\n onclick: async () => {\n await api.clearItems(this.#type)\n await this.load()\n }\n }),\n $el('button', { textContent: 'Refresh', onclick: () => this.load() })\n ])\n )\n }\n\n async update() {\n if (this.visible) {\n await this.load()\n }\n }\n\n async show() {\n this.element.style.display = 'block'\n this.button.textContent = 'Close'\n\n await this.load()\n }\n\n hide() {\n this.element.style.display = 'none'\n this.button.textContent = 'View ' + this.#text\n }\n\n toggle() {\n if (this.visible) {\n this.hide()\n return false\n } else {\n this.show()\n return true\n }\n }\n}\n\nexport class ComfyUI {\n app: ComfyApp\n dialog: _ComfyDialog\n settings: ComfySettingsDialog\n batchCount: number\n lastQueueSize: number\n queue: ComfyList\n history: ComfyList\n autoQueueMode: string\n graphHasChanged: boolean\n autoQueueEnabled: boolean\n menuContainer: HTMLDivElement\n queueSize: Element\n restoreMenuPosition: () => void\n loadFile: () => void\n\n constructor(app) {\n this.app = app\n this.dialog = new ComfyDialog()\n this.settings = new ComfySettingsDialog(app)\n\n this.batchCount = 1\n this.lastQueueSize = 0\n this.queue = new ComfyList('Queue')\n this.history = new ComfyList('History', 'history', true)\n\n api.addEventListener('status', () => {\n this.queue.update()\n this.history.update()\n })\n\n this.setup(document.body)\n }\n\n setup(containerElement: HTMLElement) {\n const fileInput = $el('input', {\n id: 'comfy-file-input',\n type: 'file',\n accept: '.json,image/png,.latent,.safetensors,image/webp,audio/flac',\n style: { display: 'none' },\n parent: document.body,\n onchange: async () => {\n await app.handleFile(fileInput.files[0])\n fileInput.value = ''\n }\n })\n\n this.loadFile = () => fileInput.click()\n\n const autoQueueModeEl = toggleSwitch(\n 'autoQueueMode',\n [\n {\n text: 'instant',\n tooltip: 'A new prompt will be queued as soon as the queue reaches 0'\n },\n {\n text: 'change',\n tooltip:\n 'A new prompt will be queued when the queue is at 0 and the graph is/has changed'\n }\n ],\n {\n onChange: (value) => {\n this.autoQueueMode = value.item.value\n }\n }\n )\n autoQueueModeEl.style.display = 'none'\n\n api.addEventListener('graphChanged', () => {\n if (this.autoQueueMode === 'change' && this.autoQueueEnabled === true) {\n if (this.lastQueueSize === 0) {\n this.graphHasChanged = false\n app.queuePrompt(0, this.batchCount)\n } else {\n this.graphHasChanged = true\n }\n }\n })\n\n this.menuContainer = $el('div.comfy-menu', { parent: containerElement }, [\n $el(\n 'div.drag-handle.comfy-menu-header',\n {\n style: {\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n cursor: 'default'\n }\n },\n [\n $el('span.drag-handle'),\n $el('span.comfy-menu-queue-size', { $: (q) => (this.queueSize = q) }),\n $el('div.comfy-menu-actions', [\n $el('button.comfy-settings-btn', {\n textContent: '⚙️',\n onclick: showSettingsDialog\n }),\n $el('button.comfy-close-menu-btn', {\n textContent: '\\u00d7',\n onclick: () => {\n useWorkspaceStore().focusMode = true\n }\n })\n ])\n ]\n ),\n $el('button.comfy-queue-btn', {\n id: 'queue-button',\n textContent: 'Queue Prompt',\n onclick: () => app.queuePrompt(0, this.batchCount)\n }),\n $el('div', {}, [\n $el('label', { innerHTML: 'Extra options' }, [\n $el('input', {\n type: 'checkbox',\n onchange: (i) => {\n document.getElementById('extraOptions').style.display = i\n .srcElement.checked\n ? 'block'\n : 'none'\n this.batchCount = i.srcElement.checked\n ? Number.parseInt(\n (\n document.getElementById(\n 'batchCountInputRange'\n ) as HTMLInputElement\n ).value\n )\n : 1\n ;(\n document.getElementById('autoQueueCheckbox') as HTMLInputElement\n ).checked = false\n this.autoQueueEnabled = false\n }\n })\n ])\n ]),\n $el(\n 'div',\n { id: 'extraOptions', style: { width: '100%', display: 'none' } },\n [\n $el('div', [\n $el('label', { innerHTML: 'Batch count' }),\n $el('input', {\n id: 'batchCountInputNumber',\n type: 'number',\n value: this.batchCount,\n min: '1',\n style: { width: '35%', marginLeft: '0.4em' },\n oninput: (i) => {\n this.batchCount = i.target.value\n /* Even though an element with a type of range logically represents a number (since\n it's used for numeric input), the value it holds is still treated as a string in HTML and\n JavaScript. This behavior is consistent across all elements regardless of their type\n (like text, number, or range), where the .value property is always a string. */\n ;(\n document.getElementById(\n 'batchCountInputRange'\n ) as HTMLInputElement\n ).value = this.batchCount.toString()\n }\n }),\n $el('input', {\n id: 'batchCountInputRange',\n type: 'range',\n min: '1',\n max: '100',\n value: this.batchCount,\n oninput: (i) => {\n this.batchCount = i.srcElement.value\n // Note\n ;(\n document.getElementById(\n 'batchCountInputNumber'\n ) as HTMLInputElement\n ).value = i.srcElement.value\n }\n })\n ]),\n $el('div', [\n $el('label', {\n for: 'autoQueueCheckbox',\n innerHTML: 'Auto Queue'\n }),\n $el('input', {\n id: 'autoQueueCheckbox',\n type: 'checkbox',\n checked: false,\n title: 'Automatically queue prompt when the queue size hits 0',\n onchange: (e) => {\n this.autoQueueEnabled = e.target.checked\n autoQueueModeEl.style.display = this.autoQueueEnabled\n ? ''\n : 'none'\n }\n }),\n autoQueueModeEl\n ])\n ]\n ),\n $el('div.comfy-menu-btns', [\n $el('button', {\n id: 'queue-front-button',\n textContent: 'Queue Front',\n onclick: () => app.queuePrompt(-1, this.batchCount)\n }),\n $el('button', {\n $: (b) => (this.queue.button = b as HTMLButtonElement),\n id: 'comfy-view-queue-button',\n textContent: 'View Queue',\n onclick: () => {\n this.history.hide()\n this.queue.toggle()\n }\n }),\n $el('button', {\n $: (b) => (this.history.button = b as HTMLButtonElement),\n id: 'comfy-view-history-button',\n textContent: 'View History',\n onclick: () => {\n this.queue.hide()\n this.history.toggle()\n }\n })\n ]),\n this.queue.element,\n this.history.element,\n $el('button', {\n id: 'comfy-save-button',\n textContent: 'Save',\n onclick: () => {\n useCommandStore().execute('Comfy.ExportWorkflow')\n }\n }),\n $el('button', {\n id: 'comfy-dev-save-api-button',\n textContent: 'Save (API Format)',\n style: { width: '100%', display: 'none' },\n onclick: () => {\n useCommandStore().execute('Comfy.ExportWorkflowAPI')\n }\n }),\n $el('button', {\n id: 'comfy-load-button',\n textContent: 'Load',\n onclick: () => fileInput.click()\n }),\n $el('button', {\n id: 'comfy-refresh-button',\n textContent: 'Refresh',\n onclick: () => app.refreshComboInNodes()\n }),\n $el('button', {\n id: 'comfy-clipspace-button',\n textContent: 'Clipspace',\n onclick: () => app.openClipspace()\n }),\n $el('button', {\n id: 'comfy-clear-button',\n textContent: 'Clear',\n onclick: () => {\n if (\n !useSettingStore().get('Comfy.ConfirmClear') ||\n confirm('Clear workflow?')\n ) {\n app.clean()\n app.graph.clear()\n app.resetView()\n api.dispatchCustomEvent('graphCleared')\n }\n }\n }),\n $el('button', {\n id: 'comfy-load-default-button',\n textContent: 'Load Default',\n onclick: async () => {\n if (\n !useSettingStore().get('Comfy.ConfirmClear') ||\n confirm('Load default workflow?')\n ) {\n app.resetView()\n await app.loadGraphData()\n }\n }\n }),\n $el('button', {\n id: 'comfy-reset-view-button',\n textContent: 'Reset View',\n onclick: async () => {\n app.resetView()\n }\n })\n ]) as HTMLDivElement\n // Hide by default on construction so it does not interfere with other views.\n this.menuContainer.style.display = 'none'\n\n this.restoreMenuPosition = dragElement(this.menuContainer, this.settings)\n\n // @ts-expect-error\n this.setStatus({ exec_info: { queue_remaining: 'X' } })\n }\n\n setStatus(status: StatusWsMessageStatus | null) {\n this.queueSize.textContent =\n 'Queue size: ' + (status ? status.exec_info.queue_remaining : 'ERR')\n if (status) {\n if (\n this.lastQueueSize != 0 &&\n status.exec_info.queue_remaining == 0 &&\n this.autoQueueEnabled &&\n (this.autoQueueMode === 'instant' || this.graphHasChanged) &&\n !app.lastExecutionError\n ) {\n app.queuePrompt(0, this.batchCount)\n status.exec_info.queue_remaining += this.batchCount\n this.graphHasChanged = false\n }\n this.lastQueueSize = status.exec_info.queue_remaining\n }\n }\n}\n","import type { ComfyWorkflowJSON } from '@/types/comfyWorkflow'\n\nexport const defaultGraph: ComfyWorkflowJSON = {\n last_node_id: 9,\n last_link_id: 9,\n nodes: [\n {\n id: 7,\n type: 'CLIPTextEncode',\n pos: [413, 389],\n size: [425.27801513671875, 180.6060791015625],\n flags: {},\n order: 3,\n mode: 0,\n inputs: [{ name: 'clip', type: 'CLIP', link: 5 }],\n outputs: [\n {\n name: 'CONDITIONING',\n type: 'CONDITIONING',\n links: [6],\n slot_index: 0\n }\n ],\n properties: {},\n widgets_values: ['text, watermark']\n },\n {\n id: 6,\n type: 'CLIPTextEncode',\n pos: [415, 186],\n size: [422.84503173828125, 164.31304931640625],\n flags: {},\n order: 2,\n mode: 0,\n inputs: [{ name: 'clip', type: 'CLIP', link: 3 }],\n outputs: [\n {\n name: 'CONDITIONING',\n type: 'CONDITIONING',\n links: [4],\n slot_index: 0\n }\n ],\n properties: {},\n widgets_values: [\n 'beautiful scenery nature glass bottle landscape, , purple galaxy bottle,'\n ]\n },\n {\n id: 5,\n type: 'EmptyLatentImage',\n pos: [473, 609],\n size: [315, 106],\n flags: {},\n order: 1,\n mode: 0,\n outputs: [{ name: 'LATENT', type: 'LATENT', links: [2], slot_index: 0 }],\n properties: {},\n widgets_values: [512, 512, 1]\n },\n {\n id: 3,\n type: 'KSampler',\n pos: [863, 186],\n size: [315, 262],\n flags: {},\n order: 4,\n mode: 0,\n inputs: [\n { name: 'model', type: 'MODEL', link: 1 },\n { name: 'positive', type: 'CONDITIONING', link: 4 },\n { name: 'negative', type: 'CONDITIONING', link: 6 },\n { name: 'latent_image', type: 'LATENT', link: 2 }\n ],\n outputs: [{ name: 'LATENT', type: 'LATENT', links: [7], slot_index: 0 }],\n properties: {},\n widgets_values: [156680208700286, true, 20, 8, 'euler', 'normal', 1]\n },\n {\n id: 8,\n type: 'VAEDecode',\n pos: [1209, 188],\n size: [210, 46],\n flags: {},\n order: 5,\n mode: 0,\n inputs: [\n { name: 'samples', type: 'LATENT', link: 7 },\n { name: 'vae', type: 'VAE', link: 8 }\n ],\n outputs: [{ name: 'IMAGE', type: 'IMAGE', links: [9], slot_index: 0 }],\n properties: {}\n },\n {\n id: 9,\n type: 'SaveImage',\n pos: [1451, 189],\n size: [210, 26],\n flags: {},\n order: 6,\n mode: 0,\n inputs: [{ name: 'images', type: 'IMAGE', link: 9 }],\n properties: {}\n },\n {\n id: 4,\n type: 'CheckpointLoaderSimple',\n pos: [26, 474],\n size: [315, 98],\n flags: {},\n order: 0,\n mode: 0,\n outputs: [\n { name: 'MODEL', type: 'MODEL', links: [1], slot_index: 0 },\n { name: 'CLIP', type: 'CLIP', links: [3, 5], slot_index: 1 },\n { name: 'VAE', type: 'VAE', links: [8], slot_index: 2 }\n ],\n properties: {},\n widgets_values: ['v1-5-pruned-emaonly.ckpt']\n }\n ],\n links: [\n [1, 4, 0, 3, 0, 'MODEL'],\n [2, 5, 0, 3, 3, 'LATENT'],\n [3, 4, 1, 6, 0, 'CLIP'],\n [4, 6, 0, 3, 1, 'CONDITIONING'],\n [5, 4, 1, 7, 0, 'CLIP'],\n [6, 7, 0, 3, 2, 'CONDITIONING'],\n [7, 3, 0, 8, 0, 'LATENT'],\n [8, 4, 2, 8, 1, 'VAE'],\n [9, 8, 0, 9, 0, 'IMAGE']\n ],\n groups: [],\n config: {},\n extra: {},\n version: 0.4\n}\n\nexport const defaultGraphJSON = JSON.stringify(defaultGraph)\n\nexport const blankGraph: ComfyWorkflowJSON = {\n last_node_id: 0,\n last_link_id: 0,\n nodes: [],\n links: [],\n groups: [],\n config: {},\n extra: {},\n version: 0.4\n}\n","// @ts-strict-ignore\nexport function getFromPngBuffer(buffer: ArrayBuffer) {\n // Get the PNG data as a Uint8Array\n const pngData = new Uint8Array(buffer)\n const dataView = new DataView(pngData.buffer)\n\n // Check that the PNG signature is present\n if (dataView.getUint32(0) !== 0x89504e47) {\n console.error('Not a valid PNG file')\n return\n }\n\n // Start searching for chunks after the PNG signature\n let offset = 8\n let txt_chunks: Record = {}\n // Loop through the chunks in the PNG file\n while (offset < pngData.length) {\n // Get the length of the chunk\n const length = dataView.getUint32(offset)\n // Get the chunk type\n const type = String.fromCharCode(...pngData.slice(offset + 4, offset + 8))\n if (type === 'tEXt' || type == 'comf' || type === 'iTXt') {\n // Get the keyword\n let keyword_end = offset + 8\n while (pngData[keyword_end] !== 0) {\n keyword_end++\n }\n const keyword = String.fromCharCode(\n ...pngData.slice(offset + 8, keyword_end)\n )\n // Get the text\n const contentArraySegment = pngData.slice(\n keyword_end + 1,\n offset + 8 + length\n )\n const contentJson = new TextDecoder('utf-8').decode(contentArraySegment)\n txt_chunks[keyword] = contentJson\n }\n\n offset += 12 + length\n }\n return txt_chunks\n}\n\nexport function getFromPngFile(file: File) {\n return new Promise>((r) => {\n const reader = new FileReader()\n reader.onload = (event) => {\n r(getFromPngBuffer(event.target.result as ArrayBuffer))\n }\n\n reader.readAsArrayBuffer(file)\n })\n}\n","// @ts-strict-ignore\nexport function getFromFlacBuffer(buffer: ArrayBuffer): Record {\n const dataView = new DataView(buffer)\n\n // Verify the FLAC signature\n const signature = String.fromCharCode(...new Uint8Array(buffer, 0, 4))\n if (signature !== 'fLaC') {\n console.error('Not a valid FLAC file')\n return\n }\n\n // Parse metadata blocks\n let offset = 4\n let vorbisComment = null\n while (offset < dataView.byteLength) {\n const isLastBlock = dataView.getUint8(offset) & 0x80\n const blockType = dataView.getUint8(offset) & 0x7f\n const blockSize = dataView.getUint32(offset, false) & 0xffffff\n offset += 4\n\n if (blockType === 4) {\n // Vorbis Comment block type\n vorbisComment = parseVorbisComment(\n new DataView(buffer, offset, blockSize)\n )\n }\n\n offset += blockSize\n if (isLastBlock) break\n }\n\n return vorbisComment\n}\n\nexport function getFromFlacFile(file: File): Promise> {\n return new Promise((r) => {\n const reader = new FileReader()\n reader.onload = function (event) {\n const arrayBuffer = event.target.result as ArrayBuffer\n r(getFromFlacBuffer(arrayBuffer))\n }\n reader.readAsArrayBuffer(file)\n })\n}\n\n// Function to parse the Vorbis Comment block\nfunction parseVorbisComment(dataView: DataView): Record {\n let offset = 0\n const vendorLength = dataView.getUint32(offset, true)\n offset += 4\n const vendorString = getString(dataView, offset, vendorLength)\n offset += vendorLength\n\n const userCommentListLength = dataView.getUint32(offset, true)\n offset += 4\n const comments = {}\n for (let i = 0; i < userCommentListLength; i++) {\n const commentLength = dataView.getUint32(offset, true)\n offset += 4\n const comment = getString(dataView, offset, commentLength)\n offset += commentLength\n\n const ind = comment.indexOf('=')\n const key = comment.substring(0, ind)\n\n comments[key] = comment.substring(ind + 1)\n }\n\n return comments\n}\n\nfunction getString(dataView: DataView, offset: number, length: number): string {\n let string = ''\n for (let i = 0; i < length; i++) {\n string += String.fromCharCode(dataView.getUint8(offset + i))\n }\n return string\n}\n","// @ts-strict-ignore\nimport { LiteGraph } from '@comfyorg/litegraph'\nimport { api } from './api'\nimport { getFromPngFile } from './metadata/png'\nimport { getFromFlacFile } from './metadata/flac'\nimport { workflowService } from '@/services/workflowService'\n\n// Original functions left in for backwards compatibility\nexport function getPngMetadata(file: File): Promise> {\n return getFromPngFile(file)\n}\n\nexport function getFlacMetadata(file: File): Promise> {\n return getFromFlacFile(file)\n}\n\nfunction parseExifData(exifData) {\n // Check for the correct TIFF header (0x4949 for little-endian or 0x4D4D for big-endian)\n const isLittleEndian = String.fromCharCode(...exifData.slice(0, 2)) === 'II'\n\n // Function to read 16-bit and 32-bit integers from binary data\n function readInt(offset, isLittleEndian, length) {\n let arr = exifData.slice(offset, offset + length)\n if (length === 2) {\n return new DataView(arr.buffer, arr.byteOffset, arr.byteLength).getUint16(\n 0,\n isLittleEndian\n )\n } else if (length === 4) {\n return new DataView(arr.buffer, arr.byteOffset, arr.byteLength).getUint32(\n 0,\n isLittleEndian\n )\n }\n }\n\n // Read the offset to the first IFD (Image File Directory)\n const ifdOffset = readInt(4, isLittleEndian, 4)\n\n function parseIFD(offset) {\n const numEntries = readInt(offset, isLittleEndian, 2)\n const result = {}\n\n for (let i = 0; i < numEntries; i++) {\n const entryOffset = offset + 2 + i * 12\n const tag = readInt(entryOffset, isLittleEndian, 2)\n const type = readInt(entryOffset + 2, isLittleEndian, 2)\n const numValues = readInt(entryOffset + 4, isLittleEndian, 4)\n const valueOffset = readInt(entryOffset + 8, isLittleEndian, 4)\n\n // Read the value(s) based on the data type\n let value\n if (type === 2) {\n // ASCII string\n value = new TextDecoder('utf-8').decode(\n exifData.subarray(valueOffset, valueOffset + numValues - 1)\n )\n }\n\n result[tag] = value\n }\n\n return result\n }\n\n // Parse the first IFD\n const ifdData = parseIFD(ifdOffset)\n return ifdData\n}\n\nfunction splitValues(input) {\n var output = {}\n for (var key in input) {\n var value = input[key]\n var splitValues = value.split(':', 2)\n output[splitValues[0]] = splitValues[1]\n }\n return output\n}\n\nexport function getWebpMetadata(file) {\n return new Promise>((r) => {\n const reader = new FileReader()\n reader.onload = (event) => {\n const webp = new Uint8Array(event.target.result as ArrayBuffer)\n const dataView = new DataView(webp.buffer)\n\n // Check that the WEBP signature is present\n if (\n dataView.getUint32(0) !== 0x52494646 ||\n dataView.getUint32(8) !== 0x57454250\n ) {\n console.error('Not a valid WEBP file')\n r({})\n return\n }\n\n // Start searching for chunks after the WEBP signature\n let offset = 12\n let txt_chunks = {}\n // Loop through the chunks in the WEBP file\n while (offset < webp.length) {\n const chunk_length = dataView.getUint32(offset + 4, true)\n const chunk_type = String.fromCharCode(\n ...webp.slice(offset, offset + 4)\n )\n if (chunk_type === 'EXIF') {\n if (\n String.fromCharCode(...webp.slice(offset + 8, offset + 8 + 6)) ==\n 'Exif\\0\\0'\n ) {\n offset += 6\n }\n let data = parseExifData(\n webp.slice(offset + 8, offset + 8 + chunk_length)\n )\n for (var key in data) {\n const value = data[key] as string\n if (typeof value === 'string') {\n const index = value.indexOf(':')\n txt_chunks[value.slice(0, index)] = value.slice(index + 1)\n }\n }\n break\n }\n\n offset += 8 + chunk_length\n }\n\n r(txt_chunks)\n }\n\n reader.readAsArrayBuffer(file)\n })\n}\n\nexport function getLatentMetadata(file) {\n return new Promise((r) => {\n const reader = new FileReader()\n reader.onload = (event) => {\n const safetensorsData = new Uint8Array(event.target.result as ArrayBuffer)\n const dataView = new DataView(safetensorsData.buffer)\n let header_size = dataView.getUint32(0, true)\n let offset = 8\n let header = JSON.parse(\n new TextDecoder().decode(\n safetensorsData.slice(offset, offset + header_size)\n )\n )\n r(header.__metadata__)\n }\n\n var slice = file.slice(0, 1024 * 1024 * 4)\n reader.readAsArrayBuffer(slice)\n })\n}\n\nexport async function importA1111(graph, parameters) {\n const p = parameters.lastIndexOf('\\nSteps:')\n if (p > -1) {\n const embeddings = await api.getEmbeddings()\n const opts = parameters\n .substr(p)\n .split('\\n')[1]\n .match(\n new RegExp('\\\\s*([^:]+:\\\\s*([^\"\\\\{].*?|\".*?\"|\\\\{.*?\\\\}))\\\\s*(,|$)', 'g')\n )\n .reduce((p, n) => {\n const s = n.split(':')\n if (s[1].endsWith(',')) {\n s[1] = s[1].substr(0, s[1].length - 1)\n }\n p[s[0].trim().toLowerCase()] = s[1].trim()\n return p\n }, {})\n const p2 = parameters.lastIndexOf('\\nNegative prompt:', p)\n if (p2 > -1) {\n let positive = parameters.substr(0, p2).trim()\n let negative = parameters.substring(p2 + 18, p).trim()\n\n const ckptNode = LiteGraph.createNode('CheckpointLoaderSimple')\n const clipSkipNode = LiteGraph.createNode('CLIPSetLastLayer')\n const positiveNode = LiteGraph.createNode('CLIPTextEncode')\n const negativeNode = LiteGraph.createNode('CLIPTextEncode')\n const samplerNode = LiteGraph.createNode('KSampler')\n const imageNode = LiteGraph.createNode('EmptyLatentImage')\n const vaeNode = LiteGraph.createNode('VAEDecode')\n const vaeLoaderNode = LiteGraph.createNode('VAELoader')\n const saveNode = LiteGraph.createNode('SaveImage')\n let hrSamplerNode = null\n let hrSteps = null\n\n const ceil64 = (v) => Math.ceil(v / 64) * 64\n\n const getWidget = (node, name) => {\n return node.widgets.find((w) => w.name === name)\n }\n\n const setWidgetValue = (node, name, value, isOptionPrefix?) => {\n const w = getWidget(node, name)\n if (isOptionPrefix) {\n const o = w.options.values.find((w) => w.startsWith(value))\n if (o) {\n w.value = o\n } else {\n console.warn(`Unknown value '${value}' for widget '${name}'`, node)\n w.value = value\n }\n } else {\n w.value = value\n }\n }\n\n const createLoraNodes = (clipNode, text, prevClip, prevModel) => {\n const loras = []\n text = text.replace(/]+)>/g, function (m, c) {\n const s = c.split(':')\n const weight = parseFloat(s[1])\n if (isNaN(weight)) {\n console.warn('Invalid LORA', m)\n } else {\n loras.push({ name: s[0], weight })\n }\n return ''\n })\n\n for (const l of loras) {\n const loraNode = LiteGraph.createNode('LoraLoader')\n graph.add(loraNode)\n setWidgetValue(loraNode, 'lora_name', l.name, true)\n setWidgetValue(loraNode, 'strength_model', l.weight)\n setWidgetValue(loraNode, 'strength_clip', l.weight)\n prevModel.node.connect(prevModel.index, loraNode, 0)\n prevClip.node.connect(prevClip.index, loraNode, 1)\n prevModel = { node: loraNode, index: 0 }\n prevClip = { node: loraNode, index: 1 }\n }\n\n prevClip.node.connect(1, clipNode, 0)\n prevModel.node.connect(0, samplerNode, 0)\n if (hrSamplerNode) {\n prevModel.node.connect(0, hrSamplerNode, 0)\n }\n\n return { text, prevModel, prevClip }\n }\n\n const replaceEmbeddings = (text) => {\n if (!embeddings.length) return text\n return text.replaceAll(\n new RegExp(\n '\\\\b(' +\n embeddings\n .map((e) => e.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n .join('\\\\b|\\\\b') +\n ')\\\\b',\n 'ig'\n ),\n 'embedding:$1'\n )\n }\n\n const popOpt = (name) => {\n const v = opts[name]\n delete opts[name]\n return v\n }\n\n graph.clear()\n graph.add(ckptNode)\n graph.add(clipSkipNode)\n graph.add(positiveNode)\n graph.add(negativeNode)\n graph.add(samplerNode)\n graph.add(imageNode)\n graph.add(vaeNode)\n graph.add(vaeLoaderNode)\n graph.add(saveNode)\n\n ckptNode.connect(1, clipSkipNode, 0)\n clipSkipNode.connect(0, positiveNode, 0)\n clipSkipNode.connect(0, negativeNode, 0)\n ckptNode.connect(0, samplerNode, 0)\n positiveNode.connect(0, samplerNode, 1)\n negativeNode.connect(0, samplerNode, 2)\n imageNode.connect(0, samplerNode, 3)\n vaeNode.connect(0, saveNode, 0)\n samplerNode.connect(0, vaeNode, 0)\n vaeLoaderNode.connect(0, vaeNode, 1)\n\n const handlers = {\n model(v) {\n setWidgetValue(ckptNode, 'ckpt_name', v, true)\n },\n vae(v) {\n setWidgetValue(vaeLoaderNode, 'vae_name', v, true)\n },\n 'cfg scale'(v) {\n setWidgetValue(samplerNode, 'cfg', +v)\n },\n 'clip skip'(v) {\n setWidgetValue(clipSkipNode, 'stop_at_clip_layer', -v)\n },\n sampler(v) {\n let name = v.toLowerCase().replace('++', 'pp').replaceAll(' ', '_')\n if (name.includes('karras')) {\n name = name.replace('karras', '').replace(/_+$/, '')\n setWidgetValue(samplerNode, 'scheduler', 'karras')\n } else {\n setWidgetValue(samplerNode, 'scheduler', 'normal')\n }\n const w = getWidget(samplerNode, 'sampler_name')\n const o = w.options.values.find(\n (w) => w === name || w === 'sample_' + name\n )\n if (o) {\n setWidgetValue(samplerNode, 'sampler_name', o)\n }\n },\n size(v) {\n const wxh = v.split('x')\n const w = ceil64(+wxh[0])\n const h = ceil64(+wxh[1])\n const hrUp = popOpt('hires upscale')\n const hrSz = popOpt('hires resize')\n hrSteps = popOpt('hires steps')\n let hrMethod = popOpt('hires upscaler')\n\n setWidgetValue(imageNode, 'width', w)\n setWidgetValue(imageNode, 'height', h)\n\n if (hrUp || hrSz) {\n let uw, uh\n if (hrUp) {\n uw = w * hrUp\n uh = h * hrUp\n } else {\n const s = hrSz.split('x')\n uw = +s[0]\n uh = +s[1]\n }\n\n let upscaleNode\n let latentNode\n\n if (hrMethod.startsWith('Latent')) {\n latentNode = upscaleNode = LiteGraph.createNode('LatentUpscale')\n graph.add(upscaleNode)\n samplerNode.connect(0, upscaleNode, 0)\n\n switch (hrMethod) {\n case 'Latent (nearest-exact)':\n hrMethod = 'nearest-exact'\n break\n }\n setWidgetValue(upscaleNode, 'upscale_method', hrMethod, true)\n } else {\n const decode = LiteGraph.createNode('VAEDecodeTiled')\n graph.add(decode)\n samplerNode.connect(0, decode, 0)\n vaeLoaderNode.connect(0, decode, 1)\n\n const upscaleLoaderNode =\n LiteGraph.createNode('UpscaleModelLoader')\n graph.add(upscaleLoaderNode)\n setWidgetValue(upscaleLoaderNode, 'model_name', hrMethod, true)\n\n const modelUpscaleNode = LiteGraph.createNode(\n 'ImageUpscaleWithModel'\n )\n graph.add(modelUpscaleNode)\n decode.connect(0, modelUpscaleNode, 1)\n upscaleLoaderNode.connect(0, modelUpscaleNode, 0)\n\n upscaleNode = LiteGraph.createNode('ImageScale')\n graph.add(upscaleNode)\n modelUpscaleNode.connect(0, upscaleNode, 0)\n\n const vaeEncodeNode = (latentNode =\n LiteGraph.createNode('VAEEncodeTiled'))\n graph.add(vaeEncodeNode)\n upscaleNode.connect(0, vaeEncodeNode, 0)\n vaeLoaderNode.connect(0, vaeEncodeNode, 1)\n }\n\n setWidgetValue(upscaleNode, 'width', ceil64(uw))\n setWidgetValue(upscaleNode, 'height', ceil64(uh))\n\n hrSamplerNode = LiteGraph.createNode('KSampler')\n graph.add(hrSamplerNode)\n ckptNode.connect(0, hrSamplerNode, 0)\n positiveNode.connect(0, hrSamplerNode, 1)\n negativeNode.connect(0, hrSamplerNode, 2)\n latentNode.connect(0, hrSamplerNode, 3)\n hrSamplerNode.connect(0, vaeNode, 0)\n }\n },\n steps(v) {\n setWidgetValue(samplerNode, 'steps', +v)\n },\n seed(v) {\n setWidgetValue(samplerNode, 'seed', +v)\n }\n }\n\n for (const opt in opts) {\n if (opt in handlers) {\n handlers[opt](popOpt(opt))\n }\n }\n\n if (hrSamplerNode) {\n setWidgetValue(\n hrSamplerNode,\n 'steps',\n hrSteps ? +hrSteps : getWidget(samplerNode, 'steps').value\n )\n setWidgetValue(\n hrSamplerNode,\n 'cfg',\n getWidget(samplerNode, 'cfg').value\n )\n setWidgetValue(\n hrSamplerNode,\n 'scheduler',\n getWidget(samplerNode, 'scheduler').value\n )\n setWidgetValue(\n hrSamplerNode,\n 'sampler_name',\n getWidget(samplerNode, 'sampler_name').value\n )\n setWidgetValue(\n hrSamplerNode,\n 'denoise',\n +(popOpt('denoising strength') || '1')\n )\n }\n\n let n = createLoraNodes(\n positiveNode,\n positive,\n { node: clipSkipNode, index: 0 },\n { node: ckptNode, index: 0 }\n )\n positive = n.text\n n = createLoraNodes(negativeNode, negative, n.prevClip, n.prevModel)\n negative = n.text\n\n setWidgetValue(positiveNode, 'text', replaceEmbeddings(positive))\n setWidgetValue(negativeNode, 'text', replaceEmbeddings(negative))\n\n graph.arrange()\n\n for (const opt of [\n 'model hash',\n 'ensd',\n 'version',\n 'vae hash',\n 'ti hashes',\n 'lora hashes',\n 'hashes'\n ]) {\n delete opts[opt]\n }\n\n console.warn('Unhandled parameters:', opts)\n }\n }\n}\n","// @ts-strict-ignore\nimport { app } from '../app'\nimport { $el } from '../ui'\n\nexport function calculateImageGrid(imgs, dw, dh) {\n let best = 0\n let w = imgs[0].naturalWidth\n let h = imgs[0].naturalHeight\n const numImages = imgs.length\n\n let cellWidth, cellHeight, cols, rows, shiftX\n // compact style\n for (let c = 1; c <= numImages; c++) {\n const r = Math.ceil(numImages / c)\n const cW = dw / c\n const cH = dh / r\n const scaleX = cW / w\n const scaleY = cH / h\n\n const scale = Math.min(scaleX, scaleY, 1)\n const imageW = w * scale\n const imageH = h * scale\n const area = imageW * imageH * numImages\n\n if (area > best) {\n best = area\n cellWidth = imageW\n cellHeight = imageH\n cols = c\n rows = r\n shiftX = c * ((cW - imageW) / 2)\n }\n }\n\n return { cellWidth, cellHeight, cols, rows, shiftX }\n}\n\nexport function createImageHost(node) {\n const el = $el('div.comfy-img-preview')\n let currentImgs\n let first = true\n\n function updateSize() {\n let w = null\n let h = null\n\n if (currentImgs) {\n let elH = el.clientHeight\n if (first) {\n first = false\n // On first run, if we are small then grow a bit\n if (elH < 190) {\n elH = 190\n }\n el.style.setProperty('--comfy-widget-min-height', elH.toString())\n } else {\n el.style.setProperty('--comfy-widget-min-height', null)\n }\n\n const nw = node.size[0]\n ;({ cellWidth: w, cellHeight: h } = calculateImageGrid(\n currentImgs,\n nw - 20,\n elH\n ))\n w += 'px'\n h += 'px'\n\n el.style.setProperty('--comfy-img-preview-width', w)\n el.style.setProperty('--comfy-img-preview-height', h)\n }\n }\n return {\n el,\n updateImages(imgs) {\n if (imgs !== currentImgs) {\n if (currentImgs == null) {\n requestAnimationFrame(() => {\n updateSize()\n })\n }\n el.replaceChildren(...imgs)\n currentImgs = imgs\n node.onResize(node.size)\n node.graph.setDirtyCanvas(true, true)\n }\n },\n getHeight() {\n updateSize()\n },\n onDraw() {\n // Element from point uses a hittest find elements so we need to toggle pointer events\n el.style.pointerEvents = 'all'\n const over = document.elementFromPoint(\n app.canvas.mouse[0],\n app.canvas.mouse[1]\n )\n el.style.pointerEvents = 'none'\n\n if (!over) return\n // Set the overIndex so Open Image etc work\n const idx = currentImgs.indexOf(over)\n node.overIndex = idx\n }\n }\n}\n","import { memoize } from 'lodash'\n\ntype RGB = { r: number; g: number; b: number }\ntype HSL = { h: number; s: number; l: number }\ntype HSLA = { h: number; s: number; l: number; a: number }\ntype ColorFormat = 'hex' | 'rgb' | 'rgba' | 'hsl' | 'hsla'\n\nexport interface ColorAdjustOptions {\n lightness?: number\n opacity?: number\n}\n\nfunction rgbToHsl({ r, g, b }: RGB): HSL {\n r /= 255\n g /= 255\n b /= 255\n const max = Math.max(r, g, b),\n min = Math.min(r, g, b)\n let h = 0,\n s = 0\n const l: number = (max + min) / 2\n\n if (max !== min) {\n const d = max - min\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min)\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0)\n break\n case g:\n h = (b - r) / d + 2\n break\n case b:\n h = (r - g) / d + 4\n break\n }\n h /= 6\n }\n\n return { h, s, l }\n}\n\nfunction hexToRgb(hex: string): RGB {\n let r = 0,\n g = 0,\n b = 0\n // 3 digits\n if (hex.length == 4) {\n r = parseInt(hex[1] + hex[1], 16)\n g = parseInt(hex[2] + hex[2], 16)\n b = parseInt(hex[3] + hex[3], 16)\n }\n // 6 digits\n else if (hex.length == 7) {\n r = parseInt(hex.slice(1, 3), 16)\n g = parseInt(hex.slice(3, 5), 16)\n b = parseInt(hex.slice(5, 7), 16)\n }\n return { r, g, b }\n}\n\nconst identifyColorFormat = (color: string): ColorFormat | null => {\n if (!color) return null\n if (color.startsWith('#') && (color.length === 4 || color.length === 7))\n return 'hex'\n if (/rgba?\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*/.test(color))\n return color.includes('rgba') ? 'rgba' : 'rgb'\n if (/hsla?\\(\\s*\\d+(\\.\\d+)?\\s*,\\s*\\d+(\\.\\d+)?%\\s*,\\s*\\d+(\\.\\d+)?%/.test(color))\n return color.includes('hsla') ? 'hsla' : 'hsl'\n return null\n}\n\nconst isHSLA = (color: unknown): color is HSLA => {\n if (typeof color !== 'object' || color === null) return false\n\n return ['h', 's', 'l', 'a'].every(\n (key) =>\n typeof (color as Record)[key] === 'number' &&\n !isNaN((color as Record)[key])\n )\n}\n\nfunction parseToHSLA(color: string, format: ColorFormat): HSLA | null {\n let match: RegExpMatchArray | null\n\n switch (format) {\n case 'hex': {\n const hsl = rgbToHsl(hexToRgb(color))\n return {\n h: Math.round(hsl.h * 360),\n s: +(hsl.s * 100).toFixed(1),\n l: +(hsl.l * 100).toFixed(1),\n a: 1\n }\n }\n\n case 'rgb':\n case 'rgba': {\n match = color.match(/\\d+(\\.\\d+)?/g)\n if (!match || match.length < 3) return null\n const [r, g, b] = match.map(Number)\n const hsl = rgbToHsl({ r, g, b })\n\n const a = format === 'rgba' && match[3] ? parseFloat(match[3]) : 1\n\n return {\n h: Math.round(hsl.h * 360),\n s: +(hsl.s * 100).toFixed(1),\n l: +(hsl.l * 100).toFixed(1),\n a\n }\n }\n\n case 'hsl':\n case 'hsla': {\n match = color.match(/\\d+(\\.\\d+)?/g)\n if (!match || match.length < 3) return null\n const [h, s, l] = match.map(Number)\n const a = format === 'hsla' && match[3] ? parseFloat(match[3]) : 1\n return { h, s, l, a }\n }\n default:\n return null\n }\n}\n\nconst applyColorAdjustments = (\n color: string,\n options: ColorAdjustOptions\n): string => {\n if (!Object.keys(options).length) return color\n\n const format = identifyColorFormat(color)\n if (!format) {\n console.warn(`Unsupported color format in color palette: ${color}`)\n return color\n }\n\n const hsla = parseToHSLA(color, format)\n if (!isHSLA(hsla)) {\n console.warn(`Invalid color values in color palette: ${color}`)\n return color\n }\n\n if (options.lightness) {\n hsla.l = Math.max(0, Math.min(100, hsla.l + options.lightness * 100.0))\n }\n\n if (options.opacity) {\n hsla.a = Math.max(0, Math.min(1, options.opacity))\n }\n\n return `hsla(${hsla.h}, ${hsla.s}%, ${hsla.l}%, ${hsla.a})`\n}\n\nexport const adjustColor: (\n color: string,\n options: ColorAdjustOptions\n) => string = memoize(\n applyColorAdjustments,\n (color: string, options: ColorAdjustOptions): string =>\n `${color}-${JSON.stringify(options)}`\n)\n","// @ts-strict-ignore\nimport { api } from './api'\nimport type { ComfyApp } from './app'\nimport { $el } from './ui'\n\n// Simple date formatter\nconst parts = {\n d: (d) => d.getDate(),\n M: (d) => d.getMonth() + 1,\n h: (d) => d.getHours(),\n m: (d) => d.getMinutes(),\n s: (d) => d.getSeconds()\n}\nconst format =\n Object.keys(parts)\n .map((k) => k + k + '?')\n .join('|') + '|yyy?y?'\n\nfunction formatDate(text: string, date: Date) {\n return text.replace(new RegExp(format, 'g'), (text: string): string => {\n if (text === 'yy') return (date.getFullYear() + '').substring(2)\n if (text === 'yyyy') return date.getFullYear().toString()\n if (text[0] in parts) {\n const p = parts[text[0]](date)\n return (p + '').padStart(text.length, '0')\n }\n return text\n })\n}\n\nexport function clone(obj: any) {\n try {\n if (typeof structuredClone !== 'undefined') {\n return structuredClone(obj)\n }\n } catch (error) {\n // structuredClone is stricter than using JSON.parse/stringify so fallback to that\n }\n\n return JSON.parse(JSON.stringify(obj))\n}\n\nexport function applyTextReplacements(app: ComfyApp, value: string): string {\n return value.replace(/%([^%]+)%/g, function (match, text) {\n const split = text.split('.')\n if (split.length !== 2) {\n // Special handling for dates\n if (split[0].startsWith('date:')) {\n return formatDate(split[0].substring(5), new Date())\n }\n\n if (text !== 'width' && text !== 'height') {\n // Dont warn on standard replacements\n console.warn('Invalid replacement pattern', text)\n }\n return match\n }\n\n // Find node with matching S&R property name\n let nodes = app.graph.nodes.filter(\n (n) => n.properties?.['Node name for S&R'] === split[0]\n )\n // If we cant, see if there is a node with that title\n if (!nodes.length) {\n nodes = app.graph.nodes.filter((n) => n.title === split[0])\n }\n if (!nodes.length) {\n console.warn('Unable to find node', split[0])\n return match\n }\n\n if (nodes.length > 1) {\n console.warn('Multiple nodes matched', split[0], 'using first match')\n }\n\n const node = nodes[0]\n\n const widget = node.widgets?.find((w) => w.name === split[1])\n if (!widget) {\n console.warn('Unable to find widget', split[1], 'on node', split[0], node)\n return match\n }\n\n return ((widget.value ?? '') + '').replaceAll(/\\/|\\\\/g, '_')\n })\n}\n\nexport async function addStylesheet(\n urlOrFile: string,\n relativeTo?: string\n): Promise {\n return new Promise((res, rej) => {\n let url\n if (urlOrFile.endsWith('.js')) {\n url = urlOrFile.substr(0, urlOrFile.length - 2) + 'css'\n } else {\n url = new URL(\n urlOrFile,\n relativeTo ?? `${window.location.protocol}//${window.location.host}`\n ).toString()\n }\n $el('link', {\n parent: document.head,\n rel: 'stylesheet',\n type: 'text/css',\n href: url,\n onload: res,\n onerror: rej\n })\n })\n}\n\n/**\n * @param { string } filename\n * @param { Blob } blob\n */\nexport function downloadBlob(filename, blob) {\n const url = URL.createObjectURL(blob)\n const a = $el('a', {\n href: url,\n download: filename,\n style: { display: 'none' },\n parent: document.body\n })\n a.click()\n setTimeout(function () {\n a.remove()\n window.URL.revokeObjectURL(url)\n }, 0)\n}\n\nexport function prop(\n target: object,\n name: string,\n defaultValue: T,\n onChanged?: (\n currentValue: T,\n previousValue: T,\n target: object,\n name: string\n ) => void\n): T {\n let currentValue\n Object.defineProperty(target, name, {\n get() {\n return currentValue\n },\n set(newValue) {\n const prevValue = currentValue\n currentValue = newValue\n onChanged?.(currentValue, prevValue, target, name)\n }\n })\n return defaultValue\n}\n\nexport function getStorageValue(id: string) {\n const clientId = api.clientId ?? api.initialClientId\n return (\n (clientId && sessionStorage.getItem(`${id}:${clientId}`)) ??\n localStorage.getItem(id)\n )\n}\n\nexport function setStorageValue(id: string, value: string) {\n const clientId = api.clientId ?? api.initialClientId\n if (clientId) {\n sessionStorage.setItem(`${id}:${clientId}`, value)\n }\n localStorage.setItem(id, value)\n}\n","// @ts-strict-ignore\nimport { $el } from '../../ui'\nimport { ComfyButton } from './button'\nimport { prop } from '../../utils'\n\nexport class ComfyButtonGroup {\n element = $el('div.comfyui-button-group')\n buttons: (HTMLElement | ComfyButton)[]\n\n constructor(...buttons: (HTMLElement | ComfyButton)[]) {\n this.buttons = prop(this, 'buttons', buttons, () => this.update())\n }\n\n insert(button: ComfyButton, index: number) {\n this.buttons.splice(index, 0, button)\n this.update()\n }\n\n append(button: ComfyButton) {\n this.buttons.push(button)\n this.update()\n }\n\n remove(indexOrButton: ComfyButton | number) {\n if (typeof indexOrButton !== 'number') {\n indexOrButton = this.buttons.indexOf(indexOrButton)\n }\n if (indexOrButton > -1) {\n const r = this.buttons.splice(indexOrButton, 1)\n this.update()\n return r\n }\n }\n\n update() {\n this.element.replaceChildren(...this.buttons.map((b) => b['element'] ?? b))\n }\n}\n","// @ts-strict-ignore\nexport type ClassList = string | string[] | Record\n\nexport function applyClasses(\n element: HTMLElement,\n classList: ClassList,\n ...requiredClasses: string[]\n) {\n classList ??= ''\n\n let str: string\n if (typeof classList === 'string') {\n str = classList\n } else if (classList instanceof Array) {\n str = classList.join(' ')\n } else {\n str = Object.entries(classList).reduce((p, c) => {\n if (c[1]) {\n p += (p.length ? ' ' : '') + c[0]\n }\n return p\n }, '')\n }\n element.className = str\n if (requiredClasses) {\n element.classList.add(...requiredClasses)\n }\n}\n\nexport function toggleElement(\n element: HTMLElement,\n {\n onHide,\n onShow\n }: {\n onHide?: (el: HTMLElement) => void\n onShow?: (el: HTMLElement, value) => void\n } = {}\n) {\n let placeholder: HTMLElement | Comment\n let hidden: boolean\n return (value) => {\n if (value) {\n if (hidden) {\n hidden = false\n placeholder.replaceWith(element)\n }\n onShow?.(element, value)\n } else {\n if (!placeholder) {\n placeholder = document.createComment('')\n }\n hidden = true\n element.replaceWith(placeholder)\n onHide?.(element)\n }\n }\n}\n","// @ts-strict-ignore\nimport { $el } from '../../ui'\nimport { applyClasses, ClassList, toggleElement } from '../utils'\nimport { prop } from '../../utils'\nimport type { ComfyPopup } from './popup'\nimport type { ComfyComponent } from '.'\nimport type { ComfyApp } from '@/scripts/app'\nimport { Settings } from '@/types/apiTypes'\n\ntype ComfyButtonProps = {\n icon?: string\n overIcon?: string\n iconSize?: number\n content?: string | HTMLElement\n tooltip?: string\n enabled?: boolean\n action?: (e: Event, btn: ComfyButton) => void\n classList?: ClassList\n visibilitySetting?: { id: keyof Settings; showValue: boolean }\n app?: ComfyApp\n}\n\nexport class ComfyButton implements ComfyComponent {\n #over = 0\n #popupOpen = false\n isOver = false\n iconElement = $el('i.mdi')\n contentElement = $el('span')\n popup: ComfyPopup\n element: HTMLElement\n overIcon: string\n iconSize: number\n content: string | HTMLElement\n icon: string\n tooltip: string\n classList: ClassList\n hidden: boolean\n enabled: boolean\n action: (e: Event, btn: ComfyButton) => void\n\n constructor({\n icon,\n overIcon,\n iconSize,\n content,\n tooltip,\n action,\n classList = 'comfyui-button',\n visibilitySetting,\n app,\n enabled = true\n }: ComfyButtonProps) {\n this.element = $el(\n 'button',\n {\n onmouseenter: () => {\n this.isOver = true\n if (this.overIcon) {\n this.updateIcon()\n }\n },\n onmouseleave: () => {\n this.isOver = false\n if (this.overIcon) {\n this.updateIcon()\n }\n }\n },\n [this.iconElement, this.contentElement]\n )\n\n this.icon = prop(\n this,\n 'icon',\n icon,\n toggleElement(this.iconElement, { onShow: this.updateIcon })\n )\n this.overIcon = prop(this, 'overIcon', overIcon, () => {\n if (this.isOver) {\n this.updateIcon()\n }\n })\n this.iconSize = prop(this, 'iconSize', iconSize, this.updateIcon)\n this.content = prop(\n this,\n 'content',\n content,\n toggleElement(this.contentElement, {\n onShow: (el, v) => {\n if (typeof v === 'string') {\n el.textContent = v\n } else {\n el.replaceChildren(v)\n }\n }\n })\n )\n\n this.tooltip = prop(this, 'tooltip', tooltip, (v) => {\n if (v) {\n this.element.title = v\n } else {\n this.element.removeAttribute('title')\n }\n })\n if (tooltip !== undefined) {\n this.element.setAttribute('aria-label', tooltip)\n }\n this.classList = prop(this, 'classList', classList, this.updateClasses)\n this.hidden = prop(this, 'hidden', false, this.updateClasses)\n this.enabled = prop(this, 'enabled', enabled, () => {\n this.updateClasses()\n ;(this.element as HTMLButtonElement).disabled = !this.enabled\n })\n this.action = prop(this, 'action', action)\n this.element.addEventListener('click', (e) => {\n if (this.popup) {\n // we are either a touch device or triggered by click not hover\n if (!this.#over) {\n this.popup.toggle()\n }\n }\n this.action?.(e, this)\n })\n\n if (visibilitySetting?.id) {\n const settingUpdated = () => {\n this.hidden =\n app.ui.settings.getSettingValue(visibilitySetting.id) !==\n visibilitySetting.showValue\n }\n app.ui.settings.addEventListener(\n visibilitySetting.id + '.change',\n settingUpdated\n )\n settingUpdated()\n }\n }\n\n updateIcon = () =>\n (this.iconElement.className = `mdi mdi-${(this.isOver && this.overIcon) || this.icon}${this.iconSize ? ' mdi-' + this.iconSize + 'px' : ''}`)\n updateClasses = () => {\n const internalClasses = []\n if (this.hidden) {\n internalClasses.push('hidden')\n }\n if (!this.enabled) {\n internalClasses.push('disabled')\n }\n if (this.popup) {\n if (this.#popupOpen) {\n internalClasses.push('popup-open')\n } else {\n internalClasses.push('popup-closed')\n }\n }\n applyClasses(this.element, this.classList, ...internalClasses)\n }\n\n withPopup(popup: ComfyPopup, mode: 'click' | 'hover' = 'click') {\n this.popup = popup\n\n if (mode === 'hover') {\n for (const el of [this.element, this.popup.element]) {\n el.addEventListener('mouseenter', () => {\n this.popup.open = !!++this.#over\n })\n el.addEventListener('mouseleave', () => {\n this.popup.open = !!--this.#over\n })\n }\n }\n\n popup.addEventListener('change', () => {\n this.#popupOpen = popup.open\n this.updateClasses()\n })\n\n return this\n }\n}\n","// @ts-strict-ignore\nimport { prop } from '../../utils'\nimport { $el } from '../../ui'\nimport { applyClasses, ClassList } from '../utils'\n\nexport class ComfyPopup extends EventTarget {\n element = $el('div.comfyui-popup')\n open: boolean\n children: HTMLElement[]\n target: HTMLElement\n ignoreTarget: boolean\n container: HTMLElement\n position: string\n closeOnEscape: boolean\n horizontal: string\n classList: ClassList\n\n constructor(\n {\n target,\n container = document.body,\n classList = '',\n ignoreTarget = true,\n closeOnEscape = true,\n position = 'absolute',\n horizontal = 'left'\n }: {\n target: HTMLElement\n container?: HTMLElement\n classList?: ClassList\n ignoreTarget?: boolean\n closeOnEscape?: boolean\n position?: 'absolute' | 'relative'\n horizontal?: 'left' | 'right'\n },\n ...children: HTMLElement[]\n ) {\n super()\n this.target = target\n this.ignoreTarget = ignoreTarget\n this.container = container\n this.position = position\n this.closeOnEscape = closeOnEscape\n this.horizontal = horizontal\n\n container.append(this.element)\n\n this.children = prop(this, 'children', children, () => {\n this.element.replaceChildren(...this.children)\n this.update()\n })\n this.classList = prop(this, 'classList', classList, () =>\n applyClasses(this.element, this.classList, 'comfyui-popup', horizontal)\n )\n this.open = prop(this, 'open', false, (v, o) => {\n if (v === o) return\n if (v) {\n this.#show()\n } else {\n this.#hide()\n }\n })\n }\n\n toggle() {\n this.open = !this.open\n }\n\n #hide() {\n this.element.classList.remove('open')\n window.removeEventListener('resize', this.update)\n window.removeEventListener('click', this.#clickHandler, { capture: true })\n window.removeEventListener('keydown', this.#escHandler, { capture: true })\n\n this.dispatchEvent(new CustomEvent('close'))\n this.dispatchEvent(new CustomEvent('change'))\n }\n\n #show() {\n this.element.classList.add('open')\n this.update()\n\n window.addEventListener('resize', this.update)\n window.addEventListener('click', this.#clickHandler, { capture: true })\n if (this.closeOnEscape) {\n window.addEventListener('keydown', this.#escHandler, { capture: true })\n }\n\n this.dispatchEvent(new CustomEvent('open'))\n this.dispatchEvent(new CustomEvent('change'))\n }\n\n #escHandler = (e) => {\n if (e.key === 'Escape') {\n this.open = false\n e.preventDefault()\n e.stopImmediatePropagation()\n }\n }\n\n #clickHandler = (e) => {\n /** @type {any} */\n const target = e.target\n if (\n !this.element.contains(target) &&\n this.ignoreTarget &&\n !this.target.contains(target)\n ) {\n this.open = false\n }\n }\n\n update = () => {\n const rect = this.target.getBoundingClientRect()\n this.element.style.setProperty('--bottom', 'unset')\n if (this.position === 'absolute') {\n if (this.horizontal === 'left') {\n this.element.style.setProperty('--left', rect.left + 'px')\n } else {\n this.element.style.setProperty(\n '--left',\n rect.right - this.element.clientWidth + 'px'\n )\n }\n this.element.style.setProperty('--top', rect.bottom + 'px')\n this.element.style.setProperty('--limit', rect.bottom + 'px')\n } else {\n this.element.style.setProperty('--left', 0 + 'px')\n this.element.style.setProperty('--top', rect.height + 'px')\n this.element.style.setProperty('--limit', rect.height + 'px')\n }\n\n const thisRect = this.element.getBoundingClientRect()\n if (thisRect.height < 30) {\n // Move up instead\n this.element.style.setProperty('--top', 'unset')\n this.element.style.setProperty('--bottom', rect.height + 5 + 'px')\n this.element.style.setProperty('--limit', rect.height + 5 + 'px')\n }\n }\n}\n","import { $el } from '../../ui'\nimport { ComfyButton } from './button'\nimport { prop } from '../../utils'\nimport { ComfyPopup } from './popup'\n\nexport class ComfySplitButton {\n arrow: ComfyButton\n element: HTMLElement\n popup: ComfyPopup\n items: Array\n\n constructor(\n {\n primary,\n mode,\n horizontal = 'left',\n position = 'relative'\n }: {\n primary: ComfyButton\n mode?: 'hover' | 'click'\n horizontal?: 'left' | 'right'\n position?: 'relative' | 'absolute'\n },\n ...items: Array\n ) {\n this.arrow = new ComfyButton({\n icon: 'chevron-down'\n })\n this.element = $el(\n 'div.comfyui-split-button' + (mode === 'hover' ? '.hover' : ''),\n [\n $el(\n 'div.comfyui-split-primary',\n {\n ariaLabel: 'Queue current workflow'\n },\n primary.element\n ),\n $el(\n 'div.comfyui-split-arrow',\n {\n ariaLabel: 'Open extra opens',\n ariaHasPopup: 'true'\n },\n this.arrow.element\n )\n ]\n )\n this.popup = new ComfyPopup({\n target: this.element,\n container: position === 'relative' ? this.element : document.body,\n classList:\n 'comfyui-split-button-popup' + (mode === 'hover' ? ' hover' : ''),\n closeOnEscape: mode === 'click',\n position,\n horizontal\n })\n\n this.arrow.withPopup(this.popup, mode)\n\n this.items = prop(this, 'items', items, () => this.update())\n }\n\n update() {\n this.popup.element.replaceChildren(\n ...this.items.map((b) => ('element' in b ? b.element : b))\n )\n }\n}\n","// @ts-strict-ignore\nimport { ComfyDialog } from '../dialog'\nimport { $el } from '../../ui'\n\nexport class ComfyAsyncDialog extends ComfyDialog {\n #resolve: (value: any) => void\n\n constructor(actions?: Array) {\n super(\n 'dialog.comfy-dialog.comfyui-dialog',\n actions?.map((opt) => {\n if (typeof opt === 'string') {\n opt = { text: opt }\n }\n return $el('button.comfyui-button', {\n type: 'button',\n textContent: opt.text,\n onclick: () => this.close(opt.value ?? opt.text)\n })\n })\n )\n }\n\n show(html: string | HTMLElement | HTMLElement[]) {\n this.element.addEventListener('close', () => {\n this.close()\n })\n\n super.show(html)\n\n return new Promise((resolve) => {\n this.#resolve = resolve\n })\n }\n\n showModal(html: string | HTMLElement | HTMLElement[]) {\n this.element.addEventListener('close', () => {\n this.close()\n })\n\n super.show(html)\n this.element.showModal()\n\n return new Promise((resolve) => {\n this.#resolve = resolve\n })\n }\n\n close(result = null) {\n this.#resolve(result)\n this.element.close()\n super.close()\n }\n\n static async prompt({\n title = null,\n message,\n actions\n }: {\n title: string | null\n message: string\n actions: Array\n }) {\n const dialog = new ComfyAsyncDialog(actions)\n const content = [$el('span', message)]\n if (title) {\n content.unshift($el('h3', title))\n }\n const res = await dialog.showModal(content)\n dialog.element.remove()\n return res\n }\n}\n","// @ts-strict-ignore\n/*\n Original implementation:\n https://github.com/TahaSh/drag-to-reorder\n MIT License\n\n Copyright (c) 2023 Taha Shashtari\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n*/\n\nimport { $el } from '../ui'\n\n$el('style', {\n parent: document.head,\n textContent: `\n .draggable-item {\n position: relative;\n will-change: transform;\n user-select: none;\n }\n .draggable-item.is-idle {\n transition: 0.25s ease transform;\n }\n .draggable-item.is-draggable {\n z-index: 10;\n }\n `\n})\n\nexport class DraggableList extends EventTarget {\n listContainer\n draggableItem\n pointerStartX\n pointerStartY\n scrollYMax\n itemsGap = 0\n items = []\n itemSelector\n handleClass = 'drag-handle'\n off = []\n offDrag = []\n\n constructor(element, itemSelector) {\n super()\n this.listContainer = element\n this.itemSelector = itemSelector\n\n if (!this.listContainer) return\n\n this.off.push(this.on(this.listContainer, 'mousedown', this.dragStart))\n this.off.push(this.on(this.listContainer, 'touchstart', this.dragStart))\n this.off.push(this.on(document, 'mouseup', this.dragEnd))\n this.off.push(this.on(document, 'touchend', this.dragEnd))\n }\n\n getAllItems() {\n if (!this.items?.length) {\n this.items = Array.from(\n this.listContainer.querySelectorAll(this.itemSelector)\n )\n this.items.forEach((element) => {\n element.classList.add('is-idle')\n })\n }\n return this.items\n }\n\n getIdleItems() {\n return this.getAllItems().filter((item) =>\n item.classList.contains('is-idle')\n )\n }\n\n isItemAbove(item) {\n return item.hasAttribute('data-is-above')\n }\n\n isItemToggled(item) {\n return item.hasAttribute('data-is-toggled')\n }\n\n on(source, event, listener, options?) {\n listener = listener.bind(this)\n source.addEventListener(event, listener, options)\n return () => source.removeEventListener(event, listener)\n }\n\n dragStart(e) {\n if (e.target.classList.contains(this.handleClass)) {\n this.draggableItem = e.target.closest(this.itemSelector)\n }\n\n if (!this.draggableItem) return\n\n this.pointerStartX = e.clientX || e.touches[0].clientX\n this.pointerStartY = e.clientY || e.touches[0].clientY\n this.scrollYMax =\n this.listContainer.scrollHeight - this.listContainer.clientHeight\n\n this.setItemsGap()\n this.initDraggableItem()\n this.initItemsState()\n\n this.offDrag.push(this.on(document, 'mousemove', this.drag))\n this.offDrag.push(\n this.on(document, 'touchmove', this.drag, { passive: false })\n )\n\n this.dispatchEvent(\n new CustomEvent('dragstart', {\n detail: {\n element: this.draggableItem,\n position: this.getAllItems().indexOf(this.draggableItem)\n }\n })\n )\n }\n\n setItemsGap() {\n if (this.getIdleItems().length <= 1) {\n this.itemsGap = 0\n return\n }\n\n const item1 = this.getIdleItems()[0]\n const item2 = this.getIdleItems()[1]\n\n const item1Rect = item1.getBoundingClientRect()\n const item2Rect = item2.getBoundingClientRect()\n\n this.itemsGap = Math.abs(item1Rect.bottom - item2Rect.top)\n }\n\n initItemsState() {\n this.getIdleItems().forEach((item, i) => {\n if (this.getAllItems().indexOf(this.draggableItem) > i) {\n item.dataset.isAbove = ''\n }\n })\n }\n\n initDraggableItem() {\n this.draggableItem.classList.remove('is-idle')\n this.draggableItem.classList.add('is-draggable')\n }\n\n drag(e) {\n if (!this.draggableItem) return\n\n e.preventDefault()\n\n const clientX = e.clientX || e.touches[0].clientX\n const clientY = e.clientY || e.touches[0].clientY\n\n const listRect = this.listContainer.getBoundingClientRect()\n\n if (clientY > listRect.bottom) {\n if (this.listContainer.scrollTop < this.scrollYMax) {\n this.listContainer.scrollBy(0, 10)\n this.pointerStartY -= 10\n }\n } else if (clientY < listRect.top && this.listContainer.scrollTop > 0) {\n this.pointerStartY += 10\n this.listContainer.scrollBy(0, -10)\n }\n\n const pointerOffsetX = clientX - this.pointerStartX\n const pointerOffsetY = clientY - this.pointerStartY\n\n this.updateIdleItemsStateAndPosition()\n this.draggableItem.style.transform = `translate(${pointerOffsetX}px, ${pointerOffsetY}px)`\n }\n\n updateIdleItemsStateAndPosition() {\n const draggableItemRect = this.draggableItem.getBoundingClientRect()\n const draggableItemY = draggableItemRect.top + draggableItemRect.height / 2\n\n // Update state\n this.getIdleItems().forEach((item) => {\n const itemRect = item.getBoundingClientRect()\n const itemY = itemRect.top + itemRect.height / 2\n if (this.isItemAbove(item)) {\n if (draggableItemY <= itemY) {\n item.dataset.isToggled = ''\n } else {\n delete item.dataset.isToggled\n }\n } else {\n if (draggableItemY >= itemY) {\n item.dataset.isToggled = ''\n } else {\n delete item.dataset.isToggled\n }\n }\n })\n\n // Update position\n this.getIdleItems().forEach((item) => {\n if (this.isItemToggled(item)) {\n const direction = this.isItemAbove(item) ? 1 : -1\n item.style.transform = `translateY(${direction * (draggableItemRect.height + this.itemsGap)}px)`\n } else {\n item.style.transform = ''\n }\n })\n }\n\n dragEnd() {\n if (!this.draggableItem) return\n\n this.applyNewItemsOrder()\n this.cleanup()\n }\n\n applyNewItemsOrder() {\n const reorderedItems = []\n\n let oldPosition = -1\n this.getAllItems().forEach((item, index) => {\n if (item === this.draggableItem) {\n oldPosition = index\n return\n }\n if (!this.isItemToggled(item)) {\n reorderedItems[index] = item\n return\n }\n const newIndex = this.isItemAbove(item) ? index + 1 : index - 1\n reorderedItems[newIndex] = item\n })\n\n for (let index = 0; index < this.getAllItems().length; index++) {\n const item = reorderedItems[index]\n if (typeof item === 'undefined') {\n reorderedItems[index] = this.draggableItem\n }\n }\n\n reorderedItems.forEach((item) => {\n this.listContainer.appendChild(item)\n })\n\n this.items = reorderedItems\n\n this.dispatchEvent(\n new CustomEvent('dragend', {\n detail: {\n element: this.draggableItem,\n oldPosition,\n newPosition: reorderedItems.indexOf(this.draggableItem)\n }\n })\n )\n }\n\n cleanup() {\n this.itemsGap = 0\n this.items = []\n this.unsetDraggableItem()\n this.unsetItemState()\n\n this.offDrag.forEach((f) => f())\n this.offDrag = []\n }\n\n unsetDraggableItem() {\n this.draggableItem.style = null\n this.draggableItem.classList.remove('is-draggable')\n this.draggableItem.classList.add('is-idle')\n this.draggableItem = null\n }\n\n unsetItemState() {\n this.getIdleItems().forEach((item, i) => {\n delete item.dataset.isAbove\n delete item.dataset.isToggled\n item.style.transform = ''\n })\n }\n\n dispose() {\n this.off.forEach((f) => f())\n }\n}\n","import type { ComfyApp } from '@/scripts/app'\nimport { $el } from '../../ui'\nimport { ComfyButtonGroup } from '../components/buttonGroup'\nimport './menu.css'\n\n// Export to make sure following components are shimmed and exported by vite\nexport { ComfyButton } from '../components/button'\nexport { ComfySplitButton } from '../components/splitButton'\nexport { ComfyPopup } from '../components/popup'\nexport { ComfyAsyncDialog } from '@/scripts/ui/components/asyncDialog'\nexport { DraggableList } from '@/scripts/ui/draggableList'\nexport { applyTextReplacements, addStylesheet } from '@/scripts/utils'\n\nexport class ComfyAppMenu {\n app: ComfyApp\n actionsGroup: ComfyButtonGroup\n settingsGroup: ComfyButtonGroup\n viewGroup: ComfyButtonGroup\n element: HTMLElement\n\n constructor(app: ComfyApp) {\n this.app = app\n\n // Keep the group as there are custom scripts attaching extra\n // elements to it.\n this.actionsGroup = new ComfyButtonGroup()\n this.settingsGroup = new ComfyButtonGroup()\n this.viewGroup = new ComfyButtonGroup()\n\n this.element = $el('div.flex.gap-2.mx-2', [\n this.actionsGroup.element,\n this.settingsGroup.element,\n this.viewGroup.element\n ])\n }\n}\n","/**\n * Fuse.js v7.0.0 - Lightweight fuzzy-search (http://fusejs.io)\n *\n * Copyright (c) 2023 Kiro Risk (http://kiro.me)\n * All Rights Reserved. Apache Software License 2.0\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n */\n\nfunction isArray(value) {\n return !Array.isArray\n ? getTag(value) === '[object Array]'\n : Array.isArray(value)\n}\n\n// Adapted from: https://github.com/lodash/lodash/blob/master/.internal/baseToString.js\nconst INFINITY = 1 / 0;\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value\n }\n let result = value + '';\n return result == '0' && 1 / value == -INFINITY ? '-0' : result\n}\n\nfunction toString(value) {\n return value == null ? '' : baseToString(value)\n}\n\nfunction isString(value) {\n return typeof value === 'string'\n}\n\nfunction isNumber(value) {\n return typeof value === 'number'\n}\n\n// Adapted from: https://github.com/lodash/lodash/blob/master/isBoolean.js\nfunction isBoolean(value) {\n return (\n value === true ||\n value === false ||\n (isObjectLike(value) && getTag(value) == '[object Boolean]')\n )\n}\n\nfunction isObject(value) {\n return typeof value === 'object'\n}\n\n// Checks if `value` is object-like.\nfunction isObjectLike(value) {\n return isObject(value) && value !== null\n}\n\nfunction isDefined(value) {\n return value !== undefined && value !== null\n}\n\nfunction isBlank(value) {\n return !value.trim().length\n}\n\n// Gets the `toStringTag` of `value`.\n// Adapted from: https://github.com/lodash/lodash/blob/master/.internal/getTag.js\nfunction getTag(value) {\n return value == null\n ? value === undefined\n ? '[object Undefined]'\n : '[object Null]'\n : Object.prototype.toString.call(value)\n}\n\nconst EXTENDED_SEARCH_UNAVAILABLE = 'Extended search is not available';\n\nconst INCORRECT_INDEX_TYPE = \"Incorrect 'index' type\";\n\nconst LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key) =>\n `Invalid value for key ${key}`;\n\nconst PATTERN_LENGTH_TOO_LARGE = (max) =>\n `Pattern length exceeds max of ${max}.`;\n\nconst MISSING_KEY_PROPERTY = (name) => `Missing ${name} property in key`;\n\nconst INVALID_KEY_WEIGHT_VALUE = (key) =>\n `Property 'weight' in key '${key}' must be a positive integer`;\n\nconst hasOwn = Object.prototype.hasOwnProperty;\n\nclass KeyStore {\n constructor(keys) {\n this._keys = [];\n this._keyMap = {};\n\n let totalWeight = 0;\n\n keys.forEach((key) => {\n let obj = createKey(key);\n\n this._keys.push(obj);\n this._keyMap[obj.id] = obj;\n\n totalWeight += obj.weight;\n });\n\n // Normalize weights so that their sum is equal to 1\n this._keys.forEach((key) => {\n key.weight /= totalWeight;\n });\n }\n get(keyId) {\n return this._keyMap[keyId]\n }\n keys() {\n return this._keys\n }\n toJSON() {\n return JSON.stringify(this._keys)\n }\n}\n\nfunction createKey(key) {\n let path = null;\n let id = null;\n let src = null;\n let weight = 1;\n let getFn = null;\n\n if (isString(key) || isArray(key)) {\n src = key;\n path = createKeyPath(key);\n id = createKeyId(key);\n } else {\n if (!hasOwn.call(key, 'name')) {\n throw new Error(MISSING_KEY_PROPERTY('name'))\n }\n\n const name = key.name;\n src = name;\n\n if (hasOwn.call(key, 'weight')) {\n weight = key.weight;\n\n if (weight <= 0) {\n throw new Error(INVALID_KEY_WEIGHT_VALUE(name))\n }\n }\n\n path = createKeyPath(name);\n id = createKeyId(name);\n getFn = key.getFn;\n }\n\n return { path, id, weight, src, getFn }\n}\n\nfunction createKeyPath(key) {\n return isArray(key) ? key : key.split('.')\n}\n\nfunction createKeyId(key) {\n return isArray(key) ? key.join('.') : key\n}\n\nfunction get(obj, path) {\n let list = [];\n let arr = false;\n\n const deepGet = (obj, path, index) => {\n if (!isDefined(obj)) {\n return\n }\n if (!path[index]) {\n // If there's no path left, we've arrived at the object we care about.\n list.push(obj);\n } else {\n let key = path[index];\n\n const value = obj[key];\n\n if (!isDefined(value)) {\n return\n }\n\n // If we're at the last value in the path, and if it's a string/number/bool,\n // add it to the list\n if (\n index === path.length - 1 &&\n (isString(value) || isNumber(value) || isBoolean(value))\n ) {\n list.push(toString(value));\n } else if (isArray(value)) {\n arr = true;\n // Search each item in the array.\n for (let i = 0, len = value.length; i < len; i += 1) {\n deepGet(value[i], path, index + 1);\n }\n } else if (path.length) {\n // An object. Recurse further.\n deepGet(value, path, index + 1);\n }\n }\n };\n\n // Backwards compatibility (since path used to be a string)\n deepGet(obj, isString(path) ? path.split('.') : path, 0);\n\n return arr ? list : list[0]\n}\n\nconst MatchOptions = {\n // Whether the matches should be included in the result set. When `true`, each record in the result\n // set will include the indices of the matched characters.\n // These can consequently be used for highlighting purposes.\n includeMatches: false,\n // When `true`, the matching function will continue to the end of a search pattern even if\n // a perfect match has already been located in the string.\n findAllMatches: false,\n // Minimum number of characters that must be matched before a result is considered a match\n minMatchCharLength: 1\n};\n\nconst BasicOptions = {\n // When `true`, the algorithm continues searching to the end of the input even if a perfect\n // match is found before the end of the same input.\n isCaseSensitive: false,\n // When true, the matching function will continue to the end of a search pattern even if\n includeScore: false,\n // List of properties that will be searched. This also supports nested properties.\n keys: [],\n // Whether to sort the result list, by score\n shouldSort: true,\n // Default sort function: sort by ascending score, ascending index\n sortFn: (a, b) =>\n a.score === b.score ? (a.idx < b.idx ? -1 : 1) : a.score < b.score ? -1 : 1\n};\n\nconst FuzzyOptions = {\n // Approximately where in the text is the pattern expected to be found?\n location: 0,\n // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match\n // (of both letters and location), a threshold of '1.0' would match anything.\n threshold: 0.6,\n // Determines how close the match must be to the fuzzy location (specified above).\n // An exact letter match which is 'distance' characters away from the fuzzy location\n // would score as a complete mismatch. A distance of '0' requires the match be at\n // the exact location specified, a threshold of '1000' would require a perfect match\n // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.\n distance: 100\n};\n\nconst AdvancedOptions = {\n // When `true`, it enables the use of unix-like search commands\n useExtendedSearch: false,\n // The get function to use when fetching an object's properties.\n // The default will search nested paths *ie foo.bar.baz*\n getFn: get,\n // When `true`, search will ignore `location` and `distance`, so it won't matter\n // where in the string the pattern appears.\n // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score\n ignoreLocation: false,\n // When `true`, the calculation for the relevance score (used for sorting) will\n // ignore the field-length norm.\n // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm\n ignoreFieldNorm: false,\n // The weight to determine how much field length norm effects scoring.\n fieldNormWeight: 1\n};\n\nvar Config = {\n ...BasicOptions,\n ...MatchOptions,\n ...FuzzyOptions,\n ...AdvancedOptions\n};\n\nconst SPACE = /[^ ]+/g;\n\n// Field-length norm: the shorter the field, the higher the weight.\n// Set to 3 decimals to reduce index size.\nfunction norm(weight = 1, mantissa = 3) {\n const cache = new Map();\n const m = Math.pow(10, mantissa);\n\n return {\n get(value) {\n const numTokens = value.match(SPACE).length;\n\n if (cache.has(numTokens)) {\n return cache.get(numTokens)\n }\n\n // Default function is 1/sqrt(x), weight makes that variable\n const norm = 1 / Math.pow(numTokens, 0.5 * weight);\n\n // In place of `toFixed(mantissa)`, for faster computation\n const n = parseFloat(Math.round(norm * m) / m);\n\n cache.set(numTokens, n);\n\n return n\n },\n clear() {\n cache.clear();\n }\n }\n}\n\nclass FuseIndex {\n constructor({\n getFn = Config.getFn,\n fieldNormWeight = Config.fieldNormWeight\n } = {}) {\n this.norm = norm(fieldNormWeight, 3);\n this.getFn = getFn;\n this.isCreated = false;\n\n this.setIndexRecords();\n }\n setSources(docs = []) {\n this.docs = docs;\n }\n setIndexRecords(records = []) {\n this.records = records;\n }\n setKeys(keys = []) {\n this.keys = keys;\n this._keysMap = {};\n keys.forEach((key, idx) => {\n this._keysMap[key.id] = idx;\n });\n }\n create() {\n if (this.isCreated || !this.docs.length) {\n return\n }\n\n this.isCreated = true;\n\n // List is Array\n if (isString(this.docs[0])) {\n this.docs.forEach((doc, docIndex) => {\n this._addString(doc, docIndex);\n });\n } else {\n // List is Array\n this.docs.forEach((doc, docIndex) => {\n this._addObject(doc, docIndex);\n });\n }\n\n this.norm.clear();\n }\n // Adds a doc to the end of the index\n add(doc) {\n const idx = this.size();\n\n if (isString(doc)) {\n this._addString(doc, idx);\n } else {\n this._addObject(doc, idx);\n }\n }\n // Removes the doc at the specified index of the index\n removeAt(idx) {\n this.records.splice(idx, 1);\n\n // Change ref index of every subsquent doc\n for (let i = idx, len = this.size(); i < len; i += 1) {\n this.records[i].i -= 1;\n }\n }\n getValueForItemAtKeyId(item, keyId) {\n return item[this._keysMap[keyId]]\n }\n size() {\n return this.records.length\n }\n _addString(doc, docIndex) {\n if (!isDefined(doc) || isBlank(doc)) {\n return\n }\n\n let record = {\n v: doc,\n i: docIndex,\n n: this.norm.get(doc)\n };\n\n this.records.push(record);\n }\n _addObject(doc, docIndex) {\n let record = { i: docIndex, $: {} };\n\n // Iterate over every key (i.e, path), and fetch the value at that key\n this.keys.forEach((key, keyIndex) => {\n let value = key.getFn ? key.getFn(doc) : this.getFn(doc, key.path);\n\n if (!isDefined(value)) {\n return\n }\n\n if (isArray(value)) {\n let subRecords = [];\n const stack = [{ nestedArrIndex: -1, value }];\n\n while (stack.length) {\n const { nestedArrIndex, value } = stack.pop();\n\n if (!isDefined(value)) {\n continue\n }\n\n if (isString(value) && !isBlank(value)) {\n let subRecord = {\n v: value,\n i: nestedArrIndex,\n n: this.norm.get(value)\n };\n\n subRecords.push(subRecord);\n } else if (isArray(value)) {\n value.forEach((item, k) => {\n stack.push({\n nestedArrIndex: k,\n value: item\n });\n });\n } else ;\n }\n record.$[keyIndex] = subRecords;\n } else if (isString(value) && !isBlank(value)) {\n let subRecord = {\n v: value,\n n: this.norm.get(value)\n };\n\n record.$[keyIndex] = subRecord;\n }\n });\n\n this.records.push(record);\n }\n toJSON() {\n return {\n keys: this.keys,\n records: this.records\n }\n }\n}\n\nfunction createIndex(\n keys,\n docs,\n { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}\n) {\n const myIndex = new FuseIndex({ getFn, fieldNormWeight });\n myIndex.setKeys(keys.map(createKey));\n myIndex.setSources(docs);\n myIndex.create();\n return myIndex\n}\n\nfunction parseIndex(\n data,\n { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}\n) {\n const { keys, records } = data;\n const myIndex = new FuseIndex({ getFn, fieldNormWeight });\n myIndex.setKeys(keys);\n myIndex.setIndexRecords(records);\n return myIndex\n}\n\nfunction computeScore$1(\n pattern,\n {\n errors = 0,\n currentLocation = 0,\n expectedLocation = 0,\n distance = Config.distance,\n ignoreLocation = Config.ignoreLocation\n } = {}\n) {\n const accuracy = errors / pattern.length;\n\n if (ignoreLocation) {\n return accuracy\n }\n\n const proximity = Math.abs(expectedLocation - currentLocation);\n\n if (!distance) {\n // Dodge divide by zero error.\n return proximity ? 1.0 : accuracy\n }\n\n return accuracy + proximity / distance\n}\n\nfunction convertMaskToIndices(\n matchmask = [],\n minMatchCharLength = Config.minMatchCharLength\n) {\n let indices = [];\n let start = -1;\n let end = -1;\n let i = 0;\n\n for (let len = matchmask.length; i < len; i += 1) {\n let match = matchmask[i];\n if (match && start === -1) {\n start = i;\n } else if (!match && start !== -1) {\n end = i - 1;\n if (end - start + 1 >= minMatchCharLength) {\n indices.push([start, end]);\n }\n start = -1;\n }\n }\n\n // (i-1 - start) + 1 => i - start\n if (matchmask[i - 1] && i - start >= minMatchCharLength) {\n indices.push([start, i - 1]);\n }\n\n return indices\n}\n\n// Machine word size\nconst MAX_BITS = 32;\n\nfunction search(\n text,\n pattern,\n patternAlphabet,\n {\n location = Config.location,\n distance = Config.distance,\n threshold = Config.threshold,\n findAllMatches = Config.findAllMatches,\n minMatchCharLength = Config.minMatchCharLength,\n includeMatches = Config.includeMatches,\n ignoreLocation = Config.ignoreLocation\n } = {}\n) {\n if (pattern.length > MAX_BITS) {\n throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS))\n }\n\n const patternLen = pattern.length;\n // Set starting location at beginning text and initialize the alphabet.\n const textLen = text.length;\n // Handle the case when location > text.length\n const expectedLocation = Math.max(0, Math.min(location, textLen));\n // Highest score beyond which we give up.\n let currentThreshold = threshold;\n // Is there a nearby exact match? (speedup)\n let bestLocation = expectedLocation;\n\n // Performance: only computer matches when the minMatchCharLength > 1\n // OR if `includeMatches` is true.\n const computeMatches = minMatchCharLength > 1 || includeMatches;\n // A mask of the matches, used for building the indices\n const matchMask = computeMatches ? Array(textLen) : [];\n\n let index;\n\n // Get all exact matches, here for speed up\n while ((index = text.indexOf(pattern, bestLocation)) > -1) {\n let score = computeScore$1(pattern, {\n currentLocation: index,\n expectedLocation,\n distance,\n ignoreLocation\n });\n\n currentThreshold = Math.min(score, currentThreshold);\n bestLocation = index + patternLen;\n\n if (computeMatches) {\n let i = 0;\n while (i < patternLen) {\n matchMask[index + i] = 1;\n i += 1;\n }\n }\n }\n\n // Reset the best location\n bestLocation = -1;\n\n let lastBitArr = [];\n let finalScore = 1;\n let binMax = patternLen + textLen;\n\n const mask = 1 << (patternLen - 1);\n\n for (let i = 0; i < patternLen; i += 1) {\n // Scan for the best match; each iteration allows for one more error.\n // Run a binary search to determine how far from the match location we can stray\n // at this error level.\n let binMin = 0;\n let binMid = binMax;\n\n while (binMin < binMid) {\n const score = computeScore$1(pattern, {\n errors: i,\n currentLocation: expectedLocation + binMid,\n expectedLocation,\n distance,\n ignoreLocation\n });\n\n if (score <= currentThreshold) {\n binMin = binMid;\n } else {\n binMax = binMid;\n }\n\n binMid = Math.floor((binMax - binMin) / 2 + binMin);\n }\n\n // Use the result from this iteration as the maximum for the next.\n binMax = binMid;\n\n let start = Math.max(1, expectedLocation - binMid + 1);\n let finish = findAllMatches\n ? textLen\n : Math.min(expectedLocation + binMid, textLen) + patternLen;\n\n // Initialize the bit array\n let bitArr = Array(finish + 2);\n\n bitArr[finish + 1] = (1 << i) - 1;\n\n for (let j = finish; j >= start; j -= 1) {\n let currentLocation = j - 1;\n let charMatch = patternAlphabet[text.charAt(currentLocation)];\n\n if (computeMatches) {\n // Speed up: quick bool to int conversion (i.e, `charMatch ? 1 : 0`)\n matchMask[currentLocation] = +!!charMatch;\n }\n\n // First pass: exact match\n bitArr[j] = ((bitArr[j + 1] << 1) | 1) & charMatch;\n\n // Subsequent passes: fuzzy match\n if (i) {\n bitArr[j] |=\n ((lastBitArr[j + 1] | lastBitArr[j]) << 1) | 1 | lastBitArr[j + 1];\n }\n\n if (bitArr[j] & mask) {\n finalScore = computeScore$1(pattern, {\n errors: i,\n currentLocation,\n expectedLocation,\n distance,\n ignoreLocation\n });\n\n // This match will almost certainly be better than any existing match.\n // But check anyway.\n if (finalScore <= currentThreshold) {\n // Indeed it is\n currentThreshold = finalScore;\n bestLocation = currentLocation;\n\n // Already passed `loc`, downhill from here on in.\n if (bestLocation <= expectedLocation) {\n break\n }\n\n // When passing `bestLocation`, don't exceed our current distance from `expectedLocation`.\n start = Math.max(1, 2 * expectedLocation - bestLocation);\n }\n }\n }\n\n // No hope for a (better) match at greater error levels.\n const score = computeScore$1(pattern, {\n errors: i + 1,\n currentLocation: expectedLocation,\n expectedLocation,\n distance,\n ignoreLocation\n });\n\n if (score > currentThreshold) {\n break\n }\n\n lastBitArr = bitArr;\n }\n\n const result = {\n isMatch: bestLocation >= 0,\n // Count exact matches (those with a score of 0) to be \"almost\" exact\n score: Math.max(0.001, finalScore)\n };\n\n if (computeMatches) {\n const indices = convertMaskToIndices(matchMask, minMatchCharLength);\n if (!indices.length) {\n result.isMatch = false;\n } else if (includeMatches) {\n result.indices = indices;\n }\n }\n\n return result\n}\n\nfunction createPatternAlphabet(pattern) {\n let mask = {};\n\n for (let i = 0, len = pattern.length; i < len; i += 1) {\n const char = pattern.charAt(i);\n mask[char] = (mask[char] || 0) | (1 << (len - i - 1));\n }\n\n return mask\n}\n\nclass BitapSearch {\n constructor(\n pattern,\n {\n location = Config.location,\n threshold = Config.threshold,\n distance = Config.distance,\n includeMatches = Config.includeMatches,\n findAllMatches = Config.findAllMatches,\n minMatchCharLength = Config.minMatchCharLength,\n isCaseSensitive = Config.isCaseSensitive,\n ignoreLocation = Config.ignoreLocation\n } = {}\n ) {\n this.options = {\n location,\n threshold,\n distance,\n includeMatches,\n findAllMatches,\n minMatchCharLength,\n isCaseSensitive,\n ignoreLocation\n };\n\n this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();\n\n this.chunks = [];\n\n if (!this.pattern.length) {\n return\n }\n\n const addChunk = (pattern, startIndex) => {\n this.chunks.push({\n pattern,\n alphabet: createPatternAlphabet(pattern),\n startIndex\n });\n };\n\n const len = this.pattern.length;\n\n if (len > MAX_BITS) {\n let i = 0;\n const remainder = len % MAX_BITS;\n const end = len - remainder;\n\n while (i < end) {\n addChunk(this.pattern.substr(i, MAX_BITS), i);\n i += MAX_BITS;\n }\n\n if (remainder) {\n const startIndex = len - MAX_BITS;\n addChunk(this.pattern.substr(startIndex), startIndex);\n }\n } else {\n addChunk(this.pattern, 0);\n }\n }\n\n searchIn(text) {\n const { isCaseSensitive, includeMatches } = this.options;\n\n if (!isCaseSensitive) {\n text = text.toLowerCase();\n }\n\n // Exact match\n if (this.pattern === text) {\n let result = {\n isMatch: true,\n score: 0\n };\n\n if (includeMatches) {\n result.indices = [[0, text.length - 1]];\n }\n\n return result\n }\n\n // Otherwise, use Bitap algorithm\n const {\n location,\n distance,\n threshold,\n findAllMatches,\n minMatchCharLength,\n ignoreLocation\n } = this.options;\n\n let allIndices = [];\n let totalScore = 0;\n let hasMatches = false;\n\n this.chunks.forEach(({ pattern, alphabet, startIndex }) => {\n const { isMatch, score, indices } = search(text, pattern, alphabet, {\n location: location + startIndex,\n distance,\n threshold,\n findAllMatches,\n minMatchCharLength,\n includeMatches,\n ignoreLocation\n });\n\n if (isMatch) {\n hasMatches = true;\n }\n\n totalScore += score;\n\n if (isMatch && indices) {\n allIndices = [...allIndices, ...indices];\n }\n });\n\n let result = {\n isMatch: hasMatches,\n score: hasMatches ? totalScore / this.chunks.length : 1\n };\n\n if (hasMatches && includeMatches) {\n result.indices = allIndices;\n }\n\n return result\n }\n}\n\nclass BaseMatch {\n constructor(pattern) {\n this.pattern = pattern;\n }\n static isMultiMatch(pattern) {\n return getMatch(pattern, this.multiRegex)\n }\n static isSingleMatch(pattern) {\n return getMatch(pattern, this.singleRegex)\n }\n search(/*text*/) {}\n}\n\nfunction getMatch(pattern, exp) {\n const matches = pattern.match(exp);\n return matches ? matches[1] : null\n}\n\n// Token: 'file\n\nclass ExactMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'exact'\n }\n static get multiRegex() {\n return /^=\"(.*)\"$/\n }\n static get singleRegex() {\n return /^=(.*)$/\n }\n search(text) {\n const isMatch = text === this.pattern;\n\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices: [0, this.pattern.length - 1]\n }\n }\n}\n\n// Token: !fire\n\nclass InverseExactMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'inverse-exact'\n }\n static get multiRegex() {\n return /^!\"(.*)\"$/\n }\n static get singleRegex() {\n return /^!(.*)$/\n }\n search(text) {\n const index = text.indexOf(this.pattern);\n const isMatch = index === -1;\n\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices: [0, text.length - 1]\n }\n }\n}\n\n// Token: ^file\n\nclass PrefixExactMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'prefix-exact'\n }\n static get multiRegex() {\n return /^\\^\"(.*)\"$/\n }\n static get singleRegex() {\n return /^\\^(.*)$/\n }\n search(text) {\n const isMatch = text.startsWith(this.pattern);\n\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices: [0, this.pattern.length - 1]\n }\n }\n}\n\n// Token: !^fire\n\nclass InversePrefixExactMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'inverse-prefix-exact'\n }\n static get multiRegex() {\n return /^!\\^\"(.*)\"$/\n }\n static get singleRegex() {\n return /^!\\^(.*)$/\n }\n search(text) {\n const isMatch = !text.startsWith(this.pattern);\n\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices: [0, text.length - 1]\n }\n }\n}\n\n// Token: .file$\n\nclass SuffixExactMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'suffix-exact'\n }\n static get multiRegex() {\n return /^\"(.*)\"\\$$/\n }\n static get singleRegex() {\n return /^(.*)\\$$/\n }\n search(text) {\n const isMatch = text.endsWith(this.pattern);\n\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices: [text.length - this.pattern.length, text.length - 1]\n }\n }\n}\n\n// Token: !.file$\n\nclass InverseSuffixExactMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'inverse-suffix-exact'\n }\n static get multiRegex() {\n return /^!\"(.*)\"\\$$/\n }\n static get singleRegex() {\n return /^!(.*)\\$$/\n }\n search(text) {\n const isMatch = !text.endsWith(this.pattern);\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices: [0, text.length - 1]\n }\n }\n}\n\nclass FuzzyMatch extends BaseMatch {\n constructor(\n pattern,\n {\n location = Config.location,\n threshold = Config.threshold,\n distance = Config.distance,\n includeMatches = Config.includeMatches,\n findAllMatches = Config.findAllMatches,\n minMatchCharLength = Config.minMatchCharLength,\n isCaseSensitive = Config.isCaseSensitive,\n ignoreLocation = Config.ignoreLocation\n } = {}\n ) {\n super(pattern);\n this._bitapSearch = new BitapSearch(pattern, {\n location,\n threshold,\n distance,\n includeMatches,\n findAllMatches,\n minMatchCharLength,\n isCaseSensitive,\n ignoreLocation\n });\n }\n static get type() {\n return 'fuzzy'\n }\n static get multiRegex() {\n return /^\"(.*)\"$/\n }\n static get singleRegex() {\n return /^(.*)$/\n }\n search(text) {\n return this._bitapSearch.searchIn(text)\n }\n}\n\n// Token: 'file\n\nclass IncludeMatch extends BaseMatch {\n constructor(pattern) {\n super(pattern);\n }\n static get type() {\n return 'include'\n }\n static get multiRegex() {\n return /^'\"(.*)\"$/\n }\n static get singleRegex() {\n return /^'(.*)$/\n }\n search(text) {\n let location = 0;\n let index;\n\n const indices = [];\n const patternLen = this.pattern.length;\n\n // Get all exact matches\n while ((index = text.indexOf(this.pattern, location)) > -1) {\n location = index + patternLen;\n indices.push([index, location - 1]);\n }\n\n const isMatch = !!indices.length;\n\n return {\n isMatch,\n score: isMatch ? 0 : 1,\n indices\n }\n }\n}\n\n// ❗Order is important. DO NOT CHANGE.\nconst searchers = [\n ExactMatch,\n IncludeMatch,\n PrefixExactMatch,\n InversePrefixExactMatch,\n InverseSuffixExactMatch,\n SuffixExactMatch,\n InverseExactMatch,\n FuzzyMatch\n];\n\nconst searchersLen = searchers.length;\n\n// Regex to split by spaces, but keep anything in quotes together\nconst SPACE_RE = / +(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)/;\nconst OR_TOKEN = '|';\n\n// Return a 2D array representation of the query, for simpler parsing.\n// Example:\n// \"^core go$ | rb$ | py$ xy$\" => [[\"^core\", \"go$\"], [\"rb$\"], [\"py$\", \"xy$\"]]\nfunction parseQuery(pattern, options = {}) {\n return pattern.split(OR_TOKEN).map((item) => {\n let query = item\n .trim()\n .split(SPACE_RE)\n .filter((item) => item && !!item.trim());\n\n let results = [];\n for (let i = 0, len = query.length; i < len; i += 1) {\n const queryItem = query[i];\n\n // 1. Handle multiple query match (i.e, once that are quoted, like `\"hello world\"`)\n let found = false;\n let idx = -1;\n while (!found && ++idx < searchersLen) {\n const searcher = searchers[idx];\n let token = searcher.isMultiMatch(queryItem);\n if (token) {\n results.push(new searcher(token, options));\n found = true;\n }\n }\n\n if (found) {\n continue\n }\n\n // 2. Handle single query matches (i.e, once that are *not* quoted)\n idx = -1;\n while (++idx < searchersLen) {\n const searcher = searchers[idx];\n let token = searcher.isSingleMatch(queryItem);\n if (token) {\n results.push(new searcher(token, options));\n break\n }\n }\n }\n\n return results\n })\n}\n\n// These extended matchers can return an array of matches, as opposed\n// to a singl match\nconst MultiMatchSet = new Set([FuzzyMatch.type, IncludeMatch.type]);\n\n/**\n * Command-like searching\n * ======================\n *\n * Given multiple search terms delimited by spaces.e.g. `^jscript .python$ ruby !java`,\n * search in a given text.\n *\n * Search syntax:\n *\n * | Token | Match type | Description |\n * | ----------- | -------------------------- | -------------------------------------- |\n * | `jscript` | fuzzy-match | Items that fuzzy match `jscript` |\n * | `=scheme` | exact-match | Items that are `scheme` |\n * | `'python` | include-match | Items that include `python` |\n * | `!ruby` | inverse-exact-match | Items that do not include `ruby` |\n * | `^java` | prefix-exact-match | Items that start with `java` |\n * | `!^earlang` | inverse-prefix-exact-match | Items that do not start with `earlang` |\n * | `.js$` | suffix-exact-match | Items that end with `.js` |\n * | `!.go$` | inverse-suffix-exact-match | Items that do not end with `.go` |\n *\n * A single pipe character acts as an OR operator. For example, the following\n * query matches entries that start with `core` and end with either`go`, `rb`,\n * or`py`.\n *\n * ```\n * ^core go$ | rb$ | py$\n * ```\n */\nclass ExtendedSearch {\n constructor(\n pattern,\n {\n isCaseSensitive = Config.isCaseSensitive,\n includeMatches = Config.includeMatches,\n minMatchCharLength = Config.minMatchCharLength,\n ignoreLocation = Config.ignoreLocation,\n findAllMatches = Config.findAllMatches,\n location = Config.location,\n threshold = Config.threshold,\n distance = Config.distance\n } = {}\n ) {\n this.query = null;\n this.options = {\n isCaseSensitive,\n includeMatches,\n minMatchCharLength,\n findAllMatches,\n ignoreLocation,\n location,\n threshold,\n distance\n };\n\n this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();\n this.query = parseQuery(this.pattern, this.options);\n }\n\n static condition(_, options) {\n return options.useExtendedSearch\n }\n\n searchIn(text) {\n const query = this.query;\n\n if (!query) {\n return {\n isMatch: false,\n score: 1\n }\n }\n\n const { includeMatches, isCaseSensitive } = this.options;\n\n text = isCaseSensitive ? text : text.toLowerCase();\n\n let numMatches = 0;\n let allIndices = [];\n let totalScore = 0;\n\n // ORs\n for (let i = 0, qLen = query.length; i < qLen; i += 1) {\n const searchers = query[i];\n\n // Reset indices\n allIndices.length = 0;\n numMatches = 0;\n\n // ANDs\n for (let j = 0, pLen = searchers.length; j < pLen; j += 1) {\n const searcher = searchers[j];\n const { isMatch, indices, score } = searcher.search(text);\n\n if (isMatch) {\n numMatches += 1;\n totalScore += score;\n if (includeMatches) {\n const type = searcher.constructor.type;\n if (MultiMatchSet.has(type)) {\n allIndices = [...allIndices, ...indices];\n } else {\n allIndices.push(indices);\n }\n }\n } else {\n totalScore = 0;\n numMatches = 0;\n allIndices.length = 0;\n break\n }\n }\n\n // OR condition, so if TRUE, return\n if (numMatches) {\n let result = {\n isMatch: true,\n score: totalScore / numMatches\n };\n\n if (includeMatches) {\n result.indices = allIndices;\n }\n\n return result\n }\n }\n\n // Nothing was matched\n return {\n isMatch: false,\n score: 1\n }\n }\n}\n\nconst registeredSearchers = [];\n\nfunction register(...args) {\n registeredSearchers.push(...args);\n}\n\nfunction createSearcher(pattern, options) {\n for (let i = 0, len = registeredSearchers.length; i < len; i += 1) {\n let searcherClass = registeredSearchers[i];\n if (searcherClass.condition(pattern, options)) {\n return new searcherClass(pattern, options)\n }\n }\n\n return new BitapSearch(pattern, options)\n}\n\nconst LogicalOperator = {\n AND: '$and',\n OR: '$or'\n};\n\nconst KeyType = {\n PATH: '$path',\n PATTERN: '$val'\n};\n\nconst isExpression = (query) =>\n !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]);\n\nconst isPath = (query) => !!query[KeyType.PATH];\n\nconst isLeaf = (query) =>\n !isArray(query) && isObject(query) && !isExpression(query);\n\nconst convertToExplicit = (query) => ({\n [LogicalOperator.AND]: Object.keys(query).map((key) => ({\n [key]: query[key]\n }))\n});\n\n// When `auto` is `true`, the parse function will infer and initialize and add\n// the appropriate `Searcher` instance\nfunction parse(query, options, { auto = true } = {}) {\n const next = (query) => {\n let keys = Object.keys(query);\n\n const isQueryPath = isPath(query);\n\n if (!isQueryPath && keys.length > 1 && !isExpression(query)) {\n return next(convertToExplicit(query))\n }\n\n if (isLeaf(query)) {\n const key = isQueryPath ? query[KeyType.PATH] : keys[0];\n\n const pattern = isQueryPath ? query[KeyType.PATTERN] : query[key];\n\n if (!isString(pattern)) {\n throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key))\n }\n\n const obj = {\n keyId: createKeyId(key),\n pattern\n };\n\n if (auto) {\n obj.searcher = createSearcher(pattern, options);\n }\n\n return obj\n }\n\n let node = {\n children: [],\n operator: keys[0]\n };\n\n keys.forEach((key) => {\n const value = query[key];\n\n if (isArray(value)) {\n value.forEach((item) => {\n node.children.push(next(item));\n });\n }\n });\n\n return node\n };\n\n if (!isExpression(query)) {\n query = convertToExplicit(query);\n }\n\n return next(query)\n}\n\n// Practical scoring function\nfunction computeScore(\n results,\n { ignoreFieldNorm = Config.ignoreFieldNorm }\n) {\n results.forEach((result) => {\n let totalScore = 1;\n\n result.matches.forEach(({ key, norm, score }) => {\n const weight = key ? key.weight : null;\n\n totalScore *= Math.pow(\n score === 0 && weight ? Number.EPSILON : score,\n (weight || 1) * (ignoreFieldNorm ? 1 : norm)\n );\n });\n\n result.score = totalScore;\n });\n}\n\nfunction transformMatches(result, data) {\n const matches = result.matches;\n data.matches = [];\n\n if (!isDefined(matches)) {\n return\n }\n\n matches.forEach((match) => {\n if (!isDefined(match.indices) || !match.indices.length) {\n return\n }\n\n const { indices, value } = match;\n\n let obj = {\n indices,\n value\n };\n\n if (match.key) {\n obj.key = match.key.src;\n }\n\n if (match.idx > -1) {\n obj.refIndex = match.idx;\n }\n\n data.matches.push(obj);\n });\n}\n\nfunction transformScore(result, data) {\n data.score = result.score;\n}\n\nfunction format(\n results,\n docs,\n {\n includeMatches = Config.includeMatches,\n includeScore = Config.includeScore\n } = {}\n) {\n const transformers = [];\n\n if (includeMatches) transformers.push(transformMatches);\n if (includeScore) transformers.push(transformScore);\n\n return results.map((result) => {\n const { idx } = result;\n\n const data = {\n item: docs[idx],\n refIndex: idx\n };\n\n if (transformers.length) {\n transformers.forEach((transformer) => {\n transformer(result, data);\n });\n }\n\n return data\n })\n}\n\nclass Fuse {\n constructor(docs, options = {}, index) {\n this.options = { ...Config, ...options };\n\n if (\n this.options.useExtendedSearch &&\n !true\n ) {\n throw new Error(EXTENDED_SEARCH_UNAVAILABLE)\n }\n\n this._keyStore = new KeyStore(this.options.keys);\n\n this.setCollection(docs, index);\n }\n\n setCollection(docs, index) {\n this._docs = docs;\n\n if (index && !(index instanceof FuseIndex)) {\n throw new Error(INCORRECT_INDEX_TYPE)\n }\n\n this._myIndex =\n index ||\n createIndex(this.options.keys, this._docs, {\n getFn: this.options.getFn,\n fieldNormWeight: this.options.fieldNormWeight\n });\n }\n\n add(doc) {\n if (!isDefined(doc)) {\n return\n }\n\n this._docs.push(doc);\n this._myIndex.add(doc);\n }\n\n remove(predicate = (/* doc, idx */) => false) {\n const results = [];\n\n for (let i = 0, len = this._docs.length; i < len; i += 1) {\n const doc = this._docs[i];\n if (predicate(doc, i)) {\n this.removeAt(i);\n i -= 1;\n len -= 1;\n\n results.push(doc);\n }\n }\n\n return results\n }\n\n removeAt(idx) {\n this._docs.splice(idx, 1);\n this._myIndex.removeAt(idx);\n }\n\n getIndex() {\n return this._myIndex\n }\n\n search(query, { limit = -1 } = {}) {\n const {\n includeMatches,\n includeScore,\n shouldSort,\n sortFn,\n ignoreFieldNorm\n } = this.options;\n\n let results = isString(query)\n ? isString(this._docs[0])\n ? this._searchStringList(query)\n : this._searchObjectList(query)\n : this._searchLogical(query);\n\n computeScore(results, { ignoreFieldNorm });\n\n if (shouldSort) {\n results.sort(sortFn);\n }\n\n if (isNumber(limit) && limit > -1) {\n results = results.slice(0, limit);\n }\n\n return format(results, this._docs, {\n includeMatches,\n includeScore\n })\n }\n\n _searchStringList(query) {\n const searcher = createSearcher(query, this.options);\n const { records } = this._myIndex;\n const results = [];\n\n // Iterate over every string in the index\n records.forEach(({ v: text, i: idx, n: norm }) => {\n if (!isDefined(text)) {\n return\n }\n\n const { isMatch, score, indices } = searcher.searchIn(text);\n\n if (isMatch) {\n results.push({\n item: text,\n idx,\n matches: [{ score, value: text, norm, indices }]\n });\n }\n });\n\n return results\n }\n\n _searchLogical(query) {\n\n const expression = parse(query, this.options);\n\n const evaluate = (node, item, idx) => {\n if (!node.children) {\n const { keyId, searcher } = node;\n\n const matches = this._findMatches({\n key: this._keyStore.get(keyId),\n value: this._myIndex.getValueForItemAtKeyId(item, keyId),\n searcher\n });\n\n if (matches && matches.length) {\n return [\n {\n idx,\n item,\n matches\n }\n ]\n }\n\n return []\n }\n\n const res = [];\n for (let i = 0, len = node.children.length; i < len; i += 1) {\n const child = node.children[i];\n const result = evaluate(child, item, idx);\n if (result.length) {\n res.push(...result);\n } else if (node.operator === LogicalOperator.AND) {\n return []\n }\n }\n return res\n };\n\n const records = this._myIndex.records;\n const resultMap = {};\n const results = [];\n\n records.forEach(({ $: item, i: idx }) => {\n if (isDefined(item)) {\n let expResults = evaluate(expression, item, idx);\n\n if (expResults.length) {\n // Dedupe when adding\n if (!resultMap[idx]) {\n resultMap[idx] = { idx, item, matches: [] };\n results.push(resultMap[idx]);\n }\n expResults.forEach(({ matches }) => {\n resultMap[idx].matches.push(...matches);\n });\n }\n }\n });\n\n return results\n }\n\n _searchObjectList(query) {\n const searcher = createSearcher(query, this.options);\n const { keys, records } = this._myIndex;\n const results = [];\n\n // List is Array\n records.forEach(({ $: item, i: idx }) => {\n if (!isDefined(item)) {\n return\n }\n\n let matches = [];\n\n // Iterate over every key (i.e, path), and fetch the value at that key\n keys.forEach((key, keyIndex) => {\n matches.push(\n ...this._findMatches({\n key,\n value: item[keyIndex],\n searcher\n })\n );\n });\n\n if (matches.length) {\n results.push({\n idx,\n item,\n matches\n });\n }\n });\n\n return results\n }\n _findMatches({ key, value, searcher }) {\n if (!isDefined(value)) {\n return []\n }\n\n let matches = [];\n\n if (isArray(value)) {\n value.forEach(({ v: text, i: idx, n: norm }) => {\n if (!isDefined(text)) {\n return\n }\n\n const { isMatch, score, indices } = searcher.searchIn(text);\n\n if (isMatch) {\n matches.push({\n score,\n key,\n value: text,\n idx,\n norm,\n indices\n });\n }\n });\n } else {\n const { v: text, n: norm } = value;\n\n const { isMatch, score, indices } = searcher.searchIn(text);\n\n if (isMatch) {\n matches.push({ score, key, value: text, norm, indices });\n }\n }\n\n return matches\n }\n}\n\nFuse.version = '7.0.0';\nFuse.createIndex = createIndex;\nFuse.parseIndex = parseIndex;\nFuse.config = Config;\n\n{\n Fuse.parseQuery = parse;\n}\n\n{\n register(ExtendedSearch);\n}\n\nexport { Fuse as default };\n","// @ts-strict-ignore\nimport { ComfyNodeDefImpl } from '@/stores/nodeDefStore'\nimport Fuse, { IFuseOptions, FuseSearchOptions } from 'fuse.js'\nimport _ from 'lodash'\n\nexport type SearchAuxScore = number[]\n\ninterface ExtraSearchOptions {\n matchWildcards?: boolean\n}\n\nexport class FuseSearch {\n public readonly fuse: Fuse\n public readonly keys: string[]\n public readonly data: T[]\n public readonly advancedScoring: boolean\n\n constructor(\n data: T[],\n options?: IFuseOptions,\n createIndex: boolean = true,\n advancedScoring: boolean = false\n ) {\n this.data = data\n this.keys = (options.keys ?? []) as string[]\n this.advancedScoring = advancedScoring\n const index =\n createIndex && options?.keys\n ? Fuse.createIndex(options.keys, data)\n : undefined\n this.fuse = new Fuse(data, options, index)\n }\n\n public search(query: string, options?: FuseSearchOptions): T[] {\n const fuseResult = !query\n ? this.data.map((x) => ({ item: x, score: 0 }))\n : this.fuse.search(query, options)\n\n if (!this.advancedScoring) {\n return fuseResult.map((x) => x.item)\n }\n\n const aux = fuseResult\n .map((x) => ({\n item: x.item,\n scores: this.calcAuxScores(query.toLocaleLowerCase(), x.item, x.score)\n }))\n .sort((a, b) => this.compareAux(a.scores, b.scores))\n\n return aux.map((x) => x.item)\n }\n\n public calcAuxScores(query: string, entry: T, score: number): SearchAuxScore {\n let values: string[] = []\n if (!this.keys.length) values = [entry as string]\n else values = this.keys.map((x) => entry[x])\n const scores = values.map((x) => this.calcAuxSingle(query, x, score))\n let result = scores.sort(this.compareAux)[0]\n\n const deprecated = values.some((x) =>\n x.toLocaleLowerCase().includes('deprecated')\n )\n result[0] += deprecated && result[0] != 0 ? 5 : 0\n if (entry['postProcessSearchScores']) {\n result = entry['postProcessSearchScores'](result) as SearchAuxScore\n }\n return result\n }\n\n public calcAuxSingle(\n query: string,\n item: string,\n score: number\n ): SearchAuxScore {\n const itemWords = item\n .split(/ |\\b|(?<=[a-z])(?=[A-Z])|(?=[A-Z][a-z])/)\n .map((x) => x.toLocaleLowerCase())\n const queryParts = query.split(' ')\n item = item.toLocaleLowerCase()\n\n let main = 9\n let aux1 = 0\n let aux2 = 0\n\n if (item == query) {\n main = 0\n } else if (item.startsWith(query)) {\n main = 1\n aux2 = item.length\n } else if (itemWords.includes(query)) {\n main = 2\n aux1 = item.indexOf(query) + item.length * 0.5\n aux2 = item.length\n } else if (item.includes(query)) {\n main = 3\n aux1 = item.indexOf(query) + item.length * 0.5\n aux2 = item.length\n } else if (queryParts.every((x) => itemWords.includes(x))) {\n const indexes = queryParts.map((x) => itemWords.indexOf(x))\n const min = Math.min(...indexes)\n const max = Math.max(...indexes)\n main = 4\n aux1 = max - min + max * 0.5 + item.length * 0.5\n aux2 = item.length\n } else if (queryParts.every((x) => item.includes(x))) {\n const min = Math.min(...queryParts.map((x) => item.indexOf(x)))\n const max = Math.max(...queryParts.map((x) => item.indexOf(x) + x.length))\n main = 5\n aux1 = max - min + max * 0.5 + item.length * 0.5\n aux2 = item.length\n }\n\n const lengthPenalty =\n 0.2 *\n (1 -\n Math.min(item.length, query.length) /\n Math.max(item.length, query.length))\n return [main, aux1, aux2, score + lengthPenalty]\n }\n\n public compareAux(a: SearchAuxScore, b: SearchAuxScore) {\n for (let i = 0; i < Math.min(a.length, b.length); i++) {\n if (a[i] !== b[i]) {\n return a[i] - b[i]\n }\n }\n return a.length - b.length\n }\n}\n\nexport type FilterAndValue = [NodeFilter, T]\n\nexport class NodeFilter {\n public readonly fuseSearch: FuseSearch\n\n constructor(\n public readonly id: string,\n public readonly name: string,\n public readonly invokeSequence: string,\n public readonly longInvokeSequence: string,\n public readonly nodeOptions:\n | FilterOptionT[]\n | ((node: ComfyNodeDefImpl) => FilterOptionT[]),\n nodeDefs: ComfyNodeDefImpl[],\n options?: IFuseOptions\n ) {\n this.fuseSearch = new FuseSearch(this.getAllNodeOptions(nodeDefs), options)\n }\n\n public getNodeOptions(node: ComfyNodeDefImpl): FilterOptionT[] {\n return this.nodeOptions instanceof Function\n ? this.nodeOptions(node)\n : this.nodeOptions\n }\n\n public getAllNodeOptions(nodeDefs: ComfyNodeDefImpl[]): FilterOptionT[] {\n return [\n ...new Set(\n nodeDefs.reduce((acc, nodeDef) => {\n return [...acc, ...this.getNodeOptions(nodeDef)]\n }, [])\n )\n ]\n }\n\n public matches(\n node: ComfyNodeDefImpl,\n value: FilterOptionT,\n extraOptions?: ExtraSearchOptions\n ): boolean {\n const matchWildcards = extraOptions?.matchWildcards !== false\n if (matchWildcards && value === '*') {\n return true\n }\n const options = this.getNodeOptions(node)\n return (\n options.includes(value) ||\n (matchWildcards && _.some(options, (option) => option === '*'))\n )\n }\n}\n\nexport class NodeSearchService {\n public readonly nodeFuseSearch: FuseSearch\n public readonly nodeFilters: NodeFilter[]\n\n constructor(data: ComfyNodeDefImpl[]) {\n this.nodeFuseSearch = new FuseSearch(\n data,\n {\n keys: ['name', 'display_name'],\n includeScore: true,\n threshold: 0.3,\n shouldSort: false,\n useExtendedSearch: true\n },\n true,\n true\n )\n\n const filterSearchOptions = {\n includeScore: true,\n threshold: 0.3,\n shouldSort: true\n }\n\n const inputTypeFilter = new NodeFilter(\n /* id */ 'input',\n /* name */ 'Input Type',\n /* invokeSequence */ 'i',\n /* longInvokeSequence */ 'input',\n (node) => node.inputs.all.map((input) => input.type),\n data,\n filterSearchOptions\n )\n\n const outputTypeFilter = new NodeFilter(\n /* id */ 'output',\n /* name */ 'Output Type',\n /* invokeSequence */ 'o',\n /* longInvokeSequence */ 'output',\n (node) => node.outputs.all.map((output) => output.type),\n data,\n filterSearchOptions\n )\n\n const nodeCategoryFilter = new NodeFilter(\n /* id */ 'category',\n /* name */ 'Category',\n /* invokeSequence */ 'c',\n /* longInvokeSequence */ 'category',\n (node) => [node.category],\n data,\n filterSearchOptions\n )\n\n const nodeSourceFilter = new NodeFilter(\n /* id */ 'source',\n /* name */ 'Source',\n /* invokeSequence */ 's',\n /* longInvokeSequence */ 'source',\n (node) => [node.nodeSource.displayText],\n data,\n filterSearchOptions\n )\n\n this.nodeFilters = [\n inputTypeFilter,\n outputTypeFilter,\n nodeCategoryFilter,\n nodeSourceFilter\n ]\n }\n\n public endsWithFilterStartSequence(query: string): boolean {\n return query.endsWith(':')\n }\n\n public searchNode(\n query: string,\n filters: FilterAndValue[] = [],\n options?: FuseSearchOptions,\n extraOptions?: ExtraSearchOptions\n ): ComfyNodeDefImpl[] {\n const matchedNodes = this.nodeFuseSearch.search(query)\n\n const results = matchedNodes.filter((node) => {\n return _.every(filters, (filterAndValue) => {\n const [filter, value] = filterAndValue\n return filter.matches(node, value, extraOptions)\n })\n })\n\n return options?.limit ? results.slice(0, options.limit) : results\n }\n\n public getFilterById(id: string): NodeFilter | undefined {\n return this.nodeFilters.find((filter) => filter.id === id)\n }\n}\n","import {\n NodeSearchService,\n type SearchAuxScore\n} from '@/services/nodeSearchService'\nimport {\n type ComfyNodeDef,\n type ComfyInputsSpec as ComfyInputsSpecSchema,\n type ComfyOutputTypesSpec as ComfyOutputTypesSpecSchema,\n type InputSpec\n} from '@/types/apiTypes'\nimport { defineStore } from 'pinia'\nimport type { TreeNode } from 'primevue/treenode'\nimport { buildTree } from '@/utils/treeUtil'\nimport { computed, ref } from 'vue'\nimport axios from 'axios'\nimport {\n type NodeSource,\n NodeSourceType,\n getNodeSource\n} from '@/types/nodeSource'\nimport type { LGraphNode } from '@comfyorg/litegraph'\n\nexport interface BaseInputSpec {\n name: string\n type: string\n tooltip?: string\n default?: T\n\n forceInput?: boolean\n}\n\nexport interface NumericInputSpec extends BaseInputSpec {\n min?: number\n max?: number\n step?: number\n}\n\nexport interface IntInputSpec extends NumericInputSpec {\n type: 'INT'\n}\n\nexport interface FloatInputSpec extends NumericInputSpec {\n type: 'FLOAT'\n round?: number\n}\n\nexport interface BooleanInputSpec extends BaseInputSpec {\n type: 'BOOLEAN'\n labelOn?: string\n labelOff?: string\n}\n\nexport interface StringInputSpec extends BaseInputSpec {\n type: 'STRING'\n multiline?: boolean\n dynamicPrompts?: boolean\n}\n\nexport interface ComboInputSpec extends BaseInputSpec {\n type: 'COMBO'\n comboOptions: any[]\n controlAfterGenerate?: boolean\n imageUpload?: boolean\n}\n\nexport class ComfyInputsSpec {\n required: Record\n optional: Record\n hidden?: Record\n\n constructor(obj: ComfyInputsSpecSchema) {\n this.required = ComfyInputsSpec.transformInputSpecRecord(obj.required ?? {})\n this.optional = ComfyInputsSpec.transformInputSpecRecord(obj.optional ?? {})\n this.hidden = obj.hidden\n }\n\n private static transformInputSpecRecord(\n record: Record\n ): Record {\n const result: Record = {}\n for (const [key, value] of Object.entries(record)) {\n result[key] = ComfyInputsSpec.transformSingleInputSpec(key, value)\n }\n return result\n }\n\n private static isInputSpec(obj: any): boolean {\n return (\n Array.isArray(obj) &&\n obj.length >= 1 &&\n (typeof obj[0] === 'string' || Array.isArray(obj[0]))\n )\n }\n\n private static transformSingleInputSpec(\n name: string,\n value: any\n ): BaseInputSpec {\n if (!ComfyInputsSpec.isInputSpec(value)) return value\n\n const [typeRaw, _spec] = value\n const spec = _spec ?? {}\n const type = Array.isArray(typeRaw) ? 'COMBO' : value[0]\n\n switch (type) {\n case 'COMBO':\n return {\n name,\n type,\n ...spec,\n comboOptions: typeRaw,\n default: spec.default ?? typeRaw[0]\n } as ComboInputSpec\n case 'INT':\n case 'FLOAT':\n case 'BOOLEAN':\n case 'STRING':\n default:\n return { name, type, ...spec } as BaseInputSpec\n }\n }\n\n get all() {\n return [...Object.values(this.required), ...Object.values(this.optional)]\n }\n\n getInput(name: string): BaseInputSpec | undefined {\n return this.required[name] ?? this.optional[name]\n }\n}\n\nexport class ComfyOutputSpec {\n constructor(\n public index: number,\n // Name is not unique for output params\n public name: string,\n public type: string,\n public is_list: boolean,\n public comboOptions?: any[],\n public tooltip?: string\n ) {}\n}\n\nexport class ComfyOutputsSpec {\n constructor(public outputs: ComfyOutputSpec[]) {}\n\n get all() {\n return this.outputs\n }\n}\n\nexport class ComfyNodeDefImpl implements ComfyNodeDef {\n // ComfyNodeDef fields\n readonly name: string\n readonly display_name: string\n /**\n * Category is not marked as readonly as the bookmark system\n * needs to write to it to assign a node to a custom folder.\n */\n category: string\n readonly python_module: string\n readonly description: string\n readonly deprecated: boolean\n readonly experimental: boolean\n readonly output_node: boolean\n /**\n * @deprecated Use `inputs` instead\n */\n readonly input: ComfyInputsSpecSchema\n /**\n * @deprecated Use `outputs` instead\n */\n readonly output: ComfyOutputTypesSpecSchema\n /**\n * @deprecated Use `outputs[n].is_list` instead\n */\n readonly output_is_list?: boolean[]\n /**\n * @deprecated Use `outputs[n].name` instead\n */\n readonly output_name?: string[]\n /**\n * @deprecated Use `outputs[n].tooltip` instead\n */\n readonly output_tooltips?: string[]\n\n // ComfyNodeDefImpl fields\n readonly inputs: ComfyInputsSpec\n readonly outputs: ComfyOutputsSpec\n readonly nodeSource: NodeSource\n\n constructor(obj: ComfyNodeDef) {\n this.name = obj.name\n this.display_name = obj.display_name\n this.category = obj.category\n this.python_module = obj.python_module\n this.description = obj.description\n this.deprecated = obj.deprecated ?? obj.category === ''\n this.experimental =\n obj.experimental ?? obj.category.startsWith('_for_testing')\n this.output_node = obj.output_node\n this.input = obj.input ?? {}\n this.output = obj.output ?? []\n this.output_is_list = obj.output_is_list\n this.output_name = obj.output_name\n this.output_tooltips = obj.output_tooltips\n\n this.inputs = new ComfyInputsSpec(obj.input ?? {})\n this.outputs = ComfyNodeDefImpl.transformOutputSpec(obj)\n this.nodeSource = getNodeSource(obj.python_module)\n }\n\n private static transformOutputSpec(obj: any): ComfyOutputsSpec {\n const { output, output_is_list, output_name, output_tooltips } = obj\n const result = (output ?? []).map((type: string | any[], index: number) => {\n const typeString = Array.isArray(type) ? 'COMBO' : type\n\n return new ComfyOutputSpec(\n index,\n output_name?.[index],\n typeString,\n output_is_list?.[index],\n Array.isArray(type) ? type : undefined,\n output_tooltips?.[index]\n )\n })\n return new ComfyOutputsSpec(result)\n }\n\n get nodePath(): string {\n return (this.category ? this.category + '/' : '') + this.name\n }\n\n get isDummyFolder(): boolean {\n return this.name === ''\n }\n\n postProcessSearchScores(scores: SearchAuxScore): SearchAuxScore {\n const nodeFrequencyStore = useNodeFrequencyStore()\n const nodeFrequency = nodeFrequencyStore.getNodeFrequencyByName(this.name)\n return [scores[0], -nodeFrequency, ...scores.slice(1)]\n }\n\n get isCoreNode(): boolean {\n return this.nodeSource.type === NodeSourceType.Core\n }\n\n get nodeLifeCycleBadgeText(): string {\n if (this.deprecated) return '[DEPR]'\n if (this.experimental) return '[BETA]'\n return ''\n }\n}\n\nexport const SYSTEM_NODE_DEFS: Record = {\n PrimitiveNode: {\n name: 'PrimitiveNode',\n display_name: 'Primitive',\n category: 'utils',\n input: { required: {}, optional: {} },\n output: ['*'],\n output_name: ['connect to widget input'],\n output_is_list: [false],\n output_node: false,\n python_module: 'nodes',\n description: 'Primitive values like numbers, strings, and booleans.'\n },\n Reroute: {\n name: 'Reroute',\n display_name: 'Reroute',\n category: 'utils',\n input: { required: { '': ['*'] }, optional: {} },\n output: ['*'],\n output_name: [''],\n output_is_list: [false],\n output_node: false,\n python_module: 'nodes',\n description: 'Reroute the connection to another node.'\n },\n Note: {\n name: 'Note',\n display_name: 'Note',\n category: 'utils',\n input: { required: {}, optional: {} },\n output: [],\n output_name: [],\n output_is_list: [],\n output_node: false,\n python_module: 'nodes',\n description: 'Node that add notes to your project'\n }\n}\n\nexport function buildNodeDefTree(nodeDefs: ComfyNodeDefImpl[]): TreeNode {\n return buildTree(nodeDefs, (nodeDef: ComfyNodeDefImpl) =>\n nodeDef.nodePath.split('/')\n )\n}\n\nexport function createDummyFolderNodeDef(folderPath: string): ComfyNodeDefImpl {\n return new ComfyNodeDefImpl({\n name: '',\n display_name: '',\n category: folderPath.endsWith('/') ? folderPath.slice(0, -1) : folderPath,\n python_module: 'nodes',\n description: 'Dummy Folder Node (User should never see this string)',\n input: {},\n output: [],\n output_name: [],\n output_is_list: [],\n output_node: false\n } as ComfyNodeDef)\n}\n\nexport const useNodeDefStore = defineStore('nodeDef', () => {\n const nodeDefsByName = ref>({})\n const nodeDefsByDisplayName = ref>({})\n const showDeprecated = ref(false)\n const showExperimental = ref(false)\n\n const nodeDefs = computed(() => Object.values(nodeDefsByName.value))\n const visibleNodeDefs = computed(() =>\n nodeDefs.value.filter(\n (nodeDef: ComfyNodeDefImpl) =>\n (showDeprecated.value || !nodeDef.deprecated) &&\n (showExperimental.value || !nodeDef.experimental)\n )\n )\n const nodeSearchService = computed(\n () => new NodeSearchService(visibleNodeDefs.value)\n )\n const nodeTree = computed(() => buildNodeDefTree(visibleNodeDefs.value))\n\n function updateNodeDefs(nodeDefs: ComfyNodeDef[]) {\n const newNodeDefsByName: Record = {}\n const newNodeDefsByDisplayName: Record = {}\n for (const nodeDef of nodeDefs) {\n try {\n const nodeDefImpl = new ComfyNodeDefImpl(nodeDef)\n newNodeDefsByName[nodeDef.name] = nodeDefImpl\n newNodeDefsByDisplayName[nodeDef.display_name] = nodeDefImpl\n } catch (e) {\n // Avoid breaking the app for invalid nodeDefs\n // NodeDef validation is now optional for performance reasons\n console.error('Error adding nodeDef:', e)\n }\n }\n nodeDefsByName.value = newNodeDefsByName\n nodeDefsByDisplayName.value = newNodeDefsByDisplayName\n }\n function addNodeDef(nodeDef: ComfyNodeDef) {\n const nodeDefImpl = new ComfyNodeDefImpl(nodeDef)\n nodeDefsByName.value[nodeDef.name] = nodeDefImpl\n nodeDefsByDisplayName.value[nodeDef.display_name] = nodeDefImpl\n }\n function fromLGraphNode(node: LGraphNode): ComfyNodeDefImpl | null {\n // Frontend-only nodes don't have nodeDef\n return nodeDefsByName.value[node.constructor?.nodeData?.name] ?? null\n }\n\n return {\n nodeDefsByName,\n nodeDefsByDisplayName,\n showDeprecated,\n showExperimental,\n\n nodeDefs,\n visibleNodeDefs,\n nodeSearchService,\n nodeTree,\n\n updateNodeDefs,\n addNodeDef,\n fromLGraphNode\n }\n})\n\nexport const useNodeFrequencyStore = defineStore('nodeFrequency', () => {\n const topNodeDefLimit = ref(64)\n const nodeFrequencyLookup = ref>({})\n const nodeNamesByFrequency = computed(() =>\n Object.keys(nodeFrequencyLookup.value)\n )\n const isLoaded = ref(false)\n\n const loadNodeFrequencies = async () => {\n if (!isLoaded.value) {\n try {\n const response = await axios.get('assets/sorted-custom-node-map.json')\n nodeFrequencyLookup.value = response.data\n isLoaded.value = true\n } catch (error) {\n console.error('Error loading node frequencies:', error)\n }\n }\n }\n\n const getNodeFrequency = (nodeDef: ComfyNodeDefImpl) => {\n return getNodeFrequencyByName(nodeDef.name)\n }\n\n const getNodeFrequencyByName = (nodeName: string) => {\n return nodeFrequencyLookup.value[nodeName] ?? 0\n }\n\n const nodeDefStore = useNodeDefStore()\n const topNodeDefs = computed(() => {\n return nodeNamesByFrequency.value\n .map((nodeName: string) => nodeDefStore.nodeDefsByName[nodeName])\n .filter((nodeDef: ComfyNodeDefImpl) => nodeDef !== undefined)\n .slice(0, topNodeDefLimit.value)\n })\n\n return {\n nodeNamesByFrequency,\n topNodeDefs,\n isLoaded,\n loadNodeFrequencies,\n getNodeFrequency,\n getNodeFrequencyByName\n }\n})\n","import { computed, ref } from 'vue'\nimport { defineStore } from 'pinia'\nimport { api } from '@/scripts/api'\n\n/** (Internal helper) finds a value in a metadata object from any of a list of keys. */\nfunction _findInMetadata(metadata: any, ...keys: string[]): string | null {\n for (const key of keys) {\n if (key in metadata) {\n return metadata[key]\n }\n for (const k in metadata) {\n if (k.endsWith(key)) {\n return metadata[k]\n }\n }\n }\n return null\n}\n\n/** Defines and holds metadata for a model */\nexport class ComfyModelDef {\n /** Proper filename of the model */\n readonly file_name: string\n /** Normalized filename of the model, with all backslashes replaced with forward slashes */\n readonly normalized_file_name: string\n /** Directory containing the model, eg 'checkpoints' */\n readonly directory: string\n /** Simplified copy of name, used as a default title. Excludes the directory and the '.safetensors' file extension */\n readonly simplified_file_name: string\n /** Key for the model, used to uniquely identify the model. */\n readonly key: string\n /** Title / display name of the model, sometimes same as the name but not always */\n title: string\n /** Metadata: architecture ID for the model, such as 'stable-diffusion-xl-v1-base' */\n architecture_id: string = ''\n /** Metadata: author of the model */\n author: string = ''\n /** Metadata: resolution of the model, eg '1024x1024' */\n resolution: string = ''\n /** Metadata: description of the model */\n description: string = ''\n /** Metadata: usage hint for the model */\n usage_hint: string = ''\n /** Metadata: trigger phrase for the model */\n trigger_phrase: string = ''\n /** Metadata: tags list for the model */\n tags: string[] = []\n /** Metadata: image for the model */\n image: string = ''\n /** Whether the model metadata has been loaded from the server, used for `load()` */\n has_loaded_metadata: boolean = false\n /** If true, a metadata load request has been triggered, but may or may not yet have finished loading */\n is_load_requested: boolean = false\n /** A string full of auto-computed lowercase-only searchable text for this model */\n searchable: string = ''\n\n constructor(name: string, directory: string) {\n this.file_name = name\n this.normalized_file_name = name.replaceAll('\\\\', '/')\n this.simplified_file_name = this.normalized_file_name.split('/').pop() ?? ''\n if (this.simplified_file_name.endsWith('.safetensors')) {\n this.simplified_file_name = this.simplified_file_name.slice(\n 0,\n -'.safetensors'.length\n )\n }\n this.title = this.simplified_file_name\n this.directory = directory\n this.key = `${directory}/${this.normalized_file_name}`\n this.updateSearchable()\n }\n\n updateSearchable() {\n this.searchable = [\n this.file_name,\n this.title,\n this.author,\n this.description,\n this.trigger_phrase,\n this.tags.join(', ')\n ]\n .join('\\n')\n .toLowerCase()\n }\n\n /** Loads the model metadata from the server, filling in this object if data is available */\n async load(): Promise {\n if (this.has_loaded_metadata || this.is_load_requested) {\n return\n }\n this.is_load_requested = true\n try {\n const metadata = await api.viewMetadata(this.directory, this.file_name)\n if (!metadata) {\n return\n }\n this.title =\n _findInMetadata(\n metadata,\n 'modelspec.title',\n 'title',\n 'display_name',\n 'name'\n ) || this.title\n this.architecture_id =\n _findInMetadata(metadata, 'modelspec.architecture', 'architecture') ||\n ''\n this.author =\n _findInMetadata(metadata, 'modelspec.author', 'author') || ''\n this.description =\n _findInMetadata(metadata, 'modelspec.description', 'description') || ''\n this.resolution =\n _findInMetadata(metadata, 'modelspec.resolution', 'resolution') || ''\n this.usage_hint =\n _findInMetadata(metadata, 'modelspec.usage_hint', 'usage_hint') || ''\n this.trigger_phrase =\n _findInMetadata(\n metadata,\n 'modelspec.trigger_phrase',\n 'trigger_phrase'\n ) || ''\n this.image =\n _findInMetadata(\n metadata,\n 'modelspec.thumbnail',\n 'thumbnail',\n 'image',\n 'icon'\n ) || ''\n const tagsCommaSeparated =\n _findInMetadata(metadata, 'modelspec.tags', 'tags') || ''\n this.tags = tagsCommaSeparated.split(',').map((tag) => tag.trim())\n this.has_loaded_metadata = true\n this.updateSearchable()\n } catch (error) {\n console.error('Error loading model metadata', this.file_name, this, error)\n }\n }\n}\n\nexport enum ResourceState {\n Uninitialized,\n Loading,\n Loaded\n}\n\nexport class ModelFolder {\n /** Models in this folder */\n models: Record = {}\n state: ResourceState = ResourceState.Uninitialized\n\n constructor(public directory: string) {}\n\n get key(): string {\n return this.directory + '/'\n }\n\n /**\n * Loads the models in this folder from the server\n */\n async load() {\n if (this.state !== ResourceState.Uninitialized) {\n return this\n }\n this.state = ResourceState.Loading\n const models = await api.getModels(this.directory)\n for (const model of models) {\n this.models[model] = new ComfyModelDef(model, this.directory)\n }\n this.state = ResourceState.Loaded\n return this\n }\n}\n\n/** Model store handler, wraps individual per-folder model stores */\nexport const useModelStore = defineStore('models', () => {\n const modelFolderNames = ref([])\n const modelFolderByName = ref>({})\n const modelFolders = computed(() =>\n modelFolderNames.value.map(\n (folderName) => modelFolderByName.value[folderName]\n )\n )\n const models = computed(() =>\n modelFolders.value.flatMap((folder) => Object.values(folder.models))\n )\n\n /**\n * Loads the model folders from the server\n */\n async function loadModelFolders() {\n modelFolderNames.value = await api.getModelFolders()\n modelFolderByName.value = {}\n for (const folderName of modelFolderNames.value) {\n modelFolderByName.value[folderName] = new ModelFolder(folderName)\n }\n }\n\n async function getLoadedModelFolder(\n folderName: string\n ): Promise {\n const folder = modelFolderByName.value[folderName]\n return folder ? await folder.load() : null\n }\n\n /**\n * Loads all model folders' contents from the server\n */\n async function loadModels() {\n return Promise.all(modelFolders.value.map((folder) => folder.load()))\n }\n\n return {\n models,\n modelFolders,\n loadModelFolders,\n loadModels,\n getLoadedModelFolder\n }\n})\n","import { api } from '@/scripts/api'\n\n/**\n * Sync entities from the API to the entityByPath map.\n * @param dir The directory to sync from\n * @param entityByPath The map to sync to\n * @param createEntity A function to create an entity from a file\n * @param updateEntity A function to update an entity from a file\n * @param exclude A function to exclude an entity\n */\nexport async function syncEntities(\n dir: string,\n entityByPath: Record,\n createEntity: (file: any) => T,\n updateEntity: (entity: T, file: any) => void,\n exclude: (file: T) => boolean = () => false\n) {\n const files = (await api.listUserDataFullInfo(dir)).map((file) => ({\n ...file,\n path: dir ? `${dir}/${file.path}` : file.path\n }))\n\n for (const file of files) {\n const existingEntity = entityByPath[file.path]\n\n if (!existingEntity) {\n // New entity, add it to the map\n entityByPath[file.path] = createEntity(file)\n } else if (exclude(existingEntity)) {\n // Entity has been excluded, skip it\n continue\n } else {\n // Entity has been modified, update its properties\n updateEntity(existingEntity, file)\n }\n }\n\n // Remove entities that no longer exist\n for (const [path, entity] of Object.entries(entityByPath)) {\n if (exclude(entity)) continue\n if (!files.some((file) => file.path === path)) {\n delete entityByPath[path]\n }\n }\n}\n","import { defineStore } from 'pinia'\nimport { api } from '@/scripts/api'\nimport { buildTree } from '@/utils/treeUtil'\nimport { computed, ref } from 'vue'\nimport { TreeExplorerNode } from '@/types/treeExplorerTypes'\nimport { UserDataFullInfo } from '@/types/apiTypes'\nimport { syncEntities } from '@/utils/syncUtil'\nimport { getPathDetails } from '@/utils/formatUtil'\n\n/**\n * Represents a file in the user's data directory.\n */\nexport class UserFile {\n /**\n * Various path components.\n * Example:\n * - path: 'dir/file.txt'\n * - directory: 'dir'\n * - fullFilename: 'file.txt'\n * - filename: 'file'\n * - suffix: 'txt'\n */\n directory: string\n fullFilename: string\n filename: string\n suffix: string | null\n\n isLoading: boolean = false\n content: string | null = null\n originalContent: string | null = null\n\n constructor(\n /**\n * Path relative to ComfyUI/user/ directory.\n */\n public path: string,\n /**\n * Last modified timestamp.\n */\n public lastModified: number,\n /**\n * File size in bytes. -1 for temporary files.\n */\n public size: number\n ) {\n const details = getPathDetails(path)\n this.path = path\n this.directory = details.directory\n this.fullFilename = details.fullFilename\n this.filename = details.filename\n this.suffix = details.suffix\n }\n\n updatePath(newPath: string) {\n const details = getPathDetails(newPath)\n this.path = newPath\n this.directory = details.directory\n this.fullFilename = details.fullFilename\n this.filename = details.filename\n this.suffix = details.suffix\n }\n\n static createTemporary(path: string): UserFile {\n return new UserFile(path, Date.now(), -1)\n }\n\n get isTemporary() {\n return this.size === -1\n }\n\n get isPersisted() {\n return !this.isTemporary\n }\n\n get key(): string {\n return this.path\n }\n\n get isLoaded() {\n return this.content !== null\n }\n\n get isModified() {\n return this.content !== this.originalContent\n }\n\n /**\n * Loads the file content from the remote storage.\n */\n async load({\n force = false\n }: { force?: boolean } = {}): Promise {\n if (this.isTemporary || (!force && this.isLoaded))\n return this as LoadedUserFile\n\n this.isLoading = true\n const resp = await api.getUserData(this.path)\n if (resp.status !== 200) {\n throw new Error(\n `Failed to load file '${this.path}': ${resp.status} ${resp.statusText}`\n )\n }\n this.content = await resp.text()\n this.originalContent = this.content\n this.isLoading = false\n return this as LoadedUserFile\n }\n\n /**\n * Unloads the file content from memory\n */\n unload(): void {\n this.content = null\n this.originalContent = null\n this.isLoading = false\n }\n\n async saveAs(newPath: string): Promise {\n const tempFile = this.isTemporary ? this : UserFile.createTemporary(newPath)\n tempFile.content = this.content\n await tempFile.save()\n return tempFile\n }\n\n /**\n * Saves the file to the remote storage.\n * @param force Whether to force the save even if the file is not modified.\n */\n async save({ force = false }: { force?: boolean } = {}): Promise {\n if (this.isPersisted && !this.isModified && !force) return this\n\n const resp = await api.storeUserData(this.path, this.content, {\n overwrite: this.isPersisted,\n throwOnError: true,\n full_info: true\n })\n\n // Note: Backend supports full_info=true feature after\n // https://github.com/comfyanonymous/ComfyUI/pull/5446\n const updatedFile = (await resp.json()) as string | UserDataFullInfo\n if (typeof updatedFile === 'object') {\n this.lastModified = updatedFile.modified\n this.size = updatedFile.size\n }\n this.originalContent = this.content\n return this\n }\n\n async delete(): Promise {\n if (this.isTemporary) return\n\n const resp = await api.deleteUserData(this.path)\n if (resp.status !== 204) {\n throw new Error(\n `Failed to delete file '${this.path}': ${resp.status} ${resp.statusText}`\n )\n }\n }\n\n async rename(newPath: string): Promise {\n if (this.isTemporary) {\n this.updatePath(newPath)\n return this\n }\n\n const resp = await api.moveUserData(this.path, newPath)\n if (resp.status !== 200) {\n throw new Error(\n `Failed to rename file '${this.path}': ${resp.status} ${resp.statusText}`\n )\n }\n this.updatePath(newPath)\n // Note: Backend supports full_info=true feature after\n // https://github.com/comfyanonymous/ComfyUI/pull/5446\n const updatedFile = (await resp.json()) as string | UserDataFullInfo\n if (typeof updatedFile === 'object') {\n this.lastModified = updatedFile.modified\n this.size = updatedFile.size\n }\n return this\n }\n}\n\nexport interface LoadedUserFile extends UserFile {\n isLoaded: true\n originalContent: string\n content: string\n}\n\nexport const useUserFileStore = defineStore('userFile', () => {\n const userFilesByPath = ref>({})\n\n const userFiles = computed(() => Object.values(userFilesByPath.value))\n const modifiedFiles = computed(() =>\n userFiles.value.filter((file: UserFile) => file.isModified)\n )\n const loadedFiles = computed(() =>\n userFiles.value.filter((file: UserFile) => file.isLoaded)\n )\n\n const fileTree = computed>(\n () =>\n buildTree(userFiles.value, (userFile: UserFile) =>\n userFile.path.split('/')\n ) as TreeExplorerNode\n )\n\n /**\n * Syncs the files in the given directory with the API.\n * @param dir The directory to sync.\n */\n const syncFiles = async (dir: string = '') => {\n await syncEntities(\n dir,\n userFilesByPath.value,\n (file) => new UserFile(file.path, file.modified, file.size),\n (existingFile, file) => {\n existingFile.lastModified = file.modified\n existingFile.size = file.size\n existingFile.unload()\n }\n )\n }\n\n return {\n userFiles,\n modifiedFiles,\n loadedFiles,\n fileTree,\n syncFiles\n }\n})\n","class Processor {\n constructor(options) {\n this.selfOptions = options || {};\n this.pipes = {};\n }\n options(options) {\n if (options) {\n this.selfOptions = options;\n }\n return this.selfOptions;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n pipe(name, pipeArg) {\n let pipe = pipeArg;\n if (typeof name === 'string') {\n if (typeof pipe === 'undefined') {\n return this.pipes[name];\n }\n else {\n this.pipes[name] = pipe;\n }\n }\n if (name && name.name) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n pipe = name;\n if (pipe.processor === this) {\n return pipe;\n }\n this.pipes[pipe.name] = pipe;\n }\n pipe.processor = this;\n return pipe;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n process(input, pipe) {\n let context = input;\n context.options = this.options();\n let nextPipe = pipe || input.pipe || 'default';\n let lastPipe;\n while (nextPipe) {\n if (typeof context.nextAfterChildren !== 'undefined') {\n // children processed and coming back to parent\n context.next = context.nextAfterChildren;\n context.nextAfterChildren = null;\n }\n if (typeof nextPipe === 'string') {\n nextPipe = this.pipe(nextPipe);\n }\n nextPipe.process(context);\n lastPipe = nextPipe;\n nextPipe = null;\n if (context) {\n if (context.next) {\n context = context.next;\n nextPipe = context.pipe || lastPipe;\n }\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return context.hasResult ? context.result : undefined;\n }\n}\nexport default Processor;\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\nclass Pipe {\n constructor(name) {\n this.name = name;\n this.filters = [];\n }\n process(input) {\n if (!this.processor) {\n throw new Error('add this pipe to a processor before using it');\n }\n const debug = this.debug;\n const length = this.filters.length;\n const context = input;\n for (let index = 0; index < length; index++) {\n const filter = this.filters[index];\n if (debug) {\n this.log(`filter: ${filter.filterName}`);\n }\n filter(context);\n if (typeof context === 'object' && context.exiting) {\n context.exiting = false;\n break;\n }\n }\n if (!context.next && this.resultCheck) {\n this.resultCheck(context);\n }\n }\n log(msg) {\n console.log(`[jsondiffpatch] ${this.name} pipe, ${msg}`);\n }\n append(...args) {\n this.filters.push(...args);\n return this;\n }\n prepend(...args) {\n this.filters.unshift(...args);\n return this;\n }\n indexOf(filterName) {\n if (!filterName) {\n throw new Error('a filter name is required');\n }\n for (let index = 0; index < this.filters.length; index++) {\n const filter = this.filters[index];\n if (filter.filterName === filterName) {\n return index;\n }\n }\n throw new Error(`filter not found: ${filterName}`);\n }\n list() {\n return this.filters.map((f) => f.filterName);\n }\n after(filterName, ...params) {\n const index = this.indexOf(filterName);\n this.filters.splice(index + 1, 0, ...params);\n return this;\n }\n before(filterName, ...params) {\n const index = this.indexOf(filterName);\n this.filters.splice(index, 0, ...params);\n return this;\n }\n replace(filterName, ...params) {\n const index = this.indexOf(filterName);\n this.filters.splice(index, 1, ...params);\n return this;\n }\n remove(filterName) {\n const index = this.indexOf(filterName);\n this.filters.splice(index, 1);\n return this;\n }\n clear() {\n this.filters.length = 0;\n return this;\n }\n shouldHaveResult(should) {\n if (should === false) {\n this.resultCheck = null;\n return;\n }\n if (this.resultCheck) {\n return;\n }\n this.resultCheck = (context) => {\n if (!context.hasResult) {\n console.log(context);\n const error = new Error(`${this.name} failed`);\n error.noResult = true;\n throw error;\n }\n };\n return this;\n }\n}\nexport default Pipe;\n","export default class Context {\n setResult(result) {\n this.result = result;\n this.hasResult = true;\n return this;\n }\n exit() {\n this.exiting = true;\n return this;\n }\n push(child, name) {\n child.parent = this;\n if (typeof name !== 'undefined') {\n child.childName = name;\n }\n child.root = this.root || this;\n child.options = child.options || this.options;\n if (!this.children) {\n this.children = [child];\n this.nextAfterChildren = this.next || null;\n this.next = child;\n }\n else {\n this.children[this.children.length - 1].next = child;\n this.children.push(child);\n }\n child.next = this;\n return this;\n }\n}\n","function cloneRegExp(re) {\n const regexMatch = /^\\/(.*)\\/([gimyu]*)$/.exec(re.toString());\n return new RegExp(regexMatch[1], regexMatch[2]);\n}\nexport default function clone(arg) {\n if (typeof arg !== 'object') {\n return arg;\n }\n if (arg === null) {\n return null;\n }\n if (Array.isArray(arg)) {\n return arg.map(clone);\n }\n if (arg instanceof Date) {\n return new Date(arg.getTime());\n }\n if (arg instanceof RegExp) {\n return cloneRegExp(arg);\n }\n const cloned = {};\n for (const name in arg) {\n if (Object.prototype.hasOwnProperty.call(arg, name)) {\n cloned[name] = clone(arg[name]);\n }\n }\n return cloned;\n}\n","import Context from './context.js';\nimport defaultClone from '../clone.js';\nclass DiffContext extends Context {\n constructor(left, right) {\n super();\n this.left = left;\n this.right = right;\n this.pipe = 'diff';\n }\n setResult(result) {\n if (this.options.cloneDiffValues && typeof result === 'object') {\n const clone = typeof this.options.cloneDiffValues === 'function'\n ? this.options.cloneDiffValues\n : defaultClone;\n if (typeof result[0] === 'object') {\n result[0] = clone(result[0]);\n }\n if (typeof result[1] === 'object') {\n result[1] = clone(result[1]);\n }\n }\n return super.setResult(result);\n }\n}\nexport default DiffContext;\n","import Context from './context.js';\nclass PatchContext extends Context {\n constructor(left, delta) {\n super();\n this.left = left;\n this.delta = delta;\n this.pipe = 'patch';\n }\n}\nexport default PatchContext;\n","import Context from './context.js';\nclass ReverseContext extends Context {\n constructor(delta) {\n super();\n this.delta = delta;\n this.pipe = 'reverse';\n }\n}\nexport default ReverseContext;\n","export const diffFilter = function trivialMatchesDiffFilter(context) {\n if (context.left === context.right) {\n context.setResult(undefined).exit();\n return;\n }\n if (typeof context.left === 'undefined') {\n if (typeof context.right === 'function') {\n throw new Error('functions are not supported');\n }\n context.setResult([context.right]).exit();\n return;\n }\n if (typeof context.right === 'undefined') {\n context.setResult([context.left, 0, 0]).exit();\n return;\n }\n if (typeof context.left === 'function' ||\n typeof context.right === 'function') {\n throw new Error('functions are not supported');\n }\n context.leftType = context.left === null ? 'null' : typeof context.left;\n context.rightType = context.right === null ? 'null' : typeof context.right;\n if (context.leftType !== context.rightType) {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n if (context.leftType === 'boolean' || context.leftType === 'number') {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n if (context.leftType === 'object') {\n context.leftIsArray = Array.isArray(context.left);\n }\n if (context.rightType === 'object') {\n context.rightIsArray = Array.isArray(context.right);\n }\n if (context.leftIsArray !== context.rightIsArray) {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n if (context.left instanceof RegExp) {\n if (context.right instanceof RegExp) {\n context\n .setResult([context.left.toString(), context.right.toString()])\n .exit();\n }\n else {\n context.setResult([context.left, context.right]).exit();\n }\n }\n};\ndiffFilter.filterName = 'trivial';\nexport const patchFilter = function trivialMatchesPatchFilter(context) {\n if (typeof context.delta === 'undefined') {\n context.setResult(context.left).exit();\n return;\n }\n context.nested = !Array.isArray(context.delta);\n if (context.nested) {\n return;\n }\n const nonNestedDelta = context.delta;\n if (nonNestedDelta.length === 1) {\n context.setResult(nonNestedDelta[0]).exit();\n return;\n }\n if (nonNestedDelta.length === 2) {\n if (context.left instanceof RegExp) {\n const regexArgs = /^\\/(.*)\\/([gimyu]+)$/.exec(nonNestedDelta[1]);\n if (regexArgs) {\n context.setResult(new RegExp(regexArgs[1], regexArgs[2])).exit();\n return;\n }\n }\n context.setResult(nonNestedDelta[1]).exit();\n return;\n }\n if (nonNestedDelta.length === 3 && nonNestedDelta[2] === 0) {\n context.setResult(undefined).exit();\n }\n};\npatchFilter.filterName = 'trivial';\nexport const reverseFilter = function trivialReferseFilter(context) {\n if (typeof context.delta === 'undefined') {\n context.setResult(context.delta).exit();\n return;\n }\n context.nested = !Array.isArray(context.delta);\n if (context.nested) {\n return;\n }\n const nonNestedDelta = context.delta;\n if (nonNestedDelta.length === 1) {\n context.setResult([nonNestedDelta[0], 0, 0]).exit();\n return;\n }\n if (nonNestedDelta.length === 2) {\n context.setResult([nonNestedDelta[1], nonNestedDelta[0]]).exit();\n return;\n }\n if (nonNestedDelta.length === 3 && nonNestedDelta[2] === 0) {\n context.setResult([nonNestedDelta[0]]).exit();\n }\n};\nreverseFilter.filterName = 'trivial';\n","import DiffContext from '../contexts/diff.js';\nimport PatchContext from '../contexts/patch.js';\nimport ReverseContext from '../contexts/reverse.js';\nexport const collectChildrenDiffFilter = (context) => {\n if (!context || !context.children) {\n return;\n }\n const length = context.children.length;\n let child;\n let result = context.result;\n for (let index = 0; index < length; index++) {\n child = context.children[index];\n if (typeof child.result === 'undefined') {\n continue;\n }\n result = result || {};\n result[child.childName] = child.result;\n }\n if (result && context.leftIsArray) {\n result._t = 'a';\n }\n context.setResult(result).exit();\n};\ncollectChildrenDiffFilter.filterName = 'collectChildren';\nexport const objectsDiffFilter = (context) => {\n if (context.leftIsArray || context.leftType !== 'object') {\n return;\n }\n const left = context.left;\n const right = context.right;\n let name;\n let child;\n const propertyFilter = context.options.propertyFilter;\n for (name in left) {\n if (!Object.prototype.hasOwnProperty.call(left, name)) {\n continue;\n }\n if (propertyFilter && !propertyFilter(name, context)) {\n continue;\n }\n child = new DiffContext(left[name], right[name]);\n context.push(child, name);\n }\n for (name in right) {\n if (!Object.prototype.hasOwnProperty.call(right, name)) {\n continue;\n }\n if (propertyFilter && !propertyFilter(name, context)) {\n continue;\n }\n if (typeof left[name] === 'undefined') {\n child = new DiffContext(undefined, right[name]);\n context.push(child, name);\n }\n }\n if (!context.children || context.children.length === 0) {\n context.setResult(undefined).exit();\n return;\n }\n context.exit();\n};\nobjectsDiffFilter.filterName = 'objects';\nexport const patchFilter = function nestedPatchFilter(context) {\n if (!context.nested) {\n return;\n }\n const nestedDelta = context.delta;\n if (nestedDelta._t) {\n return;\n }\n const objectDelta = nestedDelta;\n let name;\n let child;\n for (name in objectDelta) {\n child = new PatchContext(context.left[name], objectDelta[name]);\n context.push(child, name);\n }\n context.exit();\n};\npatchFilter.filterName = 'objects';\nexport const collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {\n if (!context || !context.children) {\n return;\n }\n const deltaWithChildren = context.delta;\n if (deltaWithChildren._t) {\n return;\n }\n const object = context.left;\n const length = context.children.length;\n let child;\n for (let index = 0; index < length; index++) {\n child = context.children[index];\n const property = child.childName;\n if (Object.prototype.hasOwnProperty.call(context.left, property) &&\n child.result === undefined) {\n delete object[property];\n }\n else if (object[property] !== child.result) {\n object[property] = child.result;\n }\n }\n context.setResult(object).exit();\n};\ncollectChildrenPatchFilter.filterName = 'collectChildren';\nexport const reverseFilter = function nestedReverseFilter(context) {\n if (!context.nested) {\n return;\n }\n const nestedDelta = context.delta;\n if (nestedDelta._t) {\n return;\n }\n const objectDelta = context.delta;\n let name;\n let child;\n for (name in objectDelta) {\n child = new ReverseContext(objectDelta[name]);\n context.push(child, name);\n }\n context.exit();\n};\nreverseFilter.filterName = 'objects';\nexport const collectChildrenReverseFilter = (context) => {\n if (!context || !context.children) {\n return;\n }\n const deltaWithChildren = context.delta;\n if (deltaWithChildren._t) {\n return;\n }\n const length = context.children.length;\n let child;\n const delta = {};\n for (let index = 0; index < length; index++) {\n child = context.children[index];\n const property = child.childName;\n if (delta[property] !== child.result) {\n delta[property] = child.result;\n }\n }\n context.setResult(delta).exit();\n};\ncollectChildrenReverseFilter.filterName = 'collectChildren';\n","/*\n\nLCS implementation that supports arrays or strings\n\nreference: http://en.wikipedia.org/wiki/Longest_common_subsequence_problem\n\n*/\nconst defaultMatch = function (array1, array2, index1, index2) {\n return array1[index1] === array2[index2];\n};\nconst lengthMatrix = function (array1, array2, match, context) {\n const len1 = array1.length;\n const len2 = array2.length;\n let x, y;\n // initialize empty matrix of len1+1 x len2+1\n const matrix = new Array(len1 + 1);\n for (x = 0; x < len1 + 1; x++) {\n matrix[x] = new Array(len2 + 1);\n for (y = 0; y < len2 + 1; y++) {\n matrix[x][y] = 0;\n }\n }\n matrix.match = match;\n // save sequence lengths for each coordinate\n for (x = 1; x < len1 + 1; x++) {\n for (y = 1; y < len2 + 1; y++) {\n if (match(array1, array2, x - 1, y - 1, context)) {\n matrix[x][y] = matrix[x - 1][y - 1] + 1;\n }\n else {\n matrix[x][y] = Math.max(matrix[x - 1][y], matrix[x][y - 1]);\n }\n }\n }\n return matrix;\n};\nconst backtrack = function (matrix, array1, array2, context) {\n let index1 = array1.length;\n let index2 = array2.length;\n const subsequence = {\n sequence: [],\n indices1: [],\n indices2: [],\n };\n while (index1 !== 0 && index2 !== 0) {\n const sameLetter = matrix.match(array1, array2, index1 - 1, index2 - 1, context);\n if (sameLetter) {\n subsequence.sequence.unshift(array1[index1 - 1]);\n subsequence.indices1.unshift(index1 - 1);\n subsequence.indices2.unshift(index2 - 1);\n --index1;\n --index2;\n }\n else {\n const valueAtMatrixAbove = matrix[index1][index2 - 1];\n const valueAtMatrixLeft = matrix[index1 - 1][index2];\n if (valueAtMatrixAbove > valueAtMatrixLeft) {\n --index2;\n }\n else {\n --index1;\n }\n }\n }\n return subsequence;\n};\nconst get = function (array1, array2, match, context) {\n const innerContext = context || {};\n const matrix = lengthMatrix(array1, array2, match || defaultMatch, innerContext);\n return backtrack(matrix, array1, array2, innerContext);\n};\nexport default {\n get,\n};\n","import DiffContext from '../contexts/diff.js';\nimport PatchContext from '../contexts/patch.js';\nimport ReverseContext from '../contexts/reverse.js';\nimport lcs from './lcs.js';\nconst ARRAY_MOVE = 3;\nfunction arraysHaveMatchByRef(array1, array2, len1, len2) {\n for (let index1 = 0; index1 < len1; index1++) {\n const val1 = array1[index1];\n for (let index2 = 0; index2 < len2; index2++) {\n const val2 = array2[index2];\n if (index1 !== index2 && val1 === val2) {\n return true;\n }\n }\n }\n}\nfunction matchItems(array1, array2, index1, index2, context) {\n const value1 = array1[index1];\n const value2 = array2[index2];\n if (value1 === value2) {\n return true;\n }\n if (typeof value1 !== 'object' || typeof value2 !== 'object') {\n return false;\n }\n const objectHash = context.objectHash;\n if (!objectHash) {\n // no way to match objects was provided, try match by position\n return context.matchByPosition && index1 === index2;\n }\n context.hashCache1 = context.hashCache1 || [];\n let hash1 = context.hashCache1[index1];\n if (typeof hash1 === 'undefined') {\n context.hashCache1[index1] = hash1 = objectHash(value1, index1);\n }\n if (typeof hash1 === 'undefined') {\n return false;\n }\n context.hashCache2 = context.hashCache2 || [];\n let hash2 = context.hashCache2[index2];\n if (typeof hash2 === 'undefined') {\n context.hashCache2[index2] = hash2 = objectHash(value2, index2);\n }\n if (typeof hash2 === 'undefined') {\n return false;\n }\n return hash1 === hash2;\n}\nexport const diffFilter = function arraysDiffFilter(context) {\n if (!context.leftIsArray) {\n return;\n }\n const matchContext = {\n objectHash: context.options && context.options.objectHash,\n matchByPosition: context.options && context.options.matchByPosition,\n };\n let commonHead = 0;\n let commonTail = 0;\n let index;\n let index1;\n let index2;\n const array1 = context.left;\n const array2 = context.right;\n const len1 = array1.length;\n const len2 = array2.length;\n let child;\n if (len1 > 0 &&\n len2 > 0 &&\n !matchContext.objectHash &&\n typeof matchContext.matchByPosition !== 'boolean') {\n matchContext.matchByPosition = !arraysHaveMatchByRef(array1, array2, len1, len2);\n }\n // separate common head\n while (commonHead < len1 &&\n commonHead < len2 &&\n matchItems(array1, array2, commonHead, commonHead, matchContext)) {\n index = commonHead;\n child = new DiffContext(array1[index], array2[index]);\n context.push(child, index);\n commonHead++;\n }\n // separate common tail\n while (commonTail + commonHead < len1 &&\n commonTail + commonHead < len2 &&\n matchItems(array1, array2, len1 - 1 - commonTail, len2 - 1 - commonTail, matchContext)) {\n index1 = len1 - 1 - commonTail;\n index2 = len2 - 1 - commonTail;\n child = new DiffContext(array1[index1], array2[index2]);\n context.push(child, index2);\n commonTail++;\n }\n let result;\n if (commonHead + commonTail === len1) {\n if (len1 === len2) {\n // arrays are identical\n context.setResult(undefined).exit();\n return;\n }\n // trivial case, a block (1 or more consecutive items) was added\n result = result || {\n _t: 'a',\n };\n for (index = commonHead; index < len2 - commonTail; index++) {\n result[index] = [array2[index]];\n }\n context.setResult(result).exit();\n return;\n }\n if (commonHead + commonTail === len2) {\n // trivial case, a block (1 or more consecutive items) was removed\n result = result || {\n _t: 'a',\n };\n for (index = commonHead; index < len1 - commonTail; index++) {\n result[`_${index}`] = [array1[index], 0, 0];\n }\n context.setResult(result).exit();\n return;\n }\n // reset hash cache\n delete matchContext.hashCache1;\n delete matchContext.hashCache2;\n // diff is not trivial, find the LCS (Longest Common Subsequence)\n const trimmed1 = array1.slice(commonHead, len1 - commonTail);\n const trimmed2 = array2.slice(commonHead, len2 - commonTail);\n const seq = lcs.get(trimmed1, trimmed2, matchItems, matchContext);\n const removedItems = [];\n result = result || {\n _t: 'a',\n };\n for (index = commonHead; index < len1 - commonTail; index++) {\n if (seq.indices1.indexOf(index - commonHead) < 0) {\n // removed\n result[`_${index}`] = [array1[index], 0, 0];\n removedItems.push(index);\n }\n }\n let detectMove = true;\n if (context.options &&\n context.options.arrays &&\n context.options.arrays.detectMove === false) {\n detectMove = false;\n }\n let includeValueOnMove = false;\n if (context.options &&\n context.options.arrays &&\n context.options.arrays.includeValueOnMove) {\n includeValueOnMove = true;\n }\n const removedItemsLength = removedItems.length;\n for (index = commonHead; index < len2 - commonTail; index++) {\n const indexOnArray2 = seq.indices2.indexOf(index - commonHead);\n if (indexOnArray2 < 0) {\n // added, try to match with a removed item and register as position move\n let isMove = false;\n if (detectMove && removedItemsLength > 0) {\n for (let removeItemIndex1 = 0; removeItemIndex1 < removedItemsLength; removeItemIndex1++) {\n index1 = removedItems[removeItemIndex1];\n if (matchItems(trimmed1, trimmed2, index1 - commonHead, index - commonHead, matchContext)) {\n // store position move as: [originalValue, newPosition, ARRAY_MOVE]\n result[`_${index1}`].splice(1, 2, index, ARRAY_MOVE);\n if (!includeValueOnMove) {\n // don't include moved value on diff, to save bytes\n result[`_${index1}`][0] = '';\n }\n index2 = index;\n child = new DiffContext(array1[index1], array2[index2]);\n context.push(child, index2);\n removedItems.splice(removeItemIndex1, 1);\n isMove = true;\n break;\n }\n }\n }\n if (!isMove) {\n // added\n result[index] = [array2[index]];\n }\n }\n else {\n // match, do inner diff\n index1 = seq.indices1[indexOnArray2] + commonHead;\n index2 = seq.indices2[indexOnArray2] + commonHead;\n child = new DiffContext(array1[index1], array2[index2]);\n context.push(child, index2);\n }\n }\n context.setResult(result).exit();\n};\ndiffFilter.filterName = 'arrays';\nconst compare = {\n numerically(a, b) {\n return a - b;\n },\n numericallyBy(name) {\n return (a, b) => a[name] - b[name];\n },\n};\nexport const patchFilter = function nestedPatchFilter(context) {\n if (!context.nested) {\n return;\n }\n const nestedDelta = context.delta;\n if (nestedDelta._t !== 'a') {\n return;\n }\n let index;\n let index1;\n const delta = nestedDelta;\n const array = context.left;\n // first, separate removals, insertions and modifications\n let toRemove = [];\n let toInsert = [];\n const toModify = [];\n for (index in delta) {\n if (index !== '_t') {\n if (index[0] === '_') {\n const removedOrMovedIndex = index;\n // removed item from original array\n if (delta[removedOrMovedIndex][2] === 0 ||\n delta[removedOrMovedIndex][2] === ARRAY_MOVE) {\n toRemove.push(parseInt(index.slice(1), 10));\n }\n else {\n throw new Error('only removal or move can be applied at original array indices,' +\n ` invalid diff type: ${delta[removedOrMovedIndex][2]}`);\n }\n }\n else {\n const numberIndex = index;\n if (delta[numberIndex].length === 1) {\n // added item at new array\n toInsert.push({\n index: parseInt(numberIndex, 10),\n value: delta[numberIndex][0],\n });\n }\n else {\n // modified item at new array\n toModify.push({\n index: parseInt(numberIndex, 10),\n delta: delta[numberIndex],\n });\n }\n }\n }\n }\n // remove items, in reverse order to avoid sawing our own floor\n toRemove = toRemove.sort(compare.numerically);\n for (index = toRemove.length - 1; index >= 0; index--) {\n index1 = toRemove[index];\n const indexDiff = delta[`_${index1}`];\n const removedValue = array.splice(index1, 1)[0];\n if (indexDiff[2] === ARRAY_MOVE) {\n // reinsert later\n toInsert.push({\n index: indexDiff[1],\n value: removedValue,\n });\n }\n }\n // insert items, in reverse order to avoid moving our own floor\n toInsert = toInsert.sort(compare.numericallyBy('index'));\n const toInsertLength = toInsert.length;\n for (index = 0; index < toInsertLength; index++) {\n const insertion = toInsert[index];\n array.splice(insertion.index, 0, insertion.value);\n }\n // apply modifications\n const toModifyLength = toModify.length;\n let child;\n if (toModifyLength > 0) {\n for (index = 0; index < toModifyLength; index++) {\n const modification = toModify[index];\n child = new PatchContext(array[modification.index], modification.delta);\n context.push(child, modification.index);\n }\n }\n if (!context.children) {\n context.setResult(array).exit();\n return;\n }\n context.exit();\n};\npatchFilter.filterName = 'arrays';\nexport const collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {\n if (!context || !context.children) {\n return;\n }\n const deltaWithChildren = context.delta;\n if (deltaWithChildren._t !== 'a') {\n return;\n }\n const array = context.left;\n const length = context.children.length;\n let child;\n for (let index = 0; index < length; index++) {\n child = context.children[index];\n const arrayIndex = child.childName;\n array[arrayIndex] = child.result;\n }\n context.setResult(array).exit();\n};\ncollectChildrenPatchFilter.filterName = 'arraysCollectChildren';\nexport const reverseFilter = function arraysReverseFilter(context) {\n if (!context.nested) {\n const nonNestedDelta = context.delta;\n if (nonNestedDelta[2] === ARRAY_MOVE) {\n const arrayMoveDelta = nonNestedDelta;\n context.newName = `_${arrayMoveDelta[1]}`;\n context\n .setResult([\n arrayMoveDelta[0],\n parseInt(context.childName.substring(1), 10),\n ARRAY_MOVE,\n ])\n .exit();\n }\n return;\n }\n const nestedDelta = context.delta;\n if (nestedDelta._t !== 'a') {\n return;\n }\n const arrayDelta = nestedDelta;\n let name;\n let child;\n for (name in arrayDelta) {\n if (name === '_t') {\n continue;\n }\n child = new ReverseContext(arrayDelta[name]);\n context.push(child, name);\n }\n context.exit();\n};\nreverseFilter.filterName = 'arrays';\nconst reverseArrayDeltaIndex = (delta, index, itemDelta) => {\n if (typeof index === 'string' && index[0] === '_') {\n return parseInt(index.substring(1), 10);\n }\n else if (Array.isArray(itemDelta) && itemDelta[2] === 0) {\n return `_${index}`;\n }\n let reverseIndex = +index;\n for (const deltaIndex in delta) {\n const deltaItem = delta[deltaIndex];\n if (Array.isArray(deltaItem)) {\n if (deltaItem[2] === ARRAY_MOVE) {\n const moveFromIndex = parseInt(deltaIndex.substring(1), 10);\n const moveToIndex = deltaItem[1];\n if (moveToIndex === +index) {\n return moveFromIndex;\n }\n if (moveFromIndex <= reverseIndex && moveToIndex > reverseIndex) {\n reverseIndex++;\n }\n else if (moveFromIndex >= reverseIndex &&\n moveToIndex < reverseIndex) {\n reverseIndex--;\n }\n }\n else if (deltaItem[2] === 0) {\n const deleteIndex = parseInt(deltaIndex.substring(1), 10);\n if (deleteIndex <= reverseIndex) {\n reverseIndex++;\n }\n }\n else if (deltaItem.length === 1 &&\n parseInt(deltaIndex, 10) <= reverseIndex) {\n reverseIndex--;\n }\n }\n }\n return reverseIndex;\n};\nexport const collectChildrenReverseFilter = (context) => {\n if (!context || !context.children) {\n return;\n }\n const deltaWithChildren = context.delta;\n if (deltaWithChildren._t !== 'a') {\n return;\n }\n const arrayDelta = deltaWithChildren;\n const length = context.children.length;\n let child;\n const delta = {\n _t: 'a',\n };\n for (let index = 0; index < length; index++) {\n child = context.children[index];\n let name = child.newName;\n if (typeof name === 'undefined') {\n name = reverseArrayDeltaIndex(arrayDelta, child.childName, child.result);\n }\n if (delta[name] !== child.result) {\n // There's no way to type this well.\n delta[name] = child.result;\n }\n }\n context.setResult(delta).exit();\n};\ncollectChildrenReverseFilter.filterName = 'arraysCollectChildren';\n","export const diffFilter = function datesDiffFilter(context) {\n if (context.left instanceof Date) {\n if (context.right instanceof Date) {\n if (context.left.getTime() !== context.right.getTime()) {\n context.setResult([context.left, context.right]);\n }\n else {\n context.setResult(undefined);\n }\n }\n else {\n context.setResult([context.left, context.right]);\n }\n context.exit();\n }\n else if (context.right instanceof Date) {\n context.setResult([context.left, context.right]).exit();\n }\n};\ndiffFilter.filterName = 'dates';\n","const TEXT_DIFF = 2;\nconst DEFAULT_MIN_LENGTH = 60;\nlet cachedDiffPatch = null;\nfunction getDiffMatchPatch(options, required) {\n var _a;\n if (!cachedDiffPatch) {\n let instance;\n if ((_a = options === null || options === void 0 ? void 0 : options.textDiff) === null || _a === void 0 ? void 0 : _a.diffMatchPatch) {\n instance = new options.textDiff.diffMatchPatch();\n }\n else {\n if (!required) {\n return null;\n }\n const error = new Error('The diff-match-patch library was not provided. Pass the library in through the options or use the `jsondiffpatch/with-text-diffs` entry-point.');\n // eslint-disable-next-line camelcase\n error.diff_match_patch_not_found = true;\n throw error;\n }\n cachedDiffPatch = {\n diff: function (txt1, txt2) {\n return instance.patch_toText(instance.patch_make(txt1, txt2));\n },\n patch: function (txt1, patch) {\n const results = instance.patch_apply(instance.patch_fromText(patch), txt1);\n for (let i = 0; i < results[1].length; i++) {\n if (!results[1][i]) {\n const error = new Error('text patch failed');\n error.textPatchFailed = true;\n }\n }\n return results[0];\n },\n };\n }\n return cachedDiffPatch;\n}\nexport const diffFilter = function textsDiffFilter(context) {\n if (context.leftType !== 'string') {\n return;\n }\n const left = context.left;\n const right = context.right;\n const minLength = (context.options &&\n context.options.textDiff &&\n context.options.textDiff.minLength) ||\n DEFAULT_MIN_LENGTH;\n if (left.length < minLength || right.length < minLength) {\n context.setResult([left, right]).exit();\n return;\n }\n // large text, try to use a text-diff algorithm\n const diffMatchPatch = getDiffMatchPatch(context.options);\n if (!diffMatchPatch) {\n // diff-match-patch library not available,\n // fallback to regular string replace\n context.setResult([left, right]).exit();\n return;\n }\n const diff = diffMatchPatch.diff;\n context.setResult([diff(left, right), 0, TEXT_DIFF]).exit();\n};\ndiffFilter.filterName = 'texts';\nexport const patchFilter = function textsPatchFilter(context) {\n if (context.nested) {\n return;\n }\n const nonNestedDelta = context.delta;\n if (nonNestedDelta[2] !== TEXT_DIFF) {\n return;\n }\n const textDiffDelta = nonNestedDelta;\n // text-diff, use a text-patch algorithm\n const patch = getDiffMatchPatch(context.options, true).patch;\n context.setResult(patch(context.left, textDiffDelta[0])).exit();\n};\npatchFilter.filterName = 'texts';\nconst textDeltaReverse = function (delta) {\n let i;\n let l;\n let line;\n let lineTmp;\n let header = null;\n const headerRegex = /^@@ +-(\\d+),(\\d+) +\\+(\\d+),(\\d+) +@@$/;\n let lineHeader;\n const lines = delta.split('\\n');\n for (i = 0, l = lines.length; i < l; i++) {\n line = lines[i];\n const lineStart = line.slice(0, 1);\n if (lineStart === '@') {\n header = headerRegex.exec(line);\n lineHeader = i;\n // fix header\n lines[lineHeader] =\n '@@ -' +\n header[3] +\n ',' +\n header[4] +\n ' +' +\n header[1] +\n ',' +\n header[2] +\n ' @@';\n }\n else if (lineStart === '+') {\n lines[i] = '-' + lines[i].slice(1);\n if (lines[i - 1].slice(0, 1) === '+') {\n // swap lines to keep default order (-+)\n lineTmp = lines[i];\n lines[i] = lines[i - 1];\n lines[i - 1] = lineTmp;\n }\n }\n else if (lineStart === '-') {\n lines[i] = '+' + lines[i].slice(1);\n }\n }\n return lines.join('\\n');\n};\nexport const reverseFilter = function textsReverseFilter(context) {\n if (context.nested) {\n return;\n }\n const nonNestedDelta = context.delta;\n if (nonNestedDelta[2] !== TEXT_DIFF) {\n return;\n }\n const textDiffDelta = nonNestedDelta;\n // text-diff, use a text-diff algorithm\n context\n .setResult([textDeltaReverse(textDiffDelta[0]), 0, TEXT_DIFF])\n .exit();\n};\nreverseFilter.filterName = 'texts';\n","import Processor from './processor.js';\nimport Pipe from './pipe.js';\nimport DiffContext from './contexts/diff.js';\nimport PatchContext from './contexts/patch.js';\nimport ReverseContext from './contexts/reverse.js';\nimport clone from './clone.js';\nimport * as trivial from './filters/trivial.js';\nimport * as nested from './filters/nested.js';\nimport * as arrays from './filters/arrays.js';\nimport * as dates from './filters/dates.js';\nimport * as texts from './filters/texts.js';\nclass DiffPatcher {\n constructor(options) {\n this.processor = new Processor(options);\n this.processor.pipe(new Pipe('diff')\n .append(nested.collectChildrenDiffFilter, trivial.diffFilter, dates.diffFilter, texts.diffFilter, nested.objectsDiffFilter, arrays.diffFilter)\n .shouldHaveResult());\n this.processor.pipe(new Pipe('patch')\n .append(nested.collectChildrenPatchFilter, arrays.collectChildrenPatchFilter, trivial.patchFilter, texts.patchFilter, nested.patchFilter, arrays.patchFilter)\n .shouldHaveResult());\n this.processor.pipe(new Pipe('reverse')\n .append(nested.collectChildrenReverseFilter, arrays.collectChildrenReverseFilter, trivial.reverseFilter, texts.reverseFilter, nested.reverseFilter, arrays.reverseFilter)\n .shouldHaveResult());\n }\n options(options) {\n return this.processor.options(options);\n }\n diff(left, right) {\n return this.processor.process(new DiffContext(left, right));\n }\n patch(left, delta) {\n return this.processor.process(new PatchContext(left, delta));\n }\n reverse(delta) {\n return this.processor.process(new ReverseContext(delta));\n }\n unpatch(right, delta) {\n return this.patch(right, this.reverse(delta));\n }\n clone(value) {\n return clone(value);\n }\n}\nexport default DiffPatcher;\n","// use as 2nd parameter for JSON.parse to revive Date instances\nexport default function dateReviver(key, value) {\n let parts;\n if (typeof value === 'string') {\n parts =\n /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d*))?(Z|([+-])(\\d{2}):(\\d{2}))$/.exec(value);\n if (parts) {\n return new Date(Date.UTC(+parts[1], +parts[2] - 1, +parts[3], +parts[4], +parts[5], +parts[6], +(parts[7] || 0)));\n }\n }\n return value;\n}\n","import DiffPatcher from './diffpatcher.js';\nimport dateReviver from './date-reviver.js';\nexport { DiffPatcher, dateReviver };\nexport function create(options) {\n return new DiffPatcher(options);\n}\nlet defaultInstance;\nexport function diff(left, right) {\n if (!defaultInstance) {\n defaultInstance = new DiffPatcher();\n }\n return defaultInstance.diff(left, right);\n}\nexport function patch(left, delta) {\n if (!defaultInstance) {\n defaultInstance = new DiffPatcher();\n }\n return defaultInstance.patch(left, delta);\n}\nexport function unpatch(right, delta) {\n if (!defaultInstance) {\n defaultInstance = new DiffPatcher();\n }\n return defaultInstance.unpatch(right, delta);\n}\nexport function reverse(delta) {\n if (!defaultInstance) {\n defaultInstance = new DiffPatcher();\n }\n return defaultInstance.reverse(delta);\n}\nexport function clone(value) {\n if (!defaultInstance) {\n defaultInstance = new DiffPatcher();\n }\n return defaultInstance.clone(value);\n}\n","/*\n* loglevel - https://github.com/pimterry/loglevel\n*\n* Copyright (c) 2013 Tim Perry\n* Licensed under the MIT license.\n*/\n(function (root, definition) {\n \"use strict\";\n if (typeof define === 'function' && define.amd) {\n define(definition);\n } else if (typeof module === 'object' && module.exports) {\n module.exports = definition();\n } else {\n root.log = definition();\n }\n}(this, function () {\n \"use strict\";\n\n // Slightly dubious tricks to cut down minimized file size\n var noop = function() {};\n var undefinedType = \"undefined\";\n var isIE = (typeof window !== undefinedType) && (typeof window.navigator !== undefinedType) && (\n /Trident\\/|MSIE /.test(window.navigator.userAgent)\n );\n\n var logMethods = [\n \"trace\",\n \"debug\",\n \"info\",\n \"warn\",\n \"error\"\n ];\n\n var _loggersByName = {};\n var defaultLogger = null;\n\n // Cross-browser bind equivalent that works at least back to IE6\n function bindMethod(obj, methodName) {\n var method = obj[methodName];\n if (typeof method.bind === 'function') {\n return method.bind(obj);\n } else {\n try {\n return Function.prototype.bind.call(method, obj);\n } catch (e) {\n // Missing bind shim or IE8 + Modernizr, fallback to wrapping\n return function() {\n return Function.prototype.apply.apply(method, [obj, arguments]);\n };\n }\n }\n }\n\n // Trace() doesn't print the message in IE, so for that case we need to wrap it\n function traceForIE() {\n if (console.log) {\n if (console.log.apply) {\n console.log.apply(console, arguments);\n } else {\n // In old IE, native console methods themselves don't have apply().\n Function.prototype.apply.apply(console.log, [console, arguments]);\n }\n }\n if (console.trace) console.trace();\n }\n\n // Build the best logging method possible for this env\n // Wherever possible we want to bind, not wrap, to preserve stack traces\n function realMethod(methodName) {\n if (methodName === 'debug') {\n methodName = 'log';\n }\n\n if (typeof console === undefinedType) {\n return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives\n } else if (methodName === 'trace' && isIE) {\n return traceForIE;\n } else if (console[methodName] !== undefined) {\n return bindMethod(console, methodName);\n } else if (console.log !== undefined) {\n return bindMethod(console, 'log');\n } else {\n return noop;\n }\n }\n\n // These private functions always need `this` to be set properly\n\n function replaceLoggingMethods() {\n /*jshint validthis:true */\n var level = this.getLevel();\n\n // Replace the actual methods.\n for (var i = 0; i < logMethods.length; i++) {\n var methodName = logMethods[i];\n this[methodName] = (i < level) ?\n noop :\n this.methodFactory(methodName, level, this.name);\n }\n\n // Define log.log as an alias for log.debug\n this.log = this.debug;\n\n // Return any important warnings.\n if (typeof console === undefinedType && level < this.levels.SILENT) {\n return \"No console available for logging\";\n }\n }\n\n // In old IE versions, the console isn't present until you first open it.\n // We build realMethod() replacements here that regenerate logging methods\n function enableLoggingWhenConsoleArrives(methodName) {\n return function () {\n if (typeof console !== undefinedType) {\n replaceLoggingMethods.call(this);\n this[methodName].apply(this, arguments);\n }\n };\n }\n\n // By default, we use closely bound real methods wherever possible, and\n // otherwise we wait for a console to appear, and then try again.\n function defaultMethodFactory(methodName, _level, _loggerName) {\n /*jshint validthis:true */\n return realMethod(methodName) ||\n enableLoggingWhenConsoleArrives.apply(this, arguments);\n }\n\n function Logger(name, factory) {\n // Private instance variables.\n var self = this;\n /**\n * The level inherited from a parent logger (or a global default). We\n * cache this here rather than delegating to the parent so that it stays\n * in sync with the actual logging methods that we have installed (the\n * parent could change levels but we might not have rebuilt the loggers\n * in this child yet).\n * @type {number}\n */\n var inheritedLevel;\n /**\n * The default level for this logger, if any. If set, this overrides\n * `inheritedLevel`.\n * @type {number|null}\n */\n var defaultLevel;\n /**\n * A user-specific level for this logger. If set, this overrides\n * `defaultLevel`.\n * @type {number|null}\n */\n var userLevel;\n\n var storageKey = \"loglevel\";\n if (typeof name === \"string\") {\n storageKey += \":\" + name;\n } else if (typeof name === \"symbol\") {\n storageKey = undefined;\n }\n\n function persistLevelIfPossible(levelNum) {\n var levelName = (logMethods[levelNum] || 'silent').toUpperCase();\n\n if (typeof window === undefinedType || !storageKey) return;\n\n // Use localStorage if available\n try {\n window.localStorage[storageKey] = levelName;\n return;\n } catch (ignore) {}\n\n // Use session cookie as fallback\n try {\n window.document.cookie =\n encodeURIComponent(storageKey) + \"=\" + levelName + \";\";\n } catch (ignore) {}\n }\n\n function getPersistedLevel() {\n var storedLevel;\n\n if (typeof window === undefinedType || !storageKey) return;\n\n try {\n storedLevel = window.localStorage[storageKey];\n } catch (ignore) {}\n\n // Fallback to cookies if local storage gives us nothing\n if (typeof storedLevel === undefinedType) {\n try {\n var cookie = window.document.cookie;\n var cookieName = encodeURIComponent(storageKey);\n var location = cookie.indexOf(cookieName + \"=\");\n if (location !== -1) {\n storedLevel = /^([^;]+)/.exec(\n cookie.slice(location + cookieName.length + 1)\n )[1];\n }\n } catch (ignore) {}\n }\n\n // If the stored level is not valid, treat it as if nothing was stored.\n if (self.levels[storedLevel] === undefined) {\n storedLevel = undefined;\n }\n\n return storedLevel;\n }\n\n function clearPersistedLevel() {\n if (typeof window === undefinedType || !storageKey) return;\n\n // Use localStorage if available\n try {\n window.localStorage.removeItem(storageKey);\n } catch (ignore) {}\n\n // Use session cookie as fallback\n try {\n window.document.cookie =\n encodeURIComponent(storageKey) + \"=; expires=Thu, 01 Jan 1970 00:00:00 UTC\";\n } catch (ignore) {}\n }\n\n function normalizeLevel(input) {\n var level = input;\n if (typeof level === \"string\" && self.levels[level.toUpperCase()] !== undefined) {\n level = self.levels[level.toUpperCase()];\n }\n if (typeof level === \"number\" && level >= 0 && level <= self.levels.SILENT) {\n return level;\n } else {\n throw new TypeError(\"log.setLevel() called with invalid level: \" + input);\n }\n }\n\n /*\n *\n * Public logger API - see https://github.com/pimterry/loglevel for details\n *\n */\n\n self.name = name;\n\n self.levels = { \"TRACE\": 0, \"DEBUG\": 1, \"INFO\": 2, \"WARN\": 3,\n \"ERROR\": 4, \"SILENT\": 5};\n\n self.methodFactory = factory || defaultMethodFactory;\n\n self.getLevel = function () {\n if (userLevel != null) {\n return userLevel;\n } else if (defaultLevel != null) {\n return defaultLevel;\n } else {\n return inheritedLevel;\n }\n };\n\n self.setLevel = function (level, persist) {\n userLevel = normalizeLevel(level);\n if (persist !== false) { // defaults to true\n persistLevelIfPossible(userLevel);\n }\n\n // NOTE: in v2, this should call rebuild(), which updates children.\n return replaceLoggingMethods.call(self);\n };\n\n self.setDefaultLevel = function (level) {\n defaultLevel = normalizeLevel(level);\n if (!getPersistedLevel()) {\n self.setLevel(level, false);\n }\n };\n\n self.resetLevel = function () {\n userLevel = null;\n clearPersistedLevel();\n replaceLoggingMethods.call(self);\n };\n\n self.enableAll = function(persist) {\n self.setLevel(self.levels.TRACE, persist);\n };\n\n self.disableAll = function(persist) {\n self.setLevel(self.levels.SILENT, persist);\n };\n\n self.rebuild = function () {\n if (defaultLogger !== self) {\n inheritedLevel = normalizeLevel(defaultLogger.getLevel());\n }\n replaceLoggingMethods.call(self);\n\n if (defaultLogger === self) {\n for (var childName in _loggersByName) {\n _loggersByName[childName].rebuild();\n }\n }\n };\n\n // Initialize all the internal levels.\n inheritedLevel = normalizeLevel(\n defaultLogger ? defaultLogger.getLevel() : \"WARN\"\n );\n var initialLevel = getPersistedLevel();\n if (initialLevel != null) {\n userLevel = normalizeLevel(initialLevel);\n }\n replaceLoggingMethods.call(self);\n }\n\n /*\n *\n * Top-level API\n *\n */\n\n defaultLogger = new Logger();\n\n defaultLogger.getLogger = function getLogger(name) {\n if ((typeof name !== \"symbol\" && typeof name !== \"string\") || name === \"\") {\n throw new TypeError(\"You must supply a name when creating a logger.\");\n }\n\n var logger = _loggersByName[name];\n if (!logger) {\n logger = _loggersByName[name] = new Logger(\n name,\n defaultLogger.methodFactory\n );\n }\n return logger;\n };\n\n // Grab the current global log variable in case of overwrite\n var _log = (typeof window !== undefinedType) ? window.log : undefined;\n defaultLogger.noConflict = function() {\n if (typeof window !== undefinedType &&\n window.log === defaultLogger) {\n window.log = _log;\n }\n\n return defaultLogger;\n };\n\n defaultLogger.getLoggers = function getLoggers() {\n return _loggersByName;\n };\n\n // ES6 default export, for compatibility\n defaultLogger['default'] = defaultLogger;\n\n return defaultLogger;\n}));\n","import type { ComfyApp } from './app'\nimport { api } from './api'\nimport { LGraphCanvas, LiteGraph } from '@comfyorg/litegraph'\nimport { ComfyWorkflow, useWorkflowStore } from '@/stores/workflowStore'\nimport { LGraphNode } from '@comfyorg/litegraph'\nimport type { ComfyWorkflowJSON } from '@/types/comfyWorkflow'\nimport type { ExecutedWsMessage } from '@/types/apiTypes'\nimport { useExecutionStore } from '@/stores/executionStore'\nimport _ from 'lodash'\nimport * as jsondiffpatch from 'jsondiffpatch'\nimport log from 'loglevel'\n\nfunction clone(obj: T): T {\n return JSON.parse(JSON.stringify(obj))\n}\n\nconst logger = log.getLogger('ChangeTracker')\n// Change to debug for more verbose logging\nlogger.setLevel('info')\n\nexport class ChangeTracker {\n static MAX_HISTORY = 50\n /**\n * The active state of the workflow.\n */\n activeState: ComfyWorkflowJSON\n undoQueue: ComfyWorkflowJSON[] = []\n redoQueue: ComfyWorkflowJSON[] = []\n changeCount: number = 0\n /**\n * Whether the redo/undo restoring is in progress.\n */\n private restoringState: boolean = false\n\n ds?: { scale: number; offset: [number, number] }\n nodeOutputs?: Record\n\n static app?: ComfyApp\n get app(): ComfyApp {\n return ChangeTracker.app!\n }\n\n constructor(\n /**\n * The workflow that this change tracker is tracking\n */\n public workflow: ComfyWorkflow,\n /**\n * The initial state of the workflow\n */\n public initialState: ComfyWorkflowJSON\n ) {\n this.activeState = initialState\n }\n\n /**\n * Save the current state as the initial state.\n */\n reset(state?: ComfyWorkflowJSON) {\n // Do not reset the state if we are restoring.\n if (this.restoringState) return\n\n logger.debug('Reset State')\n if (state) this.activeState = clone(state)\n this.initialState = clone(this.activeState)\n }\n\n store() {\n this.ds = {\n scale: this.app.canvas.ds.scale,\n offset: [this.app.canvas.ds.offset[0], this.app.canvas.ds.offset[1]]\n }\n }\n\n restore() {\n if (this.ds) {\n this.app.canvas.ds.scale = this.ds.scale\n this.app.canvas.ds.offset = this.ds.offset\n }\n if (this.nodeOutputs) {\n this.app.nodeOutputs = this.nodeOutputs\n }\n }\n\n updateModified() {\n api.dispatchCustomEvent('graphChanged', this.activeState)\n\n // Get the workflow from the store as ChangeTracker is raw object, i.e.\n // `this.workflow` is not reactive.\n const workflow = useWorkflowStore().getWorkflowByPath(this.workflow.path)\n if (workflow) {\n workflow.isModified = !ChangeTracker.graphEqual(\n this.initialState,\n this.activeState\n )\n if (logger.getLevel() <= logger.levels.DEBUG && workflow.isModified) {\n const diff = ChangeTracker.graphDiff(\n this.initialState,\n this.activeState\n )\n logger.debug('Graph diff:', diff)\n }\n }\n }\n\n checkState() {\n if (!this.app.graph || this.changeCount) return\n // @ts-expect-error zod types issue. Will be fixed after we enable ts-strict\n const currentState = clone(this.app.graph.serialize()) as ComfyWorkflowJSON\n if (!this.activeState) {\n this.activeState = currentState\n return\n }\n if (!ChangeTracker.graphEqual(this.activeState, currentState)) {\n this.undoQueue.push(this.activeState)\n if (this.undoQueue.length > ChangeTracker.MAX_HISTORY) {\n this.undoQueue.shift()\n }\n logger.debug('Diff detected. Undo queue length:', this.undoQueue.length)\n\n this.activeState = currentState\n this.redoQueue.length = 0\n this.updateModified()\n }\n }\n\n async updateState(source: ComfyWorkflowJSON[], target: ComfyWorkflowJSON[]) {\n const prevState = source.pop()\n if (prevState) {\n target.push(this.activeState)\n this.restoringState = true\n try {\n await this.app.loadGraphData(prevState, false, false, this.workflow, {\n showMissingModelsDialog: false,\n showMissingNodesDialog: false\n })\n this.activeState = prevState\n this.updateModified()\n } finally {\n this.restoringState = false\n }\n }\n }\n\n async undo() {\n await this.updateState(this.undoQueue, this.redoQueue)\n logger.debug(\n 'Undo. Undo queue length:',\n this.undoQueue.length,\n 'Redo queue length:',\n this.redoQueue.length\n )\n }\n\n async redo() {\n await this.updateState(this.redoQueue, this.undoQueue)\n logger.debug(\n 'Redo. Undo queue length:',\n this.undoQueue.length,\n 'Redo queue length:',\n this.redoQueue.length\n )\n }\n\n async undoRedo(e: KeyboardEvent) {\n if ((e.ctrlKey || e.metaKey) && !e.altKey) {\n const key = e.key.toUpperCase()\n // Redo: Ctrl + Y, or Ctrl + Shift + Z\n if ((key === 'Y' && !e.shiftKey) || (key == 'Z' && e.shiftKey)) {\n await this.redo()\n return true\n } else if (key === 'Z' && !e.shiftKey) {\n await this.undo()\n return true\n }\n }\n }\n\n beforeChange() {\n this.changeCount++\n }\n\n afterChange() {\n if (!--this.changeCount) {\n this.checkState()\n }\n }\n\n static init(app: ComfyApp) {\n const getCurrentChangeTracker = () =>\n useWorkflowStore().activeWorkflow?.changeTracker\n const checkState = () => getCurrentChangeTracker()?.checkState()\n\n ChangeTracker.app = app\n\n let keyIgnored = false\n window.addEventListener(\n 'keydown',\n (e: KeyboardEvent) => {\n // Do not trigger on repeat events (Holding down a key)\n // This can happen when user is holding down \"Space\" to pan the canvas.\n if (e.repeat) return\n\n const activeEl = document.activeElement\n requestAnimationFrame(async () => {\n let bindInputEl: Element | null = null\n // If we are auto queue in change mode then we do want to trigger on inputs\n if (!app.ui.autoQueueEnabled || app.ui.autoQueueMode === 'instant') {\n if (\n activeEl?.tagName === 'INPUT' ||\n (activeEl && 'type' in activeEl && activeEl.type === 'textarea')\n ) {\n // Ignore events on inputs, they have their native history\n return\n }\n bindInputEl = activeEl\n }\n\n keyIgnored =\n e.key === 'Control' ||\n e.key === 'Shift' ||\n e.key === 'Alt' ||\n e.key === 'Meta'\n if (keyIgnored) return\n\n const changeTracker = getCurrentChangeTracker()\n if (!changeTracker) return\n\n // Check if this is a ctrl+z ctrl+y\n if (await changeTracker.undoRedo(e)) return\n\n // If our active element is some type of input then handle changes after they're done\n if (ChangeTracker.bindInput(app, bindInputEl)) return\n logger.debug('checkState on keydown')\n changeTracker.checkState()\n })\n },\n true\n )\n\n window.addEventListener('keyup', (e) => {\n if (keyIgnored) {\n keyIgnored = false\n logger.debug('checkState on keyup')\n checkState()\n }\n })\n\n // Handle clicking DOM elements (e.g. widgets)\n window.addEventListener('mouseup', () => {\n logger.debug('checkState on mouseup')\n checkState()\n })\n\n // Handle prompt queue event for dynamic widget changes\n api.addEventListener('promptQueued', () => {\n logger.debug('checkState on promptQueued')\n checkState()\n })\n\n api.addEventListener('graphCleared', () => {\n logger.debug('checkState on graphCleared')\n checkState()\n })\n\n // Handle litegraph clicks\n const processMouseUp = LGraphCanvas.prototype.processMouseUp\n LGraphCanvas.prototype.processMouseUp = function (e) {\n const v = processMouseUp.apply(this, [e])\n logger.debug('checkState on processMouseUp')\n checkState()\n return v\n }\n const processMouseDown = LGraphCanvas.prototype.processMouseDown\n LGraphCanvas.prototype.processMouseDown = function (e) {\n const v = processMouseDown.apply(this, [e])\n logger.debug('checkState on processMouseDown')\n checkState()\n return v\n }\n\n // Handle litegraph dialog popup for number/string widgets\n const prompt = LGraphCanvas.prototype.prompt\n LGraphCanvas.prototype.prompt = function (\n title: string,\n value: any,\n callback: (v: any) => void,\n event: any\n ) {\n const extendedCallback = (v: any) => {\n callback(v)\n checkState()\n }\n logger.debug('checkState on prompt')\n return prompt.apply(this, [title, value, extendedCallback, event])\n }\n\n // Handle litegraph context menu for COMBO widgets\n const close = LiteGraph.ContextMenu.prototype.close\n LiteGraph.ContextMenu.prototype.close = function (e: MouseEvent) {\n const v = close.apply(this, [e])\n logger.debug('checkState on contextMenuClose')\n checkState()\n return v\n }\n\n // Detects nodes being added via the node search dialog\n const onNodeAdded = LiteGraph.LGraph.prototype.onNodeAdded\n LiteGraph.LGraph.prototype.onNodeAdded = function (node: LGraphNode) {\n const v = onNodeAdded?.apply(this, [node])\n if (!app?.configuringGraph) {\n logger.debug('checkState on onNodeAdded')\n checkState()\n }\n return v\n }\n\n // Handle multiple commands as a single transaction\n document.addEventListener('litegraph:canvas', (e: Event) => {\n const detail = (e as CustomEvent).detail\n if (detail.subType === 'before-change') {\n getCurrentChangeTracker()?.beforeChange()\n } else if (detail.subType === 'after-change') {\n getCurrentChangeTracker()?.afterChange()\n }\n })\n\n // Store node outputs\n api.addEventListener('executed', (e: CustomEvent) => {\n const detail = e.detail\n const workflow =\n useExecutionStore().queuedPrompts[detail.prompt_id]?.workflow\n const changeTracker = workflow?.changeTracker\n if (!changeTracker) return\n changeTracker.nodeOutputs ??= {}\n const nodeOutputs = changeTracker.nodeOutputs\n const output = nodeOutputs[detail.node]\n if (detail.merge && output) {\n for (const k in detail.output ?? {}) {\n const v = output[k]\n if (v instanceof Array) {\n output[k] = v.concat(detail.output[k])\n } else {\n output[k] = detail.output[k]\n }\n }\n } else {\n nodeOutputs[detail.node] = detail.output\n }\n })\n }\n\n static bindInput(app: ComfyApp, activeEl: Element | null): boolean {\n if (\n !activeEl ||\n activeEl.tagName === 'CANVAS' ||\n activeEl.tagName === 'BODY'\n ) {\n return false\n }\n\n for (const evt of ['change', 'input', 'blur']) {\n const htmlElement = activeEl as HTMLElement\n if (`on${evt}` in htmlElement) {\n const listener = () => {\n useWorkflowStore().activeWorkflow?.changeTracker?.checkState?.()\n htmlElement.removeEventListener(evt, listener)\n }\n htmlElement.addEventListener(evt, listener)\n return true\n }\n }\n return false\n }\n\n static graphEqual(a: ComfyWorkflowJSON, b: ComfyWorkflowJSON) {\n if (a === b) return true\n\n if (typeof a == 'object' && a && typeof b == 'object' && b) {\n // Compare nodes ignoring order\n if (\n !_.isEqualWith(a.nodes, b.nodes, (arrA, arrB) => {\n if (Array.isArray(arrA) && Array.isArray(arrB)) {\n return _.isEqual(new Set(arrA), new Set(arrB))\n }\n })\n ) {\n return false\n }\n\n // Compare extra properties ignoring ds\n if (\n !_.isEqual(_.omit(a.extra ?? {}, ['ds']), _.omit(b.extra ?? {}, ['ds']))\n )\n return false\n\n // Compare other properties normally\n for (const key of ['links', 'reroutes', 'groups']) {\n if (!_.isEqual(a[key], b[key])) {\n return false\n }\n }\n\n return true\n }\n\n return false\n }\n\n private static graphDiff(a: ComfyWorkflowJSON, b: ComfyWorkflowJSON) {\n function sortGraphNodes(graph: ComfyWorkflowJSON) {\n return {\n links: graph.links,\n groups: graph.groups,\n nodes: graph.nodes.sort((a, b) => {\n if (typeof a.id === 'number' && typeof b.id === 'number') {\n return a.id - b.id\n }\n return 0\n })\n }\n }\n return jsondiffpatch.diff(sortGraphNodes(a), sortGraphNodes(b))\n }\n}\n","import { defineStore } from 'pinia'\nimport { computed, markRaw, ref } from 'vue'\nimport { api } from '@/scripts/api'\nimport { UserFile } from './userFileStore'\nimport { ChangeTracker } from '@/scripts/changeTracker'\nimport { ComfyWorkflowJSON } from '@/types/comfyWorkflow'\nimport { getPathDetails } from '@/utils/formatUtil'\nimport { defaultGraphJSON } from '@/scripts/defaultGraph'\nimport { syncEntities } from '@/utils/syncUtil'\n\nexport class ComfyWorkflow extends UserFile {\n static readonly basePath = 'workflows/'\n\n /**\n * The change tracker for the workflow. Non-reactive raw object.\n */\n changeTracker: ChangeTracker | null = null\n /**\n * Whether the workflow has been modified comparing to the initial state.\n */\n private _isModified: boolean = false\n\n /**\n * @param options The path, modified, and size of the workflow.\n * Note: path is the full path, including the 'workflows/' prefix.\n */\n constructor(options: { path: string; modified: number; size: number }) {\n super(options.path, options.modified, options.size)\n }\n\n get key() {\n return this.path.substring(ComfyWorkflow.basePath.length)\n }\n\n get activeState(): ComfyWorkflowJSON | null {\n return this.changeTracker?.activeState ?? null\n }\n\n get initialState(): ComfyWorkflowJSON | null {\n return this.changeTracker?.initialState ?? null\n }\n\n get isLoaded(): boolean {\n return this.changeTracker !== null\n }\n\n get isModified(): boolean {\n return this._isModified\n }\n\n set isModified(value: boolean) {\n this._isModified = value\n }\n\n /**\n * Load the workflow content from remote storage. Directly returns the loaded\n * workflow if the content is already loaded.\n *\n * @param force Whether to force loading the content even if it is already loaded.\n * @returns this\n */\n async load({\n force = false\n }: { force?: boolean } = {}): Promise {\n await super.load({ force })\n if (!force && this.isLoaded) return this as LoadedComfyWorkflow\n\n if (!this.originalContent) {\n throw new Error('[ASSERT] Workflow content should be loaded')\n }\n\n // Note: originalContent is populated by super.load()\n console.debug('load and start tracking of workflow', this.path)\n this.changeTracker = markRaw(\n new ChangeTracker(\n this,\n /* initialState= */ JSON.parse(this.originalContent)\n )\n )\n return this as LoadedComfyWorkflow\n }\n\n unload(): void {\n console.debug('unload workflow', this.path)\n this.changeTracker = null\n super.unload()\n }\n\n async save() {\n this.content = JSON.stringify(this.activeState)\n // Force save to ensure the content is updated in remote storage incase\n // the isModified state is screwed by changeTracker.\n const ret = await super.save({ force: true })\n this.changeTracker?.reset()\n this.isModified = false\n return ret\n }\n\n /**\n * Save the workflow as a new file.\n * @param path The path to save the workflow to. Note: with 'workflows/' prefix.\n * @returns this\n */\n async saveAs(path: string) {\n this.content = JSON.stringify(this.activeState)\n return await super.saveAs(path)\n }\n}\n\nexport interface LoadedComfyWorkflow extends ComfyWorkflow {\n isLoaded: true\n originalContent: string\n content: string\n changeTracker: ChangeTracker\n initialState: ComfyWorkflowJSON\n activeState: ComfyWorkflowJSON\n}\n\n/**\n * Exposed store interface for the workflow store.\n * Explicitly typed to avoid trigger following error:\n * error TS7056: The inferred type of this node exceeds the maximum length the\n * compiler will serialize. An explicit type annotation is needed.\n */\nexport interface WorkflowStore {\n activeWorkflow: LoadedComfyWorkflow | null\n isActive: (workflow: ComfyWorkflow) => boolean\n openWorkflows: LoadedComfyWorkflow[]\n openedWorkflowIndexShift: (shift: number) => LoadedComfyWorkflow | null\n openWorkflow: (workflow: ComfyWorkflow) => Promise\n isOpen: (workflow: ComfyWorkflow) => boolean\n isBusy: boolean\n closeWorkflow: (workflow: ComfyWorkflow) => Promise\n createTemporary: (\n path?: string,\n workflowData?: ComfyWorkflowJSON\n ) => ComfyWorkflow\n renameWorkflow: (workflow: ComfyWorkflow, newPath: string) => Promise\n deleteWorkflow: (workflow: ComfyWorkflow) => Promise\n saveWorkflow: (workflow: ComfyWorkflow) => Promise\n\n workflows: ComfyWorkflow[]\n bookmarkedWorkflows: ComfyWorkflow[]\n persistedWorkflows: ComfyWorkflow[]\n modifiedWorkflows: ComfyWorkflow[]\n getWorkflowByPath: (path: string) => ComfyWorkflow | null\n syncWorkflows: (dir?: string) => Promise\n}\n\nexport const useWorkflowStore = defineStore('workflow', () => {\n /**\n * Detach the workflow from the store. lightweight helper function.\n * @param workflow The workflow to detach.\n * @returns The index of the workflow in the openWorkflowPaths array, or -1 if the workflow was not open.\n */\n const detachWorkflow = (workflow: ComfyWorkflow) => {\n delete workflowLookup.value[workflow.path]\n const index = openWorkflowPaths.value.indexOf(workflow.path)\n if (index !== -1) {\n openWorkflowPaths.value = openWorkflowPaths.value.filter(\n (path) => path !== workflow.path\n )\n }\n return index\n }\n\n /**\n * Attach the workflow to the store. lightweight helper function.\n * @param workflow The workflow to attach.\n * @param openIndex The index to open the workflow at.\n */\n const attachWorkflow = (workflow: ComfyWorkflow, openIndex: number = -1) => {\n workflowLookup.value[workflow.path] = workflow\n\n if (openIndex !== -1) {\n openWorkflowPaths.value.splice(openIndex, 0, workflow.path)\n }\n }\n\n /**\n * The active workflow currently being edited.\n */\n const activeWorkflow = ref(null)\n const isActive = (workflow: ComfyWorkflow) =>\n activeWorkflow.value?.path === workflow.path\n /**\n * All workflows.\n */\n const workflowLookup = ref>({})\n const workflows = computed(() =>\n Object.values(workflowLookup.value)\n )\n const getWorkflowByPath = (path: string): ComfyWorkflow | null =>\n workflowLookup.value[path] ?? null\n\n /**\n * The paths of the open workflows. It is setup as a ref to allow user\n * to reorder the workflows opened.\n */\n const openWorkflowPaths = ref([])\n const openWorkflowPathSet = computed(() => new Set(openWorkflowPaths.value))\n const openWorkflows = computed(() =>\n openWorkflowPaths.value.map((path) => workflowLookup.value[path])\n )\n const isOpen = (workflow: ComfyWorkflow) =>\n openWorkflowPathSet.value.has(workflow.path)\n\n /**\n * Set the workflow as the active workflow.\n * @param workflow The workflow to open.\n */\n const openWorkflow = async (\n workflow: ComfyWorkflow\n ): Promise => {\n if (isActive(workflow)) return workflow as LoadedComfyWorkflow\n\n if (!openWorkflowPaths.value.includes(workflow.path)) {\n openWorkflowPaths.value.push(workflow.path)\n }\n const loadedWorkflow = await workflow.load()\n activeWorkflow.value = loadedWorkflow\n console.debug('[workflowStore] open workflow', workflow.path)\n return loadedWorkflow\n }\n\n const getUnconflictedPath = (basePath: string): string => {\n const { directory, filename, suffix } = getPathDetails(basePath)\n let counter = 2\n let newPath = basePath\n while (workflowLookup.value[newPath]) {\n newPath = `${directory}/${filename} (${counter}).${suffix}`\n counter++\n }\n return newPath\n }\n\n const createTemporary = (path?: string, workflowData?: ComfyWorkflowJSON) => {\n const fullPath = getUnconflictedPath(\n ComfyWorkflow.basePath + (path ?? 'Unsaved Workflow.json')\n )\n const workflow = new ComfyWorkflow({\n path: fullPath,\n modified: Date.now(),\n size: -1\n })\n\n workflow.originalContent = workflow.content = workflowData\n ? JSON.stringify(workflowData)\n : defaultGraphJSON\n\n workflowLookup.value[workflow.path] = workflow\n return workflow\n }\n\n const closeWorkflow = async (workflow: ComfyWorkflow) => {\n openWorkflowPaths.value = openWorkflowPaths.value.filter(\n (path) => path !== workflow.path\n )\n if (workflow.isTemporary) {\n delete workflowLookup.value[workflow.path]\n } else {\n workflow.unload()\n }\n console.debug('[workflowStore] close workflow', workflow.path)\n }\n\n /**\n * Get the workflow at the given index shift from the active workflow.\n * @param shift The shift to the next workflow. Positive for next, negative for previous.\n * @returns The next workflow or null if the shift is out of bounds.\n */\n const openedWorkflowIndexShift = (shift: number): ComfyWorkflow | null => {\n const index = openWorkflowPaths.value.indexOf(\n activeWorkflow.value?.path ?? ''\n )\n\n if (index !== -1) {\n const length = openWorkflows.value.length\n const nextIndex = (index + shift + length) % length\n const nextWorkflow = openWorkflows.value[nextIndex]\n return nextWorkflow ?? null\n }\n return null\n }\n\n const persistedWorkflows = computed(() =>\n Array.from(workflows.value).filter((workflow) => workflow.isPersisted)\n )\n const syncWorkflows = async (dir: string = '') => {\n await syncEntities(\n dir ? 'workflows/' + dir : 'workflows',\n workflowLookup.value,\n (file) =>\n new ComfyWorkflow({\n path: file.path,\n modified: file.modified,\n size: file.size\n }),\n (existingWorkflow, file) => {\n existingWorkflow.lastModified = file.modified\n existingWorkflow.size = file.size\n existingWorkflow.unload()\n },\n /* exclude */ (workflow) => workflow.isTemporary\n )\n }\n\n const bookmarkStore = useWorkflowBookmarkStore()\n const bookmarkedWorkflows = computed(() =>\n workflows.value.filter((workflow) =>\n bookmarkStore.isBookmarked(workflow.path)\n )\n )\n const modifiedWorkflows = computed(() =>\n workflows.value.filter((workflow) => workflow.isModified)\n )\n\n /** A filesystem operation is currently in progress (e.g. save, rename, delete) */\n const isBusy = ref(false)\n\n const renameWorkflow = async (workflow: ComfyWorkflow, newPath: string) => {\n isBusy.value = true\n try {\n // Capture all needed values upfront\n const oldPath = workflow.path\n const wasBookmarked = bookmarkStore.isBookmarked(oldPath)\n\n const openIndex = detachWorkflow(workflow)\n // Perform the actual rename operation first\n try {\n await workflow.rename(newPath)\n } finally {\n attachWorkflow(workflow, openIndex)\n }\n\n // Update bookmarks\n if (wasBookmarked) {\n bookmarkStore.setBookmarked(oldPath, false)\n bookmarkStore.setBookmarked(newPath, true)\n }\n } finally {\n isBusy.value = false\n }\n }\n\n const deleteWorkflow = async (workflow: ComfyWorkflow) => {\n isBusy.value = true\n try {\n await workflow.delete()\n if (bookmarkStore.isBookmarked(workflow.path)) {\n bookmarkStore.setBookmarked(workflow.path, false)\n }\n delete workflowLookup.value[workflow.path]\n } finally {\n isBusy.value = false\n }\n }\n\n /**\n * Save a workflow.\n * @param workflow The workflow to save.\n */\n const saveWorkflow = async (workflow: ComfyWorkflow) => {\n isBusy.value = true\n try {\n // Detach the workflow and re-attach to force refresh the tree objects.\n const openIndex = detachWorkflow(workflow)\n try {\n await workflow.save()\n } finally {\n attachWorkflow(workflow, openIndex)\n }\n } finally {\n isBusy.value = false\n }\n }\n\n return {\n activeWorkflow,\n isActive,\n openWorkflows,\n openedWorkflowIndexShift,\n openWorkflow,\n isOpen,\n isBusy,\n closeWorkflow,\n createTemporary,\n renameWorkflow,\n deleteWorkflow,\n saveWorkflow,\n\n workflows,\n bookmarkedWorkflows,\n persistedWorkflows,\n modifiedWorkflows,\n getWorkflowByPath,\n syncWorkflows\n }\n}) as unknown as () => WorkflowStore\n\nexport const useWorkflowBookmarkStore = defineStore('workflowBookmark', () => {\n const bookmarks = ref>(new Set())\n\n const isBookmarked = (path: string) => bookmarks.value.has(path)\n\n const loadBookmarks = async () => {\n const resp = await api.getUserData('workflows/.index.json')\n if (resp.status === 200) {\n const info = await resp.json()\n bookmarks.value = new Set(info?.favorites ?? [])\n }\n }\n\n const saveBookmarks = async () => {\n await api.storeUserData('workflows/.index.json', {\n favorites: Array.from(bookmarks.value)\n })\n }\n\n const setBookmarked = (path: string, value: boolean) => {\n if (bookmarks.value.has(path) === value) return\n if (value) {\n bookmarks.value.add(path)\n } else {\n bookmarks.value.delete(path)\n }\n saveBookmarks()\n }\n\n const toggleBookmarked = (path: string) => {\n setBookmarked(path, !bookmarks.value.has(path))\n }\n\n return {\n isBookmarked,\n loadBookmarks,\n saveBookmarks,\n setBookmarked,\n toggleBookmarked\n }\n})\n","import { downloadBlob } from '@/scripts/utils'\nimport { useSettingStore } from '@/stores/settingStore'\nimport { useWorkflowStore, ComfyWorkflow } from '@/stores/workflowStore'\nimport { showConfirmationDialog, showPromptDialog } from './dialogService'\nimport { app } from '@/scripts/app'\nimport { useWorkspaceStore } from '@/stores/workspaceStore'\nimport { LGraphCanvas } from '@comfyorg/litegraph'\nimport { toRaw } from 'vue'\nimport { ComfyWorkflowJSON } from '@/types/comfyWorkflow'\nimport { blankGraph, defaultGraph } from '@/scripts/defaultGraph'\nimport { appendJsonExt } from '@/utils/formatUtil'\nimport { t } from '@/i18n'\nimport { useToastStore } from '@/stores/toastStore'\n\nasync function getFilename(defaultName: string): Promise {\n if (useSettingStore().get('Comfy.PromptFilename')) {\n let filename = await showPromptDialog({\n title: t('workflowService.exportWorkflow'),\n message: t('workflowService.enterFilename') + ':',\n defaultValue: defaultName\n })\n if (!filename) return null\n if (!filename.toLowerCase().endsWith('.json')) {\n filename += '.json'\n }\n return filename\n }\n return defaultName\n}\n\n// TODO(huchenlei): Auto Error Handling for all methods.\nexport const workflowService = {\n /**\n * Export the current workflow as a JSON file\n * @param filename The filename to save the workflow as\n * @param promptProperty The property of the prompt to export\n */\n async exportWorkflow(\n filename: string,\n promptProperty: 'workflow' | 'output'\n ): Promise {\n const workflow = useWorkflowStore().activeWorkflow\n if (workflow?.path) {\n filename = workflow.filename\n }\n const p = await app.graphToPrompt()\n const json = JSON.stringify(p[promptProperty], null, 2)\n const blob = new Blob([json], { type: 'application/json' })\n const file = await getFilename(filename)\n if (!file) return\n downloadBlob(file, blob)\n },\n /**\n * Save a workflow as a new file\n * @param workflow The workflow to save\n */\n async saveWorkflowAs(workflow: ComfyWorkflow) {\n const newFilename = await showPromptDialog({\n title: t('workflowService.saveWorkflow'),\n message: t('workflowService.enterFilename') + ':',\n defaultValue: workflow.filename\n })\n if (!newFilename) return\n\n const newPath = workflow.directory + '/' + appendJsonExt(newFilename)\n const newKey = newPath.substring(ComfyWorkflow.basePath.length)\n const workflowStore = useWorkflowStore()\n const existingWorkflow = workflowStore.getWorkflowByPath(newPath)\n\n if (existingWorkflow && !existingWorkflow.isTemporary) {\n const res = await showConfirmationDialog({\n title: t('sideToolbar.workflowTab.confirmOverwriteTitle'),\n type: 'overwrite',\n message: t('sideToolbar.workflowTab.confirmOverwrite'),\n itemList: [newPath]\n })\n\n if (res !== true) return\n\n if (existingWorkflow.path === workflow.path) {\n await this.saveWorkflow(workflow)\n return\n }\n const deleted = await this.deleteWorkflow(existingWorkflow, true)\n if (!deleted) return\n }\n\n if (workflow.isTemporary) {\n await this.renameWorkflow(workflow, newPath)\n await workflowStore.saveWorkflow(workflow)\n } else {\n const tempWorkflow = workflowStore.createTemporary(\n newKey,\n workflow.activeState as ComfyWorkflowJSON\n )\n await this.openWorkflow(tempWorkflow)\n await workflowStore.saveWorkflow(tempWorkflow)\n }\n },\n\n /**\n * Save a workflow\n * @param workflow The workflow to save\n */\n async saveWorkflow(workflow: ComfyWorkflow) {\n if (workflow.isTemporary) {\n await this.saveWorkflowAs(workflow)\n } else {\n await useWorkflowStore().saveWorkflow(workflow)\n }\n },\n\n /**\n * Load the default workflow\n */\n async loadDefaultWorkflow() {\n await app.loadGraphData(defaultGraph)\n },\n\n /**\n * Load a blank workflow\n */\n async loadBlankWorkflow() {\n await app.loadGraphData(blankGraph)\n },\n\n /**\n * Reload the current workflow\n * This is used to refresh the node definitions update, e.g. when the locale changes.\n */\n async reloadCurrentWorkflow() {\n const workflow = useWorkflowStore().activeWorkflow\n if (workflow) {\n await this.openWorkflow(workflow, { force: true })\n }\n },\n\n /**\n * Open a workflow in the current workspace\n * @param workflow The workflow to open\n * @param options The options for opening the workflow\n */\n async openWorkflow(\n workflow: ComfyWorkflow,\n options: { force: boolean } = { force: false }\n ) {\n if (useWorkflowStore().isActive(workflow) && !options.force) return\n\n const loadFromRemote = !workflow.isLoaded\n if (loadFromRemote) {\n await workflow.load()\n }\n\n await app.loadGraphData(\n toRaw(workflow.activeState) as ComfyWorkflowJSON,\n /* clean=*/ true,\n /* restore_view=*/ true,\n workflow,\n {\n showMissingModelsDialog: loadFromRemote,\n showMissingNodesDialog: loadFromRemote\n }\n )\n },\n\n /**\n * Close a workflow with confirmation if there are unsaved changes\n * @param workflow The workflow to close\n * @returns true if the workflow was closed, false if the user cancelled\n */\n async closeWorkflow(\n workflow: ComfyWorkflow,\n options: { warnIfUnsaved: boolean } = { warnIfUnsaved: true }\n ): Promise {\n if (!workflow.isLoaded) {\n return true\n }\n\n if (workflow.isModified && options.warnIfUnsaved) {\n const confirmed = await showConfirmationDialog({\n title: t('sideToolbar.workflowTab.dirtyCloseTitle'),\n type: 'dirtyClose',\n message: t('sideToolbar.workflowTab.dirtyClose'),\n itemList: [workflow.path]\n })\n // Cancel\n if (confirmed === null) return false\n\n if (confirmed === true) {\n await this.saveWorkflow(workflow)\n }\n }\n\n const workflowStore = useWorkflowStore()\n // If this is the last workflow, create a new default temporary workflow\n if (workflowStore.openWorkflows.length === 1) {\n await this.loadDefaultWorkflow()\n }\n // If this is the active workflow, load the next workflow\n if (workflowStore.isActive(workflow)) {\n await this.loadNextOpenedWorkflow()\n }\n\n await workflowStore.closeWorkflow(workflow)\n return true\n },\n\n async renameWorkflow(workflow: ComfyWorkflow, newPath: string) {\n await useWorkflowStore().renameWorkflow(workflow, newPath)\n },\n\n /**\n * Delete a workflow\n * @param workflow The workflow to delete\n * @returns `true` if the workflow was deleted, `false` if the user cancelled\n */\n async deleteWorkflow(\n workflow: ComfyWorkflow,\n silent = false\n ): Promise {\n const bypassConfirm = !useSettingStore().get('Comfy.Workflow.ConfirmDelete')\n let confirmed: boolean | null = bypassConfirm || silent\n\n if (!confirmed) {\n confirmed = await showConfirmationDialog({\n title: t('sideToolbar.workflowTab.confirmDeleteTitle'),\n type: 'delete',\n message: t('sideToolbar.workflowTab.confirmDelete'),\n itemList: [workflow.path]\n })\n if (!confirmed) return false\n }\n\n const workflowStore = useWorkflowStore()\n if (workflowStore.isOpen(workflow)) {\n const closed = await this.closeWorkflow(workflow, {\n warnIfUnsaved: !confirmed\n })\n if (!closed) return false\n }\n await workflowStore.deleteWorkflow(workflow)\n if (!silent) {\n useToastStore().add({\n severity: 'info',\n summary: t('sideToolbar.workflowTab.deleted'),\n life: 1000\n })\n }\n return true\n },\n\n /**\n * This method is called before loading a new graph.\n * There are 3 major functions that loads a new graph to the graph editor:\n * 1. loadGraphData\n * 2. loadApiJson\n * 3. importA1111\n *\n * This function is used to save the current workflow states before loading\n * a new graph.\n */\n beforeLoadNewGraph() {\n // Use workspaceStore here as it is patched in jest tests.\n const workflowStore = useWorkspaceStore().workflow\n const activeWorkflow = workflowStore.activeWorkflow\n if (activeWorkflow) {\n activeWorkflow.changeTracker.store()\n }\n },\n\n /**\n * Set the active workflow after the new graph is loaded.\n *\n * The call relationship is\n * workflowService.openWorkflow -> app.loadGraphData -> workflowService.afterLoadNewGraph\n * app.loadApiJson -> workflowService.afterLoadNewGraph\n * app.importA1111 -> workflowService.afterLoadNewGraph\n *\n * @param value The value to set as the active workflow.\n * @param workflowData The initial workflow data loaded to the graph editor.\n */\n async afterLoadNewGraph(\n value: string | ComfyWorkflow | null,\n workflowData: ComfyWorkflowJSON\n ) {\n // Use workspaceStore here as it is patched in jest tests.\n const workflowStore = useWorkspaceStore().workflow\n if (typeof value === 'string') {\n const workflow = workflowStore.getWorkflowByPath(\n ComfyWorkflow.basePath + appendJsonExt(value)\n )\n if (workflow?.isPersisted) {\n const loadedWorkflow = await workflowStore.openWorkflow(workflow)\n loadedWorkflow.changeTracker.restore()\n loadedWorkflow.changeTracker.reset(workflowData)\n return\n }\n }\n\n if (value === null || typeof value === 'string') {\n const path = value as string | null\n const tempWorkflow = workflowStore.createTemporary(\n path ? appendJsonExt(path) : undefined,\n workflowData\n )\n await workflowStore.openWorkflow(tempWorkflow)\n return\n }\n\n // value is a ComfyWorkflow.\n const loadedWorkflow = await workflowStore.openWorkflow(value)\n loadedWorkflow.changeTracker.reset(workflowData)\n loadedWorkflow.changeTracker.restore()\n },\n\n /**\n * Insert the given workflow into the current graph editor.\n */\n async insertWorkflow(workflow: ComfyWorkflow) {\n const loadedWorkflow = await workflow.load()\n const data = loadedWorkflow.initialState\n const old = localStorage.getItem('litegrapheditor_clipboard')\n // @ts-expect-error: zod issue. Should be fixed after enable ts-strict globally\n const graph = new LGraph(data)\n const canvasElement = document.createElement('canvas')\n const canvas = new LGraphCanvas(canvasElement, graph, {\n skip_events: true,\n skip_render: true\n })\n canvas.selectNodes()\n canvas.copyToClipboard()\n app.canvas.pasteFromClipboard()\n if (old !== null) {\n localStorage.setItem('litegrapheditor_clipboard', old)\n }\n },\n\n async loadNextOpenedWorkflow() {\n const nextWorkflow = useWorkflowStore().openedWorkflowIndexShift(1)\n if (nextWorkflow) {\n await this.openWorkflow(nextWorkflow)\n }\n },\n\n async loadPreviousOpenedWorkflow() {\n const previousWorkflow = useWorkflowStore().openedWorkflowIndexShift(-1)\n if (previousWorkflow) {\n await this.openWorkflow(previousWorkflow)\n }\n },\n\n /**\n * Takes an existing workflow and duplicates it with a new name\n */\n async duplicateWorkflow(workflow: ComfyWorkflow) {\n const state = JSON.parse(JSON.stringify(workflow.activeState))\n await app.loadGraphData(state, true, true, workflow.filename)\n }\n}\n","// @ts-strict-ignore\nimport type { LGraph, LGraphCanvas, LGraphNode } from '@comfyorg/litegraph'\nimport { LiteGraph } from '@comfyorg/litegraph'\n\n/**\n * Serialises an array of nodes using a modified version of the old Litegraph copy (& paste) function\n * @param nodes All nodes to be serialised\n * @param graph The graph we are working in\n * @returns A serialised string of all nodes, and their connections\n * @deprecated Format not in use anywhere else.\n */\nexport function serialise(nodes: LGraphNode[], graph: LGraph): string {\n const serialisable = {\n nodes: [],\n links: []\n }\n let index = 0\n const cloneable: LGraphNode[] = []\n\n for (const node of nodes) {\n if (node.clonable === false) continue\n\n node._relative_id = index++\n cloneable.push(node)\n }\n\n // Clone the node\n for (const node of cloneable) {\n const cloned = node.clone()\n if (!cloned) {\n console.warn('node type not found: ' + node.type)\n continue\n }\n\n serialisable.nodes.push(cloned.serialize())\n if (!node.inputs?.length) continue\n\n // For inputs only, gather link details of every connection\n for (const input of node.inputs) {\n if (!input || input.link == null) continue\n\n const link = graph.links.get(input.link)\n if (!link) continue\n\n const outNode = graph.getNodeById(link.origin_id)\n if (!outNode) continue\n\n // Special format for old Litegraph copy & paste only\n serialisable.links.push([\n outNode._relative_id,\n link.origin_slot,\n node._relative_id,\n link.target_slot,\n outNode.id\n ])\n }\n }\n\n return JSON.stringify(serialisable)\n}\n\n/**\n * Deserialises nodes and links using a modified version of the old Litegraph (copy &) paste function\n * @param data The serialised nodes and links to create\n * @param canvas The canvas to create the serialised items in\n */\nexport function deserialiseAndCreate(data: string, canvas: LGraphCanvas): void {\n if (!data) return\n\n const { graph, graph_mouse } = canvas\n canvas.emitBeforeChange()\n try {\n graph.beforeChange()\n\n const deserialised = JSON.parse(data)\n\n // Find the top left point of the boundary of all pasted nodes\n const topLeft = [Infinity, Infinity]\n for (const { pos } of deserialised.nodes) {\n if (topLeft[0] > pos[0]) topLeft[0] = pos[0]\n if (topLeft[1] > pos[1]) topLeft[1] = pos[1]\n }\n\n // Silent default instead of throw\n if (!Number.isFinite(topLeft[0]) || !Number.isFinite(topLeft[1])) {\n topLeft[0] = graph_mouse[0]\n topLeft[1] = graph_mouse[1]\n }\n\n // Create nodes\n const nodes: LGraphNode[] = []\n for (const info of deserialised.nodes) {\n const node = LiteGraph.createNode(info.type)\n if (!node) continue\n\n node.configure(info)\n\n // Paste to the bottom right of pointer\n node.pos[0] += graph_mouse[0] - topLeft[0]\n node.pos[1] += graph_mouse[1] - topLeft[1]\n\n graph.add(node, true)\n nodes.push(node)\n }\n\n // Create links\n for (const info of deserialised.links) {\n const relativeId = info[0]\n const outNode = relativeId != null ? nodes[relativeId] : undefined\n\n const inNode = nodes[info[2]]\n if (outNode && inNode) outNode.connect(info[1], inNode, info[3])\n else console.warn('Warning, nodes missing on pasting')\n }\n\n canvas.selectNodes(nodes)\n\n graph.afterChange()\n } finally {\n canvas.emitAfterChange()\n }\n}\n","// @ts-strict-ignore\nimport {\n type ComfyWidgetConstructor,\n ComfyWidgets,\n initWidgets\n} from './widgets'\nimport { ComfyUI, $el } from './ui'\nimport { api, type ComfyApi } from './api'\nimport { defaultGraph } from './defaultGraph'\nimport {\n getPngMetadata,\n getWebpMetadata,\n getFlacMetadata,\n importA1111,\n getLatentMetadata\n} from './pnginfo'\nimport { createImageHost, calculateImageGrid } from './ui/imagePreview'\nimport type { ComfyExtension, MissingNodeType } from '@/types/comfy'\nimport {\n type ComfyWorkflowJSON,\n type NodeId,\n validateComfyWorkflow\n} from '@/types/comfyWorkflow'\nimport type { ComfyNodeDef } from '@/types/apiTypes'\nimport { adjustColor, ColorAdjustOptions } from '@/utils/colorUtil'\nimport { ComfyAppMenu } from './ui/menu/index'\nimport { getStorageValue } from './utils'\nimport { ComfyWorkflow } from '@/stores/workflowStore'\nimport {\n LGraphCanvas,\n LGraph,\n LGraphNode,\n LiteGraph,\n LGraphEventMode\n} from '@comfyorg/litegraph'\nimport { ExtensionManager } from '@/types/extensionTypes'\nimport {\n ComfyNodeDefImpl,\n SYSTEM_NODE_DEFS,\n useNodeDefStore\n} from '@/stores/nodeDefStore'\nimport { INodeInputSlot, Vector2 } from '@comfyorg/litegraph'\nimport _ from 'lodash'\nimport {\n showExecutionErrorDialog,\n showLoadWorkflowWarning,\n showMissingModelsWarning\n} from '@/services/dialogService'\nimport { useSettingStore } from '@/stores/settingStore'\nimport { useToastStore } from '@/stores/toastStore'\nimport { useModelStore } from '@/stores/modelStore'\nimport type { ToastMessageOptions } from 'primevue/toast'\nimport { useWorkspaceStore } from '@/stores/workspaceStore'\nimport { useExecutionStore } from '@/stores/executionStore'\nimport { IWidget } from '@comfyorg/litegraph'\nimport { useExtensionStore } from '@/stores/extensionStore'\nimport { KeyComboImpl, useKeybindingStore } from '@/stores/keybindingStore'\nimport { useCommandStore } from '@/stores/commandStore'\nimport { shallowReactive } from 'vue'\nimport { type IBaseWidget } from '@comfyorg/litegraph/dist/types/widgets'\nimport { workflowService } from '@/services/workflowService'\nimport { useWidgetStore } from '@/stores/widgetStore'\nimport { deserialiseAndCreate } from '@/extensions/core/vintageClipboard'\nimport { st } from '@/i18n'\nimport { normalizeI18nKey } from '@/utils/formatUtil'\nimport { ISerialisedGraph } from '@comfyorg/litegraph'\n\nexport const ANIM_PREVIEW_WIDGET = '$$comfy_animation_preview'\n\nfunction sanitizeNodeName(string) {\n let entityMap = {\n '&': '',\n '<': '',\n '>': '',\n '\"': '',\n \"'\": '',\n '`': '',\n '=': ''\n }\n return String(string).replace(/[&<>\"'`=]/g, function fromEntityMap(s) {\n return entityMap[s]\n })\n}\n\ntype Clipspace = {\n widgets?: { type?: string; name?: string; value?: any }[] | null\n imgs?: HTMLImageElement[] | null\n original_imgs?: HTMLImageElement[] | null\n images?: any[] | null\n selectedIndex: number\n img_paste_mode: string\n}\n\n/**\n * @typedef {import(\"types/comfy\").ComfyExtension} ComfyExtension\n */\n\nexport class ComfyApp {\n /**\n * List of entries to queue\n * @type {{number: number, batchCount: number}[]}\n */\n #queueItems = []\n /**\n * If the queue is currently being processed\n * @type {boolean}\n */\n #processingQueue = false\n\n /**\n * Content Clipboard\n * @type {serialized node object}\n */\n static clipspace: Clipspace | null = null\n static clipspace_invalidate_handler: (() => void) | null = null\n static open_maskeditor = null\n static clipspace_return_node = null\n\n vueAppReady: boolean\n api: ComfyApi\n ui: ComfyUI\n extensions: ComfyExtension[]\n extensionManager: ExtensionManager\n _nodeOutputs: Record\n nodePreviewImages: Record\n graph: LGraph\n canvas: LGraphCanvas\n dragOverNode: LGraphNode | null\n canvasEl: HTMLCanvasElement\n // x, y, scale\n zoom_drag_start: [number, number, number] | null\n lastNodeErrors: any[] | null\n /** @type {ExecutionErrorWsMessage} */\n lastExecutionError: { node_id?: NodeId } | null\n /** @type {ProgressWsMessage} */\n progress: { value?: number; max?: number } | null\n configuringGraph: boolean\n ctx: CanvasRenderingContext2D\n bodyTop: HTMLElement\n bodyLeft: HTMLElement\n bodyRight: HTMLElement\n bodyBottom: HTMLElement\n canvasContainer: HTMLElement\n menu: ComfyAppMenu\n bypassBgColor: string\n // Set by Comfy.Clipspace extension\n openClipspace: () => void = () => {}\n\n /**\n * @deprecated Use useExecutionStore().executingNodeId instead\n */\n get runningNodeId(): string | null {\n return useExecutionStore().executingNodeId\n }\n\n /**\n * @deprecated Use useWorkspaceStore().shiftDown instead\n */\n get shiftDown(): boolean {\n return useWorkspaceStore().shiftDown\n }\n\n /**\n * @deprecated Use useWidgetStore().widgets instead\n */\n get widgets(): Record {\n if (this.vueAppReady) {\n return useWidgetStore().widgets\n }\n return ComfyWidgets\n }\n\n /**\n * @deprecated storageLocation is always 'server' since\n * https://github.com/comfyanonymous/ComfyUI/commit/53c8a99e6c00b5e20425100f6680cd9ea2652218\n */\n get storageLocation() {\n return 'server'\n }\n\n /**\n * @deprecated storage migration is no longer needed.\n */\n get isNewUserSession() {\n return false\n }\n\n constructor() {\n this.vueAppReady = false\n this.ui = new ComfyUI(this)\n this.api = api\n this.bodyTop = $el('div.comfyui-body-top', { parent: document.body })\n this.bodyLeft = $el('div.comfyui-body-left', { parent: document.body })\n this.bodyRight = $el('div.comfyui-body-right', { parent: document.body })\n this.bodyBottom = $el('div.comfyui-body-bottom', { parent: document.body })\n this.canvasContainer = $el('div.graph-canvas-container', {\n parent: document.body\n })\n this.menu = new ComfyAppMenu(this)\n this.bypassBgColor = '#FF00FF'\n\n /**\n * List of extensions that are registered with the app\n * @type {ComfyExtension[]}\n */\n this.extensions = []\n\n /**\n * Stores the execution output data for each node\n * @type {Record}\n */\n this.nodeOutputs = {}\n\n /**\n * Stores the preview image data for each node\n * @type {Record}\n */\n this.nodePreviewImages = {}\n }\n\n get nodeOutputs() {\n return this._nodeOutputs\n }\n\n set nodeOutputs(value) {\n this._nodeOutputs = value\n this.#invokeExtensions('onNodeOutputsUpdated', value)\n }\n\n getPreviewFormatParam() {\n let preview_format = this.ui.settings.getSettingValue('Comfy.PreviewFormat')\n if (preview_format) return `&preview=${preview_format}`\n else return ''\n }\n\n getRandParam() {\n return '&rand=' + Math.random()\n }\n\n static isImageNode(node) {\n return (\n node.imgs ||\n (node &&\n node.widgets &&\n node.widgets.findIndex((obj) => obj.name === 'image') >= 0)\n )\n }\n\n static onClipspaceEditorSave() {\n if (ComfyApp.clipspace_return_node) {\n ComfyApp.pasteFromClipspace(ComfyApp.clipspace_return_node)\n }\n }\n\n static onClipspaceEditorClosed() {\n ComfyApp.clipspace_return_node = null\n }\n\n static copyToClipspace(node) {\n var widgets = null\n if (node.widgets) {\n widgets = node.widgets.map(({ type, name, value }) => ({\n type,\n name,\n value\n }))\n }\n\n var imgs = undefined\n var orig_imgs = undefined\n if (node.imgs != undefined) {\n imgs = []\n orig_imgs = []\n\n for (let i = 0; i < node.imgs.length; i++) {\n imgs[i] = new Image()\n imgs[i].src = node.imgs[i].src\n orig_imgs[i] = imgs[i]\n }\n }\n\n var selectedIndex = 0\n if (node.imageIndex) {\n selectedIndex = node.imageIndex\n }\n\n ComfyApp.clipspace = {\n widgets: widgets,\n imgs: imgs,\n original_imgs: orig_imgs,\n images: node.images,\n selectedIndex: selectedIndex,\n img_paste_mode: 'selected' // reset to default im_paste_mode state on copy action\n }\n\n ComfyApp.clipspace_return_node = null\n\n if (ComfyApp.clipspace_invalidate_handler) {\n ComfyApp.clipspace_invalidate_handler()\n }\n }\n\n static pasteFromClipspace(node) {\n if (ComfyApp.clipspace) {\n // image paste\n if (ComfyApp.clipspace.imgs && node.imgs) {\n if (node.images && ComfyApp.clipspace.images) {\n if (ComfyApp.clipspace['img_paste_mode'] == 'selected') {\n node.images = [\n ComfyApp.clipspace.images[ComfyApp.clipspace['selectedIndex']]\n ]\n } else {\n node.images = ComfyApp.clipspace.images\n }\n\n if (app.nodeOutputs[node.id + ''])\n app.nodeOutputs[node.id + ''].images = node.images\n }\n\n if (ComfyApp.clipspace.imgs) {\n // deep-copy to cut link with clipspace\n if (ComfyApp.clipspace['img_paste_mode'] == 'selected') {\n const img = new Image()\n img.src =\n ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']].src\n node.imgs = [img]\n node.imageIndex = 0\n } else {\n const imgs = []\n for (let i = 0; i < ComfyApp.clipspace.imgs.length; i++) {\n imgs[i] = new Image()\n imgs[i].src = ComfyApp.clipspace.imgs[i].src\n node.imgs = imgs\n }\n }\n }\n }\n\n if (node.widgets) {\n if (ComfyApp.clipspace.images) {\n const clip_image =\n ComfyApp.clipspace.images[ComfyApp.clipspace['selectedIndex']]\n const index = node.widgets.findIndex((obj) => obj.name === 'image')\n if (index >= 0) {\n if (\n node.widgets[index].type != 'image' &&\n typeof node.widgets[index].value == 'string' &&\n clip_image.filename\n ) {\n node.widgets[index].value =\n (clip_image.subfolder ? clip_image.subfolder + '/' : '') +\n clip_image.filename +\n (clip_image.type ? ` [${clip_image.type}]` : '')\n } else {\n node.widgets[index].value = clip_image\n }\n }\n }\n if (ComfyApp.clipspace.widgets) {\n ComfyApp.clipspace.widgets.forEach(({ type, name, value }) => {\n const prop = Object.values(node.widgets).find(\n // @ts-expect-errorg\n (obj) => obj.type === type && obj.name === name\n )\n // @ts-expect-error\n if (prop && prop.type != 'button') {\n if (\n // @ts-expect-error\n prop.type != 'image' &&\n // @ts-expect-error\n typeof prop.value == 'string' &&\n value.filename\n ) {\n // @ts-expect-error\n prop.value =\n (value.subfolder ? value.subfolder + '/' : '') +\n value.filename +\n (value.type ? ` [${value.type}]` : '')\n } else {\n // @ts-expect-error\n prop.value = value\n // @ts-expect-error\n prop.callback(value)\n }\n }\n })\n }\n }\n\n app.graph.setDirtyCanvas(true)\n }\n }\n\n get enabledExtensions() {\n if (!this.vueAppReady) {\n return this.extensions\n }\n return useExtensionStore().enabledExtensions\n }\n\n /**\n * Invoke an extension callback\n * @param {keyof ComfyExtension} method The extension callback to execute\n * @param {any[]} args Any arguments to pass to the callback\n * @returns\n */\n #invokeExtensions(method, ...args) {\n let results = []\n for (const ext of this.enabledExtensions) {\n if (method in ext) {\n try {\n results.push(ext[method](...args, this))\n } catch (error) {\n console.error(\n `Error calling extension '${ext.name}' method '${method}'`,\n { error },\n { extension: ext },\n { args }\n )\n }\n }\n }\n return results\n }\n\n /**\n * Invoke an async extension callback\n * Each callback will be invoked concurrently\n * @param {string} method The extension callback to execute\n * @param {...any} args Any arguments to pass to the callback\n * @returns\n */\n async #invokeExtensionsAsync(method, ...args) {\n return await Promise.all(\n this.enabledExtensions.map(async (ext) => {\n if (method in ext) {\n try {\n return await ext[method](...args, this)\n } catch (error) {\n console.error(\n `Error calling extension '${ext.name}' method '${method}'`,\n { error },\n { extension: ext },\n { args }\n )\n }\n }\n })\n )\n }\n\n #addRestoreWorkflowView() {\n const serialize = LGraph.prototype.serialize\n const self = this\n LGraph.prototype.serialize = function () {\n const workflow = serialize.apply(this, arguments)\n\n // Store the drag & scale info in the serialized workflow if the setting is enabled\n if (useSettingStore().get('Comfy.EnableWorkflowViewRestore')) {\n if (!workflow.extra) {\n workflow.extra = {}\n }\n workflow.extra.ds = {\n scale: self.canvas.ds.scale,\n offset: self.canvas.ds.offset\n }\n } else if (workflow.extra?.ds) {\n // Clear any old view data\n delete workflow.extra.ds\n }\n\n return workflow\n }\n }\n\n /**\n * Adds special context menu handling for nodes\n * e.g. this adds Open Image functionality for nodes that show images\n * @param {*} node The node to add the menu handler\n */\n #addNodeContextMenuHandler(node) {\n function getCopyImageOption(img) {\n if (typeof window.ClipboardItem === 'undefined') return []\n return [\n {\n content: 'Copy Image',\n callback: async () => {\n const url = new URL(img.src)\n url.searchParams.delete('preview')\n\n const writeImage = async (blob) => {\n await navigator.clipboard.write([\n new ClipboardItem({\n [blob.type]: blob\n })\n ])\n }\n\n try {\n const data = await fetch(url)\n const blob = await data.blob()\n try {\n await writeImage(blob)\n } catch (error) {\n // Chrome seems to only support PNG on write, convert and try again\n if (blob.type !== 'image/png') {\n const canvas = $el('canvas', {\n width: img.naturalWidth,\n height: img.naturalHeight\n }) as HTMLCanvasElement\n const ctx = canvas.getContext('2d')\n let image\n if (typeof window.createImageBitmap === 'undefined') {\n image = new Image()\n const p = new Promise((resolve, reject) => {\n image.onload = resolve\n image.onerror = reject\n }).finally(() => {\n URL.revokeObjectURL(image.src)\n })\n image.src = URL.createObjectURL(blob)\n await p\n } else {\n image = await createImageBitmap(blob)\n }\n try {\n ctx.drawImage(image, 0, 0)\n canvas.toBlob(writeImage, 'image/png')\n } finally {\n if (typeof image.close === 'function') {\n image.close()\n }\n }\n\n return\n }\n throw error\n }\n } catch (error) {\n useToastStore().addAlert(\n 'Error copying image: ' + (error.message ?? error)\n )\n }\n }\n }\n ]\n }\n\n node.prototype.getExtraMenuOptions = function (_, options) {\n if (this.imgs) {\n // If this node has images then we add an open in new tab item\n let img\n if (this.imageIndex != null) {\n // An image is selected so select that\n img = this.imgs[this.imageIndex]\n } else if (this.overIndex != null) {\n // No image is selected but one is hovered\n img = this.imgs[this.overIndex]\n }\n if (img) {\n options.unshift(\n {\n content: 'Open Image',\n callback: () => {\n let url = new URL(img.src)\n url.searchParams.delete('preview')\n window.open(url, '_blank')\n }\n },\n ...getCopyImageOption(img),\n {\n content: 'Save Image',\n callback: () => {\n const a = document.createElement('a')\n let url = new URL(img.src)\n url.searchParams.delete('preview')\n a.href = url.toString()\n a.setAttribute(\n 'download',\n new URLSearchParams(url.search).get('filename')\n )\n document.body.append(a)\n a.click()\n requestAnimationFrame(() => a.remove())\n }\n }\n )\n }\n }\n\n options.push({\n content: 'Bypass',\n callback: (obj) => {\n if (this.mode === LGraphEventMode.BYPASS)\n this.mode = LGraphEventMode.ALWAYS\n else this.mode = LGraphEventMode.BYPASS\n this.graph.change()\n }\n })\n\n // prevent conflict of clipspace content\n if (!ComfyApp.clipspace_return_node) {\n options.push({\n content: 'Copy (Clipspace)',\n callback: (obj) => {\n ComfyApp.copyToClipspace(this)\n }\n })\n\n if (ComfyApp.clipspace != null) {\n options.push({\n content: 'Paste (Clipspace)',\n callback: () => {\n ComfyApp.pasteFromClipspace(this)\n }\n })\n }\n\n if (ComfyApp.isImageNode(this)) {\n options.push({\n content: 'Open in MaskEditor',\n callback: (obj) => {\n ComfyApp.copyToClipspace(this)\n ComfyApp.clipspace_return_node = this\n ComfyApp.open_maskeditor()\n }\n })\n }\n }\n }\n }\n\n #addNodeKeyHandler(node) {\n const app = this\n const origNodeOnKeyDown = node.prototype.onKeyDown\n\n node.prototype.onKeyDown = function (e) {\n if (origNodeOnKeyDown && origNodeOnKeyDown.apply(this, e) === false) {\n return false\n }\n\n if (this.flags.collapsed || !this.imgs || this.imageIndex === null) {\n return\n }\n\n let handled = false\n\n if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n if (e.key === 'ArrowLeft') {\n this.imageIndex -= 1\n } else if (e.key === 'ArrowRight') {\n this.imageIndex += 1\n }\n this.imageIndex %= this.imgs.length\n\n if (this.imageIndex < 0) {\n this.imageIndex = this.imgs.length + this.imageIndex\n }\n handled = true\n } else if (e.key === 'Escape') {\n this.imageIndex = null\n handled = true\n }\n\n if (handled === true) {\n e.preventDefault()\n e.stopImmediatePropagation()\n return false\n }\n }\n }\n\n /**\n * Adds Custom drawing logic for nodes\n * e.g. Draws images and handles thumbnail navigation on nodes that output images\n * @param {*} node The node to add the draw handler\n */\n #addDrawBackgroundHandler(node) {\n const app = this\n\n function getImageTop(node) {\n let shiftY\n if (node.imageOffset != null) {\n shiftY = node.imageOffset\n } else {\n if (node.widgets?.length) {\n const w = node.widgets[node.widgets.length - 1]\n shiftY = w.last_y\n if (w.computeSize) {\n shiftY += w.computeSize()[1] + 4\n } else if (w.computedHeight) {\n shiftY += w.computedHeight\n } else {\n shiftY += LiteGraph.NODE_WIDGET_HEIGHT + 4\n }\n } else {\n shiftY = node.computeSize()[1]\n }\n }\n return shiftY\n }\n\n node.prototype.setSizeForImage = function (force) {\n if (!force && this.animatedImages) return\n\n if (this.inputHeight || this.freeWidgetSpace > 210) {\n this.setSize(this.size)\n return\n }\n const minHeight = getImageTop(this) + 220\n if (this.size[1] < minHeight) {\n this.setSize([this.size[0], minHeight])\n }\n }\n\n function unsafeDrawBackground(ctx) {\n if (!this.flags.collapsed) {\n let imgURLs = []\n let imagesChanged = false\n\n const output = app.nodeOutputs[this.id + '']\n if (output?.images) {\n this.animatedImages = output?.animated?.find(Boolean)\n if (this.images !== output.images) {\n this.images = output.images\n imagesChanged = true\n imgURLs = imgURLs.concat(\n output.images.map((params) => {\n return api.apiURL(\n '/view?' +\n new URLSearchParams(params).toString() +\n (this.animatedImages ? '' : app.getPreviewFormatParam()) +\n app.getRandParam()\n )\n })\n )\n }\n }\n\n const preview = app.nodePreviewImages[this.id + '']\n if (this.preview !== preview) {\n this.preview = preview\n imagesChanged = true\n if (preview != null) {\n imgURLs.push(preview)\n }\n }\n\n if (imagesChanged) {\n this.imageIndex = null\n if (imgURLs.length > 0) {\n Promise.all(\n imgURLs.map((src) => {\n return new Promise((r) => {\n const img = new Image()\n img.onload = () => r(img)\n img.onerror = () => r(null)\n img.src = src\n })\n })\n ).then((imgs) => {\n if (\n (!output || this.images === output.images) &&\n (!preview || this.preview === preview)\n ) {\n this.imgs = imgs.filter(Boolean)\n this.setSizeForImage?.()\n app.graph.setDirtyCanvas(true)\n }\n })\n } else {\n this.imgs = null\n }\n }\n\n const is_all_same_aspect_ratio = (imgs) => {\n // assume: imgs.length >= 2\n let ratio = imgs[0].naturalWidth / imgs[0].naturalHeight\n\n for (let i = 1; i < imgs.length; i++) {\n let this_ratio = imgs[i].naturalWidth / imgs[i].naturalHeight\n if (ratio != this_ratio) return false\n }\n\n return true\n }\n\n if (this.imgs?.length) {\n const widgetIdx = this.widgets?.findIndex(\n (w) => w.name === ANIM_PREVIEW_WIDGET\n )\n\n if (this.animatedImages) {\n // Instead of using the canvas we'll use a IMG\n if (widgetIdx > -1) {\n // Replace content\n const widget = this.widgets[widgetIdx]\n widget.options.host.updateImages(this.imgs)\n } else {\n const host = createImageHost(this)\n this.setSizeForImage(true)\n const widget = this.addDOMWidget(\n ANIM_PREVIEW_WIDGET,\n 'img',\n host.el,\n {\n host,\n getHeight: host.getHeight,\n onDraw: host.onDraw,\n hideOnZoom: false\n }\n )\n widget.serializeValue = () => undefined\n widget.options.host.updateImages(this.imgs)\n }\n return\n }\n\n if (widgetIdx > -1) {\n this.widgets[widgetIdx].onRemove?.()\n this.widgets.splice(widgetIdx, 1)\n }\n\n const canvas = app.graph.list_of_graphcanvas[0]\n const mouse = canvas.graph_mouse\n if (!canvas.pointer_is_down && this.pointerDown) {\n if (\n mouse[0] === this.pointerDown.pos[0] &&\n mouse[1] === this.pointerDown.pos[1]\n ) {\n this.imageIndex = this.pointerDown.index\n }\n this.pointerDown = null\n }\n\n let imageIndex = this.imageIndex\n const numImages = this.imgs.length\n if (numImages === 1 && !imageIndex) {\n this.imageIndex = imageIndex = 0\n }\n\n const top = getImageTop(this)\n var shiftY = top\n\n let dw = this.size[0]\n let dh = this.size[1]\n dh -= shiftY\n\n if (imageIndex == null) {\n var cellWidth, cellHeight, shiftX, cell_padding, cols\n\n const compact_mode = is_all_same_aspect_ratio(this.imgs)\n if (!compact_mode) {\n // use rectangle cell style and border line\n cell_padding = 2\n // Prevent infinite canvas2d scale-up\n const largestDimension = this.imgs.reduce(\n (acc, current) =>\n Math.max(acc, current.naturalWidth, current.naturalHeight),\n 0\n )\n const fakeImgs = []\n fakeImgs.length = this.imgs.length\n fakeImgs[0] = {\n naturalWidth: largestDimension,\n naturalHeight: largestDimension\n }\n ;({ cellWidth, cellHeight, cols, shiftX } = calculateImageGrid(\n fakeImgs,\n dw,\n dh\n ))\n } else {\n cell_padding = 0\n ;({ cellWidth, cellHeight, cols, shiftX } = calculateImageGrid(\n this.imgs,\n dw,\n dh\n ))\n }\n\n let anyHovered = false\n this.imageRects = []\n for (let i = 0; i < numImages; i++) {\n const img = this.imgs[i]\n const row = Math.floor(i / cols)\n const col = i % cols\n const x = col * cellWidth + shiftX\n const y = row * cellHeight + shiftY\n if (!anyHovered) {\n anyHovered = LiteGraph.isInsideRectangle(\n mouse[0],\n mouse[1],\n x + this.pos[0],\n y + this.pos[1],\n cellWidth,\n cellHeight\n )\n if (anyHovered) {\n this.overIndex = i\n let value = 110\n if (canvas.pointer_is_down) {\n if (!this.pointerDown || this.pointerDown.index !== i) {\n this.pointerDown = { index: i, pos: [...mouse] }\n }\n value = 125\n }\n ctx.filter = `contrast(${value}%) brightness(${value}%)`\n canvas.canvas.style.cursor = 'pointer'\n }\n }\n this.imageRects.push([x, y, cellWidth, cellHeight])\n\n let wratio = cellWidth / img.width\n let hratio = cellHeight / img.height\n var ratio = Math.min(wratio, hratio)\n\n let imgHeight = ratio * img.height\n let imgY =\n row * cellHeight + shiftY + (cellHeight - imgHeight) / 2\n let imgWidth = ratio * img.width\n let imgX = col * cellWidth + shiftX + (cellWidth - imgWidth) / 2\n\n ctx.drawImage(\n img,\n imgX + cell_padding,\n imgY + cell_padding,\n imgWidth - cell_padding * 2,\n imgHeight - cell_padding * 2\n )\n if (!compact_mode) {\n // rectangle cell and border line style\n ctx.strokeStyle = '#8F8F8F'\n ctx.lineWidth = 1\n ctx.strokeRect(\n x + cell_padding,\n y + cell_padding,\n cellWidth - cell_padding * 2,\n cellHeight - cell_padding * 2\n )\n }\n\n ctx.filter = 'none'\n }\n\n if (!anyHovered) {\n this.pointerDown = null\n this.overIndex = null\n }\n } else {\n // Draw individual\n let w = this.imgs[imageIndex].naturalWidth\n let h = this.imgs[imageIndex].naturalHeight\n\n const scaleX = dw / w\n const scaleY = dh / h\n const scale = Math.min(scaleX, scaleY, 1)\n\n w *= scale\n h *= scale\n\n let x = (dw - w) / 2\n let y = (dh - h) / 2 + shiftY\n ctx.drawImage(this.imgs[imageIndex], x, y, w, h)\n\n const drawButton = (x, y, sz, text) => {\n const hovered = LiteGraph.isInsideRectangle(\n mouse[0],\n mouse[1],\n x + this.pos[0],\n y + this.pos[1],\n sz,\n sz\n )\n let fill = '#333'\n let textFill = '#fff'\n let isClicking = false\n if (hovered) {\n canvas.canvas.style.cursor = 'pointer'\n if (canvas.pointer_is_down) {\n fill = '#1e90ff'\n isClicking = true\n } else {\n fill = '#eee'\n textFill = '#000'\n }\n } else {\n this.pointerWasDown = null\n }\n\n ctx.fillStyle = fill\n ctx.beginPath()\n ctx.roundRect(x, y, sz, sz, [4])\n ctx.fill()\n ctx.fillStyle = textFill\n ctx.font = '12px Arial'\n ctx.textAlign = 'center'\n ctx.fillText(text, x + 15, y + 20)\n\n return isClicking\n }\n\n if (numImages > 1) {\n if (\n drawButton(\n dw - 40,\n dh + top - 40,\n 30,\n `${this.imageIndex + 1}/${numImages}`\n )\n ) {\n let i =\n this.imageIndex + 1 >= numImages ? 0 : this.imageIndex + 1\n if (!this.pointerDown || !this.pointerDown.index === i) {\n this.pointerDown = { index: i, pos: [...mouse] }\n }\n }\n\n if (drawButton(dw - 40, top + 10, 30, `x`)) {\n if (!this.pointerDown || !this.pointerDown.index === null) {\n this.pointerDown = { index: null, pos: [...mouse] }\n }\n }\n }\n }\n }\n }\n }\n\n node.prototype.onDrawBackground = function (ctx) {\n try {\n unsafeDrawBackground.call(this, ctx)\n } catch (error) {\n console.error('Error drawing node background', error)\n }\n }\n }\n\n /**\n * Adds a handler allowing drag+drop of files onto the window to load workflows\n */\n #addDropHandler() {\n // Get prompt from dropped PNG or json\n document.addEventListener('drop', async (event) => {\n event.preventDefault()\n event.stopPropagation()\n\n const n = this.dragOverNode\n this.dragOverNode = null\n // Node handles file drop, we dont use the built in onDropFile handler as its buggy\n // If you drag multiple files it will call it multiple times with the same file\n // @ts-expect-error This is not a standard event. TODO fix it.\n if (n && n.onDragDrop && (await n.onDragDrop(event))) {\n return\n }\n // Dragging from Chrome->Firefox there is a file but its a bmp, so ignore that\n if (\n event.dataTransfer.files.length &&\n event.dataTransfer.files[0].type !== 'image/bmp'\n ) {\n await this.handleFile(event.dataTransfer.files[0])\n } else {\n // Try loading the first URI in the transfer list\n const validTypes = ['text/uri-list', 'text/x-moz-url']\n const match = [...event.dataTransfer.types].find((t) =>\n validTypes.find((v) => t === v)\n )\n if (match) {\n const uri = event.dataTransfer.getData(match)?.split('\\n')?.[0]\n if (uri) {\n await this.handleFile(await (await fetch(uri)).blob())\n }\n }\n }\n })\n\n // Always clear over node on drag leave\n this.canvasEl.addEventListener('dragleave', async () => {\n if (this.dragOverNode) {\n this.dragOverNode = null\n this.graph.setDirtyCanvas(false, true)\n }\n })\n\n // Add handler for dropping onto a specific node\n this.canvasEl.addEventListener(\n 'dragover',\n (e) => {\n this.canvas.adjustMouseEvent(e)\n const node = this.graph.getNodeOnPos(e.canvasX, e.canvasY)\n if (node) {\n // @ts-expect-error This is not a standard event. TODO fix it.\n if (node.onDragOver && node.onDragOver(e)) {\n this.dragOverNode = node\n\n // dragover event is fired very frequently, run this on an animation frame\n requestAnimationFrame(() => {\n this.graph.setDirtyCanvas(false, true)\n })\n return\n }\n }\n this.dragOverNode = null\n },\n false\n )\n }\n\n /**\n * Adds a handler on paste that extracts and loads images or workflows from pasted JSON data\n */\n #addPasteHandler() {\n document.addEventListener('paste', async (e: ClipboardEvent) => {\n // ctrl+shift+v is used to paste nodes with connections\n // this is handled by litegraph\n if (this.shiftDown) return\n\n // @ts-expect-error: Property 'clipboardData' does not exist on type 'Window & typeof globalThis'.\n // Did you mean 'Clipboard'?ts(2551)\n // TODO: Not sure what the code wants to do.\n let data = e.clipboardData || window.clipboardData\n const items = data.items\n\n // Look for image paste data\n for (const item of items) {\n if (item.type.startsWith('image/')) {\n var imageNode = null\n\n // If an image node is selected, paste into it\n if (\n this.canvas.current_node &&\n this.canvas.current_node.is_selected &&\n ComfyApp.isImageNode(this.canvas.current_node)\n ) {\n imageNode = this.canvas.current_node\n }\n\n // No image node selected: add a new one\n if (!imageNode) {\n const newNode = LiteGraph.createNode('LoadImage')\n // @ts-expect-error array to Float32Array\n newNode.pos = [...this.canvas.graph_mouse]\n imageNode = this.graph.add(newNode)\n this.graph.change()\n }\n const blob = item.getAsFile()\n imageNode.pasteFile(blob)\n return\n }\n }\n\n // No image found. Look for node data\n data = data.getData('text/plain')\n let workflow: ComfyWorkflowJSON | null = null\n try {\n data = data.slice(data.indexOf('{'))\n workflow = JSON.parse(data)\n } catch (err) {\n try {\n data = data.slice(data.indexOf('workflow\\n'))\n data = data.slice(data.indexOf('{'))\n workflow = JSON.parse(data)\n } catch (error) {\n workflow = null\n }\n }\n\n if (workflow && workflow.version && workflow.nodes && workflow.extra) {\n await this.loadGraphData(workflow)\n } else {\n if (\n (e.target instanceof HTMLTextAreaElement &&\n e.target.type === 'textarea') ||\n (e.target instanceof HTMLInputElement && e.target.type === 'text')\n ) {\n return\n }\n\n // Litegraph default paste\n this.canvas.pasteFromClipboard()\n }\n })\n }\n\n /**\n * Adds a handler on copy that serializes selected nodes to JSON\n */\n #addCopyHandler() {\n document.addEventListener('copy', (e) => {\n if (!(e.target instanceof Element)) {\n return\n }\n if (\n (e.target instanceof HTMLTextAreaElement &&\n e.target.type === 'textarea') ||\n (e.target instanceof HTMLInputElement && e.target.type === 'text')\n ) {\n // Default system copy\n return\n }\n const isTargetInGraph =\n e.target.classList.contains('litegraph') ||\n e.target.classList.contains('graph-canvas-container')\n\n // copy nodes and clear clipboard\n if (isTargetInGraph && this.canvas.selected_nodes) {\n this.canvas.copyToClipboard()\n e.clipboardData.setData('text', ' ') //clearData doesn't remove images from clipboard\n e.preventDefault()\n e.stopImmediatePropagation()\n return false\n }\n })\n }\n\n /**\n * Handle mouse\n *\n * Move group by header\n */\n #addProcessMouseHandler() {\n const self = this\n\n const origProcessMouseDown = LGraphCanvas.prototype.processMouseDown\n LGraphCanvas.prototype.processMouseDown = function (e) {\n // prepare for ctrl+shift drag: zoom start\n const useFastZoom = useSettingStore().get('Comfy.Graph.CtrlShiftZoom')\n if (useFastZoom && e.ctrlKey && e.shiftKey && !e.altKey && e.buttons) {\n self.zoom_drag_start = [e.x, e.y, this.ds.scale]\n return\n }\n\n const res = origProcessMouseDown.apply(this, arguments)\n return res\n }\n const origProcessMouseMove = LGraphCanvas.prototype.processMouseMove\n LGraphCanvas.prototype.processMouseMove = function (e) {\n // handle ctrl+shift drag\n if (e.ctrlKey && e.shiftKey && self.zoom_drag_start) {\n // stop canvas zoom action\n if (!e.buttons) {\n self.zoom_drag_start = null\n return\n }\n\n // calculate delta\n let deltaY = e.y - self.zoom_drag_start[1]\n let startScale = self.zoom_drag_start[2]\n\n let scale = startScale - deltaY / 100\n\n this.ds.changeScale(scale, [\n self.zoom_drag_start[0],\n self.zoom_drag_start[1]\n ])\n this.graph.change()\n\n return\n }\n\n return origProcessMouseMove.apply(this, arguments)\n }\n }\n\n /**\n * Handle keypress\n */\n #addProcessKeyHandler() {\n const origProcessKey = LGraphCanvas.prototype.processKey\n LGraphCanvas.prototype.processKey = function (e: KeyboardEvent) {\n if (!this.graph) {\n return\n }\n\n var block_default = false\n\n if (e.target instanceof Element && e.target.localName == 'input') {\n return\n }\n\n if (e.type == 'keydown' && !e.repeat) {\n const keyCombo = KeyComboImpl.fromEvent(e)\n const keybindingStore = useKeybindingStore()\n const keybinding = keybindingStore.getKeybinding(keyCombo)\n if (keybinding && keybinding.targetSelector === '#graph-canvas') {\n useCommandStore().execute(keybinding.commandId)\n block_default = true\n }\n\n // Ctrl+C Copy\n if (e.key === 'c' && (e.metaKey || e.ctrlKey)) {\n // Trigger onCopy\n return true\n }\n\n // Ctrl+V Paste\n if (\n (e.key === 'v' || e.key == 'V') &&\n (e.metaKey || e.ctrlKey) &&\n !e.shiftKey\n ) {\n // Trigger onPaste\n return true\n }\n }\n\n this.graph.change()\n\n if (block_default) {\n e.preventDefault()\n e.stopImmediatePropagation()\n return false\n }\n\n // Fall through to Litegraph defaults\n return origProcessKey.apply(this, arguments)\n }\n }\n\n /**\n * Draws group header bar\n */\n #addDrawGroupsHandler() {\n const self = this\n const origDrawGroups = LGraphCanvas.prototype.drawGroups\n LGraphCanvas.prototype.drawGroups = function (canvas, ctx) {\n if (!this.graph) {\n return\n }\n\n var groups = this.graph.groups\n\n ctx.save()\n ctx.globalAlpha = 0.7 * this.editor_alpha\n\n for (var i = 0; i < groups.length; ++i) {\n var group = groups[i]\n\n if (!LiteGraph.overlapBounding(this.visible_area, group._bounding)) {\n continue\n } //out of the visible area\n\n ctx.fillStyle = group.color || '#335'\n ctx.strokeStyle = group.color || '#335'\n var pos = group._pos\n var size = group._size\n ctx.globalAlpha = 0.25 * this.editor_alpha\n ctx.beginPath()\n var font_size = group.font_size || LiteGraph.DEFAULT_GROUP_FONT_SIZE\n ctx.rect(pos[0] + 0.5, pos[1] + 0.5, size[0], font_size * 1.4)\n ctx.fill()\n ctx.globalAlpha = this.editor_alpha\n }\n\n ctx.restore()\n\n const res = origDrawGroups.apply(this, arguments)\n return res\n }\n }\n\n /**\n * Draws node highlights (executing, drag drop) and progress bar\n */\n #addDrawNodeHandler() {\n const origDrawNodeShape = LGraphCanvas.prototype.drawNodeShape\n const self = this\n LGraphCanvas.prototype.drawNodeShape = function (\n node,\n ctx,\n size,\n fgcolor,\n bgcolor,\n selected\n ) {\n const res = origDrawNodeShape.apply(this, arguments)\n\n const nodeErrors = self.lastNodeErrors?.[node.id]\n\n let color = null\n let lineWidth = 1\n if (node.id === +self.runningNodeId) {\n color = '#0f0'\n } else if (self.dragOverNode && node.id === self.dragOverNode.id) {\n color = 'dodgerblue'\n } else if (nodeErrors?.errors) {\n color = 'red'\n lineWidth = 2\n } else if (\n self.lastExecutionError &&\n +self.lastExecutionError.node_id === node.id\n ) {\n color = '#f0f'\n lineWidth = 2\n }\n\n if (color) {\n const shape =\n node._shape || node.constructor.shape || LiteGraph.ROUND_SHAPE\n ctx.lineWidth = lineWidth\n ctx.globalAlpha = 0.8\n ctx.beginPath()\n if (shape == LiteGraph.BOX_SHAPE)\n ctx.rect(\n -6,\n -6 - LiteGraph.NODE_TITLE_HEIGHT,\n 12 + size[0] + 1,\n 12 + size[1] + LiteGraph.NODE_TITLE_HEIGHT\n )\n else if (\n shape == LiteGraph.ROUND_SHAPE ||\n (shape == LiteGraph.CARD_SHAPE && node.flags.collapsed)\n )\n ctx.roundRect(\n -6,\n -6 - LiteGraph.NODE_TITLE_HEIGHT,\n 12 + size[0] + 1,\n 12 + size[1] + LiteGraph.NODE_TITLE_HEIGHT,\n this.round_radius * 2\n )\n else if (shape == LiteGraph.CARD_SHAPE)\n ctx.roundRect(\n -6,\n -6 - LiteGraph.NODE_TITLE_HEIGHT,\n 12 + size[0] + 1,\n 12 + size[1] + LiteGraph.NODE_TITLE_HEIGHT,\n [this.round_radius * 2, this.round_radius * 2, 2, 2]\n )\n else if (shape == LiteGraph.CIRCLE_SHAPE)\n ctx.arc(\n size[0] * 0.5,\n size[1] * 0.5,\n size[0] * 0.5 + 6,\n 0,\n Math.PI * 2\n )\n ctx.strokeStyle = color\n ctx.stroke()\n ctx.strokeStyle = fgcolor\n ctx.globalAlpha = 1\n }\n\n if (self.progress && node.id === +self.runningNodeId) {\n ctx.fillStyle = 'green'\n ctx.fillRect(\n 0,\n 0,\n size[0] * (self.progress.value / self.progress.max),\n 6\n )\n ctx.fillStyle = bgcolor\n }\n\n // Highlight inputs that failed validation\n if (nodeErrors) {\n ctx.lineWidth = 2\n ctx.strokeStyle = 'red'\n for (const error of nodeErrors.errors) {\n if (error.extra_info && error.extra_info.input_name) {\n const inputIndex = node.findInputSlot(error.extra_info.input_name)\n if (inputIndex !== -1) {\n let pos = node.getConnectionPos(true, inputIndex)\n ctx.beginPath()\n ctx.arc(\n pos[0] - node.pos[0],\n pos[1] - node.pos[1],\n 12,\n 0,\n 2 * Math.PI,\n false\n )\n ctx.stroke()\n }\n }\n }\n }\n\n return res\n }\n\n const origDrawNode = LGraphCanvas.prototype.drawNode\n LGraphCanvas.prototype.drawNode = function (node, ctx) {\n const editor_alpha = this.editor_alpha\n const old_color = node.color\n const old_bgcolor = node.bgcolor\n\n if (node.mode === LGraphEventMode.NEVER) {\n this.editor_alpha = 0.4\n }\n\n let bgColor: string\n if (node.mode === LGraphEventMode.BYPASS) {\n bgColor = app.bypassBgColor\n this.editor_alpha = 0.2\n } else {\n bgColor = old_bgcolor || LiteGraph.NODE_DEFAULT_BGCOLOR\n }\n\n const adjustments: ColorAdjustOptions = {}\n\n const opacity = useSettingStore().get('Comfy.Node.Opacity')\n if (opacity) adjustments.opacity = opacity\n\n if (useSettingStore().get('Comfy.ColorPalette') === 'light') {\n adjustments.lightness = 0.5\n\n // Lighten title bar of colored nodes on light theme\n if (old_color) {\n node.color = adjustColor(old_color, { lightness: 0.5 })\n }\n }\n\n node.bgcolor = adjustColor(bgColor, adjustments)\n\n const res = origDrawNode.apply(this, arguments)\n\n this.editor_alpha = editor_alpha\n node.color = old_color\n node.bgcolor = old_bgcolor\n\n return res\n }\n }\n\n /**\n * Handles updates from the API socket\n */\n #addApiUpdateHandlers() {\n api.addEventListener('status', ({ detail }) => {\n this.ui.setStatus(detail)\n })\n\n api.addEventListener('progress', ({ detail }) => {\n this.progress = detail\n this.graph.setDirtyCanvas(true, false)\n })\n\n api.addEventListener('executing', ({ detail }) => {\n this.progress = null\n this.graph.setDirtyCanvas(true, false)\n delete this.nodePreviewImages[this.runningNodeId]\n })\n\n api.addEventListener('executed', ({ detail }) => {\n const output = this.nodeOutputs[detail.display_node || detail.node]\n if (detail.merge && output) {\n for (const k in detail.output ?? {}) {\n const v = output[k]\n if (v instanceof Array) {\n output[k] = v.concat(detail.output[k])\n } else {\n output[k] = detail.output[k]\n }\n }\n } else {\n this.nodeOutputs[detail.display_node || detail.node] = detail.output\n }\n const node = this.graph.getNodeById(detail.display_node || detail.node)\n if (node) {\n if (node.onExecuted) node.onExecuted(detail.output)\n }\n })\n\n api.addEventListener('execution_start', ({ detail }) => {\n this.lastExecutionError = null\n this.graph.nodes.forEach((node) => {\n if (node.onExecutionStart) node.onExecutionStart()\n })\n })\n\n api.addEventListener('execution_error', ({ detail }) => {\n this.lastExecutionError = detail\n showExecutionErrorDialog(detail)\n this.canvas.draw(true, true)\n })\n\n api.addEventListener('b_preview', ({ detail }) => {\n const id = this.runningNodeId\n if (id == null) return\n\n const blob = detail\n const blobUrl = URL.createObjectURL(blob)\n // @ts-expect-error\n this.nodePreviewImages[id] = [blobUrl]\n })\n\n api.init()\n }\n\n #addConfigureHandler() {\n const app = this\n const configure = LGraph.prototype.configure\n // Flag that the graph is configuring to prevent nodes from running checks while its still loading\n LGraph.prototype.configure = function () {\n app.configuringGraph = true\n try {\n return configure.apply(this, arguments)\n } finally {\n app.configuringGraph = false\n }\n }\n }\n\n #addWidgetLinkHandling() {\n app.canvas.getWidgetLinkType = function (widget, node) {\n const nodeDefStore = useNodeDefStore()\n const nodeDef = nodeDefStore.nodeDefsByName[node.type]\n const input = nodeDef.inputs.getInput(widget.name)\n return input?.type\n }\n\n type ConnectingWidgetLink = {\n subType: 'connectingWidgetLink'\n widget: IWidget\n node: LGraphNode\n link: { node: LGraphNode; slot: number }\n }\n\n document.addEventListener(\n 'litegraph:canvas',\n async (e: CustomEvent) => {\n if (e.detail.subType === 'connectingWidgetLink') {\n const { convertToInput } = await import(\n '@/extensions/core/widgetInputs'\n )\n\n const { node, link, widget } = e.detail\n if (!node || !link || !widget) return\n\n const nodeData = node.constructor.nodeData\n if (!nodeData) return\n const all = {\n ...nodeData?.input?.required,\n ...nodeData?.input?.optional\n }\n const inputSpec = all[widget.name]\n if (!inputSpec) return\n\n const input = convertToInput(node, widget, inputSpec)\n if (!input) return\n\n const originNode = link.node\n\n originNode.connect(link.slot, node, node.inputs.lastIndexOf(input))\n }\n }\n )\n }\n\n #addAfterConfigureHandler() {\n const app = this\n const onConfigure = app.graph.onConfigure\n app.graph.onConfigure = function () {\n // Fire callbacks before the onConfigure, this is used by widget inputs to setup the config\n for (const node of app.graph.nodes) {\n node.onGraphConfigured?.()\n }\n\n const r = onConfigure?.apply(this, arguments)\n\n // Fire after onConfigure, used by primitives to generate widget using input nodes config\n for (const node of app.graph.nodes) {\n node.onAfterGraphConfigured?.()\n }\n\n return r\n }\n }\n\n /**\n * Loads all extensions from the API into the window in parallel\n */\n async #loadExtensions() {\n useExtensionStore().loadDisabledExtensionNames()\n\n const extensions = await api.getExtensions()\n\n // Need to load core extensions first as some custom extensions\n // may depend on them.\n await import('../extensions/core/index')\n await Promise.all(\n extensions\n .filter((extension) => !extension.includes('extensions/core'))\n .map(async (ext) => {\n try {\n await import(/* @vite-ignore */ api.fileURL(ext))\n } catch (error) {\n console.error('Error loading extension', ext, error)\n }\n })\n )\n }\n\n /**\n * Set up the app on the page\n */\n async setup(canvasEl: HTMLCanvasElement) {\n this.canvasEl = canvasEl\n // Show menu container for GraphView.\n this.ui.menuContainer.style.display = 'block'\n\n this.resizeCanvas()\n\n await Promise.all([\n useWorkspaceStore().workflow.syncWorkflows(),\n this.ui.settings.load()\n ])\n await this.#loadExtensions()\n\n this.#addProcessMouseHandler()\n this.#addProcessKeyHandler()\n this.#addConfigureHandler()\n this.#addApiUpdateHandlers()\n this.#addRestoreWorkflowView()\n\n this.graph = new LGraph()\n\n this.#addAfterConfigureHandler()\n\n // Make LGraphCanvas.state shallow reactive so that any change on the root\n // object triggers reactivity.\n this.canvas = new LGraphCanvas(canvasEl, this.graph)\n this.canvas.state = shallowReactive(this.canvas.state)\n\n this.ctx = canvasEl.getContext('2d')\n\n LiteGraph.alt_drag_do_clone_nodes = true\n\n this.graph.start()\n\n // Ensure the canvas fills the window\n this.resizeCanvas()\n window.addEventListener('resize', () => this.resizeCanvas())\n const ro = new ResizeObserver(() => this.resizeCanvas())\n ro.observe(this.bodyTop)\n ro.observe(this.bodyLeft)\n ro.observe(this.bodyRight)\n ro.observe(this.bodyBottom)\n\n await this.#invokeExtensionsAsync('init')\n await this.registerNodes()\n initWidgets(this)\n\n // Load previous workflow\n let restored = false\n try {\n const loadWorkflow = async (json) => {\n if (json) {\n const workflow = JSON.parse(json)\n const workflowName = getStorageValue('Comfy.PreviousWorkflow')\n await this.loadGraphData(workflow, true, true, workflowName)\n return true\n }\n }\n const clientId = api.initialClientId ?? api.clientId\n restored =\n (clientId &&\n (await loadWorkflow(\n sessionStorage.getItem(`workflow:${clientId}`)\n ))) ||\n (await loadWorkflow(localStorage.getItem('workflow')))\n } catch (err) {\n console.error('Error loading previous workflow', err)\n }\n\n // We failed to restore a workflow so load the default\n if (!restored) {\n await this.loadGraphData()\n }\n\n this.#addDrawNodeHandler()\n this.#addDrawGroupsHandler()\n this.#addDropHandler()\n this.#addCopyHandler()\n this.#addPasteHandler()\n this.#addWidgetLinkHandling()\n\n await this.#invokeExtensionsAsync('setup')\n }\n\n resizeCanvas() {\n // Limit minimal scale to 1, see https://github.com/comfyanonymous/ComfyUI/pull/845\n const scale = Math.max(window.devicePixelRatio, 1)\n\n // Clear fixed width and height while calculating rect so it uses 100% instead\n this.canvasEl.height = this.canvasEl.width = NaN\n const { width, height } = this.canvasEl.getBoundingClientRect()\n this.canvasEl.width = Math.round(width * scale)\n this.canvasEl.height = Math.round(height * scale)\n this.canvasEl.getContext('2d').scale(scale, scale)\n this.canvas?.draw(true, true)\n }\n\n private updateVueAppNodeDefs(defs: Record) {\n // Frontend only nodes registered by custom nodes.\n // Example: https://github.com/rgthree/rgthree-comfy/blob/dd534e5384be8cf0c0fa35865afe2126ba75ac55/src_web/comfyui/fast_groups_bypasser.ts#L10\n const rawDefs = Object.fromEntries(\n Object.entries(LiteGraph.registered_node_types).map(([name, node]) => [\n name,\n {\n name,\n display_name: name,\n category: node.category || '__frontend_only__',\n input: { required: {}, optional: {} },\n output: [],\n output_name: [],\n output_is_list: [],\n python_module: 'custom_nodes.frontend_only',\n description: `Frontend only node for ${name}`\n }\n ])\n )\n\n const allNodeDefs = {\n ...rawDefs,\n ...defs,\n ...SYSTEM_NODE_DEFS\n }\n\n const nodeDefStore = useNodeDefStore()\n const nodeDefArray: ComfyNodeDef[] = Object.values(allNodeDefs)\n this.#invokeExtensions('beforeRegisterVueAppNodeDefs', nodeDefArray, this)\n nodeDefStore.updateNodeDefs(nodeDefArray)\n }\n\n #translateNodeDefs(defs: Record) {\n return Object.fromEntries(\n Object.entries(defs).map(([name, def]) => [\n name,\n {\n ...def,\n display_name: st(\n `nodeDefs.${name}.display_name`,\n def.display_name ?? def.name\n ),\n description: def.description\n ? st(`nodeDefs.${name}.description`, def.description)\n : undefined,\n category: def.category\n .split('/')\n .map((category) => st(`nodeCategories.${category}`, category))\n .join('/')\n }\n ])\n )\n }\n\n async #getNodeDefs() {\n return this.#translateNodeDefs(\n await api.getNodeDefs({\n validate: useSettingStore().get('Comfy.Validation.NodeDefs')\n })\n )\n }\n\n /**\n * Registers nodes with the graph\n */\n async registerNodes() {\n // Load node definitions from the backend\n const defs = await this.#getNodeDefs()\n await this.registerNodesFromDefs(defs)\n await this.#invokeExtensionsAsync('registerCustomNodes')\n if (this.vueAppReady) {\n this.updateVueAppNodeDefs(defs)\n }\n }\n\n /**\n * Remove the impl after groupNode jest tests are removed.\n * @deprecated Use useWidgetStore().getWidgetType instead\n */\n getWidgetType(inputData, inputName: string) {\n const type = inputData[0]\n\n if (Array.isArray(type)) {\n return 'COMBO'\n } else if (`${type}:${inputName}` in this.widgets) {\n return `${type}:${inputName}`\n } else if (type in this.widgets) {\n return type\n } else {\n return null\n }\n }\n\n async registerNodeDef(nodeId: string, nodeData: ComfyNodeDef) {\n const self = this\n const node = class ComfyNode extends LGraphNode {\n static comfyClass? = nodeData.name\n // TODO: change to \"title?\" once litegraph.d.ts has been updated\n static title = nodeData.display_name || nodeData.name\n static nodeData? = nodeData\n static category?: string\n\n constructor(title?: string) {\n super(title)\n const requiredInputs = nodeData.input.required\n\n var inputs = nodeData['input']['required']\n if (nodeData['input']['optional'] != undefined) {\n inputs = Object.assign(\n {},\n nodeData['input']['required'],\n nodeData['input']['optional']\n )\n }\n const config: {\n minWidth: number\n minHeight: number\n widget?: IBaseWidget\n } = { minWidth: 1, minHeight: 1 }\n for (const inputName in inputs) {\n const _inputData = inputs[inputName]\n const type = _inputData[0]\n const options = _inputData[1] ?? {}\n const inputData = [type, options]\n const nameKey = `nodeDefs.${normalizeI18nKey(nodeData.name)}.inputs.${normalizeI18nKey(inputName)}.name`\n\n const inputIsRequired = requiredInputs && inputName in requiredInputs\n\n let widgetCreated = true\n const widgetType = self.getWidgetType(inputData, inputName)\n if (widgetType) {\n if (widgetType === 'COMBO') {\n Object.assign(\n config,\n self.widgets.COMBO(this, inputName, inputData, app) || {}\n )\n } else {\n Object.assign(\n config,\n self.widgets[widgetType](this, inputName, inputData, app) || {}\n )\n }\n if (config.widget) {\n config.widget.label = st(nameKey, inputName)\n }\n } else {\n // Node connection inputs\n const shapeOptions = inputIsRequired\n ? {}\n : { shape: LiteGraph.SlotShape.HollowCircle }\n const inputOptions = {\n ...shapeOptions,\n localized_name: st(nameKey, inputName)\n }\n this.addInput(inputName, type, inputOptions)\n widgetCreated = false\n }\n\n if (widgetCreated && config?.widget) {\n config.widget.options ??= {}\n if (!inputIsRequired) {\n config.widget.options.inputIsOptional = true\n }\n if (inputData[1]?.forceInput) {\n config.widget.options.forceInput = true\n }\n if (inputData[1]?.defaultInput) {\n config.widget.options.defaultInput = true\n }\n if (inputData[1]?.advanced) {\n config.widget.advanced = true\n }\n if (inputData[1]?.hidden) {\n config.widget.hidden = true\n }\n }\n }\n\n for (const o in nodeData['output']) {\n let output = nodeData['output'][o]\n if (output instanceof Array) output = 'COMBO'\n const outputName = nodeData['output_name'][o] || output\n const outputIsList = nodeData['output_is_list'][o]\n const shapeOptions = outputIsList\n ? { shape: LiteGraph.GRID_SHAPE }\n : {}\n const nameKey = `nodeDefs.${normalizeI18nKey(nodeData.name)}.outputs.${o}.name`\n const typeKey = `dataTypes.${normalizeI18nKey(output)}`\n const outputOptions = {\n ...shapeOptions,\n // If the output name is different from the output type, use the output name.\n // e.g.\n // - type (\"INT\"); name (\"Positive\") => translate name\n // - type (\"FLOAT\"); name (\"FLOAT\") => translate type\n localized_name:\n output !== outputName\n ? st(nameKey, outputName)\n : st(typeKey, outputName)\n }\n this.addOutput(outputName, output, outputOptions)\n }\n\n const s = this.computeSize()\n s[0] = Math.max(config.minWidth, s[0] * 1.5)\n s[1] = Math.max(config.minHeight, s[1])\n this.size = s\n this.serialize_widgets = true\n\n app.#invokeExtensionsAsync('nodeCreated', this)\n }\n\n configure(data: any) {\n // Keep 'name', 'type', 'shape', and 'localized_name' information from the original node definition.\n const merge = (\n current: Record,\n incoming: Record\n ) => {\n const result = { ...incoming }\n if (current.widget === undefined && incoming.widget !== undefined) {\n // Field must be input as only inputs can be converted\n this.inputs.push(current as INodeInputSlot)\n return incoming\n }\n for (const key of ['name', 'type', 'shape', 'localized_name']) {\n if (current[key] !== undefined) {\n result[key] = current[key]\n }\n }\n return result\n }\n for (const field of ['inputs', 'outputs']) {\n const slots = data[field] ?? []\n data[field] = slots.map((slot, i) =>\n merge(this[field][i] ?? {}, slot)\n )\n }\n super.configure(data)\n }\n }\n node.prototype.comfyClass = nodeData.name\n\n this.#addNodeContextMenuHandler(node)\n this.#addDrawBackgroundHandler(node)\n this.#addNodeKeyHandler(node)\n\n await this.#invokeExtensionsAsync('beforeRegisterNodeDef', node, nodeData)\n LiteGraph.registerNodeType(nodeId, node)\n // Note: Do not move this to the class definition, it will be overwritten\n node.category = nodeData.category\n }\n\n async registerNodesFromDefs(defs: Record) {\n await this.#invokeExtensionsAsync('addCustomNodeDefs', defs)\n\n // Register a node for each definition\n for (const nodeId in defs) {\n this.registerNodeDef(nodeId, defs[nodeId])\n }\n }\n\n loadTemplateData(templateData) {\n if (!templateData?.templates) {\n return\n }\n\n const old = localStorage.getItem('litegrapheditor_clipboard')\n\n var maxY, nodeBottom, node\n\n for (const template of templateData.templates) {\n if (!template?.data) {\n continue\n }\n\n // Check for old clipboard format\n const data = JSON.parse(template.data)\n if (!data.reroutes) {\n deserialiseAndCreate(template.data, app.canvas)\n } else {\n localStorage.setItem('litegrapheditor_clipboard', template.data)\n app.canvas.pasteFromClipboard()\n }\n\n // Move mouse position down to paste the next template below\n\n maxY = false\n\n for (const i in app.canvas.selected_nodes) {\n node = app.canvas.selected_nodes[i]\n\n nodeBottom = node.pos[1] + node.size[1]\n\n if (maxY === false || nodeBottom > maxY) {\n maxY = nodeBottom\n }\n }\n\n app.canvas.graph_mouse[1] = maxY + 50\n }\n\n localStorage.setItem('litegrapheditor_clipboard', old)\n }\n\n #showMissingNodesError(missingNodeTypes: MissingNodeType[]) {\n if (useSettingStore().get('Comfy.Workflow.ShowMissingNodesWarning')) {\n showLoadWorkflowWarning({ missingNodeTypes })\n }\n }\n\n #showMissingModelsError(missingModels, paths) {\n if (useSettingStore().get('Comfy.Workflow.ShowMissingModelsWarning')) {\n showMissingModelsWarning({\n missingModels,\n paths\n })\n }\n }\n\n async loadGraphData(\n graphData?: ComfyWorkflowJSON,\n clean: boolean = true,\n restore_view: boolean = true,\n workflow: string | null | ComfyWorkflow = null,\n { showMissingNodesDialog = true, showMissingModelsDialog = true } = {}\n ) {\n if (clean !== false) {\n this.clean()\n }\n\n let reset_invalid_values = false\n if (!graphData) {\n graphData = defaultGraph\n reset_invalid_values = true\n }\n\n if (typeof structuredClone === 'undefined') {\n graphData = JSON.parse(JSON.stringify(graphData))\n } else {\n graphData = structuredClone(graphData)\n }\n\n if (useSettingStore().get('Comfy.Validation.Workflows')) {\n // TODO: Show validation error in a dialog.\n const validatedGraphData = await validateComfyWorkflow(\n graphData,\n /* onError=*/ (err) => {\n useToastStore().addAlert(err)\n }\n )\n // If the validation failed, use the original graph data.\n // Ideally we should not block users from loading the workflow.\n graphData = validatedGraphData ?? graphData\n }\n\n workflowService.beforeLoadNewGraph()\n\n const missingNodeTypes: MissingNodeType[] = []\n const missingModels = []\n await this.#invokeExtensionsAsync(\n 'beforeConfigureGraph',\n graphData,\n missingNodeTypes\n // TODO: missingModels\n )\n for (let n of graphData.nodes) {\n // Patch T2IAdapterLoader to ControlNetLoader since they are the same node now\n if (n.type == 'T2IAdapterLoader') n.type = 'ControlNetLoader'\n if (n.type == 'ConditioningAverage ') n.type = 'ConditioningAverage' //typo fix\n if (n.type == 'SDV_img2vid_Conditioning')\n n.type = 'SVD_img2vid_Conditioning' //typo fix\n\n // Find missing node types\n if (!(n.type in LiteGraph.registered_node_types)) {\n missingNodeTypes.push(n.type)\n n.type = sanitizeNodeName(n.type)\n }\n }\n if (\n graphData.models &&\n useSettingStore().get('Comfy.Workflow.ShowMissingModelsWarning')\n ) {\n for (const m of graphData.models) {\n const models_available = await useModelStore().getLoadedModelFolder(\n m.directory\n )\n if (models_available === null) {\n // @ts-expect-error\n m.directory_invalid = true\n missingModels.push(m)\n } else if (!(m.name in models_available.models)) {\n missingModels.push(m)\n }\n }\n }\n\n try {\n // @ts-expect-error Discrepancies between zod and litegraph - in progress\n this.graph.configure(graphData)\n if (\n restore_view &&\n useSettingStore().get('Comfy.EnableWorkflowViewRestore') &&\n graphData.extra?.ds\n ) {\n // @ts-expect-error\n // Need to set strict: true for zod to match the type [number, number]\n // https://github.com/colinhacks/zod/issues/3056\n this.canvas.ds.offset = graphData.extra.ds.offset\n this.canvas.ds.scale = graphData.extra.ds.scale\n }\n } catch (error) {\n let errorHint = []\n // Try extracting filename to see if it was caused by an extension script\n const filename =\n error.fileName ||\n (error.stack || '').match(/(\\/extensions\\/.*\\.js)/)?.[1]\n const pos = (filename || '').indexOf('/extensions/')\n if (pos > -1) {\n errorHint.push(\n $el('span', {\n textContent: 'This may be due to the following script:'\n }),\n $el('br'),\n $el('span', {\n style: {\n fontWeight: 'bold'\n },\n textContent: filename.substring(pos)\n })\n )\n }\n\n // Show dialog to let the user know something went wrong loading the data\n this.ui.dialog.show(\n $el('div', [\n $el('p', {\n textContent: 'Loading aborted due to error reloading workflow data'\n }),\n $el('pre', {\n style: { padding: '5px', backgroundColor: 'rgba(255,0,0,0.2)' },\n textContent: error.toString()\n }),\n $el('pre', {\n style: {\n padding: '5px',\n color: '#ccc',\n fontSize: '10px',\n maxHeight: '50vh',\n overflow: 'auto',\n backgroundColor: 'rgba(0,0,0,0.2)'\n },\n textContent: error.stack || 'No stacktrace available'\n }),\n ...errorHint\n ]).outerHTML\n )\n\n return\n }\n for (const node of this.graph.nodes) {\n const size = node.computeSize()\n size[0] = Math.max(node.size[0], size[0])\n size[1] = Math.max(node.size[1], size[1])\n node.size = size\n if (node.widgets) {\n // If you break something in the backend and want to patch workflows in the frontend\n // This is the place to do this\n for (let widget of node.widgets) {\n if (node.type == 'KSampler' || node.type == 'KSamplerAdvanced') {\n if (widget.name == 'sampler_name') {\n if (\n typeof widget.value === 'string' &&\n widget.value.startsWith('sample_')\n ) {\n widget.value = widget.value.slice(7)\n }\n }\n }\n if (\n node.type == 'KSampler' ||\n node.type == 'KSamplerAdvanced' ||\n node.type == 'PrimitiveNode'\n ) {\n if (widget.name == 'control_after_generate') {\n if (widget.value === true) {\n // @ts-expect-error change widget type from boolean to string\n widget.value = 'randomize'\n } else if (widget.value === false) {\n // @ts-expect-error change widget type from boolean to string\n widget.value = 'fixed'\n }\n }\n }\n if (reset_invalid_values) {\n if (widget.type == 'combo') {\n if (\n !widget.options.values.includes(widget.value as string) &&\n widget.options.values.length > 0\n ) {\n widget.value = widget.options.values[0]\n }\n }\n }\n }\n }\n\n this.#invokeExtensions('loadedGraphNode', node)\n }\n\n // TODO: Properly handle if both nodes and models are missing (sequential dialogs?)\n if (missingNodeTypes.length && showMissingNodesDialog) {\n this.#showMissingNodesError(missingNodeTypes)\n }\n if (missingModels.length && showMissingModelsDialog) {\n const paths = await api.getFolderPaths()\n this.#showMissingModelsError(missingModels, paths)\n }\n await this.#invokeExtensionsAsync('afterConfigureGraph', missingNodeTypes)\n // @ts-expect-error zod types issue. Will be fixed after we enable ts-strict\n await workflowService.afterLoadNewGraph(workflow, this.graph.serialize())\n requestAnimationFrame(() => {\n this.graph.setDirtyCanvas(true, true)\n })\n }\n\n /**\n * Serializes a graph using preferred user settings.\n * @param graph The litegraph to serialize.\n * @returns A serialized graph (aka workflow) with preferred user settings.\n */\n serializeGraph(graph: LGraph = this.graph) {\n const sortNodes = useSettingStore().get('Comfy.Workflow.SortNodeIdOnSave')\n return graph.serialize({ sortNodes })\n }\n\n /**\n * Converts the current graph workflow for sending to the API.\n * Note: Node widgets are updated before serialization to prepare queueing.\n * @returns The workflow and node links\n */\n async graphToPrompt(graph = this.graph, clean = true) {\n for (const outerNode of this.graph.computeExecutionOrder(false)) {\n if (outerNode.widgets) {\n for (const widget of outerNode.widgets) {\n // Allow widgets to run callbacks before a prompt has been queued\n // e.g. random seed before every gen\n widget.beforeQueued?.()\n }\n }\n\n const innerNodes = outerNode.getInnerNodes\n ? outerNode.getInnerNodes()\n : [outerNode]\n for (const node of innerNodes) {\n if (node.isVirtualNode) {\n // Don't serialize frontend only nodes but let them make changes\n if (node.applyToGraph) {\n node.applyToGraph()\n }\n }\n }\n }\n\n const workflow = this.serializeGraph(graph)\n\n // Remove localized_name from the workflow\n for (const node of workflow.nodes) {\n for (const slot of node.inputs) {\n delete slot.localized_name\n }\n for (const slot of node.outputs) {\n delete slot.localized_name\n }\n }\n\n const output = {}\n // Process nodes in order of execution\n for (const outerNode of graph.computeExecutionOrder(false)) {\n const skipNode =\n outerNode.mode === LGraphEventMode.NEVER ||\n outerNode.mode === LGraphEventMode.BYPASS\n const innerNodes =\n !skipNode && outerNode.getInnerNodes\n ? outerNode.getInnerNodes()\n : [outerNode]\n for (const node of innerNodes) {\n if (node.isVirtualNode) {\n continue\n }\n\n if (\n node.mode === LGraphEventMode.NEVER ||\n node.mode === LGraphEventMode.BYPASS\n ) {\n // Don't serialize muted nodes\n continue\n }\n\n const inputs = {}\n const widgets = node.widgets\n\n // Store all widget values\n if (widgets) {\n for (const i in widgets) {\n const widget = widgets[i]\n if (!widget.options || widget.options.serialize !== false) {\n inputs[widget.name] = widget.serializeValue\n ? await widget.serializeValue(node, i)\n : widget.value\n }\n }\n }\n\n // Store all node links\n for (let i in node.inputs) {\n let parent = node.getInputNode(i)\n if (parent) {\n let link = node.getInputLink(i)\n while (\n parent.mode === LGraphEventMode.BYPASS ||\n parent.isVirtualNode\n ) {\n let found = false\n if (parent.isVirtualNode) {\n link = parent.getInputLink(link.origin_slot)\n if (link) {\n parent = parent.getInputNode(link.target_slot)\n if (parent) {\n found = true\n }\n }\n } else if (link && parent.mode === LGraphEventMode.BYPASS) {\n let all_inputs = [link.origin_slot]\n if (parent.inputs) {\n all_inputs = all_inputs.concat(Object.keys(parent.inputs))\n for (let parent_input in all_inputs) {\n parent_input = all_inputs[parent_input]\n if (\n parent.inputs[parent_input]?.type === node.inputs[i].type\n ) {\n link = parent.getInputLink(parent_input)\n if (link) {\n parent = parent.getInputNode(parent_input)\n }\n found = true\n break\n }\n }\n }\n }\n\n if (!found) {\n break\n }\n }\n\n if (link) {\n if (parent?.updateLink) {\n link = parent.updateLink(link)\n }\n if (link) {\n inputs[node.inputs[i].name] = [\n String(link.origin_id),\n parseInt(link.origin_slot)\n ]\n }\n }\n }\n }\n\n const node_data = {\n inputs,\n class_type: node.comfyClass\n }\n\n // Ignored by the backend.\n node_data['_meta'] = {\n title: node.title\n }\n\n output[String(node.id)] = node_data\n }\n }\n\n // Remove inputs connected to removed nodes\n if (clean) {\n for (const o in output) {\n for (const i in output[o].inputs) {\n if (\n Array.isArray(output[o].inputs[i]) &&\n output[o].inputs[i].length === 2 &&\n !output[output[o].inputs[i][0]]\n ) {\n delete output[o].inputs[i]\n }\n }\n }\n }\n\n return { workflow, output }\n }\n\n #formatPromptError(error) {\n if (error == null) {\n return '(unknown error)'\n } else if (typeof error === 'string') {\n return error\n } else if (error.stack && error.message) {\n return error.toString()\n } else if (error.response) {\n let message = error.response.error.message\n if (error.response.error.details)\n message += ': ' + error.response.error.details\n for (const [nodeID, nodeError] of Object.entries(\n error.response.node_errors\n )) {\n // @ts-expect-error\n message += '\\n' + nodeError.class_type + ':'\n // @ts-expect-error\n for (const errorReason of nodeError.errors) {\n message +=\n '\\n - ' + errorReason.message + ': ' + errorReason.details\n }\n }\n return message\n }\n return '(unknown error)'\n }\n\n async queuePrompt(number, batchCount = 1) {\n this.#queueItems.push({ number, batchCount })\n\n // Only have one action process the items so each one gets a unique seed correctly\n if (this.#processingQueue) {\n return\n }\n\n this.#processingQueue = true\n this.lastNodeErrors = null\n\n try {\n while (this.#queueItems.length) {\n ;({ number, batchCount } = this.#queueItems.pop())\n\n for (let i = 0; i < batchCount; i++) {\n const p = await this.graphToPrompt()\n\n try {\n // @ts-expect-error Discrepancies between zod and litegraph - in progress\n const res = await api.queuePrompt(number, p)\n this.lastNodeErrors = res.node_errors\n if (this.lastNodeErrors.length > 0) {\n this.canvas.draw(true, true)\n } else {\n try {\n useExecutionStore().storePrompt({\n id: res.prompt_id,\n nodes: Object.keys(p.output),\n workflow: useWorkspaceStore().workflow\n .activeWorkflow as ComfyWorkflow\n })\n } catch (error) {}\n }\n } catch (error) {\n const formattedError = this.#formatPromptError(error)\n this.ui.dialog.show(formattedError)\n if (error.response) {\n this.lastNodeErrors = error.response.node_errors\n this.canvas.draw(true, true)\n }\n break\n }\n\n for (const n of p.workflow.nodes) {\n const node = this.graph.getNodeById(n.id)\n if (node.widgets) {\n for (const widget of node.widgets) {\n // Allow widgets to run callbacks after a prompt has been queued\n // e.g. random seed after every gen\n // @ts-expect-error\n if (widget.afterQueued) {\n // @ts-expect-error\n widget.afterQueued()\n }\n }\n }\n }\n\n this.canvas.draw(true, true)\n await this.ui.queue.update()\n }\n }\n } finally {\n this.#processingQueue = false\n }\n api.dispatchCustomEvent('promptQueued', { number, batchCount })\n return !this.lastNodeErrors\n }\n\n showErrorOnFileLoad(file) {\n this.ui.dialog.show(\n $el('div', [\n $el('p', { textContent: `Unable to find workflow in ${file.name}` })\n ]).outerHTML\n )\n }\n\n /**\n * Loads workflow data from the specified file\n * @param {File} file\n */\n async handleFile(file) {\n const removeExt = (f) => {\n if (!f) return f\n const p = f.lastIndexOf('.')\n if (p === -1) return f\n return f.substring(0, p)\n }\n const fileName = removeExt(file.name)\n if (file.type === 'image/png') {\n const pngInfo = await getPngMetadata(file)\n if (pngInfo?.workflow) {\n await this.loadGraphData(\n JSON.parse(pngInfo.workflow),\n true,\n true,\n fileName\n )\n } else if (pngInfo?.prompt) {\n this.loadApiJson(JSON.parse(pngInfo.prompt), fileName)\n } else if (pngInfo?.parameters) {\n // Note: Not putting this in `importA1111` as it is mostly not used\n // by external callers, and `importA1111` has no access to `app`.\n workflowService.beforeLoadNewGraph()\n importA1111(this.graph, pngInfo.parameters)\n // @ts-expect-error zod type issue on ComfyWorkflowJSON. Should be resolved after enabling ts-strict globally.\n workflowService.afterLoadNewGraph(fileName, this.serializeGraph())\n } else {\n this.showErrorOnFileLoad(file)\n }\n } else if (file.type === 'image/webp') {\n const pngInfo = await getWebpMetadata(file)\n // Support loading workflows from that webp custom node.\n const workflow = pngInfo?.workflow || pngInfo?.Workflow\n const prompt = pngInfo?.prompt || pngInfo?.Prompt\n\n if (workflow) {\n this.loadGraphData(JSON.parse(workflow), true, true, fileName)\n } else if (prompt) {\n this.loadApiJson(JSON.parse(prompt), fileName)\n } else {\n this.showErrorOnFileLoad(file)\n }\n } else if (file.type === 'audio/flac' || file.type === 'audio/x-flac') {\n const pngInfo = await getFlacMetadata(file)\n const workflow = pngInfo?.workflow || pngInfo?.Workflow\n const prompt = pngInfo?.prompt || pngInfo?.Prompt\n\n if (workflow) {\n this.loadGraphData(JSON.parse(workflow), true, true, fileName)\n } else if (prompt) {\n this.loadApiJson(JSON.parse(prompt), fileName)\n } else {\n this.showErrorOnFileLoad(file)\n }\n } else if (\n file.type === 'application/json' ||\n file.name?.endsWith('.json')\n ) {\n const reader = new FileReader()\n reader.onload = async () => {\n const readerResult = reader.result as string\n const jsonContent = JSON.parse(readerResult)\n if (jsonContent?.templates) {\n this.loadTemplateData(jsonContent)\n } else if (this.isApiJson(jsonContent)) {\n this.loadApiJson(jsonContent, fileName)\n } else {\n await this.loadGraphData(\n JSON.parse(readerResult),\n true,\n false,\n fileName\n )\n }\n }\n reader.readAsText(file)\n } else if (\n file.name?.endsWith('.latent') ||\n file.name?.endsWith('.safetensors')\n ) {\n const info = await getLatentMetadata(file)\n // TODO define schema to LatentMetadata\n // @ts-expect-error\n if (info.workflow) {\n await this.loadGraphData(\n // @ts-expect-error\n JSON.parse(info.workflow),\n true,\n true,\n fileName\n )\n // @ts-expect-error\n } else if (info.prompt) {\n // @ts-expect-error\n this.loadApiJson(JSON.parse(info.prompt))\n } else {\n this.showErrorOnFileLoad(file)\n }\n } else {\n this.showErrorOnFileLoad(file)\n }\n }\n\n isApiJson(data) {\n // @ts-expect-error\n return Object.values(data).every((v) => v.class_type)\n }\n\n loadApiJson(apiData, fileName: string) {\n workflowService.beforeLoadNewGraph()\n\n const missingNodeTypes = Object.values(apiData).filter(\n // @ts-expect-error\n (n) => !LiteGraph.registered_node_types[n.class_type]\n )\n if (missingNodeTypes.length) {\n this.#showMissingNodesError(\n // @ts-expect-error\n missingNodeTypes.map((t) => t.class_type)\n )\n return\n }\n\n const ids = Object.keys(apiData)\n app.graph.clear()\n for (const id of ids) {\n const data = apiData[id]\n const node = LiteGraph.createNode(data.class_type)\n node.id = isNaN(+id) ? id : +id\n node.title = data._meta?.title ?? node.title\n app.graph.add(node)\n }\n\n for (const id of ids) {\n const data = apiData[id]\n const node = app.graph.getNodeById(id)\n for (const input in data.inputs ?? {}) {\n const value = data.inputs[input]\n if (value instanceof Array) {\n const [fromId, fromSlot] = value\n const fromNode = app.graph.getNodeById(fromId)\n let toSlot = node.inputs?.findIndex((inp) => inp.name === input)\n if (toSlot == null || toSlot === -1) {\n try {\n // Target has no matching input, most likely a converted widget\n const widget = node.widgets?.find((w) => w.name === input)\n // @ts-expect-error\n if (widget && node.convertWidgetToInput?.(widget)) {\n toSlot = node.inputs?.length - 1\n }\n } catch (error) {}\n }\n if (toSlot != null || toSlot !== -1) {\n fromNode.connect(fromSlot, node, toSlot)\n }\n } else {\n const widget = node.widgets?.find((w) => w.name === input)\n if (widget) {\n widget.value = value\n widget.callback?.(value)\n }\n }\n }\n }\n app.graph.arrange()\n\n for (const id of ids) {\n const data = apiData[id]\n const node = app.graph.getNodeById(id)\n for (const input in data.inputs ?? {}) {\n const value = data.inputs[input]\n if (value instanceof Array) {\n const [fromId, fromSlot] = value\n const fromNode = app.graph.getNodeById(fromId)\n let toSlot = node.inputs?.findIndex((inp) => inp.name === input)\n if (toSlot == null || toSlot === -1) {\n try {\n // Target has no matching input, most likely a converted widget\n const widget = node.widgets?.find((w) => w.name === input)\n // @ts-expect-error\n if (widget && node.convertWidgetToInput?.(widget)) {\n toSlot = node.inputs?.length - 1\n }\n } catch (error) {}\n }\n if (toSlot != null || toSlot !== -1) {\n fromNode.connect(fromSlot, node, toSlot)\n }\n } else {\n const widget = node.widgets?.find((w) => w.name === input)\n if (widget) {\n widget.value = value\n widget.callback?.(value)\n }\n }\n }\n }\n\n app.graph.arrange()\n\n // @ts-expect-error zod type issue on ComfyWorkflowJSON. Should be resolved after enabling ts-strict globally.\n workflowService.afterLoadNewGraph(fileName, this.serializeGraph())\n }\n\n /**\n * Registers a Comfy web extension with the app\n * @param {ComfyExtension} extension\n */\n registerExtension(extension: ComfyExtension) {\n if (this.vueAppReady) {\n useExtensionStore().registerExtension(extension)\n } else {\n // For jest testing.\n this.extensions.push(extension)\n }\n }\n\n /**\n * Refresh combo list on whole nodes\n */\n async refreshComboInNodes() {\n const requestToastMessage: ToastMessageOptions = {\n severity: 'info',\n summary: 'Update',\n detail: 'Update requested'\n }\n if (this.vueAppReady) {\n useToastStore().add(requestToastMessage)\n }\n\n const defs = await this.#getNodeDefs()\n for (const nodeId in defs) {\n this.registerNodeDef(nodeId, defs[nodeId])\n }\n for (let nodeNum in this.graph.nodes) {\n const node = this.graph.nodes[nodeNum]\n const def = defs[node.type]\n // Allow primitive nodes to handle refresh\n node.refreshComboInNode?.(defs)\n\n if (!def) continue\n\n for (const widgetNum in node.widgets) {\n const widget = node.widgets[widgetNum]\n if (\n widget.type == 'combo' &&\n def['input']['required'][widget.name] !== undefined\n ) {\n widget.options.values = def['input']['required'][widget.name][0]\n }\n }\n }\n\n await this.#invokeExtensionsAsync('refreshComboInNodes', defs)\n\n if (this.vueAppReady) {\n this.updateVueAppNodeDefs(defs)\n useToastStore().remove(requestToastMessage)\n useToastStore().add({\n severity: 'success',\n summary: 'Updated',\n detail: 'Node definitions updated',\n life: 1000\n })\n }\n }\n\n resetView() {\n app.canvas.ds.scale = 1\n app.canvas.ds.offset = [0, 0]\n app.graph.setDirtyCanvas(true, true)\n }\n\n /**\n * Clean current state\n */\n clean() {\n this.nodeOutputs = {}\n this.nodePreviewImages = {}\n this.lastNodeErrors = null\n this.lastExecutionError = null\n }\n\n addNodeOnGraph(\n nodeDef: ComfyNodeDef | ComfyNodeDefImpl,\n options: Record = {}\n ): LGraphNode {\n const node = LiteGraph.createNode(\n nodeDef.name,\n nodeDef.display_name,\n options\n )\n this.graph.add(node)\n return node\n }\n\n clientPosToCanvasPos(pos: Vector2): Vector2 {\n const rect = this.canvasContainer.getBoundingClientRect()\n const containerOffsets = [rect.left, rect.top]\n return _.zip(pos, this.canvas.ds.offset, containerOffsets).map(\n ([p, o1, o2]) => (p - o2) / this.canvas.ds.scale - o1\n ) as Vector2\n }\n\n canvasPosToClientPos(pos: Vector2): Vector2 {\n const rect = this.canvasContainer.getBoundingClientRect()\n const containerOffsets = [rect.left, rect.top]\n return _.zip(pos, this.canvas.ds.offset, containerOffsets).map(\n ([p, o1, o2]) => (p + o1) * this.canvas.ds.scale + o2\n ) as Vector2\n }\n\n getCanvasCenter(): Vector2 {\n const dpi = Math.max(window.devicePixelRatio ?? 1, 1)\n const [x, y, w, h] = app.canvas.ds.visible_area\n return [x + w / dpi / 2, y + h / dpi / 2]\n }\n\n public goToNode(nodeId: NodeId) {\n const graphNode = this.graph.getNodeById(nodeId)\n if (!graphNode) return\n this.canvas.animateToBounds(graphNode.boundingRect)\n }\n}\n\nexport const app = new ComfyApp()\n","import type { Keybinding } from '@/types/keyBindingTypes'\nimport { NodeBadgeMode } from '@/types/nodeSource'\nimport { LinkReleaseTriggerAction } from '@/types/searchBoxTypes'\nimport type { SettingParams } from '@/types/settingTypes'\nimport { LinkMarkerShape } from '@comfyorg/litegraph'\nimport { LiteGraph } from '@comfyorg/litegraph'\n\nexport const CORE_SETTINGS: SettingParams[] = [\n {\n id: 'Comfy.Validation.Workflows',\n name: 'Validate workflows',\n type: 'boolean',\n defaultValue: true\n },\n {\n id: 'Comfy.NodeSearchBoxImpl',\n category: ['Comfy', 'Node Search Box', 'Implementation'],\n experimental: true,\n name: 'Node search box implementation',\n type: 'combo',\n options: ['default', 'litegraph (legacy)'],\n defaultValue: 'default'\n },\n {\n id: 'Comfy.LinkRelease.Action',\n category: ['LiteGraph', 'LinkRelease', 'Action'],\n name: 'Action on link release (No modifier)',\n type: 'combo',\n options: Object.values(LinkReleaseTriggerAction),\n defaultValue: LinkReleaseTriggerAction.CONTEXT_MENU\n },\n {\n id: 'Comfy.LinkRelease.ActionShift',\n category: ['LiteGraph', 'LinkRelease', 'ActionShift'],\n name: 'Action on link release (Shift)',\n type: 'combo',\n options: Object.values(LinkReleaseTriggerAction),\n defaultValue: LinkReleaseTriggerAction.SEARCH_BOX\n },\n {\n id: 'Comfy.NodeSearchBoxImpl.NodePreview',\n category: ['Comfy', 'Node Search Box', 'NodePreview'],\n name: 'Node preview',\n tooltip: 'Only applies to the default implementation',\n type: 'boolean',\n defaultValue: true\n },\n {\n id: 'Comfy.NodeSearchBoxImpl.ShowCategory',\n category: ['Comfy', 'Node Search Box', 'ShowCategory'],\n name: 'Show node category in search results',\n tooltip: 'Only applies to the default implementation',\n type: 'boolean',\n defaultValue: true\n },\n {\n id: 'Comfy.NodeSearchBoxImpl.ShowIdName',\n category: ['Comfy', 'Node Search Box', 'ShowIdName'],\n name: 'Show node id name in search results',\n tooltip: 'Only applies to the default implementation',\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'Comfy.NodeSearchBoxImpl.ShowNodeFrequency',\n category: ['Comfy', 'Node Search Box', 'ShowNodeFrequency'],\n name: 'Show node frequency in search results',\n tooltip: 'Only applies to the default implementation',\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'Comfy.Sidebar.Location',\n category: ['Appearance', 'Sidebar', 'Location'],\n name: 'Sidebar location',\n type: 'combo',\n options: ['left', 'right'],\n defaultValue: 'left'\n },\n {\n id: 'Comfy.Sidebar.Size',\n category: ['Appearance', 'Sidebar', 'Size'],\n name: 'Sidebar size',\n type: 'combo',\n options: ['normal', 'small'],\n defaultValue: () => (window.innerWidth < 1600 ? 'small' : 'normal')\n },\n {\n id: 'Comfy.TextareaWidget.FontSize',\n category: ['Appearance', 'Node Widget', 'TextareaWidget', 'FontSize'],\n name: 'Textarea widget font size',\n type: 'slider',\n defaultValue: 10,\n attrs: {\n min: 8,\n max: 24\n }\n },\n {\n id: 'Comfy.TextareaWidget.Spellcheck',\n category: ['Comfy', 'Node Widget', 'TextareaWidget', 'Spellcheck'],\n name: 'Textarea widget spellcheck',\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'Comfy.Workflow.SortNodeIdOnSave',\n name: 'Sort node IDs when saving workflow',\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'Comfy.Graph.CanvasInfo',\n category: ['LiteGraph', 'Canvas', 'CanvasInfo'],\n name: 'Show canvas info on bottom left corner (fps, etc.)',\n type: 'boolean',\n defaultValue: true\n },\n {\n id: 'Comfy.Node.ShowDeprecated',\n name: 'Show deprecated nodes in search',\n tooltip:\n 'Deprecated nodes are hidden by default in the UI, but remain functional in existing workflows that use them.',\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'Comfy.Node.ShowExperimental',\n name: 'Show experimental nodes in search',\n tooltip:\n 'Experimental nodes are marked as such in the UI and may be subject to significant changes or removal in future versions. Use with caution in production workflows',\n type: 'boolean',\n defaultValue: true\n },\n {\n id: 'Comfy.Node.Opacity',\n category: ['Appearance', 'Node', 'Opacity'],\n name: 'Node opacity',\n type: 'slider',\n defaultValue: 1,\n attrs: {\n min: 0.01,\n max: 1,\n step: 0.01\n }\n },\n {\n id: 'Comfy.Workflow.ShowMissingNodesWarning',\n name: 'Show missing nodes warning',\n type: 'boolean',\n defaultValue: true\n },\n {\n id: 'Comfy.Workflow.ShowMissingModelsWarning',\n name: 'Show missing models warning',\n type: 'boolean',\n defaultValue: false,\n experimental: true\n },\n {\n id: 'Comfy.Graph.ZoomSpeed',\n category: ['LiteGraph', 'Canvas', 'ZoomSpeed'],\n name: 'Canvas zoom speed',\n type: 'slider',\n defaultValue: 1.1,\n attrs: {\n min: 1.01,\n max: 2.5,\n step: 0.01\n }\n },\n // Bookmarks are stored in the settings store.\n // Bookmarks are in format of category/display_name. e.g. \"conditioning/CLIPTextEncode\"\n {\n id: 'Comfy.NodeLibrary.Bookmarks',\n name: 'Node library bookmarks with display name (deprecated)',\n type: 'hidden',\n defaultValue: [],\n deprecated: true\n },\n {\n id: 'Comfy.NodeLibrary.Bookmarks.V2',\n name: 'Node library bookmarks v2 with unique name',\n type: 'hidden',\n defaultValue: []\n },\n // Stores mapping from bookmark folder name to its customization.\n {\n id: 'Comfy.NodeLibrary.BookmarksCustomization',\n name: 'Node library bookmarks customization',\n type: 'hidden',\n defaultValue: {}\n },\n // Hidden setting used by the queue for how to fit images\n {\n id: 'Comfy.Queue.ImageFit',\n name: 'Queue image fit',\n type: 'hidden',\n defaultValue: 'cover'\n },\n {\n id: 'Comfy.GroupSelectedNodes.Padding',\n category: ['LiteGraph', 'Group', 'Padding'],\n name: 'Group selected nodes padding',\n type: 'slider',\n defaultValue: 10,\n attrs: {\n min: 0,\n max: 100\n }\n },\n {\n id: 'Comfy.Node.DoubleClickTitleToEdit',\n category: ['LiteGraph', 'Node', 'DoubleClickTitleToEdit'],\n name: 'Double click node title to edit',\n type: 'boolean',\n defaultValue: true\n },\n {\n id: 'Comfy.Group.DoubleClickTitleToEdit',\n category: ['LiteGraph', 'Group', 'DoubleClickTitleToEdit'],\n name: 'Double click group title to edit',\n type: 'boolean',\n defaultValue: true\n },\n {\n id: 'Comfy.Window.UnloadConfirmation',\n name: 'Show confirmation when closing window',\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'Comfy.TreeExplorer.ItemPadding',\n category: ['Appearance', 'Tree Explorer', 'ItemPadding'],\n name: 'Tree explorer item padding',\n type: 'slider',\n defaultValue: 2,\n attrs: {\n min: 0,\n max: 8,\n step: 1\n }\n },\n {\n id: 'Comfy.ModelLibrary.AutoLoadAll',\n name: 'Automatically load all model folders',\n tooltip:\n 'If true, all folders will load as soon as you open the model library (this may cause delays while it loads). If false, root level model folders will only load once you click on them.',\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'Comfy.ModelLibrary.NameFormat',\n name: 'What name to display in the model library tree view',\n tooltip:\n 'Select \"filename\" to render a simplified view of the raw filename (without directory or \".safetensors\" extension) in the model list. Select \"title\" to display the configurable model metadata title.',\n type: 'combo',\n options: ['filename', 'title'],\n defaultValue: 'title'\n },\n {\n id: 'Comfy.Locale',\n name: 'Language',\n type: 'combo',\n options: [\n { value: 'en', text: 'English' },\n { value: 'zh', text: '中文' },\n { value: 'ru', text: 'Русский' },\n { value: 'ja', text: '日本語' },\n { value: 'ko', text: '한국어' }\n ],\n defaultValue: () => navigator.language.split('-')[0] || 'en'\n },\n {\n id: 'Comfy.NodeBadge.NodeSourceBadgeMode',\n category: ['LiteGraph', 'Node', 'NodeSourceBadgeMode'],\n name: 'Node source badge mode',\n type: 'combo',\n options: Object.values(NodeBadgeMode),\n defaultValue: NodeBadgeMode.HideBuiltIn\n },\n {\n id: 'Comfy.NodeBadge.NodeIdBadgeMode',\n category: ['LiteGraph', 'Node', 'NodeIdBadgeMode'],\n name: 'Node ID badge mode',\n type: 'combo',\n options: [NodeBadgeMode.None, NodeBadgeMode.ShowAll],\n defaultValue: NodeBadgeMode.ShowAll\n },\n {\n id: 'Comfy.NodeBadge.NodeLifeCycleBadgeMode',\n category: ['LiteGraph', 'Node', 'NodeLifeCycleBadgeMode'],\n name: 'Node life cycle badge mode',\n type: 'combo',\n options: [NodeBadgeMode.None, NodeBadgeMode.ShowAll],\n defaultValue: NodeBadgeMode.ShowAll\n },\n {\n id: 'Comfy.ConfirmClear',\n category: ['Comfy', 'Workflow', 'ConfirmClear'],\n name: 'Require confirmation when clearing workflow',\n type: 'boolean',\n defaultValue: true\n },\n {\n id: 'Comfy.PromptFilename',\n category: ['Comfy', 'Workflow', 'PromptFilename'],\n name: 'Prompt for filename when saving workflow',\n type: 'boolean',\n defaultValue: true\n },\n /**\n * file format for preview\n *\n * format;quality\n *\n * ex)\n * webp;50 -> webp, quality 50\n * jpeg;80 -> rgb, jpeg, quality 80\n *\n * @type {string}\n */\n {\n id: 'Comfy.PreviewFormat',\n category: ['LiteGraph', 'Node Widget', 'PreviewFormat'],\n name: 'Preview image format',\n tooltip:\n 'When displaying a preview in the image widget, convert it to a lightweight image, e.g. webp, jpeg, webp;50, etc.',\n type: 'text',\n defaultValue: ''\n },\n {\n id: 'Comfy.DisableSliders',\n category: ['LiteGraph', 'Node Widget', 'DisableSliders'],\n name: 'Disable node widget sliders',\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'Comfy.DisableFloatRounding',\n category: ['LiteGraph', 'Node Widget', 'DisableFloatRounding'],\n name: 'Disable default float widget rounding.',\n tooltip:\n '(requires page reload) Cannot disable round when round is set by the node in the backend.',\n type: 'boolean',\n defaultValue: false\n },\n {\n id: 'Comfy.FloatRoundingPrecision',\n category: ['LiteGraph', 'Node Widget', 'FloatRoundingPrecision'],\n name: 'Float widget rounding decimal places [0 = auto].',\n tooltip: '(requires page reload)',\n type: 'slider',\n attrs: {\n min: 0,\n max: 6,\n step: 1\n },\n defaultValue: 0\n },\n {\n id: 'Comfy.EnableTooltips',\n category: ['LiteGraph', 'Node', 'EnableTooltips'],\n name: 'Enable Tooltips',\n type: 'boolean',\n defaultValue: true\n },\n {\n id: 'Comfy.DevMode',\n name: 'Enable dev mode options (API save, etc.)',\n type: 'boolean',\n defaultValue: false,\n onChange: (value) => {\n const element = document.getElementById('comfy-dev-save-api-button')\n if (element) {\n element.style.display = value ? 'flex' : 'none'\n }\n }\n },\n {\n id: 'Comfy.UseNewMenu',\n category: ['Comfy', 'Menu', 'UseNewMenu'],\n defaultValue: 'Top',\n name: 'Use new menu',\n type: 'combo',\n options: ['Disabled', 'Top', 'Bottom'],\n migrateDeprecatedValue: (value: string) => {\n // Floating is now supported by dragging the docked actionbar off.\n if (value === 'Floating') {\n return 'Top'\n }\n return value\n }\n },\n {\n id: 'Comfy.Workflow.WorkflowTabsPosition',\n name: 'Opened workflows position',\n type: 'combo',\n options: ['Sidebar', 'Topbar'],\n defaultValue: 'Topbar'\n },\n {\n id: 'Comfy.Graph.CanvasMenu',\n category: ['LiteGraph', 'Canvas', 'CanvasMenu'],\n name: 'Show graph canvas menu',\n type: 'boolean',\n defaultValue: true\n },\n {\n id: 'Comfy.QueueButton.BatchCountLimit',\n name: 'Batch count limit',\n tooltip:\n 'The maximum number of tasks added to the queue at one button click',\n type: 'number',\n defaultValue: 100,\n versionAdded: '1.3.5'\n },\n {\n id: 'Comfy.Keybinding.UnsetBindings',\n name: 'Keybindings unset by the user',\n type: 'hidden',\n defaultValue: [] as Keybinding[],\n versionAdded: '1.3.7'\n },\n {\n id: 'Comfy.Keybinding.NewBindings',\n name: 'Keybindings set by the user',\n type: 'hidden',\n defaultValue: [] as Keybinding[],\n versionAdded: '1.3.7'\n },\n {\n id: 'Comfy.Extension.Disabled',\n name: 'Disabled extension names',\n type: 'hidden',\n defaultValue: [] as string[],\n versionAdded: '1.3.11'\n },\n {\n id: 'Comfy.Settings.ExtensionPanel',\n name: 'Show extension panel in settings dialog',\n type: 'boolean',\n defaultValue: false,\n experimental: true,\n versionAdded: '1.3.11'\n },\n {\n id: 'Comfy.Validation.NodeDefs',\n name: 'Validate node definitions (slow)',\n type: 'boolean',\n tooltip:\n 'Recommended for node developers. This will validate all node definitions on startup.',\n defaultValue: false,\n versionAdded: '1.3.14'\n },\n {\n id: 'Comfy.LinkRenderMode',\n category: ['LiteGraph', 'Graph', 'LinkRenderMode'],\n name: 'Link Render Mode',\n defaultValue: 2,\n type: 'combo',\n options: [\n { value: LiteGraph.STRAIGHT_LINK, text: 'Straight' },\n { value: LiteGraph.LINEAR_LINK, text: 'Linear' },\n { value: LiteGraph.SPLINE_LINK, text: 'Spline' },\n { value: LiteGraph.HIDDEN_LINK, text: 'Hidden' }\n ]\n },\n {\n id: 'Comfy.Node.AutoSnapLinkToSlot',\n category: ['LiteGraph', 'Node', 'AutoSnapLinkToSlot'],\n name: 'Auto snap link to node slot',\n tooltip:\n 'When dragging a link over a node, the link automatically snap to a viable input slot on the node',\n type: 'boolean',\n defaultValue: true,\n versionAdded: '1.3.29'\n },\n {\n id: 'Comfy.Node.SnapHighlightsNode',\n category: ['LiteGraph', 'Node', 'SnapHighlightsNode'],\n name: 'Snap highlights node',\n tooltip:\n 'When dragging a link over a node with viable input slot, highlight the node',\n type: 'boolean',\n defaultValue: true,\n versionAdded: '1.3.29'\n },\n {\n id: 'Comfy.Node.BypassAllLinksOnDelete',\n category: ['LiteGraph', 'Node', 'BypassAllLinksOnDelete'],\n name: 'Keep all links when deleting nodes',\n tooltip:\n 'When deleting a node, attempt to reconnect all of its input and output links (bypassing the deleted node)',\n type: 'boolean',\n defaultValue: true,\n versionAdded: '1.3.40'\n },\n {\n id: 'Comfy.Node.MiddleClickRerouteNode',\n category: ['LiteGraph', 'Node', 'MiddleClickRerouteNode'],\n name: 'Middle-click creates a new Reroute node',\n type: 'boolean',\n defaultValue: true,\n versionAdded: '1.3.42'\n },\n {\n id: 'Comfy.RerouteBeta',\n category: ['LiteGraph', 'RerouteBeta'],\n name: 'Opt-in to the reroute beta test',\n tooltip:\n 'Enables the new native reroutes.\\n\\nReroutes can be added by holding alt and dragging from a link line, or on the link menu.\\n\\nDisabling this option is non-destructive - reroutes are hidden.',\n experimental: true,\n type: 'boolean',\n defaultValue: false,\n versionAdded: '1.3.42'\n },\n {\n id: 'Comfy.Graph.LinkMarkers',\n category: ['LiteGraph', 'Link', 'LinkMarkers'],\n name: 'Link midpoint markers',\n defaultValue: LinkMarkerShape.Circle,\n type: 'combo',\n options: [\n { value: LinkMarkerShape.None, text: 'None' },\n { value: LinkMarkerShape.Circle, text: 'Circle' },\n { value: LinkMarkerShape.Arrow, text: 'Arrow' }\n ],\n versionAdded: '1.3.42'\n },\n {\n id: 'Comfy.DOMClippingEnabled',\n category: ['LiteGraph', 'Node', 'DOMClippingEnabled'],\n name: 'Enable DOM element clipping (enabling may reduce performance)',\n type: 'boolean',\n defaultValue: true\n },\n {\n id: 'Comfy.Graph.CtrlShiftZoom',\n category: ['LiteGraph', 'Canvas', 'CtrlShiftZoom'],\n name: 'Enable fast-zoom shortcut (Ctrl + Shift + Drag)',\n type: 'boolean',\n defaultValue: true,\n versionAdded: '1.4.0'\n },\n {\n id: 'Comfy.Pointer.ClickDrift',\n category: ['LiteGraph', 'Pointer', 'ClickDrift'],\n name: 'Pointer click drift (maximum distance)',\n tooltip:\n 'If the pointer moves more than this distance while holding a button down, it is considered dragging (rather than clicking).\\n\\nHelps prevent objects from being unintentionally nudged if the pointer is moved whilst clicking.',\n experimental: true,\n type: 'slider',\n attrs: {\n min: 0,\n max: 20,\n step: 1\n },\n defaultValue: 6,\n versionAdded: '1.4.3'\n },\n {\n id: 'Comfy.Pointer.ClickBufferTime',\n category: ['LiteGraph', 'Pointer', 'ClickBufferTime'],\n name: 'Pointer click drift delay',\n tooltip:\n 'After pressing a pointer button down, this is the maximum time (in milliseconds) that pointer movement can be ignored for.\\n\\nHelps prevent objects from being unintentionally nudged if the pointer is moved whilst clicking.',\n experimental: true,\n type: 'slider',\n attrs: {\n min: 0,\n max: 1000,\n step: 25\n },\n defaultValue: 150,\n versionAdded: '1.4.3'\n },\n {\n id: 'Comfy.Pointer.DoubleClickTime',\n category: ['LiteGraph', 'Pointer', 'DoubleClickTime'],\n name: 'Double click interval (maximum)',\n tooltip:\n 'The maximum time in milliseconds between the two clicks of a double-click. Increasing this value may assist if double-clicks are sometimes not registered.',\n type: 'slider',\n attrs: {\n min: 100,\n max: 1000,\n step: 50\n },\n defaultValue: 300,\n versionAdded: '1.4.3'\n },\n {\n id: 'Comfy.SnapToGrid.GridSize',\n category: ['LiteGraph', 'Canvas', 'GridSize'],\n name: 'Snap to grid size',\n type: 'slider',\n attrs: {\n min: 1,\n max: 500\n },\n tooltip:\n 'When dragging and resizing nodes while holding shift they will be aligned to the grid, this controls the size of that grid.',\n defaultValue: LiteGraph.CANVAS_GRID_SIZE\n },\n // Keep the 'pysssss.SnapToGrid' setting id so we don't need to migrate setting values.\n // Using a new setting id can cause existing users to lose their existing settings.\n {\n id: 'pysssss.SnapToGrid',\n category: ['LiteGraph', 'Canvas', 'AlwaysSnapToGrid'],\n name: 'Always snap to grid',\n type: 'boolean',\n defaultValue: false,\n versionAdded: '1.3.13'\n },\n {\n id: 'Comfy.Server.ServerConfigValues',\n name: 'Server config values for frontend display',\n tooltip: 'Server config values used for frontend display only',\n type: 'hidden',\n // Mapping from server config id to value.\n defaultValue: {} as Record,\n versionAdded: '1.4.8'\n },\n {\n id: 'Comfy.Server.LaunchArgs',\n name: 'Server launch arguments',\n tooltip:\n 'These are the actual arguments that are passed to the server when it is launched.',\n type: 'hidden',\n defaultValue: {} as Record,\n versionAdded: '1.4.8'\n },\n {\n id: 'Comfy.Queue.MaxHistoryItems',\n name: 'Queue history size',\n tooltip: 'The maximum number of tasks that show in the queue history.',\n type: 'slider',\n attrs: {\n min: 16,\n max: 256,\n step: 16\n },\n defaultValue: 64,\n versionAdded: '1.4.12'\n },\n {\n id: 'LiteGraph.Canvas.MaximumFps',\n name: 'Maxium FPS',\n tooltip:\n 'The maximum frames per second that the canvas is allowed to render. Caps GPU usage at the cost of smoothness. If 0, the screen refresh rate is used. Default: 0',\n type: 'slider',\n attrs: {\n min: 0,\n max: 120\n },\n defaultValue: 0,\n versionAdded: '1.5.1'\n },\n {\n id: 'Comfy.EnableWorkflowViewRestore',\n category: ['Comfy', 'Workflow', 'EnableWorkflowViewRestore'],\n name: 'Save and restore canvas position and zoom level in workflows',\n type: 'boolean',\n defaultValue: true,\n versionModified: '1.5.4'\n },\n {\n id: 'Comfy.Workflow.ConfirmDelete',\n name: 'Show confirmation when deleting workflows',\n type: 'boolean',\n defaultValue: true,\n versionAdded: '1.5.6'\n }\n]\n","/**\n * TODO: Migrate scripts/ui/settings.ts here\n *\n * Currently the reactive settings act as a proxy of the legacy settings.\n * Every time a setting is changed, the settingStore dispatch the change to the\n * legacy settings. Every time the legacy settings are changed, the legacy\n * settings directly updates the settingStore.settingValues.\n */\n\nimport { ref, computed } from 'vue'\nimport { defineStore } from 'pinia'\nimport { app } from '@/scripts/app'\nimport { ComfySettingsDialog } from '@/scripts/ui/settings'\nimport type { Settings } from '@/types/apiTypes'\nimport type { SettingParams } from '@/types/settingTypes'\nimport type { TreeNode } from 'primevue/treenode'\nimport type { ComfyExtension } from '@/types/comfy'\nimport { buildTree } from '@/utils/treeUtil'\nimport { CORE_SETTINGS } from '@/constants/coreSettings'\n\nexport interface SettingTreeNode extends TreeNode {\n data?: SettingParams\n}\n\nexport const useSettingStore = defineStore('setting', () => {\n const settingValues = ref>({})\n const settings = ref>({})\n\n const settingTree = computed(() => {\n const root = buildTree(\n Object.values(settings.value).filter(\n (setting: SettingParams) => setting.type !== 'hidden'\n ),\n (setting: SettingParams) => setting.category || setting.id.split('.')\n )\n\n const floatingSettings = (root.children ?? []).filter((node) => node.leaf)\n if (floatingSettings.length) {\n root.children = (root.children ?? []).filter((node) => !node.leaf)\n root.children.push({\n key: 'Other',\n label: 'Other',\n leaf: false,\n children: floatingSettings\n })\n }\n\n return root\n })\n\n function addSettings(settingsDialog: ComfySettingsDialog) {\n for (const id in settingsDialog.settingsLookup) {\n const value = settingsDialog.getSettingValue(id)\n settingValues.value[id] = value\n }\n settings.value = settingsDialog.settingsParamLookup\n\n CORE_SETTINGS.forEach((setting: SettingParams) => {\n settingsDialog.addSetting(setting)\n })\n }\n\n function loadExtensionSettings(extension: ComfyExtension) {\n extension.settings?.forEach((setting: SettingParams) => {\n app.ui.settings.addSetting(setting)\n })\n }\n\n function exists(key: string) {\n return settingValues.value[key] !== undefined\n }\n\n async function set(key: K, value: Settings[K]) {\n settingValues.value[key] = value\n await app.ui.settings.setSettingValueAsync(key, value)\n }\n\n function get(key: K): Settings[K] {\n return (\n settingValues.value[key] ?? app.ui.settings.getSettingDefaultValue(key)\n )\n }\n\n return {\n settingValues,\n settings,\n settingTree,\n addSettings,\n loadExtensionSettings,\n set,\n get,\n exists\n }\n})\n","import type { Keybinding } from '@/types/keyBindingTypes'\n\nexport const CORE_KEYBINDINGS: Keybinding[] = [\n {\n combo: {\n ctrl: true,\n key: 'Enter'\n },\n commandId: 'Comfy.QueuePrompt'\n },\n {\n combo: {\n ctrl: true,\n shift: true,\n key: 'Enter'\n },\n commandId: 'Comfy.QueuePromptFront'\n },\n {\n combo: {\n ctrl: true,\n alt: true,\n key: 'Enter'\n },\n commandId: 'Comfy.Interrupt'\n },\n {\n combo: {\n key: 'r'\n },\n commandId: 'Comfy.RefreshNodeDefinitions'\n },\n {\n combo: {\n key: 'q'\n },\n commandId: 'Workspace.ToggleSidebarTab.queue'\n },\n {\n combo: {\n key: 'w'\n },\n commandId: 'Workspace.ToggleSidebarTab.workflows'\n },\n {\n combo: {\n key: 'n'\n },\n commandId: 'Workspace.ToggleSidebarTab.node-library'\n },\n {\n combo: {\n key: 'm'\n },\n commandId: 'Workspace.ToggleSidebarTab.model-library'\n },\n {\n combo: {\n key: 's',\n ctrl: true\n },\n commandId: 'Comfy.SaveWorkflow'\n },\n {\n combo: {\n key: 'o',\n ctrl: true\n },\n commandId: 'Comfy.OpenWorkflow'\n },\n {\n combo: {\n key: 'Backspace'\n },\n commandId: 'Comfy.ClearWorkflow'\n },\n {\n combo: {\n key: 'g',\n ctrl: true\n },\n commandId: 'Comfy.Graph.GroupSelectedNodes'\n },\n {\n combo: {\n key: ',',\n ctrl: true\n },\n commandId: 'Comfy.ShowSettingsDialog'\n },\n // For '=' both holding shift and not holding shift\n {\n combo: {\n key: '=',\n alt: true\n },\n commandId: 'Comfy.Canvas.ZoomIn',\n targetSelector: '#graph-canvas'\n },\n {\n combo: {\n key: '+',\n alt: true,\n shift: true\n },\n commandId: 'Comfy.Canvas.ZoomIn',\n targetSelector: '#graph-canvas'\n },\n // For number pad '+'\n {\n combo: {\n key: '+',\n alt: true\n },\n commandId: 'Comfy.Canvas.ZoomIn',\n targetSelector: '#graph-canvas'\n },\n {\n combo: {\n key: '-',\n alt: true\n },\n commandId: 'Comfy.Canvas.ZoomOut',\n targetSelector: '#graph-canvas'\n },\n {\n combo: {\n key: '.'\n },\n commandId: 'Comfy.Canvas.FitView',\n targetSelector: '#graph-canvas'\n },\n {\n combo: {\n key: 'p'\n },\n commandId: 'Comfy.Canvas.ToggleSelected.Pin',\n targetSelector: '#graph-canvas'\n },\n {\n combo: {\n key: 'c',\n alt: true\n },\n commandId: 'Comfy.Canvas.ToggleSelectedNodes.Collapse',\n targetSelector: '#graph-canvas'\n },\n {\n combo: {\n key: 'b',\n ctrl: true\n },\n commandId: 'Comfy.Canvas.ToggleSelectedNodes.Bypass',\n targetSelector: '#graph-canvas'\n },\n {\n combo: {\n key: 'm',\n ctrl: true\n },\n commandId: 'Comfy.Canvas.ToggleSelectedNodes.Mute',\n targetSelector: '#graph-canvas'\n },\n {\n combo: {\n key: '`',\n ctrl: true\n },\n commandId: 'Workspace.ToggleBottomPanelTab.logs-terminal'\n },\n {\n combo: {\n key: 'f'\n },\n commandId: 'Workspace.ToggleFocusMode'\n }\n]\n","import { defineStore } from 'pinia'\nimport { computed, Ref, ref, toRaw } from 'vue'\nimport { Keybinding, KeyCombo } from '@/types/keyBindingTypes'\nimport { useSettingStore } from './settingStore'\nimport { CORE_KEYBINDINGS } from '@/constants/coreKeybindings'\nimport type { ComfyExtension } from '@/types/comfy'\n\nexport class KeybindingImpl implements Keybinding {\n commandId: string\n combo: KeyComboImpl\n targetSelector?: string\n\n constructor(obj: Keybinding) {\n this.commandId = obj.commandId\n this.combo = new KeyComboImpl(obj.combo)\n this.targetSelector = obj.targetSelector\n }\n\n equals(other: unknown): boolean {\n const raw = toRaw(other)\n\n return raw instanceof KeybindingImpl\n ? this.commandId === raw.commandId &&\n this.combo.equals(raw.combo) &&\n this.targetSelector === raw.targetSelector\n : false\n }\n}\n\nexport class KeyComboImpl implements KeyCombo {\n key: string\n // ctrl or meta(cmd on mac)\n ctrl: boolean\n alt: boolean\n shift: boolean\n\n constructor(obj: KeyCombo) {\n this.key = obj.key\n this.ctrl = obj.ctrl ?? false\n this.alt = obj.alt ?? false\n this.shift = obj.shift ?? false\n }\n\n static fromEvent(event: KeyboardEvent) {\n return new KeyComboImpl({\n key: event.key,\n ctrl: event.ctrlKey || event.metaKey,\n alt: event.altKey,\n shift: event.shiftKey\n })\n }\n\n equals(other: unknown): boolean {\n const raw = toRaw(other)\n\n return raw instanceof KeyComboImpl\n ? this.key.toUpperCase() === raw.key.toUpperCase() &&\n this.ctrl === raw.ctrl &&\n this.alt === raw.alt &&\n this.shift === raw.shift\n : false\n }\n\n serialize(): string {\n return `${this.key.toUpperCase()}:${this.ctrl}:${this.alt}:${this.shift}`\n }\n\n toString(): string {\n return this.getKeySequences().join(' + ')\n }\n\n get hasModifier(): boolean {\n return this.ctrl || this.alt || this.shift\n }\n\n get isModifier(): boolean {\n return ['Control', 'Meta', 'Alt', 'Shift'].includes(this.key)\n }\n\n getKeySequences(): string[] {\n const sequences: string[] = []\n if (this.ctrl) {\n sequences.push('Ctrl')\n }\n if (this.alt) {\n sequences.push('Alt')\n }\n if (this.shift) {\n sequences.push('Shift')\n }\n sequences.push(this.key)\n return sequences\n }\n}\n\nexport const useKeybindingStore = defineStore('keybinding', () => {\n /**\n * Default keybindings provided by core and extensions.\n */\n const defaultKeybindings = ref>({})\n /**\n * User-defined keybindings.\n */\n const userKeybindings = ref>({})\n /**\n * User-defined keybindings that unset default keybindings.\n */\n const userUnsetKeybindings = ref>({})\n\n const keybindingByKeyCombo = computed>(() => {\n const result: Record = {\n ...defaultKeybindings.value\n }\n\n for (const keybinding of Object.values(userUnsetKeybindings.value)) {\n const serializedCombo = keybinding.combo.serialize()\n if (result[serializedCombo]?.equals(keybinding)) {\n delete result[serializedCombo]\n }\n }\n\n return {\n ...result,\n ...userKeybindings.value\n }\n })\n\n const keybindings = computed(() =>\n Object.values(keybindingByKeyCombo.value)\n )\n\n function getKeybinding(combo: KeyComboImpl) {\n return keybindingByKeyCombo.value[combo.serialize()]\n }\n\n function createKeybindingsByCommandId(keybindings: KeybindingImpl[]) {\n const result: Record = {}\n for (const keybinding of keybindings) {\n if (!(keybinding.commandId in result)) {\n result[keybinding.commandId] = []\n }\n result[keybinding.commandId].push(keybinding)\n }\n return result\n }\n\n const keybindingsByCommandId = computed>(\n () => {\n return createKeybindingsByCommandId(keybindings.value)\n }\n )\n\n function getKeybindingsByCommandId(commandId: string) {\n return keybindingsByCommandId.value[commandId] ?? []\n }\n\n const defaultKeybindingsByCommandId = computed<\n Record\n >(() => {\n return createKeybindingsByCommandId(Object.values(defaultKeybindings.value))\n })\n\n function getKeybindingByCommandId(commandId: string) {\n return getKeybindingsByCommandId(commandId)[0]\n }\n\n function addKeybinding(\n target: Ref>,\n keybinding: KeybindingImpl,\n { existOk = false }: { existOk: boolean }\n ) {\n if (!existOk && keybinding.combo.serialize() in target.value) {\n throw new Error(\n `Keybinding on ${keybinding.combo} already exists on ${\n target.value[keybinding.combo.serialize()].commandId\n }`\n )\n }\n target.value[keybinding.combo.serialize()] = keybinding\n }\n\n function addDefaultKeybinding(keybinding: KeybindingImpl) {\n addKeybinding(defaultKeybindings, keybinding, { existOk: false })\n }\n\n function addUserKeybinding(keybinding: KeybindingImpl) {\n const defaultKeybinding =\n defaultKeybindings.value[keybinding.combo.serialize()]\n const userUnsetKeybinding =\n userUnsetKeybindings.value[keybinding.combo.serialize()]\n\n // User is adding back a keybinding that was an unsetted default keybinding.\n if (\n keybinding.equals(defaultKeybinding) &&\n keybinding.equals(userUnsetKeybinding)\n ) {\n delete userUnsetKeybindings.value[keybinding.combo.serialize()]\n return\n }\n\n // Unset keybinding on default keybinding if it exists and is not the same as userUnsetKeybinding\n if (defaultKeybinding && !defaultKeybinding.equals(userUnsetKeybinding)) {\n unsetKeybinding(defaultKeybinding)\n }\n\n addKeybinding(userKeybindings, keybinding, { existOk: true })\n }\n\n function unsetKeybinding(keybinding: KeybindingImpl) {\n const serializedCombo = keybinding.combo.serialize()\n if (!(serializedCombo in keybindingByKeyCombo.value)) {\n console.warn(\n `Trying to unset non-exist keybinding: ${JSON.stringify(keybinding)}`\n )\n return\n }\n\n if (userKeybindings.value[serializedCombo]?.equals(keybinding)) {\n delete userKeybindings.value[serializedCombo]\n return\n }\n\n if (defaultKeybindings.value[serializedCombo]?.equals(keybinding)) {\n addKeybinding(userUnsetKeybindings, keybinding, { existOk: false })\n return\n }\n\n throw new Error(`Unknown keybinding: ${JSON.stringify(keybinding)}`)\n }\n\n /**\n * Update the keybinding on given command if it is different from the current keybinding.\n *\n * @returns true if the keybinding is updated, false otherwise.\n */\n function updateKeybindingOnCommand(keybinding: KeybindingImpl): boolean {\n const currentKeybinding = getKeybindingByCommandId(keybinding.commandId)\n if (currentKeybinding?.equals(keybinding)) {\n return false\n }\n if (currentKeybinding) {\n unsetKeybinding(currentKeybinding)\n }\n addUserKeybinding(keybinding)\n return true\n }\n\n function loadUserKeybindings() {\n const settingStore = useSettingStore()\n // Unset bindings first as new bindings might conflict with default bindings.\n const unsetBindings = settingStore.get('Comfy.Keybinding.UnsetBindings')\n for (const keybinding of unsetBindings) {\n unsetKeybinding(new KeybindingImpl(keybinding))\n }\n const newBindings = settingStore.get('Comfy.Keybinding.NewBindings')\n for (const keybinding of newBindings) {\n addUserKeybinding(new KeybindingImpl(keybinding))\n }\n }\n\n function loadCoreKeybindings() {\n for (const keybinding of CORE_KEYBINDINGS) {\n addDefaultKeybinding(new KeybindingImpl(keybinding))\n }\n }\n\n function loadExtensionKeybindings(extension: ComfyExtension) {\n if (extension.keybindings) {\n for (const keybinding of extension.keybindings) {\n try {\n addDefaultKeybinding(new KeybindingImpl(keybinding))\n } catch (error) {\n console.warn(\n `Failed to load keybinding for extension ${extension.name}`,\n error\n )\n }\n }\n }\n }\n\n async function persistUserKeybindings() {\n const settingStore = useSettingStore()\n // TODO(https://github.com/Comfy-Org/ComfyUI_frontend/issues/1079):\n // Allow setting multiple values at once in settingStore\n await settingStore.set(\n 'Comfy.Keybinding.NewBindings',\n Object.values(userKeybindings.value)\n )\n await settingStore.set(\n 'Comfy.Keybinding.UnsetBindings',\n Object.values(userUnsetKeybindings.value)\n )\n }\n\n function resetKeybindings() {\n userKeybindings.value = {}\n userUnsetKeybindings.value = {}\n }\n\n function isCommandKeybindingModified(commandId: string): boolean {\n const currentKeybinding: KeybindingImpl | undefined =\n getKeybindingByCommandId(commandId)\n const defaultKeybinding: KeybindingImpl | undefined =\n defaultKeybindingsByCommandId.value[commandId]?.[0]\n\n return !(\n (currentKeybinding === undefined && defaultKeybinding === undefined) ||\n currentKeybinding?.equals(defaultKeybinding)\n )\n }\n\n return {\n keybindings,\n getKeybinding,\n getKeybindingsByCommandId,\n getKeybindingByCommandId,\n addDefaultKeybinding,\n addUserKeybinding,\n unsetKeybinding,\n updateKeybindingOnCommand,\n loadUserKeybindings,\n loadCoreKeybindings,\n loadExtensionKeybindings,\n persistUserKeybindings,\n resetKeybindings,\n isCommandKeybindingModified\n }\n})\n","import { defineStore } from 'pinia'\nimport { computed, ref } from 'vue'\nimport type { ComfyExtension } from '@/types/comfy'\nimport { useErrorHandling } from '@/hooks/errorHooks'\nimport { type KeybindingImpl, useKeybindingStore } from './keybindingStore'\n\nexport interface ComfyCommand {\n id: string\n function: () => void | Promise\n\n label?: string | (() => string)\n icon?: string | (() => string)\n tooltip?: string | (() => string)\n /** Menubar item label, if different from command label */\n menubarLabel?: string | (() => string)\n versionAdded?: string\n /** If non-nullish, this command will prompt for confirmation. */\n confirmation?: string\n}\n\nexport class ComfyCommandImpl implements ComfyCommand {\n id: string\n function: () => void | Promise\n _label?: string | (() => string)\n _icon?: string | (() => string)\n _tooltip?: string | (() => string)\n _menubarLabel?: string | (() => string)\n versionAdded?: string\n confirmation?: string\n\n constructor(command: ComfyCommand) {\n this.id = command.id\n this.function = command.function\n this._label = command.label\n this._icon = command.icon\n this._tooltip = command.tooltip\n this._menubarLabel = command.menubarLabel ?? command.label\n this.versionAdded = command.versionAdded\n this.confirmation = command.confirmation\n }\n\n get label() {\n return typeof this._label === 'function' ? this._label() : this._label\n }\n\n get icon() {\n return typeof this._icon === 'function' ? this._icon() : this._icon\n }\n\n get tooltip() {\n return typeof this._tooltip === 'function' ? this._tooltip() : this._tooltip\n }\n\n get menubarLabel() {\n return typeof this._menubarLabel === 'function'\n ? this._menubarLabel()\n : this._menubarLabel\n }\n\n get keybinding(): KeybindingImpl | null {\n return useKeybindingStore().getKeybindingByCommandId(this.id)\n }\n}\n\nexport const useCommandStore = defineStore('command', () => {\n const commandsById = ref>({})\n const commands = computed(() => Object.values(commandsById.value))\n\n const registerCommand = (command: ComfyCommand) => {\n if (commandsById.value[command.id]) {\n console.warn(`Command ${command.id} already registered`)\n }\n commandsById.value[command.id] = new ComfyCommandImpl(command)\n }\n\n const registerCommands = (commands: ComfyCommand[]) => {\n for (const command of commands) {\n registerCommand(command)\n }\n }\n\n const getCommand = (command: string) => {\n return commandsById.value[command]\n }\n\n const { wrapWithErrorHandlingAsync } = useErrorHandling()\n const execute = async (\n commandId: string,\n errorHandler?: (error: any) => void\n ) => {\n const command = getCommand(commandId)\n if (command) {\n await wrapWithErrorHandlingAsync(command.function, errorHandler)()\n } else {\n throw new Error(`Command ${commandId} not found`)\n }\n }\n\n const isRegistered = (command: string) => {\n return !!commandsById.value[command]\n }\n\n const loadExtensionCommands = (extension: ComfyExtension) => {\n if (extension.commands) {\n for (const command of extension.commands) {\n registerCommand(command)\n }\n }\n }\n\n return {\n commands,\n execute,\n getCommand,\n registerCommand,\n registerCommands,\n isRegistered,\n loadExtensionCommands\n }\n})\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-tree {\\n background: \".concat(dt('tree.background'), \";\\n color: \").concat(dt('tree.color'), \";\\n padding: \").concat(dt('tree.padding'), \";\\n}\\n\\n.p-tree-root-children,\\n.p-tree-node-children {\\n display: flex;\\n list-style-type: none;\\n flex-direction: column;\\n margin: 0;\\n gap: \").concat(dt('tree.gap'), \";\\n}\\n\\n.p-tree-root-children {\\n padding: \").concat(dt('tree.gap'), \" 0 0 0;\\n}\\n\\n.p-tree-node-children {\\n padding: \").concat(dt('tree.gap'), \" 0 0 \").concat(dt('tree.indent'), \";\\n}\\n\\n.p-tree-node {\\n padding: 0;\\n outline: 0 none;\\n}\\n\\n.p-tree-node-content {\\n border-radius: \").concat(dt('tree.node.border.radius'), \";\\n padding: \").concat(dt('tree.node.padding'), \";\\n display: flex;\\n align-items: center;\\n outline-color: transparent;\\n color: \").concat(dt('tree.node.color'), \";\\n gap: \").concat(dt('tree.node.gap'), \";\\n transition: background \").concat(dt('tree.transition.duration'), \", color \").concat(dt('tree.transition.duration'), \", outline-color \").concat(dt('tree.transition.duration'), \", box-shadow \").concat(dt('tree.transition.duration'), \";\\n}\\n\\n.p-tree-node:focus-visible > .p-tree-node-content {\\n box-shadow: \").concat(dt('tree.node.focus.ring.shadow'), \";\\n outline: \").concat(dt('tree.node.focus.ring.width'), \" \").concat(dt('tree.node.focus.ring.style'), \" \").concat(dt('tree.node.focus.ring.color'), \";\\n outline-offset: \").concat(dt('tree.node.focus.ring.offset'), \";\\n}\\n\\n.p-tree-node-content.p-tree-node-selectable:not(.p-tree-node-selected):hover {\\n background: \").concat(dt('tree.node.hover.background'), \";\\n color: \").concat(dt('tree.node.hover.color'), \";\\n}\\n\\n.p-tree-node-content.p-tree-node-selectable:not(.p-tree-node-selected):hover .p-tree-node-icon {\\n color: \").concat(dt('tree.node.icon.hover.color'), \";\\n}\\n\\n.p-tree-node-content.p-tree-node-selected {\\n background: \").concat(dt('tree.node.selected.background'), \";\\n color: \").concat(dt('tree.node.selected.color'), \";\\n}\\n\\n.p-tree-node-content.p-tree-node-selected .p-tree-node-toggle-button {\\n color: inherit;\\n}\\n\\n.p-tree-node-toggle-button {\\n cursor: pointer;\\n user-select: none;\\n display: inline-flex;\\n align-items: center;\\n justify-content: center;\\n overflow: hidden;\\n position: relative;\\n flex-shrink: 0;\\n width: \").concat(dt('tree.node.toggle.button.size'), \";\\n height: \").concat(dt('tree.node.toggle.button.size'), \";\\n color: \").concat(dt('tree.node.toggle.button.color'), \";\\n border: 0 none;\\n background: transparent;\\n border-radius: \").concat(dt('tree.node.toggle.button.border.radius'), \";\\n transition: background \").concat(dt('tree.transition.duration'), \", color \").concat(dt('tree.transition.duration'), \", border-color \").concat(dt('tree.transition.duration'), \", outline-color \").concat(dt('tree.transition.duration'), \", box-shadow \").concat(dt('tree.transition.duration'), \";\\n outline-color: transparent;\\n padding: 0;\\n}\\n\\n.p-tree-node-toggle-button:enabled:hover {\\n background: \").concat(dt('tree.node.toggle.button.hover.background'), \";\\n color: \").concat(dt('tree.node.toggle.button.hover.color'), \";\\n}\\n\\n.p-tree-node-content.p-tree-node-selected .p-tree-node-toggle-button:hover {\\n background: \").concat(dt('tree.node.toggle.button.selected.hover.background'), \";\\n color: \").concat(dt('tree.node.toggle.button.selected.hover.color'), \";\\n}\\n\\n.p-tree-root {\\n overflow: auto;\\n}\\n\\n.p-tree-node-selectable {\\n cursor: pointer;\\n user-select: none;\\n}\\n\\n.p-tree-node-leaf > .p-tree-node-content .p-tree-node-toggle-button {\\n visibility: hidden;\\n}\\n\\n.p-tree-node-icon {\\n color: \").concat(dt('tree.node.icon.color'), \";\\n transition: color \").concat(dt('tree.transition.duration'), \";\\n}\\n\\n.p-tree-node-content.p-tree-node-selected .p-tree-node-icon {\\n color: \").concat(dt('tree.node.icon.selected.color'), \";\\n}\\n\\n.p-tree-filter-input {\\n width: 100%;\\n}\\n\\n.p-tree-loading {\\n position: relative;\\n height: 100%;\\n}\\n\\n.p-tree-loading-icon {\\n font-size: \").concat(dt('tree.loading.icon.size'), \";\\n width: \").concat(dt('tree.loading.icon.size'), \";\\n height: \").concat(dt('tree.loading.icon.size'), \";\\n}\\n\\n.p-tree .p-tree-mask {\\n position: absolute;\\n z-index: 1;\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n}\\n\\n.p-tree-flex-scrollable {\\n display: flex;\\n flex: 1;\\n height: 100%;\\n flex-direction: column;\\n}\\n\\n.p-tree-flex-scrollable .p-tree-root {\\n flex: 1;\\n}\\n\");\n};\nvar classes = {\n root: function root(_ref2) {\n var props = _ref2.props;\n return ['p-tree p-component', {\n 'p-tree-selectable': props.selectionMode != null,\n 'p-tree-loading': props.loading,\n 'p-tree-flex-scrollable': props.scrollHeight === 'flex'\n }];\n },\n mask: 'p-tree-mask p-overlay-mask',\n loadingIcon: 'p-tree-loading-icon',\n pcFilterInput: 'p-tree-filter-input',\n wrapper: 'p-tree-root',\n //TODO: discuss\n rootChildren: 'p-tree-root-children',\n node: function node(_ref3) {\n var instance = _ref3.instance;\n return ['p-tree-node', {\n 'p-tree-node-leaf': instance.leaf\n }];\n },\n nodeContent: function nodeContent(_ref4) {\n var instance = _ref4.instance;\n return ['p-tree-node-content', instance.node.styleClass, {\n 'p-tree-node-selectable': instance.selectable,\n 'p-tree-node-selected': instance.checkboxMode && instance.$parentInstance.highlightOnSelect ? instance.checked : instance.selected\n }];\n },\n nodeToggleButton: 'p-tree-node-toggle-button',\n nodeToggleIcon: 'p-tree-node-toggle-icon',\n nodeCheckbox: 'p-tree-node-checkbox',\n nodeIcon: 'p-tree-node-icon',\n nodeLabel: 'p-tree-node-label',\n nodeChildren: 'p-tree-node-children'\n};\nvar TreeStyle = BaseStyle.extend({\n name: 'tree',\n theme: theme,\n classes: classes\n});\n\nexport { TreeStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseIcon from '@primevue/icons/baseicon';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode } from 'vue';\n\nvar script = {\n name: 'MinusIcon',\n \"extends\": BaseIcon\n};\n\nvar _hoisted_1 = /*#__PURE__*/createElementVNode(\"path\", {\n d: \"M13.2222 7.77778H0.777778C0.571498 7.77778 0.373667 7.69584 0.227806 7.54998C0.0819442 7.40412 0 7.20629 0 7.00001C0 6.79373 0.0819442 6.5959 0.227806 6.45003C0.373667 6.30417 0.571498 6.22223 0.777778 6.22223H13.2222C13.4285 6.22223 13.6263 6.30417 13.7722 6.45003C13.9181 6.5959 14 6.79373 14 7.00001C14 7.20629 13.9181 7.40412 13.7722 7.54998C13.6263 7.69584 13.4285 7.77778 13.2222 7.77778Z\",\n fill: \"currentColor\"\n}, null, -1);\nvar _hoisted_2 = [_hoisted_1];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"svg\", mergeProps({\n width: \"14\",\n height: \"14\",\n viewBox: \"0 0 14 14\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, _ctx.pti()), _hoisted_2, 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-checkbox {\\n position: relative;\\n display: inline-flex;\\n user-select: none;\\n vertical-align: bottom;\\n width: \".concat(dt('checkbox.width'), \";\\n height: \").concat(dt('checkbox.height'), \";\\n}\\n\\n.p-checkbox-input {\\n cursor: pointer;\\n appearance: none;\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 100%;\\n height: 100%;\\n padding: 0;\\n margin: 0;\\n opacity: 0;\\n z-index: 1;\\n outline: 0 none;\\n border: 1px solid transparent;\\n border-radius: \").concat(dt('checkbox.border.radius'), \";\\n}\\n\\n.p-checkbox-box {\\n display: flex;\\n justify-content: center;\\n align-items: center;\\n border-radius: \").concat(dt('checkbox.border.radius'), \";\\n border: 1px solid \").concat(dt('checkbox.border.color'), \";\\n background: \").concat(dt('checkbox.background'), \";\\n width: \").concat(dt('checkbox.width'), \";\\n height: \").concat(dt('checkbox.height'), \";\\n transition: background \").concat(dt('checkbox.transition.duration'), \", color \").concat(dt('checkbox.transition.duration'), \", border-color \").concat(dt('checkbox.transition.duration'), \", box-shadow \").concat(dt('checkbox.transition.duration'), \", outline-color \").concat(dt('checkbox.transition.duration'), \";\\n outline-color: transparent;\\n box-shadow: \").concat(dt('checkbox.shadow'), \";\\n}\\n\\n.p-checkbox-icon {\\n transition-duration: \").concat(dt('checkbox.transition.duration'), \";\\n color: \").concat(dt('checkbox.icon.color'), \";\\n font-size: \").concat(dt('checkbox.icon.size'), \";\\n width: \").concat(dt('checkbox.icon.size'), \";\\n height: \").concat(dt('checkbox.icon.size'), \";\\n}\\n\\n.p-checkbox:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-box {\\n border-color: \").concat(dt('checkbox.hover.border.color'), \";\\n}\\n\\n.p-checkbox-checked .p-checkbox-box {\\n border-color: \").concat(dt('checkbox.checked.border.color'), \";\\n background: \").concat(dt('checkbox.checked.background'), \";\\n}\\n\\n.p-checkbox-checked .p-checkbox-icon {\\n color: \").concat(dt('checkbox.icon.checked.color'), \";\\n}\\n\\n.p-checkbox-checked:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-box {\\n background: \").concat(dt('checkbox.checked.hover.background'), \";\\n border-color: \").concat(dt('checkbox.checked.hover.border.color'), \";\\n}\\n\\n.p-checkbox-checked:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-icon {\\n color: \").concat(dt('checkbox.icon.checked.hover.color'), \";\\n}\\n\\n.p-checkbox:not(.p-disabled):has(.p-checkbox-input:focus-visible) .p-checkbox-box {\\n border-color: \").concat(dt('checkbox.focus.border.color'), \";\\n box-shadow: \").concat(dt('checkbox.focus.ring.shadow'), \";\\n outline: \").concat(dt('checkbox.focus.ring.width'), \" \").concat(dt('checkbox.focus.ring.style'), \" \").concat(dt('checkbox.focus.ring.color'), \";\\n outline-offset: \").concat(dt('checkbox.focus.ring.offset'), \";\\n}\\n\\n.p-checkbox-checked:not(.p-disabled):has(.p-checkbox-input:focus-visible) .p-checkbox-box {\\n border-color: \").concat(dt('checkbox.checked.focus.border.color'), \";\\n}\\n\\n.p-checkbox.p-invalid > .p-checkbox-box {\\n border-color: \").concat(dt('checkbox.invalid.border.color'), \";\\n}\\n\\n.p-checkbox.p-variant-filled .p-checkbox-box {\\n background: \").concat(dt('checkbox.filled.background'), \";\\n}\\n\\n.p-checkbox-checked.p-variant-filled .p-checkbox-box {\\n background: \").concat(dt('checkbox.checked.background'), \";\\n}\\n\\n.p-checkbox-checked.p-variant-filled:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-box {\\n background: \").concat(dt('checkbox.checked.hover.background'), \";\\n}\\n\\n.p-checkbox.p-disabled {\\n opacity: 1;\\n}\\n\\n.p-checkbox.p-disabled .p-checkbox-box {\\n background: \").concat(dt('checkbox.disabled.background'), \";\\n border-color: \").concat(dt('checkbox.checked.disabled.border.color'), \";\\n}\\n\\n.p-checkbox.p-disabled .p-checkbox-box .p-checkbox-icon {\\n color: \").concat(dt('checkbox.icon.disabled.color'), \";\\n}\\n\");\n};\nvar classes = {\n root: function root(_ref2) {\n var instance = _ref2.instance,\n props = _ref2.props;\n return ['p-checkbox p-component', {\n 'p-checkbox-checked': instance.checked,\n 'p-disabled': props.disabled,\n 'p-invalid': props.invalid,\n 'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled' || instance.$primevue.config.inputVariant === 'filled'\n }];\n },\n box: 'p-checkbox-box',\n input: 'p-checkbox-input',\n icon: 'p-checkbox-icon'\n};\nvar CheckboxStyle = BaseStyle.extend({\n name: 'checkbox',\n theme: theme,\n classes: classes\n});\n\nexport { CheckboxStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import { equals, contains } from '@primeuix/utils/object';\nimport CheckIcon from '@primevue/icons/check';\nimport MinusIcon from '@primevue/icons/minus';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport CheckboxStyle from 'primevue/checkbox/style';\nimport { resolveComponent, openBlock, createElementBlock, mergeProps, createElementVNode, renderSlot, normalizeClass, createBlock, createCommentVNode } from 'vue';\n\nvar script$1 = {\n name: 'BaseCheckbox',\n \"extends\": BaseComponent,\n props: {\n value: null,\n modelValue: null,\n binary: Boolean,\n name: {\n type: String,\n \"default\": null\n },\n indeterminate: {\n type: Boolean,\n \"default\": false\n },\n trueValue: {\n type: null,\n \"default\": true\n },\n falseValue: {\n type: null,\n \"default\": false\n },\n variant: {\n type: String,\n \"default\": null\n },\n invalid: {\n type: Boolean,\n \"default\": false\n },\n disabled: {\n type: Boolean,\n \"default\": false\n },\n readonly: {\n type: Boolean,\n \"default\": false\n },\n required: {\n type: Boolean,\n \"default\": false\n },\n tabindex: {\n type: Number,\n \"default\": null\n },\n inputId: {\n type: String,\n \"default\": null\n },\n inputClass: {\n type: [String, Object],\n \"default\": null\n },\n inputStyle: {\n type: Object,\n \"default\": null\n },\n ariaLabelledby: {\n type: String,\n \"default\": null\n },\n ariaLabel: {\n type: String,\n \"default\": null\n }\n },\n style: CheckboxStyle,\n provide: function provide() {\n return {\n $pcCheckbox: this,\n $parentInstance: this\n };\n }\n};\n\nfunction _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _iterableToArray(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nvar script = {\n name: 'Checkbox',\n \"extends\": script$1,\n inheritAttrs: false,\n emits: ['update:modelValue', 'change', 'focus', 'blur', 'update:indeterminate'],\n data: function data() {\n return {\n d_indeterminate: this.indeterminate\n };\n },\n watch: {\n indeterminate: function indeterminate(newValue) {\n this.d_indeterminate = newValue;\n }\n },\n methods: {\n getPTOptions: function getPTOptions(key) {\n var _ptm = key === 'root' ? this.ptmi : this.ptm;\n return _ptm(key, {\n context: {\n checked: this.checked,\n indeterminate: this.d_indeterminate,\n disabled: this.disabled\n }\n });\n },\n onChange: function onChange(event) {\n var _this = this;\n if (!this.disabled && !this.readonly) {\n var newModelValue;\n if (this.binary) {\n newModelValue = this.d_indeterminate ? this.trueValue : this.checked ? this.falseValue : this.trueValue;\n } else {\n if (this.checked || this.d_indeterminate) newModelValue = this.modelValue.filter(function (val) {\n return !equals(val, _this.value);\n });else newModelValue = this.modelValue ? [].concat(_toConsumableArray(this.modelValue), [this.value]) : [this.value];\n }\n if (this.d_indeterminate) {\n this.d_indeterminate = false;\n this.$emit('update:indeterminate', this.d_indeterminate);\n }\n this.$emit('update:modelValue', newModelValue);\n this.$emit('change', event);\n }\n },\n onFocus: function onFocus(event) {\n this.$emit('focus', event);\n },\n onBlur: function onBlur(event) {\n this.$emit('blur', event);\n }\n },\n computed: {\n checked: function checked() {\n return this.d_indeterminate ? false : this.binary ? this.modelValue === this.trueValue : contains(this.value, this.modelValue);\n }\n },\n components: {\n CheckIcon: CheckIcon,\n MinusIcon: MinusIcon\n }\n};\n\nvar _hoisted_1 = [\"data-p-checked\", \"data-p-indeterminate\", \"data-p-disabled\"];\nvar _hoisted_2 = [\"id\", \"value\", \"name\", \"checked\", \"tabindex\", \"disabled\", \"readonly\", \"required\", \"aria-labelledby\", \"aria-label\", \"aria-invalid\", \"aria-checked\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_CheckIcon = resolveComponent(\"CheckIcon\");\n var _component_MinusIcon = resolveComponent(\"MinusIcon\");\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root')\n }, $options.getPTOptions('root'), {\n \"data-p-checked\": $options.checked,\n \"data-p-indeterminate\": $data.d_indeterminate || undefined,\n \"data-p-disabled\": _ctx.disabled\n }), [createElementVNode(\"input\", mergeProps({\n id: _ctx.inputId,\n type: \"checkbox\",\n \"class\": [_ctx.cx('input'), _ctx.inputClass],\n style: _ctx.inputStyle,\n value: _ctx.value,\n name: _ctx.name,\n checked: $options.checked,\n tabindex: _ctx.tabindex,\n disabled: _ctx.disabled,\n readonly: _ctx.readonly,\n required: _ctx.required,\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-label\": _ctx.ariaLabel,\n \"aria-invalid\": _ctx.invalid || undefined,\n \"aria-checked\": $data.d_indeterminate ? 'mixed' : undefined,\n onFocus: _cache[0] || (_cache[0] = function () {\n return $options.onFocus && $options.onFocus.apply($options, arguments);\n }),\n onBlur: _cache[1] || (_cache[1] = function () {\n return $options.onBlur && $options.onBlur.apply($options, arguments);\n }),\n onChange: _cache[2] || (_cache[2] = function () {\n return $options.onChange && $options.onChange.apply($options, arguments);\n })\n }, $options.getPTOptions('input')), null, 16, _hoisted_2), createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('box')\n }, $options.getPTOptions('box')), [renderSlot(_ctx.$slots, \"icon\", {\n checked: $options.checked,\n indeterminate: $data.d_indeterminate,\n \"class\": normalizeClass(_ctx.cx('icon'))\n }, function () {\n return [$options.checked ? (openBlock(), createBlock(_component_CheckIcon, mergeProps({\n key: 0,\n \"class\": _ctx.cx('icon')\n }, $options.getPTOptions('icon')), null, 16, [\"class\"])) : $data.d_indeterminate ? (openBlock(), createBlock(_component_MinusIcon, mergeProps({\n key: 1,\n \"class\": _ctx.cx('icon')\n }, $options.getPTOptions('icon')), null, 16, [\"class\"])) : createCommentVNode(\"\", true)];\n })], 16)], 16, _hoisted_1);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import { resolveFieldData } from '@primeuix/utils/object';\nimport SearchIcon from '@primevue/icons/search';\nimport SpinnerIcon from '@primevue/icons/spinner';\nimport IconField from 'primevue/iconfield';\nimport InputIcon from 'primevue/inputicon';\nimport InputText from 'primevue/inputtext';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport TreeStyle from 'primevue/tree/style';\nimport { getAttribute, findSingle, find } from '@primeuix/utils/dom';\nimport CheckIcon from '@primevue/icons/check';\nimport ChevronDownIcon from '@primevue/icons/chevrondown';\nimport ChevronRightIcon from '@primevue/icons/chevronright';\nimport MinusIcon from '@primevue/icons/minus';\nimport Checkbox from 'primevue/checkbox';\nimport Ripple from 'primevue/ripple';\nimport { resolveComponent, resolveDirective, openBlock, createElementBlock, mergeProps, createElementVNode, withDirectives, Fragment, createBlock, resolveDynamicComponent, normalizeClass, withCtx, createCommentVNode, withModifiers, createTextVNode, toDisplayString, renderList, renderSlot, createVNode } from 'vue';\n\nvar script$2 = {\n name: 'BaseTree',\n \"extends\": BaseComponent,\n props: {\n value: {\n type: null,\n \"default\": null\n },\n expandedKeys: {\n type: null,\n \"default\": null\n },\n selectionKeys: {\n type: null,\n \"default\": null\n },\n selectionMode: {\n type: String,\n \"default\": null\n },\n metaKeySelection: {\n type: Boolean,\n \"default\": false\n },\n loading: {\n type: Boolean,\n \"default\": false\n },\n loadingIcon: {\n type: String,\n \"default\": undefined\n },\n loadingMode: {\n type: String,\n \"default\": 'mask'\n },\n filter: {\n type: Boolean,\n \"default\": false\n },\n filterBy: {\n type: String,\n \"default\": 'label'\n },\n filterMode: {\n type: String,\n \"default\": 'lenient'\n },\n filterPlaceholder: {\n type: String,\n \"default\": null\n },\n filterLocale: {\n type: String,\n \"default\": undefined\n },\n highlightOnSelect: {\n type: Boolean,\n \"default\": false\n },\n scrollHeight: {\n type: String,\n \"default\": null\n },\n level: {\n type: Number,\n \"default\": 0\n },\n ariaLabelledby: {\n type: String,\n \"default\": null\n },\n ariaLabel: {\n type: String,\n \"default\": null\n }\n },\n style: TreeStyle,\n provide: function provide() {\n return {\n $pcTree: this,\n $parentInstance: this\n };\n }\n};\n\nfunction _typeof$1(o) { \"@babel/helpers - typeof\"; return _typeof$1 = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof$1(o); }\nfunction _createForOfIteratorHelper$1(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t[\"return\"] || t[\"return\"](); } finally { if (u) throw o; } } }; }\nfunction ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty$1(e, r, t) { return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey$1(t) { var i = _toPrimitive$1(t, \"string\"); return \"symbol\" == _typeof$1(i) ? i : i + \"\"; }\nfunction _toPrimitive$1(t, r) { if (\"object\" != _typeof$1(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof$1(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _toConsumableArray$1(r) { return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread$1(); }\nfunction _nonIterableSpread$1() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray$1(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }\nfunction _iterableToArray$1(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles$1(r) { if (Array.isArray(r)) return _arrayLikeToArray$1(r); }\nfunction _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nvar script$1 = {\n name: 'TreeNode',\n hostName: 'Tree',\n \"extends\": BaseComponent,\n emits: ['node-toggle', 'node-click', 'checkbox-change'],\n props: {\n node: {\n type: null,\n \"default\": null\n },\n expandedKeys: {\n type: null,\n \"default\": null\n },\n loadingMode: {\n type: String,\n \"default\": 'mask'\n },\n selectionKeys: {\n type: null,\n \"default\": null\n },\n selectionMode: {\n type: String,\n \"default\": null\n },\n templates: {\n type: null,\n \"default\": null\n },\n level: {\n type: Number,\n \"default\": null\n },\n index: null\n },\n nodeTouched: false,\n toggleClicked: false,\n mounted: function mounted() {\n this.setAllNodesTabIndexes();\n },\n methods: {\n toggle: function toggle() {\n this.$emit('node-toggle', this.node);\n this.toggleClicked = true;\n },\n label: function label(node) {\n return typeof node.label === 'function' ? node.label() : node.label;\n },\n onChildNodeToggle: function onChildNodeToggle(node) {\n this.$emit('node-toggle', node);\n },\n getPTOptions: function getPTOptions(key) {\n return this.ptm(key, {\n context: {\n index: this.index,\n expanded: this.expanded,\n selected: this.selected,\n checked: this.checked,\n leaf: this.leaf\n }\n });\n },\n onClick: function onClick(event) {\n if (this.toggleClicked || getAttribute(event.target, '[data-pc-section=\"nodetogglebutton\"]') || getAttribute(event.target.parentElement, '[data-pc-section=\"nodetogglebutton\"]')) {\n this.toggleClicked = false;\n return;\n }\n if (this.isCheckboxSelectionMode()) {\n if (this.node.selectable != false) {\n this.toggleCheckbox();\n }\n } else {\n this.$emit('node-click', {\n originalEvent: event,\n nodeTouched: this.nodeTouched,\n node: this.node\n });\n }\n this.nodeTouched = false;\n },\n onChildNodeClick: function onChildNodeClick(event) {\n this.$emit('node-click', event);\n },\n onTouchEnd: function onTouchEnd() {\n this.nodeTouched = true;\n },\n onKeyDown: function onKeyDown(event) {\n if (!this.isSameNode(event)) return;\n switch (event.code) {\n case 'Tab':\n this.onTabKey(event);\n break;\n case 'ArrowDown':\n this.onArrowDown(event);\n break;\n case 'ArrowUp':\n this.onArrowUp(event);\n break;\n case 'ArrowRight':\n this.onArrowRight(event);\n break;\n case 'ArrowLeft':\n this.onArrowLeft(event);\n break;\n case 'Enter':\n case 'NumpadEnter':\n case 'Space':\n this.onEnterKey(event);\n break;\n }\n },\n onArrowDown: function onArrowDown(event) {\n var nodeElement = event.target.getAttribute('data-pc-section') === 'nodetogglebutton' ? event.target.closest('[role=\"treeitem\"]') : event.target;\n var listElement = nodeElement.children[1];\n if (listElement) {\n this.focusRowChange(nodeElement, listElement.children[0]);\n } else {\n if (nodeElement.nextElementSibling) {\n this.focusRowChange(nodeElement, nodeElement.nextElementSibling);\n } else {\n var nextSiblingAncestor = this.findNextSiblingOfAncestor(nodeElement);\n if (nextSiblingAncestor) {\n this.focusRowChange(nodeElement, nextSiblingAncestor);\n }\n }\n }\n event.preventDefault();\n },\n onArrowUp: function onArrowUp(event) {\n var nodeElement = event.target;\n if (nodeElement.previousElementSibling) {\n this.focusRowChange(nodeElement, nodeElement.previousElementSibling, this.findLastVisibleDescendant(nodeElement.previousElementSibling));\n } else {\n var parentNodeElement = this.getParentNodeElement(nodeElement);\n if (parentNodeElement) {\n this.focusRowChange(nodeElement, parentNodeElement);\n }\n }\n event.preventDefault();\n },\n onArrowRight: function onArrowRight(event) {\n var _this = this;\n if (this.leaf || this.expanded) return;\n event.currentTarget.tabIndex = -1;\n this.$emit('node-toggle', this.node);\n this.$nextTick(function () {\n _this.onArrowDown(event);\n });\n },\n onArrowLeft: function onArrowLeft(event) {\n var togglerElement = findSingle(event.currentTarget, '[data-pc-section=\"nodetogglebutton\"]');\n if (this.level === 0 && !this.expanded) {\n return false;\n }\n if (this.expanded && !this.leaf) {\n togglerElement.click();\n return false;\n }\n var target = this.findBeforeClickableNode(event.currentTarget);\n if (target) {\n this.focusRowChange(event.currentTarget, target);\n }\n },\n onEnterKey: function onEnterKey(event) {\n this.setTabIndexForSelectionMode(event, this.nodeTouched);\n this.onClick(event);\n event.preventDefault();\n },\n onTabKey: function onTabKey() {\n this.setAllNodesTabIndexes();\n },\n setAllNodesTabIndexes: function setAllNodesTabIndexes() {\n var nodes = find(this.$refs.currentNode.closest('[data-pc-section=\"rootchildren\"]'), '[role=\"treeitem\"]');\n var hasSelectedNode = _toConsumableArray$1(nodes).some(function (node) {\n return node.getAttribute('aria-selected') === 'true' || node.getAttribute('aria-checked') === 'true';\n });\n _toConsumableArray$1(nodes).forEach(function (node) {\n node.tabIndex = -1;\n });\n if (hasSelectedNode) {\n var selectedNodes = _toConsumableArray$1(nodes).filter(function (node) {\n return node.getAttribute('aria-selected') === 'true' || node.getAttribute('aria-checked') === 'true';\n });\n selectedNodes[0].tabIndex = 0;\n return;\n }\n _toConsumableArray$1(nodes)[0].tabIndex = 0;\n },\n setTabIndexForSelectionMode: function setTabIndexForSelectionMode(event, nodeTouched) {\n if (this.selectionMode !== null) {\n var elements = _toConsumableArray$1(find(this.$refs.currentNode.parentElement, '[role=\"treeitem\"]'));\n event.currentTarget.tabIndex = nodeTouched === false ? -1 : 0;\n if (elements.every(function (element) {\n return element.tabIndex === -1;\n })) {\n elements[0].tabIndex = 0;\n }\n }\n },\n focusRowChange: function focusRowChange(firstFocusableRow, currentFocusedRow, lastVisibleDescendant) {\n firstFocusableRow.tabIndex = '-1';\n currentFocusedRow.tabIndex = '0';\n this.focusNode(lastVisibleDescendant || currentFocusedRow);\n },\n findBeforeClickableNode: function findBeforeClickableNode(node) {\n var parentListElement = node.closest('ul').closest('li');\n if (parentListElement) {\n var prevNodeButton = findSingle(parentListElement, 'button');\n if (prevNodeButton && prevNodeButton.style.visibility !== 'hidden') {\n return parentListElement;\n }\n return this.findBeforeClickableNode(node.previousElementSibling);\n }\n return null;\n },\n toggleCheckbox: function toggleCheckbox() {\n var _selectionKeys = this.selectionKeys ? _objectSpread$1({}, this.selectionKeys) : {};\n var _check = !this.checked;\n this.propagateDown(this.node, _check, _selectionKeys);\n this.$emit('checkbox-change', {\n node: this.node,\n check: _check,\n selectionKeys: _selectionKeys\n });\n },\n propagateDown: function propagateDown(node, check, selectionKeys) {\n if (check && node.selectable != false) selectionKeys[node.key] = {\n checked: true,\n partialChecked: false\n };else delete selectionKeys[node.key];\n if (node.children && node.children.length) {\n var _iterator = _createForOfIteratorHelper$1(node.children),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var child = _step.value;\n this.propagateDown(child, check, selectionKeys);\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n }\n },\n propagateUp: function propagateUp(event) {\n var check = event.check;\n var _selectionKeys = _objectSpread$1({}, event.selectionKeys);\n var checkedChildCount = 0;\n var childPartialSelected = false;\n var _iterator2 = _createForOfIteratorHelper$1(this.node.children),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var child = _step2.value;\n if (_selectionKeys[child.key] && _selectionKeys[child.key].checked) checkedChildCount++;else if (_selectionKeys[child.key] && _selectionKeys[child.key].partialChecked) childPartialSelected = true;\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n if (check && checkedChildCount === this.node.children.length) {\n _selectionKeys[this.node.key] = {\n checked: true,\n partialChecked: false\n };\n } else {\n if (!check) {\n delete _selectionKeys[this.node.key];\n }\n if (childPartialSelected || checkedChildCount > 0 && checkedChildCount !== this.node.children.length) _selectionKeys[this.node.key] = {\n checked: false,\n partialChecked: true\n };else delete _selectionKeys[this.node.key];\n }\n this.$emit('checkbox-change', {\n node: event.node,\n check: event.check,\n selectionKeys: _selectionKeys\n });\n },\n onChildCheckboxChange: function onChildCheckboxChange(event) {\n this.$emit('checkbox-change', event);\n },\n findNextSiblingOfAncestor: function findNextSiblingOfAncestor(nodeElement) {\n var parentNodeElement = this.getParentNodeElement(nodeElement);\n if (parentNodeElement) {\n if (parentNodeElement.nextElementSibling) return parentNodeElement.nextElementSibling;else return this.findNextSiblingOfAncestor(parentNodeElement);\n } else {\n return null;\n }\n },\n findLastVisibleDescendant: function findLastVisibleDescendant(nodeElement) {\n var childrenListElement = nodeElement.children[1];\n if (childrenListElement) {\n var lastChildElement = childrenListElement.children[childrenListElement.children.length - 1];\n return this.findLastVisibleDescendant(lastChildElement);\n } else {\n return nodeElement;\n }\n },\n getParentNodeElement: function getParentNodeElement(nodeElement) {\n var parentNodeElement = nodeElement.parentElement.parentElement;\n return getAttribute(parentNodeElement, 'role') === 'treeitem' ? parentNodeElement : null;\n },\n focusNode: function focusNode(element) {\n element.focus();\n },\n isCheckboxSelectionMode: function isCheckboxSelectionMode() {\n return this.selectionMode === 'checkbox';\n },\n isSameNode: function isSameNode(event) {\n return event.currentTarget && (event.currentTarget.isSameNode(event.target) || event.currentTarget.isSameNode(event.target.closest('[role=\"treeitem\"]')));\n }\n },\n computed: {\n hasChildren: function hasChildren() {\n return this.node.children && this.node.children.length > 0;\n },\n expanded: function expanded() {\n return this.expandedKeys && this.expandedKeys[this.node.key] === true;\n },\n leaf: function leaf() {\n return this.node.leaf === false ? false : !(this.node.children && this.node.children.length);\n },\n selectable: function selectable() {\n return this.node.selectable === false ? false : this.selectionMode != null;\n },\n selected: function selected() {\n return this.selectionMode && this.selectionKeys ? this.selectionKeys[this.node.key] === true : false;\n },\n checkboxMode: function checkboxMode() {\n return this.selectionMode === 'checkbox' && this.node.selectable !== false;\n },\n checked: function checked() {\n return this.selectionKeys ? this.selectionKeys[this.node.key] && this.selectionKeys[this.node.key].checked : false;\n },\n partialChecked: function partialChecked() {\n return this.selectionKeys ? this.selectionKeys[this.node.key] && this.selectionKeys[this.node.key].partialChecked : false;\n },\n ariaChecked: function ariaChecked() {\n return this.selectionMode === 'single' || this.selectionMode === 'multiple' ? this.selected : undefined;\n },\n ariaSelected: function ariaSelected() {\n return this.checkboxMode ? this.checked : undefined;\n }\n },\n components: {\n Checkbox: Checkbox,\n ChevronDownIcon: ChevronDownIcon,\n ChevronRightIcon: ChevronRightIcon,\n CheckIcon: CheckIcon,\n MinusIcon: MinusIcon,\n SpinnerIcon: SpinnerIcon\n },\n directives: {\n ripple: Ripple\n }\n};\n\nvar _hoisted_1$1 = [\"aria-label\", \"aria-selected\", \"aria-expanded\", \"aria-setsize\", \"aria-posinset\", \"aria-level\", \"aria-checked\", \"tabindex\"];\nvar _hoisted_2 = [\"data-p-selected\", \"data-p-selectable\"];\nfunction render$1(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_SpinnerIcon = resolveComponent(\"SpinnerIcon\");\n var _component_Checkbox = resolveComponent(\"Checkbox\");\n var _component_TreeNode = resolveComponent(\"TreeNode\", true);\n var _directive_ripple = resolveDirective(\"ripple\");\n return openBlock(), createElementBlock(\"li\", mergeProps({\n ref: \"currentNode\",\n \"class\": _ctx.cx('node'),\n role: \"treeitem\",\n \"aria-label\": $options.label($props.node),\n \"aria-selected\": $options.ariaSelected,\n \"aria-expanded\": $options.expanded,\n \"aria-setsize\": $props.node.children ? $props.node.children.length : 0,\n \"aria-posinset\": $props.index + 1,\n \"aria-level\": $props.level,\n \"aria-checked\": $options.ariaChecked,\n tabindex: $props.index === 0 ? 0 : -1,\n onKeydown: _cache[4] || (_cache[4] = function () {\n return $options.onKeyDown && $options.onKeyDown.apply($options, arguments);\n })\n }, $props.level === 1 ? $options.getPTOptions('node') : _ctx.ptm('nodeChildren')), [createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('nodeContent'),\n onClick: _cache[2] || (_cache[2] = function () {\n return $options.onClick && $options.onClick.apply($options, arguments);\n }),\n onTouchend: _cache[3] || (_cache[3] = function () {\n return $options.onTouchEnd && $options.onTouchEnd.apply($options, arguments);\n }),\n style: $props.node.style\n }, $options.getPTOptions('nodeContent'), {\n \"data-p-selected\": $options.checkboxMode ? $options.checked : $options.selected,\n \"data-p-selectable\": $options.selectable\n }), [withDirectives((openBlock(), createElementBlock(\"button\", mergeProps({\n type: \"button\",\n \"class\": _ctx.cx('nodeToggleButton'),\n onClick: _cache[0] || (_cache[0] = function () {\n return $options.toggle && $options.toggle.apply($options, arguments);\n }),\n tabindex: \"-1\"\n }, $options.getPTOptions('nodeToggleButton')), [$props.node.loading && $props.loadingMode === 'icon' ? (openBlock(), createElementBlock(Fragment, {\n key: 0\n }, [$props.templates['nodetoggleicon'] || $props.templates['nodetogglericon'] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates['nodetoggleicon'] || $props.templates['nodetogglericon']), {\n key: 0,\n \"class\": normalizeClass(_ctx.cx('nodeToggleIcon'))\n }, null, 8, [\"class\"])) : (openBlock(), createBlock(_component_SpinnerIcon, mergeProps({\n key: 1,\n spin: \"\",\n \"class\": _ctx.cx('nodetogglericon')\n }, _ctx.ptm('nodeToggleIcon')), null, 16, [\"class\"]))], 64)) : (openBlock(), createElementBlock(Fragment, {\n key: 1\n }, [$props.templates['nodetoggleicon'] || $props.templates['togglericon'] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates['nodetoggleicon'] || $props.templates['togglericon']), {\n key: 0,\n node: $props.node,\n expanded: $options.expanded,\n \"class\": normalizeClass(_ctx.cx('nodeToggleIcon'))\n }, null, 8, [\"node\", \"expanded\", \"class\"])) : $options.expanded ? (openBlock(), createBlock(resolveDynamicComponent($props.node.expandedIcon ? 'span' : 'ChevronDownIcon'), mergeProps({\n key: 1,\n \"class\": _ctx.cx('nodeToggleIcon')\n }, $options.getPTOptions('nodeToggleIcon')), null, 16, [\"class\"])) : (openBlock(), createBlock(resolveDynamicComponent($props.node.collapsedIcon ? 'span' : 'ChevronRightIcon'), mergeProps({\n key: 2,\n \"class\": _ctx.cx('nodeToggleIcon')\n }, $options.getPTOptions('nodeToggleIcon')), null, 16, [\"class\"]))], 64))], 16)), [[_directive_ripple]]), $options.checkboxMode ? (openBlock(), createBlock(_component_Checkbox, {\n key: 0,\n modelValue: $options.checked,\n binary: true,\n indeterminate: $options.partialChecked,\n \"class\": normalizeClass(_ctx.cx('nodeCheckbox')),\n tabindex: -1,\n unstyled: _ctx.unstyled,\n pt: $options.getPTOptions('nodeCheckbox'),\n \"data-p-partialchecked\": $options.partialChecked\n }, {\n icon: withCtx(function (slotProps) {\n return [$props.templates['checkboxicon'] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates['checkboxicon']), {\n key: 0,\n checked: slotProps.checked,\n partialChecked: $options.partialChecked,\n \"class\": normalizeClass(slotProps[\"class\"])\n }, null, 8, [\"checked\", \"partialChecked\", \"class\"])) : createCommentVNode(\"\", true)];\n }),\n _: 1\n }, 8, [\"modelValue\", \"indeterminate\", \"class\", \"unstyled\", \"pt\", \"data-p-partialchecked\"])) : createCommentVNode(\"\", true), $props.templates['nodeicon'] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates['nodeicon']), mergeProps({\n key: 1,\n node: $props.node,\n \"class\": [_ctx.cx('nodeIcon')]\n }, $options.getPTOptions('nodeIcon')), null, 16, [\"node\", \"class\"])) : (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 2,\n \"class\": [_ctx.cx('nodeIcon'), $props.node.icon]\n }, $options.getPTOptions('nodeIcon')), null, 16)), createElementVNode(\"span\", mergeProps({\n \"class\": _ctx.cx('nodeLabel')\n }, $options.getPTOptions('nodeLabel'), {\n onKeydown: _cache[1] || (_cache[1] = withModifiers(function () {}, [\"stop\"]))\n }), [$props.templates[$props.node.type] || $props.templates['default'] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates[$props.node.type] || $props.templates['default']), {\n key: 0,\n node: $props.node,\n selected: $options.checkboxMode ? $options.checked : $options.selected\n }, null, 8, [\"node\", \"selected\"])) : (openBlock(), createElementBlock(Fragment, {\n key: 1\n }, [createTextVNode(toDisplayString($options.label($props.node)), 1)], 64))], 16)], 16, _hoisted_2), $options.hasChildren && $options.expanded ? (openBlock(), createElementBlock(\"ul\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('nodeChildren'),\n role: \"group\"\n }, _ctx.ptm('nodeChildren')), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.node.children, function (childNode) {\n return openBlock(), createBlock(_component_TreeNode, {\n key: childNode.key,\n node: childNode,\n templates: $props.templates,\n level: $props.level + 1,\n loadingMode: $props.loadingMode,\n expandedKeys: $props.expandedKeys,\n onNodeToggle: $options.onChildNodeToggle,\n onNodeClick: $options.onChildNodeClick,\n selectionMode: $props.selectionMode,\n selectionKeys: $props.selectionKeys,\n onCheckboxChange: $options.propagateUp,\n unstyled: _ctx.unstyled,\n pt: _ctx.pt\n }, null, 8, [\"node\", \"templates\", \"level\", \"loadingMode\", \"expandedKeys\", \"onNodeToggle\", \"onNodeClick\", \"selectionMode\", \"selectionKeys\", \"onCheckboxChange\", \"unstyled\", \"pt\"]);\n }), 128))], 16)) : createCommentVNode(\"\", true)], 16, _hoisted_1$1);\n}\n\nscript$1.render = render$1;\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _createForOfIteratorHelper(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t[\"return\"] || t[\"return\"](); } finally { if (u) throw o; } } }; }\nfunction _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _iterableToArray(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar script = {\n name: 'Tree',\n \"extends\": script$2,\n inheritAttrs: false,\n emits: ['node-expand', 'node-collapse', 'update:expandedKeys', 'update:selectionKeys', 'node-select', 'node-unselect', 'filter'],\n data: function data() {\n return {\n d_expandedKeys: this.expandedKeys || {},\n filterValue: null\n };\n },\n watch: {\n expandedKeys: function expandedKeys(newValue) {\n this.d_expandedKeys = newValue;\n }\n },\n methods: {\n onNodeToggle: function onNodeToggle(node) {\n var key = node.key;\n if (this.d_expandedKeys[key]) {\n delete this.d_expandedKeys[key];\n this.$emit('node-collapse', node);\n } else {\n this.d_expandedKeys[key] = true;\n this.$emit('node-expand', node);\n }\n this.d_expandedKeys = _objectSpread({}, this.d_expandedKeys);\n this.$emit('update:expandedKeys', this.d_expandedKeys);\n },\n onNodeClick: function onNodeClick(event) {\n if (this.selectionMode != null && event.node.selectable !== false) {\n var metaSelection = event.nodeTouched ? false : this.metaKeySelection;\n var _selectionKeys = metaSelection ? this.handleSelectionWithMetaKey(event) : this.handleSelectionWithoutMetaKey(event);\n this.$emit('update:selectionKeys', _selectionKeys);\n }\n },\n onCheckboxChange: function onCheckboxChange(event) {\n this.$emit('update:selectionKeys', event.selectionKeys);\n if (event.check) this.$emit('node-select', event.node);else this.$emit('node-unselect', event.node);\n },\n handleSelectionWithMetaKey: function handleSelectionWithMetaKey(event) {\n var originalEvent = event.originalEvent;\n var node = event.node;\n var metaKey = originalEvent.metaKey || originalEvent.ctrlKey;\n var selected = this.isNodeSelected(node);\n var _selectionKeys;\n if (selected && metaKey) {\n if (this.isSingleSelectionMode()) {\n _selectionKeys = {};\n } else {\n _selectionKeys = _objectSpread({}, this.selectionKeys);\n delete _selectionKeys[node.key];\n }\n this.$emit('node-unselect', node);\n } else {\n if (this.isSingleSelectionMode()) {\n _selectionKeys = {};\n } else if (this.isMultipleSelectionMode()) {\n _selectionKeys = !metaKey ? {} : this.selectionKeys ? _objectSpread({}, this.selectionKeys) : {};\n }\n _selectionKeys[node.key] = true;\n this.$emit('node-select', node);\n }\n return _selectionKeys;\n },\n handleSelectionWithoutMetaKey: function handleSelectionWithoutMetaKey(event) {\n var node = event.node;\n var selected = this.isNodeSelected(node);\n var _selectionKeys;\n if (this.isSingleSelectionMode()) {\n if (selected) {\n _selectionKeys = {};\n this.$emit('node-unselect', node);\n } else {\n _selectionKeys = {};\n _selectionKeys[node.key] = true;\n this.$emit('node-select', node);\n }\n } else {\n if (selected) {\n _selectionKeys = _objectSpread({}, this.selectionKeys);\n delete _selectionKeys[node.key];\n this.$emit('node-unselect', node);\n } else {\n _selectionKeys = this.selectionKeys ? _objectSpread({}, this.selectionKeys) : {};\n _selectionKeys[node.key] = true;\n this.$emit('node-select', node);\n }\n }\n return _selectionKeys;\n },\n isSingleSelectionMode: function isSingleSelectionMode() {\n return this.selectionMode === 'single';\n },\n isMultipleSelectionMode: function isMultipleSelectionMode() {\n return this.selectionMode === 'multiple';\n },\n isNodeSelected: function isNodeSelected(node) {\n return this.selectionMode && this.selectionKeys ? this.selectionKeys[node.key] === true : false;\n },\n isChecked: function isChecked(node) {\n return this.selectionKeys ? this.selectionKeys[node.key] && this.selectionKeys[node.key].checked : false;\n },\n isNodeLeaf: function isNodeLeaf(node) {\n return node.leaf === false ? false : !(node.children && node.children.length);\n },\n onFilterKeydown: function onFilterKeydown(event) {\n if (event.code === 'Enter' || event.code === 'NumpadEnter') {\n event.preventDefault();\n }\n this.$emit('filter', {\n originalEvent: event,\n value: event.target.value\n });\n },\n findFilteredNodes: function findFilteredNodes(node, paramsWithoutNode) {\n if (node) {\n var matched = false;\n if (node.children) {\n var childNodes = _toConsumableArray(node.children);\n node.children = [];\n var _iterator = _createForOfIteratorHelper(childNodes),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var childNode = _step.value;\n var copyChildNode = _objectSpread({}, childNode);\n if (this.isFilterMatched(copyChildNode, paramsWithoutNode)) {\n matched = true;\n node.children.push(copyChildNode);\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n }\n if (matched) {\n return true;\n }\n }\n },\n isFilterMatched: function isFilterMatched(node, _ref) {\n var searchFields = _ref.searchFields,\n filterText = _ref.filterText,\n strict = _ref.strict;\n var matched = false;\n var _iterator2 = _createForOfIteratorHelper(searchFields),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var field = _step2.value;\n var fieldValue = String(resolveFieldData(node, field)).toLocaleLowerCase(this.filterLocale);\n if (fieldValue.indexOf(filterText) > -1) {\n matched = true;\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n if (!matched || strict && !this.isNodeLeaf(node)) {\n matched = this.findFilteredNodes(node, {\n searchFields: searchFields,\n filterText: filterText,\n strict: strict\n }) || matched;\n }\n return matched;\n }\n },\n computed: {\n filteredValue: function filteredValue() {\n var filteredNodes = [];\n var searchFields = this.filterBy.split(',');\n var filterText = this.filterValue.trim().toLocaleLowerCase(this.filterLocale);\n var strict = this.filterMode === 'strict';\n var _iterator3 = _createForOfIteratorHelper(this.value),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var node = _step3.value;\n var _node = _objectSpread({}, node);\n var paramsWithoutNode = {\n searchFields: searchFields,\n filterText: filterText,\n strict: strict\n };\n if (strict && (this.findFilteredNodes(_node, paramsWithoutNode) || this.isFilterMatched(_node, paramsWithoutNode)) || !strict && (this.isFilterMatched(_node, paramsWithoutNode) || this.findFilteredNodes(_node, paramsWithoutNode))) {\n filteredNodes.push(_node);\n }\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n return filteredNodes;\n },\n valueToRender: function valueToRender() {\n if (this.filterValue && this.filterValue.trim().length > 0) return this.filteredValue;else return this.value;\n }\n },\n components: {\n TreeNode: script$1,\n InputText: InputText,\n InputIcon: InputIcon,\n IconField: IconField,\n SearchIcon: SearchIcon,\n SpinnerIcon: SpinnerIcon\n }\n};\n\nvar _hoisted_1 = [\"aria-labelledby\", \"aria-label\"];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_SpinnerIcon = resolveComponent(\"SpinnerIcon\");\n var _component_InputText = resolveComponent(\"InputText\");\n var _component_SearchIcon = resolveComponent(\"SearchIcon\");\n var _component_InputIcon = resolveComponent(\"InputIcon\");\n var _component_IconField = resolveComponent(\"IconField\");\n var _component_TreeNode = resolveComponent(\"TreeNode\");\n return openBlock(), createElementBlock(\"div\", mergeProps({\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root')), [_ctx.loading && _ctx.loadingMode === 'mask' ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n \"class\": _ctx.cx('mask')\n }, _ctx.ptm('mask')), [renderSlot(_ctx.$slots, \"loadingicon\", {\n \"class\": normalizeClass(_ctx.cx('loadingIcon'))\n }, function () {\n return [_ctx.loadingIcon ? (openBlock(), createElementBlock(\"i\", mergeProps({\n key: 0,\n \"class\": [_ctx.cx('loadingIcon'), 'pi-spin', _ctx.loadingIcon]\n }, _ctx.ptm('loadingIcon')), null, 16)) : (openBlock(), createBlock(_component_SpinnerIcon, mergeProps({\n key: 1,\n spin: \"\",\n \"class\": _ctx.cx('loadingIcon')\n }, _ctx.ptm('loadingIcon')), null, 16, [\"class\"]))];\n })], 16)) : createCommentVNode(\"\", true), _ctx.filter ? (openBlock(), createBlock(_component_IconField, {\n key: 1,\n unstyled: _ctx.unstyled,\n pt: _ctx.ptm('pcFilterContainer')\n }, {\n \"default\": withCtx(function () {\n return [createVNode(_component_InputText, {\n modelValue: $data.filterValue,\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = function ($event) {\n return $data.filterValue = $event;\n }),\n autocomplete: \"off\",\n \"class\": normalizeClass(_ctx.cx('pcFilter')),\n placeholder: _ctx.filterPlaceholder,\n unstyled: _ctx.unstyled,\n onKeydown: $options.onFilterKeydown,\n pt: _ctx.ptm('pcFilter')\n }, null, 8, [\"modelValue\", \"class\", \"placeholder\", \"unstyled\", \"onKeydown\", \"pt\"]), createVNode(_component_InputIcon, {\n unstyled: _ctx.unstyled,\n pt: _ctx.ptm('pcFilterIconContainer')\n }, {\n \"default\": withCtx(function () {\n return [renderSlot(_ctx.$slots, _ctx.$slots.filtericon ? 'filtericon' : 'searchicon', {\n \"class\": normalizeClass(_ctx.cx('filterIcon'))\n }, function () {\n return [createVNode(_component_SearchIcon, mergeProps({\n \"class\": _ctx.cx('filterIcon')\n }, _ctx.ptm('filterIcon')), null, 16, [\"class\"])];\n })];\n }),\n _: 3\n }, 8, [\"unstyled\", \"pt\"])];\n }),\n _: 3\n }, 8, [\"unstyled\", \"pt\"])) : createCommentVNode(\"\", true), createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('wrapper'),\n style: {\n maxHeight: _ctx.scrollHeight\n }\n }, _ctx.ptm('wrapper')), [createElementVNode(\"ul\", mergeProps({\n \"class\": _ctx.cx('rootChildren'),\n role: \"tree\",\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-label\": _ctx.ariaLabel\n }, _ctx.ptm('rootChildren')), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.valueToRender, function (node, index) {\n return openBlock(), createBlock(_component_TreeNode, {\n key: node.key,\n node: node,\n templates: _ctx.$slots,\n level: _ctx.level + 1,\n index: index,\n expandedKeys: $data.d_expandedKeys,\n onNodeToggle: $options.onNodeToggle,\n onNodeClick: $options.onNodeClick,\n selectionMode: _ctx.selectionMode,\n selectionKeys: _ctx.selectionKeys,\n onCheckboxChange: $options.onCheckboxChange,\n loadingMode: _ctx.loadingMode,\n unstyled: _ctx.unstyled,\n pt: _ctx.pt\n }, null, 8, [\"node\", \"templates\", \"level\", \"index\", \"expandedKeys\", \"onNodeToggle\", \"onNodeClick\", \"selectionMode\", \"selectionKeys\", \"onCheckboxChange\", \"loadingMode\", \"unstyled\", \"pt\"]);\n }), 128))], 16, _hoisted_1)], 16)], 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseStyle from '@primevue/core/base/style';\n\nvar theme = function theme(_ref) {\n var dt = _ref.dt;\n return \"\\n.p-contextmenu {\\n background: \".concat(dt('contextmenu.background'), \";\\n color: \").concat(dt('contextmenu.color'), \";\\n border: 1px solid \").concat(dt('contextmenu.border.color'), \";\\n border-radius: \").concat(dt('contextmenu.border.radius'), \";\\n box-shadow: \").concat(dt('contextmenu.shadow'), \";\\n min-width: 12.5rem;\\n}\\n\\n.p-contextmenu-root-list,\\n.p-contextmenu-submenu {\\n margin: 0;\\n padding: \").concat(dt('contextmenu.list.padding'), \";\\n list-style: none;\\n outline: 0 none;\\n display: flex;\\n flex-direction: column;\\n gap: \").concat(dt('contextmenu.list.gap'), \";\\n}\\n\\n.p-contextmenu-submenu {\\n position: absolute;\\n display: flex;\\n flex-direction: column;\\n min-width: 100%;\\n z-index: 1;\\n background: \").concat(dt('contextmenu.background'), \";\\n color: \").concat(dt('contextmenu.color'), \";\\n border: 1px solid \").concat(dt('contextmenu.border.color'), \";\\n border-radius: \").concat(dt('contextmenu.border.radius'), \";\\n box-shadow: \").concat(dt('contextmenu.shadow'), \";\\n}\\n\\n.p-contextmenu-item {\\n position: relative;\\n}\\n\\n.p-contextmenu-item-content {\\n transition: background \").concat(dt('contextmenu.transition.duration'), \", color \").concat(dt('contextmenu.transition.duration'), \";\\n border-radius: \").concat(dt('contextmenu.item.border.radius'), \";\\n color: \").concat(dt('contextmenu.item.color'), \";\\n}\\n\\n.p-contextmenu-item-link {\\n cursor: pointer;\\n display: flex;\\n align-items: center;\\n text-decoration: none;\\n overflow: hidden;\\n position: relative;\\n color: inherit;\\n padding: \").concat(dt('contextmenu.item.padding'), \";\\n gap: \").concat(dt('contextmenu.item.gap'), \";\\n user-select: none;\\n}\\n\\n.p-contextmenu-item-label {\\n line-height: 1;\\n}\\n\\n.p-contextmenu-item-icon {\\n color: \").concat(dt('contextmenu.item.icon.color'), \";\\n}\\n\\n.p-contextmenu-submenu-icon {\\n color: \").concat(dt('contextmenu.submenu.icon.color'), \";\\n margin-left: auto;\\n font-size: \").concat(dt('contextmenu.submenu.icon.size'), \";\\n width: \").concat(dt('contextmenu.submenu.icon.size'), \";\\n height: \").concat(dt('contextmenu.submenu.icon.size'), \";\\n}\\n\\n.p-contextmenu-item.p-focus > .p-contextmenu-item-content {\\n color: \").concat(dt('contextmenu.item.focus.color'), \";\\n background: \").concat(dt('contextmenu.item.focus.background'), \";\\n}\\n\\n.p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-item-icon {\\n color: \").concat(dt('contextmenu.item.icon.focus.color'), \";\\n}\\n\\n.p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-submenu-icon {\\n color: \").concat(dt('contextmenu.submenu.icon.focus.color'), \";\\n}\\n\\n.p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover {\\n color: \").concat(dt('contextmenu.item.focus.color'), \";\\n background: \").concat(dt('contextmenu.item.focus.background'), \";\\n}\\n\\n.p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-item-icon {\\n color: \").concat(dt('contextmenu.item.icon.focus.color'), \";\\n}\\n\\n.p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-submenu-icon {\\n color: \").concat(dt('contextmenu.submenu.icon.focus.color'), \";\\n}\\n\\n.p-contextmenu-item-active > .p-contextmenu-item-content {\\n color: \").concat(dt('contextmenu.item.active.color'), \";\\n background: \").concat(dt('contextmenu.item.active.background'), \";\\n}\\n\\n.p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-item-icon {\\n color: \").concat(dt('contextmenu.item.icon.active.color'), \";\\n}\\n\\n.p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-submenu-icon {\\n color: \").concat(dt('contextmenu.submenu.icon.active.color'), \";\\n}\\n\\n.p-contextmenu-separator {\\n border-top: 1px solid \").concat(dt('contextmenu.separator.border.color'), \";\\n}\\n\\n.p-contextmenu-enter-from,\\n.p-contextmenu-leave-active {\\n opacity: 0;\\n}\\n\\n.p-contextmenu-enter-active {\\n transition: opacity 250ms;\\n}\\n\");\n};\nvar classes = {\n root: 'p-contextmenu p-component',\n rootList: 'p-contextmenu-root-list',\n item: function item(_ref2) {\n var instance = _ref2.instance,\n processedItem = _ref2.processedItem;\n return ['p-contextmenu-item', {\n 'p-contextmenu-item-active': instance.isItemActive(processedItem),\n 'p-focus': instance.isItemFocused(processedItem),\n 'p-disabled': instance.isItemDisabled(processedItem)\n }];\n },\n itemContent: 'p-contextmenu-item-content',\n itemLink: 'p-contextmenu-item-link',\n itemIcon: 'p-contextmenu-item-icon',\n itemLabel: 'p-contextmenu-item-label',\n submenuIcon: 'p-contextmenu-submenu-icon',\n submenu: 'p-contextmenu-submenu',\n separator: 'p-contextmenu-separator'\n};\nvar ContextMenuStyle = BaseStyle.extend({\n name: 'contextmenu',\n theme: theme,\n classes: classes\n});\n\nexport { ContextMenuStyle as default };\n//# sourceMappingURL=index.mjs.map\n","import BaseIcon from '@primevue/icons/baseicon';\nimport { openBlock, createElementBlock, mergeProps, createElementVNode } from 'vue';\n\nvar script = {\n name: 'AngleRightIcon',\n \"extends\": BaseIcon\n};\n\nvar _hoisted_1 = /*#__PURE__*/createElementVNode(\"path\", {\n d: \"M5.25 11.1728C5.14929 11.1694 5.05033 11.1455 4.9592 11.1025C4.86806 11.0595 4.78666 10.9984 4.72 10.9228C4.57955 10.7822 4.50066 10.5916 4.50066 10.3928C4.50066 10.1941 4.57955 10.0035 4.72 9.86283L7.72 6.86283L4.72 3.86283C4.66067 3.71882 4.64765 3.55991 4.68275 3.40816C4.71785 3.25642 4.79932 3.11936 4.91585 3.01602C5.03238 2.91268 5.17819 2.84819 5.33305 2.83149C5.4879 2.81479 5.64411 2.84671 5.78 2.92283L9.28 6.42283C9.42045 6.56346 9.49934 6.75408 9.49934 6.95283C9.49934 7.15158 9.42045 7.34221 9.28 7.48283L5.78 10.9228C5.71333 10.9984 5.63193 11.0595 5.5408 11.1025C5.44966 11.1455 5.35071 11.1694 5.25 11.1728Z\",\n fill: \"currentColor\"\n}, null, -1);\nvar _hoisted_2 = [_hoisted_1];\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return openBlock(), createElementBlock(\"svg\", mergeProps({\n width: \"14\",\n height: \"14\",\n viewBox: \"0 0 14 14\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n }, _ctx.pti()), _hoisted_2, 16);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","import { UniqueComponentId } from '@primevue/core/utils';\nimport { nestedPosition, focus, findSingle, addStyle, getHiddenElementOuterWidth, getHiddenElementOuterHeight, getViewport, isTouchDevice } from '@primeuix/utils/dom';\nimport { resolve, isNotEmpty, isPrintableCharacter, isEmpty, findLastIndex } from '@primeuix/utils/object';\nimport { ZIndex } from '@primeuix/utils/zindex';\nimport Portal from 'primevue/portal';\nimport BaseComponent from '@primevue/core/basecomponent';\nimport ContextMenuStyle from 'primevue/contextmenu/style';\nimport AngleRightIcon from '@primevue/icons/angleright';\nimport Ripple from 'primevue/ripple';\nimport { mergeProps, resolveComponent, resolveDirective, openBlock, createBlock, Transition, withCtx, createElementBlock, Fragment, renderList, createElementVNode, withDirectives, resolveDynamicComponent, normalizeClass, createCommentVNode, toDisplayString, createVNode } from 'vue';\n\nvar script$2 = {\n name: 'BaseContextMenu',\n \"extends\": BaseComponent,\n props: {\n model: {\n type: Array,\n \"default\": null\n },\n appendTo: {\n type: [String, Object],\n \"default\": 'body'\n },\n autoZIndex: {\n type: Boolean,\n \"default\": true\n },\n baseZIndex: {\n type: Number,\n \"default\": 0\n },\n global: {\n type: Boolean,\n \"default\": false\n },\n tabindex: {\n type: Number,\n \"default\": 0\n },\n ariaLabelledby: {\n type: String,\n \"default\": null\n },\n ariaLabel: {\n type: String,\n \"default\": null\n }\n },\n style: ContextMenuStyle,\n provide: function provide() {\n return {\n $pcContextMenu: this,\n $parentInstance: this\n };\n }\n};\n\nvar script$1 = {\n name: 'ContextMenuSub',\n hostName: 'ContextMenu',\n \"extends\": BaseComponent,\n emits: ['item-click', 'item-mouseenter', 'item-mousemove'],\n props: {\n items: {\n type: Array,\n \"default\": null\n },\n menuId: {\n type: String,\n \"default\": null\n },\n focusedItemId: {\n type: String,\n \"default\": null\n },\n root: {\n type: Boolean,\n \"default\": false\n },\n visible: {\n type: Boolean,\n \"default\": false\n },\n level: {\n type: Number,\n \"default\": 0\n },\n templates: {\n type: Object,\n \"default\": null\n },\n activeItemPath: {\n type: Object,\n \"default\": null\n },\n tabindex: {\n type: Number,\n \"default\": 0\n }\n },\n methods: {\n getItemId: function getItemId(processedItem) {\n return \"\".concat(this.menuId, \"_\").concat(processedItem.key);\n },\n getItemKey: function getItemKey(processedItem) {\n return this.getItemId(processedItem);\n },\n getItemProp: function getItemProp(processedItem, name, params) {\n return processedItem && processedItem.item ? resolve(processedItem.item[name], params) : undefined;\n },\n getItemLabel: function getItemLabel(processedItem) {\n return this.getItemProp(processedItem, 'label');\n },\n getItemLabelId: function getItemLabelId(processedItem) {\n return \"\".concat(this.menuId, \"_\").concat(processedItem.key, \"_label\");\n },\n getPTOptions: function getPTOptions(key, processedItem, index) {\n return this.ptm(key, {\n context: {\n item: processedItem.item,\n active: this.isItemActive(processedItem),\n focused: this.isItemFocused(processedItem),\n disabled: this.isItemDisabled(processedItem),\n index: index\n }\n });\n },\n isItemActive: function isItemActive(processedItem) {\n return this.activeItemPath.some(function (path) {\n return path.key === processedItem.key;\n });\n },\n isItemVisible: function isItemVisible(processedItem) {\n return this.getItemProp(processedItem, 'visible') !== false;\n },\n isItemDisabled: function isItemDisabled(processedItem) {\n return this.getItemProp(processedItem, 'disabled');\n },\n isItemFocused: function isItemFocused(processedItem) {\n return this.focusedItemId === this.getItemId(processedItem);\n },\n isItemGroup: function isItemGroup(processedItem) {\n return isNotEmpty(processedItem.items);\n },\n onItemClick: function onItemClick(event, processedItem) {\n this.getItemProp(processedItem, 'command', {\n originalEvent: event,\n item: processedItem.item\n });\n this.$emit('item-click', {\n originalEvent: event,\n processedItem: processedItem,\n isFocus: true\n });\n },\n onItemMouseEnter: function onItemMouseEnter(event, processedItem) {\n this.$emit('item-mouseenter', {\n originalEvent: event,\n processedItem: processedItem\n });\n },\n onItemMouseMove: function onItemMouseMove(event, processedItem) {\n this.$emit('item-mousemove', {\n originalEvent: event,\n processedItem: processedItem,\n isFocus: true\n });\n },\n getAriaSetSize: function getAriaSetSize() {\n var _this = this;\n return this.items.filter(function (processedItem) {\n return _this.isItemVisible(processedItem) && !_this.getItemProp(processedItem, 'separator');\n }).length;\n },\n getAriaPosInset: function getAriaPosInset(index) {\n var _this2 = this;\n return index - this.items.slice(0, index).filter(function (processedItem) {\n return _this2.isItemVisible(processedItem) && _this2.getItemProp(processedItem, 'separator');\n }).length + 1;\n },\n onEnter: function onEnter() {\n nestedPosition(this.$refs.container, this.level);\n },\n getMenuItemProps: function getMenuItemProps(processedItem, index) {\n return {\n action: mergeProps({\n \"class\": this.cx('itemLink'),\n tabindex: -1,\n 'aria-hidden': true\n }, this.getPTOptions('itemLink', processedItem, index)),\n icon: mergeProps({\n \"class\": [this.cx('itemIcon'), this.getItemProp(processedItem, 'icon')]\n }, this.getPTOptions('itemIcon', processedItem, index)),\n label: mergeProps({\n \"class\": this.cx('itemLabel')\n }, this.getPTOptions('itemLabel', processedItem, index)),\n submenuicon: mergeProps({\n \"class\": this.cx('submenuIcon')\n }, this.getPTOptions('submenuicon', processedItem, index))\n };\n }\n },\n components: {\n AngleRightIcon: AngleRightIcon\n },\n directives: {\n ripple: Ripple\n }\n};\n\nvar _hoisted_1 = [\"tabindex\"];\nvar _hoisted_2 = [\"id\", \"aria-label\", \"aria-disabled\", \"aria-expanded\", \"aria-haspopup\", \"aria-level\", \"aria-setsize\", \"aria-posinset\", \"data-p-active\", \"data-p-focused\", \"data-p-disabled\"];\nvar _hoisted_3 = [\"onClick\", \"onMouseenter\", \"onMousemove\"];\nvar _hoisted_4 = [\"href\", \"target\"];\nvar _hoisted_5 = [\"id\"];\nvar _hoisted_6 = [\"id\"];\nfunction render$1(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_AngleRightIcon = resolveComponent(\"AngleRightIcon\");\n var _component_ContextMenuSub = resolveComponent(\"ContextMenuSub\", true);\n var _directive_ripple = resolveDirective(\"ripple\");\n return openBlock(), createBlock(Transition, mergeProps({\n name: \"p-contextmenusub\",\n onEnter: $options.onEnter\n }, _ctx.ptm('menu.transition')), {\n \"default\": withCtx(function () {\n return [($props.root ? true : $props.visible) ? (openBlock(), createElementBlock(\"ul\", mergeProps({\n key: 0,\n ref: \"container\",\n tabindex: $props.tabindex\n }, _ctx.ptm('rootList')), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.items, function (processedItem, index) {\n return openBlock(), createElementBlock(Fragment, {\n key: $options.getItemKey(processedItem)\n }, [$options.isItemVisible(processedItem) && !$options.getItemProp(processedItem, 'separator') ? (openBlock(), createElementBlock(\"li\", mergeProps({\n key: 0,\n id: $options.getItemId(processedItem),\n style: $options.getItemProp(processedItem, 'style'),\n \"class\": [_ctx.cx('item', {\n processedItem: processedItem\n }), $options.getItemProp(processedItem, 'class')],\n role: \"menuitem\",\n \"aria-label\": $options.getItemLabel(processedItem),\n \"aria-disabled\": $options.isItemDisabled(processedItem) || undefined,\n \"aria-expanded\": $options.isItemGroup(processedItem) ? $options.isItemActive(processedItem) : undefined,\n \"aria-haspopup\": $options.isItemGroup(processedItem) && !$options.getItemProp(processedItem, 'to') ? 'menu' : undefined,\n \"aria-level\": $props.level + 1,\n \"aria-setsize\": $options.getAriaSetSize(),\n \"aria-posinset\": $options.getAriaPosInset(index),\n ref_for: true\n }, $options.getPTOptions('item', processedItem, index), {\n \"data-p-active\": $options.isItemActive(processedItem),\n \"data-p-focused\": $options.isItemFocused(processedItem),\n \"data-p-disabled\": $options.isItemDisabled(processedItem)\n }), [createElementVNode(\"div\", mergeProps({\n \"class\": _ctx.cx('itemContent'),\n onClick: function onClick($event) {\n return $options.onItemClick($event, processedItem);\n },\n onMouseenter: function onMouseenter($event) {\n return $options.onItemMouseEnter($event, processedItem);\n },\n onMousemove: function onMousemove($event) {\n return $options.onItemMouseMove($event, processedItem);\n },\n ref_for: true\n }, $options.getPTOptions('itemContent', processedItem, index)), [!$props.templates.item ? withDirectives((openBlock(), createElementBlock(\"a\", mergeProps({\n key: 0,\n href: $options.getItemProp(processedItem, 'url'),\n \"class\": _ctx.cx('itemLink'),\n target: $options.getItemProp(processedItem, 'target'),\n tabindex: \"-1\",\n ref_for: true\n }, $options.getPTOptions('itemLink', processedItem, index)), [$props.templates.itemicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.itemicon), {\n key: 0,\n item: processedItem.item,\n \"class\": normalizeClass(_ctx.cx('itemIcon'))\n }, null, 8, [\"item\", \"class\"])) : $options.getItemProp(processedItem, 'icon') ? (openBlock(), createElementBlock(\"span\", mergeProps({\n key: 1,\n \"class\": [_ctx.cx('itemIcon'), $options.getItemProp(processedItem, 'icon')],\n ref_for: true\n }, $options.getPTOptions('itemIcon', processedItem, index)), null, 16)) : createCommentVNode(\"\", true), createElementVNode(\"span\", mergeProps({\n id: $options.getItemLabelId(processedItem),\n \"class\": _ctx.cx('itemLabel'),\n ref_for: true\n }, $options.getPTOptions('itemLabel', processedItem, index)), toDisplayString($options.getItemLabel(processedItem)), 17, _hoisted_5), $options.getItemProp(processedItem, 'items') ? (openBlock(), createElementBlock(Fragment, {\n key: 2\n }, [$props.templates.submenuicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.submenuicon), {\n key: 0,\n active: $options.isItemActive(processedItem),\n \"class\": normalizeClass(_ctx.cx('submenuIcon'))\n }, null, 8, [\"active\", \"class\"])) : (openBlock(), createBlock(_component_AngleRightIcon, mergeProps({\n key: 1,\n \"class\": _ctx.cx('submenuIcon'),\n ref_for: true\n }, $options.getPTOptions('submenuicon', processedItem, index)), null, 16, [\"class\"]))], 64)) : createCommentVNode(\"\", true)], 16, _hoisted_4)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), {\n key: 1,\n item: processedItem.item,\n hasSubmenu: $options.getItemProp(processedItem, 'items'),\n label: $options.getItemLabel(processedItem),\n props: $options.getMenuItemProps(processedItem, index)\n }, null, 8, [\"item\", \"hasSubmenu\", \"label\", \"props\"]))], 16, _hoisted_3), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_ContextMenuSub, mergeProps({\n key: 0,\n id: $options.getItemId(processedItem) + '_list',\n role: \"menu\",\n \"class\": _ctx.cx('submenu'),\n menuId: $props.menuId,\n focusedItemId: $props.focusedItemId,\n items: processedItem.items,\n templates: $props.templates,\n activeItemPath: $props.activeItemPath,\n level: $props.level + 1,\n visible: $options.isItemActive(processedItem) && $options.isItemGroup(processedItem),\n pt: _ctx.pt,\n unstyled: _ctx.unstyled,\n onItemClick: _cache[0] || (_cache[0] = function ($event) {\n return _ctx.$emit('item-click', $event);\n }),\n onItemMouseenter: _cache[1] || (_cache[1] = function ($event) {\n return _ctx.$emit('item-mouseenter', $event);\n }),\n onItemMousemove: _cache[2] || (_cache[2] = function ($event) {\n return _ctx.$emit('item-mousemove', $event);\n }),\n \"aria-labelledby\": $options.getItemLabelId(processedItem),\n ref_for: true\n }, _ctx.ptm('submenu')), null, 16, [\"id\", \"class\", \"menuId\", \"focusedItemId\", \"items\", \"templates\", \"activeItemPath\", \"level\", \"visible\", \"pt\", \"unstyled\", \"aria-labelledby\"])) : createCommentVNode(\"\", true)], 16, _hoisted_2)) : createCommentVNode(\"\", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, 'separator') ? (openBlock(), createElementBlock(\"li\", mergeProps({\n key: 1,\n id: $options.getItemId(processedItem),\n style: $options.getItemProp(processedItem, 'style'),\n \"class\": [_ctx.cx('separator'), $options.getItemProp(processedItem, 'class')],\n role: \"separator\",\n ref_for: true\n }, _ctx.ptm('separator')), null, 16, _hoisted_6)) : createCommentVNode(\"\", true)], 64);\n }), 128))], 16, _hoisted_1)) : createCommentVNode(\"\", true)];\n }),\n _: 1\n }, 16, [\"onEnter\"]);\n}\n\nscript$1.render = render$1;\n\nvar script = {\n name: 'ContextMenu',\n \"extends\": script$2,\n inheritAttrs: false,\n emits: ['focus', 'blur', 'show', 'hide', 'before-show', 'before-hide'],\n target: null,\n outsideClickListener: null,\n resizeListener: null,\n documentContextMenuListener: null,\n pageX: null,\n pageY: null,\n container: null,\n list: null,\n data: function data() {\n return {\n id: this.$attrs.id,\n focused: false,\n focusedItemInfo: {\n index: -1,\n level: 0,\n parentKey: ''\n },\n activeItemPath: [],\n visible: false,\n submenuVisible: false\n };\n },\n watch: {\n '$attrs.id': function $attrsId(newValue) {\n this.id = newValue || UniqueComponentId();\n },\n activeItemPath: function activeItemPath(newPath) {\n if (isNotEmpty(newPath)) {\n this.bindOutsideClickListener();\n this.bindResizeListener();\n } else if (!this.visible) {\n this.unbindOutsideClickListener();\n this.unbindResizeListener();\n }\n }\n },\n mounted: function mounted() {\n this.id = this.id || UniqueComponentId();\n if (this.global) {\n this.bindDocumentContextMenuListener();\n }\n },\n beforeUnmount: function beforeUnmount() {\n this.unbindResizeListener();\n this.unbindOutsideClickListener();\n this.unbindDocumentContextMenuListener();\n if (this.container && this.autoZIndex) {\n ZIndex.clear(this.container);\n }\n this.target = null;\n this.container = null;\n },\n methods: {\n getItemProp: function getItemProp(item, name) {\n return item ? resolve(item[name]) : undefined;\n },\n getItemLabel: function getItemLabel(item) {\n return this.getItemProp(item, 'label');\n },\n isItemDisabled: function isItemDisabled(item) {\n return this.getItemProp(item, 'disabled');\n },\n isItemVisible: function isItemVisible(item) {\n return this.getItemProp(item, 'visible') !== false;\n },\n isItemGroup: function isItemGroup(item) {\n return isNotEmpty(this.getItemProp(item, 'items'));\n },\n isItemSeparator: function isItemSeparator(item) {\n return this.getItemProp(item, 'separator');\n },\n getProccessedItemLabel: function getProccessedItemLabel(processedItem) {\n return processedItem ? this.getItemLabel(processedItem.item) : undefined;\n },\n isProccessedItemGroup: function isProccessedItemGroup(processedItem) {\n return processedItem && isNotEmpty(processedItem.items);\n },\n toggle: function toggle(event) {\n this.visible ? this.hide() : this.show(event);\n },\n show: function show(event) {\n this.$emit('before-show');\n this.activeItemPath = [];\n this.focusedItemInfo = {\n index: -1,\n level: 0,\n parentKey: ''\n };\n focus(this.list);\n this.pageX = event.pageX;\n this.pageY = event.pageY;\n this.visible ? this.position() : this.visible = true;\n event.stopPropagation();\n event.preventDefault();\n },\n hide: function hide() {\n this.$emit('before-hide');\n this.visible = false;\n this.activeItemPath = [];\n this.focusedItemInfo = {\n index: -1,\n level: 0,\n parentKey: ''\n };\n },\n onFocus: function onFocus(event) {\n this.focused = true;\n this.focusedItemInfo = this.focusedItemInfo.index !== -1 ? this.focusedItemInfo : {\n index: -1,\n level: 0,\n parentKey: ''\n };\n this.$emit('focus', event);\n },\n onBlur: function onBlur(event) {\n this.focused = false;\n this.focusedItemInfo = {\n index: -1,\n level: 0,\n parentKey: ''\n };\n this.searchValue = '';\n this.$emit('blur', event);\n },\n onKeyDown: function onKeyDown(event) {\n var metaKey = event.metaKey || event.ctrlKey;\n switch (event.code) {\n case 'ArrowDown':\n this.onArrowDownKey(event);\n break;\n case 'ArrowUp':\n this.onArrowUpKey(event);\n break;\n case 'ArrowLeft':\n this.onArrowLeftKey(event);\n break;\n case 'ArrowRight':\n this.onArrowRightKey(event);\n break;\n case 'Home':\n this.onHomeKey(event);\n break;\n case 'End':\n this.onEndKey(event);\n break;\n case 'Space':\n this.onSpaceKey(event);\n break;\n case 'Enter':\n case 'NumpadEnter':\n this.onEnterKey(event);\n break;\n case 'Escape':\n this.onEscapeKey(event);\n break;\n case 'Tab':\n this.onTabKey(event);\n break;\n case 'PageDown':\n case 'PageUp':\n case 'Backspace':\n case 'ShiftLeft':\n case 'ShiftRight':\n //NOOP\n break;\n default:\n if (!metaKey && isPrintableCharacter(event.key)) {\n this.searchItems(event, event.key);\n }\n break;\n }\n },\n onItemChange: function onItemChange(event) {\n var processedItem = event.processedItem,\n isFocus = event.isFocus;\n if (isEmpty(processedItem)) return;\n var index = processedItem.index,\n key = processedItem.key,\n level = processedItem.level,\n parentKey = processedItem.parentKey,\n items = processedItem.items;\n var grouped = isNotEmpty(items);\n var activeItemPath = this.activeItemPath.filter(function (p) {\n return p.parentKey !== parentKey && p.parentKey !== key;\n });\n if (grouped) {\n activeItemPath.push(processedItem);\n this.submenuVisible = true;\n }\n this.focusedItemInfo = {\n index: index,\n level: level,\n parentKey: parentKey\n };\n this.activeItemPath = activeItemPath;\n isFocus && focus(this.list);\n },\n onItemClick: function onItemClick(event) {\n var processedItem = event.processedItem;\n var grouped = this.isProccessedItemGroup(processedItem);\n var selected = this.isSelected(processedItem);\n if (selected) {\n var index = processedItem.index,\n key = processedItem.key,\n level = processedItem.level,\n parentKey = processedItem.parentKey;\n this.activeItemPath = this.activeItemPath.filter(function (p) {\n return key !== p.key && key.startsWith(p.key);\n });\n this.focusedItemInfo = {\n index: index,\n level: level,\n parentKey: parentKey\n };\n focus(this.list);\n } else {\n grouped ? this.onItemChange(event) : this.hide();\n }\n },\n onItemMouseEnter: function onItemMouseEnter(event) {\n this.onItemChange(event);\n },\n onItemMouseMove: function onItemMouseMove(event) {\n if (this.focused) {\n this.changeFocusedItemIndex(event, event.processedItem.index);\n }\n },\n onArrowDownKey: function onArrowDownKey(event) {\n var itemIndex = this.focusedItemInfo.index !== -1 ? this.findNextItemIndex(this.focusedItemInfo.index) : this.findFirstFocusedItemIndex();\n this.changeFocusedItemIndex(event, itemIndex);\n event.preventDefault();\n },\n onArrowUpKey: function onArrowUpKey(event) {\n if (event.altKey) {\n if (this.focusedItemInfo.index !== -1) {\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var grouped = this.isProccessedItemGroup(processedItem);\n !grouped && this.onItemChange({\n originalEvent: event,\n processedItem: processedItem\n });\n }\n this.popup && this.hide();\n event.preventDefault();\n } else {\n var itemIndex = this.focusedItemInfo.index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo.index) : this.findLastFocusedItemIndex();\n this.changeFocusedItemIndex(event, itemIndex);\n event.preventDefault();\n }\n },\n onArrowLeftKey: function onArrowLeftKey(event) {\n var _this = this;\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var parentItem = this.activeItemPath.find(function (p) {\n return p.key === processedItem.parentKey;\n });\n var root = isEmpty(processedItem.parent);\n if (!root) {\n this.focusedItemInfo = {\n index: -1,\n parentKey: parentItem ? parentItem.parentKey : ''\n };\n this.searchValue = '';\n this.onArrowDownKey(event);\n }\n this.activeItemPath = this.activeItemPath.filter(function (p) {\n return p.parentKey !== _this.focusedItemInfo.parentKey;\n });\n event.preventDefault();\n },\n onArrowRightKey: function onArrowRightKey(event) {\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var grouped = this.isProccessedItemGroup(processedItem);\n if (grouped) {\n this.onItemChange({\n originalEvent: event,\n processedItem: processedItem\n });\n this.focusedItemInfo = {\n index: -1,\n parentKey: processedItem.key\n };\n this.searchValue = '';\n this.onArrowDownKey(event);\n }\n event.preventDefault();\n },\n onHomeKey: function onHomeKey(event) {\n this.changeFocusedItemIndex(event, this.findFirstItemIndex());\n event.preventDefault();\n },\n onEndKey: function onEndKey(event) {\n this.changeFocusedItemIndex(event, this.findLastItemIndex());\n event.preventDefault();\n },\n onEnterKey: function onEnterKey(event) {\n if (this.focusedItemInfo.index !== -1) {\n var element = findSingle(this.list, \"li[id=\\\"\".concat(\"\".concat(this.focusedItemIdx), \"\\\"]\"));\n var anchorElement = element && findSingle(element, '[data-pc-section=\"itemlink\"]');\n anchorElement ? anchorElement.click() : element && element.click();\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var grouped = this.isProccessedItemGroup(processedItem);\n !grouped && (this.focusedItemInfo.index = this.findFirstFocusedItemIndex());\n }\n event.preventDefault();\n },\n onSpaceKey: function onSpaceKey(event) {\n this.onEnterKey(event);\n },\n onEscapeKey: function onEscapeKey(event) {\n this.hide();\n !this.popup && (this.focusedItemInfo.index = this.findFirstFocusedItemIndex());\n event.preventDefault();\n },\n onTabKey: function onTabKey(event) {\n if (this.focusedItemInfo.index !== -1) {\n var processedItem = this.visibleItems[this.focusedItemInfo.index];\n var grouped = this.isProccessedItemGroup(processedItem);\n !grouped && this.onItemChange({\n originalEvent: event,\n processedItem: processedItem\n });\n }\n this.hide();\n },\n onEnter: function onEnter(el) {\n addStyle(el, {\n position: 'absolute'\n });\n this.position();\n if (this.autoZIndex) {\n ZIndex.set('menu', el, this.baseZIndex + this.$primevue.config.zIndex.menu);\n }\n },\n onAfterEnter: function onAfterEnter() {\n this.bindOutsideClickListener();\n this.bindResizeListener();\n this.$emit('show');\n focus(this.list);\n },\n onLeave: function onLeave() {\n this.$emit('hide');\n this.container = null;\n },\n onAfterLeave: function onAfterLeave(el) {\n if (this.autoZIndex) {\n ZIndex.clear(el);\n }\n this.unbindOutsideClickListener();\n this.unbindResizeListener();\n },\n position: function position() {\n var left = this.pageX + 1;\n var top = this.pageY + 1;\n var width = this.container.offsetParent ? this.container.offsetWidth : getHiddenElementOuterWidth(this.container);\n var height = this.container.offsetParent ? this.container.offsetHeight : getHiddenElementOuterHeight(this.container);\n var viewport = getViewport();\n\n //flip\n if (left + width - document.body.scrollLeft > viewport.width) {\n left -= width;\n }\n\n //flip\n if (top + height - document.body.scrollTop > viewport.height) {\n top -= height;\n }\n\n //fit\n if (left < document.body.scrollLeft) {\n left = document.body.scrollLeft;\n }\n\n //fit\n if (top < document.body.scrollTop) {\n top = document.body.scrollTop;\n }\n this.container.style.left = left + 'px';\n this.container.style.top = top + 'px';\n },\n bindOutsideClickListener: function bindOutsideClickListener() {\n var _this2 = this;\n if (!this.outsideClickListener) {\n this.outsideClickListener = function (event) {\n var isOutsideContainer = _this2.container && !_this2.container.contains(event.target);\n var isOutsideTarget = _this2.visible ? !(_this2.target && (_this2.target === event.target || _this2.target.contains(event.target))) : true;\n if (isOutsideContainer && isOutsideTarget) {\n _this2.hide();\n }\n };\n document.addEventListener('click', this.outsideClickListener);\n }\n },\n unbindOutsideClickListener: function unbindOutsideClickListener() {\n if (this.outsideClickListener) {\n document.removeEventListener('click', this.outsideClickListener);\n this.outsideClickListener = null;\n }\n },\n bindResizeListener: function bindResizeListener() {\n var _this3 = this;\n if (!this.resizeListener) {\n this.resizeListener = function () {\n if (_this3.visible && !isTouchDevice()) {\n _this3.hide();\n }\n };\n window.addEventListener('resize', this.resizeListener);\n }\n },\n unbindResizeListener: function unbindResizeListener() {\n if (this.resizeListener) {\n window.removeEventListener('resize', this.resizeListener);\n this.resizeListener = null;\n }\n },\n bindDocumentContextMenuListener: function bindDocumentContextMenuListener() {\n var _this4 = this;\n if (!this.documentContextMenuListener) {\n this.documentContextMenuListener = function (event) {\n event.button === 2 && _this4.show(event);\n };\n document.addEventListener('contextmenu', this.documentContextMenuListener);\n }\n },\n unbindDocumentContextMenuListener: function unbindDocumentContextMenuListener() {\n if (this.documentContextMenuListener) {\n document.removeEventListener('contextmenu', this.documentContextMenuListener);\n this.documentContextMenuListener = null;\n }\n },\n isItemMatched: function isItemMatched(processedItem) {\n var _this$getProccessedIt;\n return this.isValidItem(processedItem) && ((_this$getProccessedIt = this.getProccessedItemLabel(processedItem)) === null || _this$getProccessedIt === void 0 ? void 0 : _this$getProccessedIt.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase()));\n },\n isValidItem: function isValidItem(processedItem) {\n return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item) && this.isItemVisible(processedItem.item);\n },\n isValidSelectedItem: function isValidSelectedItem(processedItem) {\n return this.isValidItem(processedItem) && this.isSelected(processedItem);\n },\n isSelected: function isSelected(processedItem) {\n return this.activeItemPath.some(function (p) {\n return p.key === processedItem.key;\n });\n },\n findFirstItemIndex: function findFirstItemIndex() {\n var _this5 = this;\n return this.visibleItems.findIndex(function (processedItem) {\n return _this5.isValidItem(processedItem);\n });\n },\n findLastItemIndex: function findLastItemIndex() {\n var _this6 = this;\n return findLastIndex(this.visibleItems, function (processedItem) {\n return _this6.isValidItem(processedItem);\n });\n },\n findNextItemIndex: function findNextItemIndex(index) {\n var _this7 = this;\n var matchedItemIndex = index < this.visibleItems.length - 1 ? this.visibleItems.slice(index + 1).findIndex(function (processedItem) {\n return _this7.isValidItem(processedItem);\n }) : -1;\n return matchedItemIndex > -1 ? matchedItemIndex + index + 1 : index;\n },\n findPrevItemIndex: function findPrevItemIndex(index) {\n var _this8 = this;\n var matchedItemIndex = index > 0 ? findLastIndex(this.visibleItems.slice(0, index), function (processedItem) {\n return _this8.isValidItem(processedItem);\n }) : -1;\n return matchedItemIndex > -1 ? matchedItemIndex : index;\n },\n findSelectedItemIndex: function findSelectedItemIndex() {\n var _this9 = this;\n return this.visibleItems.findIndex(function (processedItem) {\n return _this9.isValidSelectedItem(processedItem);\n });\n },\n findFirstFocusedItemIndex: function findFirstFocusedItemIndex() {\n var selectedIndex = this.findSelectedItemIndex();\n return selectedIndex < 0 ? this.findFirstItemIndex() : selectedIndex;\n },\n findLastFocusedItemIndex: function findLastFocusedItemIndex() {\n var selectedIndex = this.findSelectedItemIndex();\n return selectedIndex < 0 ? this.findLastItemIndex() : selectedIndex;\n },\n searchItems: function searchItems(event, _char) {\n var _this10 = this;\n this.searchValue = (this.searchValue || '') + _char;\n var itemIndex = -1;\n var matched = false;\n if (this.focusedItemInfo.index !== -1) {\n itemIndex = this.visibleItems.slice(this.focusedItemInfo.index).findIndex(function (processedItem) {\n return _this10.isItemMatched(processedItem);\n });\n itemIndex = itemIndex === -1 ? this.visibleItems.slice(0, this.focusedItemInfo.index).findIndex(function (processedItem) {\n return _this10.isItemMatched(processedItem);\n }) : itemIndex + this.focusedItemInfo.index;\n } else {\n itemIndex = this.visibleItems.findIndex(function (processedItem) {\n return _this10.isItemMatched(processedItem);\n });\n }\n if (itemIndex !== -1) {\n matched = true;\n }\n if (itemIndex === -1 && this.focusedItemInfo.index === -1) {\n itemIndex = this.findFirstFocusedItemIndex();\n }\n if (itemIndex !== -1) {\n this.changeFocusedItemIndex(event, itemIndex);\n }\n if (this.searchTimeout) {\n clearTimeout(this.searchTimeout);\n }\n this.searchTimeout = setTimeout(function () {\n _this10.searchValue = '';\n _this10.searchTimeout = null;\n }, 500);\n return matched;\n },\n changeFocusedItemIndex: function changeFocusedItemIndex(event, index) {\n if (this.focusedItemInfo.index !== index) {\n this.focusedItemInfo.index = index;\n this.scrollInView();\n }\n },\n scrollInView: function scrollInView() {\n var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;\n var id = index !== -1 ? \"\".concat(this.id, \"_\").concat(index) : this.focusedItemIdx;\n var element = findSingle(this.list, \"li[id=\\\"\".concat(id, \"\\\"]\"));\n if (element) {\n element.scrollIntoView && element.scrollIntoView({\n block: 'nearest',\n inline: 'start'\n });\n }\n },\n createProcessedItems: function createProcessedItems(items) {\n var _this11 = this;\n var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var parentKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';\n var processedItems = [];\n items && items.forEach(function (item, index) {\n var key = (parentKey !== '' ? parentKey + '_' : '') + index;\n var newItem = {\n item: item,\n index: index,\n level: level,\n key: key,\n parent: parent,\n parentKey: parentKey\n };\n newItem['items'] = _this11.createProcessedItems(item.items, level + 1, newItem, key);\n processedItems.push(newItem);\n });\n return processedItems;\n },\n containerRef: function containerRef(el) {\n this.container = el;\n },\n listRef: function listRef(el) {\n this.list = el ? el.$el : undefined;\n }\n },\n computed: {\n processedItems: function processedItems() {\n return this.createProcessedItems(this.model || []);\n },\n visibleItems: function visibleItems() {\n var _this12 = this;\n var processedItem = this.activeItemPath.find(function (p) {\n return p.key === _this12.focusedItemInfo.parentKey;\n });\n return processedItem ? processedItem.items : this.processedItems;\n },\n focusedItemIdx: function focusedItemIdx() {\n return this.focusedItemInfo.index !== -1 ? \"\".concat(this.id).concat(isNotEmpty(this.focusedItemInfo.parentKey) ? '_' + this.focusedItemInfo.parentKey : '', \"_\").concat(this.focusedItemInfo.index) : null;\n }\n },\n components: {\n ContextMenuSub: script$1,\n Portal: Portal\n }\n};\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n var _component_ContextMenuSub = resolveComponent(\"ContextMenuSub\");\n var _component_Portal = resolveComponent(\"Portal\");\n return openBlock(), createBlock(_component_Portal, {\n appendTo: _ctx.appendTo\n }, {\n \"default\": withCtx(function () {\n return [createVNode(Transition, mergeProps({\n name: \"p-contextmenu\",\n onEnter: $options.onEnter,\n onAfterEnter: $options.onAfterEnter,\n onLeave: $options.onLeave,\n onAfterLeave: $options.onAfterLeave\n }, _ctx.ptm('transition')), {\n \"default\": withCtx(function () {\n return [$data.visible ? (openBlock(), createElementBlock(\"div\", mergeProps({\n key: 0,\n ref: $options.containerRef,\n \"class\": _ctx.cx('root')\n }, _ctx.ptmi('root')), [createVNode(_component_ContextMenuSub, {\n ref: $options.listRef,\n id: $data.id + '_list',\n \"class\": normalizeClass(_ctx.cx('rootList')),\n role: \"menubar\",\n root: true,\n tabindex: _ctx.tabindex,\n \"aria-orientation\": \"vertical\",\n \"aria-activedescendant\": $data.focused ? $options.focusedItemIdx : undefined,\n menuId: $data.id,\n focusedItemId: $data.focused ? $options.focusedItemIdx : undefined,\n items: $options.processedItems,\n templates: _ctx.$slots,\n activeItemPath: $data.activeItemPath,\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-label\": _ctx.ariaLabel,\n level: 0,\n visible: $data.submenuVisible,\n pt: _ctx.pt,\n unstyled: _ctx.unstyled,\n onFocus: $options.onFocus,\n onBlur: $options.onBlur,\n onKeydown: $options.onKeyDown,\n onItemClick: $options.onItemClick,\n onItemMouseenter: $options.onItemMouseEnter,\n onItemMousemove: $options.onItemMouseMove\n }, null, 8, [\"id\", \"class\", \"tabindex\", \"aria-activedescendant\", \"menuId\", \"focusedItemId\", \"items\", \"templates\", \"activeItemPath\", \"aria-labelledby\", \"aria-label\", \"visible\", \"pt\", \"unstyled\", \"onFocus\", \"onBlur\", \"onKeydown\", \"onItemClick\", \"onItemMouseenter\", \"onItemMousemove\"])], 16)) : createCommentVNode(\"\", true)];\n }),\n _: 1\n }, 16, [\"onEnter\", \"onAfterEnter\", \"onLeave\", \"onAfterLeave\"])];\n }),\n _: 1\n }, 8, [\"appendTo\"]);\n}\n\nscript.render = render;\n\nexport { script as default };\n//# sourceMappingURL=index.mjs.map\n","\n\n\n\n\n","function _arrayWithHoles(r) {\n if (Array.isArray(r)) return r;\n}\nexport { _arrayWithHoles as default };","function _iterableToArrayLimit(r, l) {\n var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (null != t) {\n var e,\n n,\n i,\n u,\n a = [],\n f = !0,\n o = !1;\n try {\n if (i = (t = t.call(r)).next, 0 === l) {\n if (Object(t) !== t) return;\n f = !1;\n } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);\n } catch (r) {\n o = !0, n = r;\n } finally {\n try {\n if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return;\n } finally {\n if (o) throw n;\n }\n }\n return a;\n }\n}\nexport { _iterableToArrayLimit as default };","function _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nexport { _arrayLikeToArray as default };","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0;\n }\n}\nexport { _unsupportedIterableToArray as default };","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nexport { _nonIterableRest as default };","import arrayWithHoles from \"./arrayWithHoles.js\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableRest from \"./nonIterableRest.js\";\nfunction _slicedToArray(r, e) {\n return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest();\n}\nexport { _slicedToArray as default };","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.bind = void 0;\nfunction bind(target, _a) {\n var type = _a.type, listener = _a.listener, options = _a.options;\n target.addEventListener(type, listener, options);\n return function unbind() {\n target.removeEventListener(type, listener, options);\n };\n}\nexports.bind = bind;\n","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.bindAll = void 0;\nvar bind_1 = require(\"./bind\");\nfunction toOptions(value) {\n if (typeof value === 'undefined') {\n return undefined;\n }\n if (typeof value === 'boolean') {\n return {\n capture: value,\n };\n }\n return value;\n}\nfunction getBinding(original, sharedOptions) {\n if (sharedOptions == null) {\n return original;\n }\n var binding = __assign(__assign({}, original), { options: __assign(__assign({}, toOptions(sharedOptions)), toOptions(original.options)) });\n return binding;\n}\nfunction bindAll(target, bindings, sharedOptions) {\n var unbinds = bindings.map(function (original) {\n var binding = getBinding(original, sharedOptions);\n return (0, bind_1.bind)(target, binding);\n });\n return function unbindAll() {\n unbinds.forEach(function (unbind) { return unbind(); });\n };\n}\nexports.bindAll = bindAll;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.bindAll = exports.bind = void 0;\nvar bind_1 = require(\"./bind\");\nObject.defineProperty(exports, \"bind\", { enumerable: true, get: function () { return bind_1.bind; } });\nvar bind_all_1 = require(\"./bind-all\");\nObject.defineProperty(exports, \"bindAll\", { enumerable: true, get: function () { return bind_all_1.bindAll; } });\n","// pulling this into a separate file so adapter(s) that don't\n// need the honey pot can pay as little as possible for it.\nexport var honeyPotDataAttribute = 'data-pdnd-honey-pot';","import { honeyPotDataAttribute } from './honey-pot-data-attribute';\nexport function isHoneyPotElement(target) {\n return target instanceof Element && target.hasAttribute(honeyPotDataAttribute);\n}","import _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport { isHoneyPotElement } from './is-honey-pot-element';\nexport function getElementFromPointWithoutHoneypot(client) {\n // eslint-disable-next-line no-restricted-syntax\n var _document$elementsFro = document.elementsFromPoint(client.x, client.y),\n _document$elementsFro2 = _slicedToArray(_document$elementsFro, 2),\n top = _document$elementsFro2[0],\n second = _document$elementsFro2[1];\n if (!top) {\n return null;\n }\n if (isHoneyPotElement(top)) {\n return second !== null && second !== void 0 ? second : null;\n }\n return top;\n}","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };","import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nexport { _defineProperty as default };","// Maximum possible z-index\n// https://stackoverflow.com/questions/491052/minimum-and-maximum-value-of-z-index\nexport var maxZIndex = 2147483647;","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nimport { bind, bindAll } from 'bind-event-listener';\nimport { maxZIndex } from '../util/max-z-index';\nimport { honeyPotDataAttribute } from './honey-pot-data-attribute';\nvar honeyPotSize = 2;\nvar halfHoneyPotSize = honeyPotSize / 2;\n\n/**\n * `clientX` and `clientY` can be in sub pixels (eg `2.332`)\n * However, browser hitbox testing is commonly do to the closest pixel.\n *\n * → https://issues.chromium.org/issues/40940531\n *\n * To be sure that the honey pot will be over the `client` position,\n * we `.floor()` `clientX` and`clientY` and then make it `2px` in size.\n **/\nfunction floorToClosestPixel(point) {\n return {\n x: Math.floor(point.x),\n y: Math.floor(point.y)\n };\n}\n\n/**\n * We want to make sure the honey pot sits around the users position.\n * This seemed to be the most resilient while testing.\n */\nfunction pullBackByHalfHoneyPotSize(point) {\n return {\n x: point.x - halfHoneyPotSize,\n y: point.y - halfHoneyPotSize\n };\n}\n\n/**\n * Prevent the honey pot from changing the window size.\n * This is super unlikely to occur, but just being safe.\n */\nfunction preventGoingBackwardsOffScreen(point) {\n return {\n x: Math.max(point.x, 0),\n y: Math.max(point.y, 0)\n };\n}\n\n/**\n * Prevent the honey pot from changing the window size.\n * This is super unlikely to occur, but just being safe.\n */\nfunction preventGoingForwardsOffScreen(point) {\n return {\n x: Math.min(point.x, window.innerWidth - honeyPotSize),\n y: Math.min(point.y, window.innerHeight - honeyPotSize)\n };\n}\n\n/**\n * Create a `2x2` `DOMRect` around the `client` position\n */\nfunction getHoneyPotRectFor(_ref) {\n var client = _ref.client;\n var point = preventGoingForwardsOffScreen(preventGoingBackwardsOffScreen(pullBackByHalfHoneyPotSize(floorToClosestPixel(client))));\n\n // When debugging, it is helpful to\n // make this element a bit bigger\n return DOMRect.fromRect({\n x: point.x,\n y: point.y,\n width: honeyPotSize,\n height: honeyPotSize\n });\n}\nfunction getRectStyles(_ref2) {\n var clientRect = _ref2.clientRect;\n return {\n left: \"\".concat(clientRect.left, \"px\"),\n top: \"\".concat(clientRect.top, \"px\"),\n width: \"\".concat(clientRect.width, \"px\"),\n height: \"\".concat(clientRect.height, \"px\")\n };\n}\nfunction isWithin(_ref3) {\n var client = _ref3.client,\n clientRect = _ref3.clientRect;\n return (\n // is within horizontal bounds\n client.x >= clientRect.x && client.x <= clientRect.x + clientRect.width &&\n // is within vertical bounds\n client.y >= clientRect.y && client.y <= clientRect.y + clientRect.height\n );\n}\n/**\n * The honey pot fix is designed to get around a painful bug in all browsers.\n *\n * [Overview](https://www.youtube.com/watch?v=udE9qbFTeQg)\n *\n * **Background**\n *\n * When a drag starts, browsers incorrectly think that the users pointer is\n * still depressed where the drag started. Any element that goes under this position\n * will be entered into, causing `\"mouseenter\"` events and `\":hover\"` styles to be applied.\n *\n * _This is a violation of the spec_\n *\n * > \"From the moment that the user agent is to initiate the drag-and-drop operation,\n * > until the end \tof the drag-and-drop operation, device input events\n * > (e.g. mouse and keyboard events) must be suppressed.\"\n * >\n * > - https://html.spec.whatwg.org/multipage/dnd.html#drag-and-drop-processing-model\n *\n * _Some impacts_\n *\n * - `\":hover\"` styles being applied where they shouldn't (looks messy)\n * - components such as tooltips responding to `\"mouseenter\"` can show during a drag,\n * and on an element the user isn't even over\n *\n * Bug: https://issues.chromium.org/issues/41129937\n *\n * **Honey pot fix**\n *\n * 1. Create an element where the browser thinks the depressed pointer is\n * to absorb the incorrect pointer events\n * 2. Remove that element when it is no longer needed\n */\nfunction mountHoneyPot(_ref4) {\n var initial = _ref4.initial;\n var element = document.createElement('div');\n element.setAttribute(honeyPotDataAttribute, 'true');\n\n // can shift during the drag thanks to Firefox\n var clientRect = getHoneyPotRectFor({\n client: initial\n });\n Object.assign(element.style, _objectSpread(_objectSpread({\n // Setting a background color explicitly to avoid any inherited styles.\n // Looks like this could be `opacity: 0`, but worried that _might_\n // cause the element to be ignored on some platforms.\n // When debugging, set backgroundColor to something like \"red\".\n backgroundColor: 'transparent',\n position: 'fixed',\n // Being explicit to avoid inheriting styles\n padding: 0,\n margin: 0,\n boxSizing: 'border-box'\n }, getRectStyles({\n clientRect: clientRect\n })), {}, {\n // We want this element to absorb pointer events,\n // it's kind of the whole point 😉\n pointerEvents: 'auto',\n // Want to make sure the honey pot is top of everything else.\n // Don't need to worry about native drag previews, as they will\n // have been rendered (and removed) before the honey pot is rendered\n zIndex: maxZIndex\n }));\n document.body.appendChild(element);\n\n /**\n * 🦊 In firefox we can get `\"pointermove\"` events after the drag\n * has started, which is a spec violation.\n * The final `\"pointermove\"` will reveal where the \"depressed\" position\n * is for our honey pot fix.\n */\n var unbindPointerMove = bind(window, {\n type: 'pointermove',\n listener: function listener(event) {\n var client = {\n x: event.clientX,\n y: event.clientY\n };\n clientRect = getHoneyPotRectFor({\n client: client\n });\n Object.assign(element.style, getRectStyles({\n clientRect: clientRect\n }));\n },\n // using capture so we are less likely to be impacted by event stopping\n options: {\n capture: true\n }\n });\n return function finish(_ref5) {\n var current = _ref5.current;\n // Don't need this any more\n unbindPointerMove();\n\n // If the user is hover the honey pot, we remove it\n // so that the user can continue to interact with the page normally.\n if (isWithin({\n client: current,\n clientRect: clientRect\n })) {\n element.remove();\n return;\n }\n function cleanup() {\n unbindPostDragEvents();\n element.remove();\n }\n var unbindPostDragEvents = bindAll(window, [{\n type: 'pointerdown',\n listener: cleanup\n }, {\n type: 'pointermove',\n listener: cleanup\n }, {\n type: 'focusin',\n listener: cleanup\n }, {\n type: 'focusout',\n listener: cleanup\n },\n // a 'pointerdown' should happen before 'dragstart', but just being super safe\n {\n type: 'dragstart',\n listener: cleanup\n },\n // if the user has dragged something out of the window\n // and then is dragging something back into the window\n // the first events we will see are \"dragenter\" (and then \"dragover\").\n // So if we see any of these we need to clear the post drag fix.\n {\n type: 'dragenter',\n listener: cleanup\n }, {\n type: 'dragover',\n listener: cleanup\n }\n\n // Not adding a \"wheel\" event listener, as \"wheel\" by itself does not\n // resolve the bug.\n ], {\n // Using `capture` so less likely to be impacted by other code stopping events\n capture: true\n });\n };\n}\nexport function makeHoneyPotFix() {\n var latestPointerMove = null;\n function bindEvents() {\n // For sanity, only collecting this value from when events are first bound.\n // This prevents the case where a super old \"pointermove\" could be used\n // from a prior interaction.\n latestPointerMove = null;\n return bind(window, {\n type: 'pointermove',\n listener: function listener(event) {\n latestPointerMove = {\n x: event.clientX,\n y: event.clientY\n };\n },\n // listening for pointer move in capture phase\n // so we are less likely to be impacted by events being stopped.\n options: {\n capture: true\n }\n });\n }\n function getOnPostDispatch() {\n var finish = null;\n return function onPostEvent(_ref6) {\n var eventName = _ref6.eventName,\n payload = _ref6.payload;\n // We are adding the honey pot `onDragStart` so we don't\n // impact the creation of the native drag preview.\n if (eventName === 'onDragStart') {\n var _latestPointerMove;\n var input = payload.location.initial.input;\n\n // Sometimes there will be no latest \"pointermove\" (eg iOS).\n // In which case, we use the start position of the drag.\n var initial = (_latestPointerMove = latestPointerMove) !== null && _latestPointerMove !== void 0 ? _latestPointerMove : {\n x: input.clientX,\n y: input.clientY\n };\n\n // Don't need to defensively call `finish()` as `onDrop` from\n // one interaction is guaranteed to be called before `onDragStart`\n // of the next.\n finish = mountHoneyPot({\n initial: initial\n });\n }\n if (eventName === 'onDrop') {\n var _finish;\n var _input = payload.location.current.input;\n (_finish = finish) === null || _finish === void 0 || _finish({\n current: {\n x: _input.clientX,\n y: _input.clientY\n }\n });\n finish = null;\n // this interaction is finished, we want to use\n // the latest \"pointermove\" for each interaction\n latestPointerMove = null;\n }\n };\n }\n return {\n bindEvents: bindEvents,\n getOnPostDispatch: getOnPostDispatch\n };\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nfunction _arrayWithoutHoles(r) {\n if (Array.isArray(r)) return arrayLikeToArray(r);\n}\nexport { _arrayWithoutHoles as default };","function _iterableToArray(r) {\n if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r);\n}\nexport { _iterableToArray as default };","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nexport { _nonIterableSpread as default };","import arrayWithoutHoles from \"./arrayWithoutHoles.js\";\nimport iterableToArray from \"./iterableToArray.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableSpread from \"./nonIterableSpread.js\";\nfunction _toConsumableArray(r) {\n return arrayWithoutHoles(r) || iterableToArray(r) || unsupportedIterableToArray(r) || nonIterableSpread();\n}\nexport { _toConsumableArray as default };","/** Provide a function that you only ever want to be called a single time */\nexport function once(fn) {\n var cache = null;\n return function wrapped() {\n if (!cache) {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var result = fn.apply(this, args);\n cache = {\n result: result\n };\n }\n return cache.result;\n };\n}","import { once } from '../public-utils/once';\n\n// using `cache` as our `isFirefox()` result will not change in a browser\n\n/**\n * Returns `true` if a `Firefox` browser\n * */\nexport var isFirefox = once(function isFirefox() {\n if (process.env.NODE_ENV === 'test') {\n return false;\n }\n return navigator.userAgent.includes('Firefox');\n});","import { once } from '../public-utils/once';\n\n// using `cache` as our `isSafari()` result will not change in a browser\n\n/**\n * Returns `true` if a `Safari` browser.\n * Returns `true` if the browser is running on iOS (they are all Safari).\n * */\nexport var isSafari = once(function isSafari() {\n if (process.env.NODE_ENV === 'test') {\n return false;\n }\n var _navigator = navigator,\n userAgent = _navigator.userAgent;\n return userAgent.includes('AppleWebKit') && !userAgent.includes('Chrome');\n});","import { bindAll } from 'bind-event-listener';\nimport { isSafari } from '../is-safari';\n\n/* For \"dragenter\" events, the browser should set `relatedTarget` to the previous element.\n * For external drag operations, our first \"dragenter\" event should have a `event.relatedTarget` of `null`.\n *\n * Unfortunately in Safari `event.relatedTarget` is *always* set to `null`\n * Safari bug: https://bugs.webkit.org/show_bug.cgi?id=242627\n * To work around this we count \"dragenter\" and \"dragleave\" events */\n\n// Using symbols for event properties so we don't clash with\n// anything on the `event` object\nvar symbols = {\n isLeavingWindow: Symbol('leaving'),\n isEnteringWindow: Symbol('entering')\n};\nexport function isEnteringWindowInSafari(_ref) {\n var dragEnter = _ref.dragEnter;\n if (!isSafari()) {\n return false;\n }\n return dragEnter.hasOwnProperty(symbols.isEnteringWindow);\n}\nexport function isLeavingWindowInSafari(_ref2) {\n var dragLeave = _ref2.dragLeave;\n if (!isSafari()) {\n return false;\n }\n return dragLeave.hasOwnProperty(symbols.isLeavingWindow);\n}\n(function fixSafari() {\n // Don't do anything when server side rendering\n if (typeof window === 'undefined') {\n return;\n }\n\n // rather than checking the userAgent for \"jsdom\" we can do this check\n // so that the check will be removed completely in production code\n if (process.env.NODE_ENV === 'test') {\n return;\n }\n if (!isSafari()) {\n return;\n }\n function getInitialState() {\n return {\n enterCount: 0,\n isOverWindow: false\n };\n }\n var state = getInitialState();\n function resetState() {\n state = getInitialState();\n }\n\n // These event listeners are bound _forever_ and _never_ removed\n // We don't bother cleaning up these event listeners (for now)\n // as this workaround is only for Safari\n\n // This is how the event count works:\n //\n // lift (+1 enterCount)\n // - dragstart(draggable) [enterCount: 0]\n // - dragenter(draggable) [enterCount: 1]\n // leaving draggable (+0 enterCount)\n // - dragenter(document.body) [enterCount: 2]\n // - dragleave(draggable) [enterCount: 1]\n // leaving window (-1 enterCount)\n // - dragleave(document.body) [enterCount: 0] {leaving the window}\n\n // Things to note:\n // - dragenter and dragleave bubble\n // - the first dragenter when entering a window might not be on `window`\n // - it could be on an element that is pressed up against the window\n // - (so we cannot rely on `event.target` values)\n\n bindAll(window, [{\n type: 'dragstart',\n listener: function listener() {\n state.enterCount = 0;\n // drag start occurs in the source window\n state.isOverWindow = true;\n // When a drag first starts it will also trigger a \"dragenter\" on the draggable element\n }\n }, {\n type: 'drop',\n listener: resetState\n }, {\n type: 'dragend',\n listener: resetState\n }, {\n type: 'dragenter',\n listener: function listener(event) {\n if (!state.isOverWindow && state.enterCount === 0) {\n // Patching the `event` object\n // The `event` object is shared with all event listeners for the event\n // @ts-expect-error: adding property to the event object\n event[symbols.isEnteringWindow] = true;\n }\n state.isOverWindow = true;\n state.enterCount++;\n }\n }, {\n type: 'dragleave',\n listener: function listener(event) {\n state.enterCount--;\n if (state.isOverWindow && state.enterCount === 0) {\n // Patching the `event` object as it is shared with all event listeners\n // The `event` object is shared with all event listeners for the event\n // @ts-expect-error: adding property to the event object\n event[symbols.isLeavingWindow] = true;\n state.isOverWindow = false;\n }\n }\n }],\n // using `capture: true` so that adding event listeners\n // in bubble phase will have the correct symbols\n {\n capture: true\n });\n})();","/**\n * Does the `EventTarget` look like a `Node` based on \"duck typing\".\n *\n * Helpful when the `Node` might be outside of the current document\n * so we cannot to an `target instanceof Node` check.\n */\nfunction isNodeLike(target) {\n return 'nodeName' in target;\n}\n\n/**\n * Is an `EventTarget` a `Node` from another `window`?\n */\nexport function isFromAnotherWindow(eventTarget) {\n return isNodeLike(eventTarget) && eventTarget.ownerDocument !== document;\n}","import { isFirefox } from '../is-firefox';\nimport { isSafari } from '../is-safari';\nimport { isLeavingWindowInSafari } from './count-events-for-safari';\nimport { isFromAnotherWindow } from './is-from-another-window';\nexport function isLeavingWindow(_ref) {\n var dragLeave = _ref.dragLeave;\n var type = dragLeave.type,\n relatedTarget = dragLeave.relatedTarget;\n if (type !== 'dragleave') {\n return false;\n }\n if (isSafari()) {\n return isLeavingWindowInSafari({\n dragLeave: dragLeave\n });\n }\n\n // Standard check: if going to `null` we are leaving the `window`\n if (relatedTarget == null) {\n return true;\n }\n\n /**\n * 🦊 Exception: `iframe` in Firefox (`125.0`)\n *\n * Case 1: parent `window` → child `iframe`\n * `dragLeave.relatedTarget` is element _inside_ the child `iframe`\n * (foreign element)\n *\n * Case 2: child `iframe` → parent `window`\n * `dragLeave.relatedTarget` is the `iframe` in the parent `window`\n * (foreign element)\n */\n\n if (isFirefox()) {\n return isFromAnotherWindow(relatedTarget);\n }\n\n /**\n * 🌏 Exception: `iframe` in Chrome (`124.0`)\n *\n * Case 1: parent `window` → child `iframe`\n * `dragLeave.relatedTarget` is the `iframe` in the parent `window`\n *\n * Case 2: child `iframe` → parent `window`\n * `dragLeave.relatedTarget` is `null` *(standard check)*\n */\n\n // Case 2\n // Using `instanceof` check as the element will be in the same `window`\n return relatedTarget instanceof HTMLIFrameElement;\n}","export function getBindingsForBrokenDrags(_ref) {\n var onDragEnd = _ref.onDragEnd;\n return [\n // ## Detecting drag ending for removed draggables\n //\n // If a draggable element is removed during a drag and the user drops:\n // 1. if over a valid drop target: we get a \"drop\" event to know the drag is finished\n // 2. if not over a valid drop target (or cancelled): we get nothing\n // The \"dragend\" event will not fire on the source draggable if it has been\n // removed from the DOM.\n // So we need to figure out if a drag operation has finished by looking at other events\n // We can do this by looking at other events\n\n // ### First detection: \"pointermove\" events\n\n // 1. \"pointermove\" events cannot fire during a drag and drop operation\n // according to the spec. So if we get a \"pointermove\" it means that\n // the drag and drop operations has finished. So if we get a \"pointermove\"\n // we know that the drag is over\n // 2. 🦊😤 Drag and drop operations are _supposed_ to suppress\n // other pointer events. However, firefox will allow a few\n // pointer event to get through after a drag starts.\n // The most I've seen is 3\n {\n type: 'pointermove',\n listener: function () {\n var callCount = 0;\n return function listener() {\n // Using 20 as it is far bigger than the most observed (3)\n if (callCount < 20) {\n callCount++;\n return;\n }\n onDragEnd();\n };\n }()\n },\n // ### Second detection: \"pointerdown\" events\n\n // If we receive this event then we know that a drag operation has finished\n // and potentially another one is about to start.\n // Note: `pointerdown` fires on all browsers / platforms before \"dragstart\"\n {\n type: 'pointerdown',\n listener: onDragEnd\n }];\n}","export function getInput(event) {\n return {\n altKey: event.altKey,\n button: event.button,\n buttons: event.buttons,\n ctrlKey: event.ctrlKey,\n metaKey: event.metaKey,\n shiftKey: event.shiftKey,\n clientX: event.clientX,\n clientY: event.clientY,\n pageX: event.pageX,\n pageY: event.pageY\n };\n}","var rafSchd = function rafSchd(fn) {\n var lastArgs = [];\n var frameId = null;\n\n var wrapperFn = function wrapperFn() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n lastArgs = args;\n\n if (frameId) {\n return;\n }\n\n frameId = requestAnimationFrame(function () {\n frameId = null;\n fn.apply(void 0, lastArgs);\n });\n };\n\n wrapperFn.cancel = function () {\n if (!frameId) {\n return;\n }\n\n cancelAnimationFrame(frameId);\n frameId = null;\n };\n\n return wrapperFn;\n};\n\nexport default rafSchd;\n","import rafSchd from 'raf-schd';\nvar scheduleOnDrag = rafSchd(function (fn) {\n return fn();\n});\nvar dragStart = function () {\n var scheduled = null;\n function schedule(fn) {\n var frameId = requestAnimationFrame(function () {\n scheduled = null;\n fn();\n });\n scheduled = {\n frameId: frameId,\n fn: fn\n };\n }\n function flush() {\n if (scheduled) {\n cancelAnimationFrame(scheduled.frameId);\n scheduled.fn();\n scheduled = null;\n }\n }\n return {\n schedule: schedule,\n flush: flush\n };\n}();\nexport function makeDispatch(_ref) {\n var source = _ref.source,\n initial = _ref.initial,\n dispatchEvent = _ref.dispatchEvent;\n var previous = {\n dropTargets: []\n };\n function safeDispatch(args) {\n dispatchEvent(args);\n previous = {\n dropTargets: args.payload.location.current.dropTargets\n };\n }\n var dispatch = {\n start: function start(_ref2) {\n var nativeSetDragImage = _ref2.nativeSetDragImage;\n // Ensuring that both `onGenerateDragPreview` and `onDragStart` get the same location.\n // We do this so that `previous` is`[]` in `onDragStart` (which is logical)\n var location = {\n current: initial,\n previous: previous,\n initial: initial\n };\n // a `onGenerateDragPreview` does _not_ add another entry for `previous`\n // onDragPreview\n safeDispatch({\n eventName: 'onGenerateDragPreview',\n payload: {\n source: source,\n location: location,\n nativeSetDragImage: nativeSetDragImage\n }\n });\n dragStart.schedule(function () {\n safeDispatch({\n eventName: 'onDragStart',\n payload: {\n source: source,\n location: location\n }\n });\n });\n },\n dragUpdate: function dragUpdate(_ref3) {\n var current = _ref3.current;\n dragStart.flush();\n scheduleOnDrag.cancel();\n safeDispatch({\n eventName: 'onDropTargetChange',\n payload: {\n source: source,\n location: {\n initial: initial,\n previous: previous,\n current: current\n }\n }\n });\n },\n drag: function drag(_ref4) {\n var current = _ref4.current;\n scheduleOnDrag(function () {\n dragStart.flush();\n var location = {\n initial: initial,\n previous: previous,\n current: current\n };\n safeDispatch({\n eventName: 'onDrag',\n payload: {\n source: source,\n location: location\n }\n });\n });\n },\n drop: function drop(_ref5) {\n var current = _ref5.current,\n updatedSourcePayload = _ref5.updatedSourcePayload;\n dragStart.flush();\n scheduleOnDrag.cancel();\n safeDispatch({\n eventName: 'onDrop',\n payload: {\n source: updatedSourcePayload !== null && updatedSourcePayload !== void 0 ? updatedSourcePayload : source,\n location: {\n current: current,\n previous: previous,\n initial: initial\n }\n }\n });\n }\n };\n return dispatch;\n}","import _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nimport { bindAll } from 'bind-event-listener';\nimport { getElementFromPointWithoutHoneypot } from '../honey-pot-fix/get-element-from-point-without-honey-pot';\nimport { isHoneyPotElement } from '../honey-pot-fix/is-honey-pot-element';\nimport { isLeavingWindow } from '../util/changing-window/is-leaving-window';\nimport { getBindingsForBrokenDrags } from '../util/detect-broken-drag';\nimport { getInput } from '../util/get-input';\nimport { makeDispatch } from './dispatch-consumer-event';\nvar globalState = {\n isActive: false\n};\nfunction canStart() {\n return !globalState.isActive;\n}\nfunction getNativeSetDragImage(event) {\n if (event.dataTransfer) {\n // need to use `.bind` as `setDragImage` is required\n // to be run with `event.dataTransfer` as the \"this\" context\n return event.dataTransfer.setDragImage.bind(event.dataTransfer);\n }\n return null;\n}\nfunction hasHierarchyChanged(_ref) {\n var current = _ref.current,\n next = _ref.next;\n if (current.length !== next.length) {\n return true;\n }\n // not checking stickiness, data or dropEffect,\n // just whether the hierarchy has changed\n for (var i = 0; i < current.length; i++) {\n if (current[i].element !== next[i].element) {\n return true;\n }\n }\n return false;\n}\nfunction start(_ref2) {\n var event = _ref2.event,\n dragType = _ref2.dragType,\n getDropTargetsOver = _ref2.getDropTargetsOver,\n dispatchEvent = _ref2.dispatchEvent;\n if (!canStart()) {\n return;\n }\n var initial = getStartLocation({\n event: event,\n dragType: dragType,\n getDropTargetsOver: getDropTargetsOver\n });\n globalState.isActive = true;\n var state = {\n current: initial\n };\n\n // Setting initial drop effect for the drag\n setDropEffectOnEvent({\n event: event,\n current: initial.dropTargets\n });\n var dispatch = makeDispatch({\n source: dragType.payload,\n dispatchEvent: dispatchEvent,\n initial: initial\n });\n function updateState(next) {\n // only looking at whether hierarchy has changed to determine whether something as 'changed'\n var hasChanged = hasHierarchyChanged({\n current: state.current.dropTargets,\n next: next.dropTargets\n });\n\n // Always updating the state to include latest data, dropEffect and stickiness\n // Only updating consumers if the hierarchy has changed in some way\n // Consumers can get the latest data by using `onDrag`\n state.current = next;\n if (hasChanged) {\n dispatch.dragUpdate({\n current: state.current\n });\n }\n }\n function onUpdateEvent(event) {\n var input = getInput(event);\n\n // If we are over the honey pot, we need to get the element\n // that the user would have been over if not for the honey pot\n var target = isHoneyPotElement(event.target) ? getElementFromPointWithoutHoneypot({\n x: input.clientX,\n y: input.clientY\n }) : event.target;\n var nextDropTargets = getDropTargetsOver({\n target: target,\n input: input,\n source: dragType.payload,\n current: state.current.dropTargets\n });\n if (nextDropTargets.length) {\n // 🩸 must call `event.preventDefault()` to allow a browser drop to occur\n event.preventDefault();\n setDropEffectOnEvent({\n event: event,\n current: nextDropTargets\n });\n }\n updateState({\n dropTargets: nextDropTargets,\n input: input\n });\n }\n function cancel() {\n // The spec behaviour is that when a drag is cancelled, or when dropping on no drop targets,\n // a \"dragleave\" event is fired on the active drop target before a \"dragend\" event.\n // We are replicating that behaviour in `cancel` if there are any active drop targets to\n // ensure consistent behaviour.\n //\n // Note: When cancelling, or dropping on no drop targets, a \"dragleave\" event\n // will have already cleared the dropTargets to `[]` (as that particular \"dragleave\" has a `relatedTarget` of `null`)\n\n if (state.current.dropTargets.length) {\n updateState({\n dropTargets: [],\n input: state.current.input\n });\n }\n dispatch.drop({\n current: state.current,\n updatedSourcePayload: null\n });\n finish();\n }\n function finish() {\n globalState.isActive = false;\n unbindEvents();\n }\n var unbindEvents = bindAll(window, [{\n // 👋 Note: we are repurposing the `dragover` event as our `drag` event\n // this is because firefox does not publish pointer coordinates during\n // a `drag` event, but does for every other type of drag event\n // `dragover` fires on all elements that are being dragged over\n // Because we are binding to `window` - our `dragover` is effectively the same as a `drag`\n // 🦊😤\n type: 'dragover',\n listener: function listener(event) {\n // We need to regularly calculate the drop targets in order to allow:\n // - dynamic `canDrop()` checks\n // - rapid updating `getData()` calls to attach data in response to user input (eg for edge detection)\n // Sadly we cannot schedule inspecting changes resulting from this event\n // we need to be able to conditionally cancel the event with `event.preventDefault()`\n // to enable the correct native drop experience.\n\n // 1. check to see if anything has changed\n onUpdateEvent(event);\n\n // 2. let consumers know a move has occurred\n // This will include the latest 'input' values\n dispatch.drag({\n current: state.current\n });\n }\n }, {\n type: 'dragenter',\n listener: onUpdateEvent\n }, {\n type: 'dragleave',\n listener: function listener(event) {\n if (!isLeavingWindow({\n dragLeave: event\n })) {\n return;\n }\n\n /**\n * At this point we don't know if a drag is being cancelled,\n * or if a drag is leaving the `window`.\n *\n * Both have:\n * 1. \"dragleave\" (with `relatedTarget: null`)\n * 2. \"dragend\" (a \"dragend\" can occur when outside the `window`)\n *\n * **Clearing drop targets**\n *\n * For either case we are clearing the the drop targets\n *\n * - cancelling: we clear drop targets in `\"dragend\"` anyway\n * - leaving the `window`: we clear the drop targets (to clear stickiness)\n *\n * **Leaving the window and finishing the drag**\n *\n * _internal drags_\n *\n * - The drag continues when the user is outside the `window`\n * and can resume if the user drags back over the `window`,\n * or end when the user drops in an external `window`.\n * - We will get a `\"dragend\"`, or we can listen for other\n * events to determine the drag is finished when the user re-enters the `window`).\n *\n * _external drags_\n *\n * - We conclude the drag operation.\n * - We have no idea if the user will drag back over the `window`,\n * or if the drag ends elsewhere.\n * - We will create a new drag if the user re-enters the `window`.\n *\n * **Not updating `input`**\n *\n * 🐛 Bug[Chrome] the final `\"dragleave\"` has default input values (eg `clientX == 0`)\n * Workaround: intentionally not updating `input` in \"dragleave\"\n * rather than the users current input values\n * - [Conversation](https://twitter.com/alexandereardon/status/1642697633864241152)\n * - [Bug](https://bugs.chromium.org/p/chromium/issues/detail?id=1429937)\n **/\n\n updateState({\n input: state.current.input,\n dropTargets: []\n });\n if (dragType.startedFrom === 'external') {\n cancel();\n }\n }\n }, {\n // A \"drop\" can only happen if the browser allowed the drop\n type: 'drop',\n listener: function listener(event) {\n // Capture the final input.\n // We are capturing the final `input` for the\n // most accurate honey pot experience\n state.current = {\n dropTargets: state.current.dropTargets,\n input: getInput(event)\n };\n\n /** If there are no drop targets, then we will get\n * a \"drop\" event if:\n * - `preventUnhandled()` is being used\n * - there is an unmanaged drop target (eg another library)\n * In these cases, it's up to the consumer\n * to handle the drop if it's not over one of our drop targets\n * - `preventUnhandled()` will cancel the \"drop\"\n * - unmanaged drop targets can handle the \"drop\" how they want to\n * We won't call `event.preventDefault()` in this call path */\n\n if (!state.current.dropTargets.length) {\n cancel();\n return;\n }\n event.preventDefault();\n\n // applying the latest drop effect to the event\n setDropEffectOnEvent({\n event: event,\n current: state.current.dropTargets\n });\n dispatch.drop({\n current: state.current,\n // When dropping something native, we need to extract the latest\n // `.items` from the \"drop\" event as it is now accessible\n updatedSourcePayload: dragType.type === 'external' ? dragType.getDropPayload(event) : null\n });\n finish();\n }\n }, {\n // \"dragend\" fires when on the drag source (eg a draggable element)\n // when the drag is finished.\n // \"dragend\" will fire after \"drop\" (if there was a successful drop)\n // \"dragend\" does not fire if the draggable source has been removed during the drag\n // or for external drag sources (eg files)\n\n // This \"dragend\" listener will not fire if there was a successful drop\n // as we will have already removed the event listener\n\n type: 'dragend',\n listener: function listener(event) {\n // In firefox, the position of the \"dragend\" event can\n // be a bit different to the last \"dragover\" event.\n // Updating the input so we can get the best possible\n // information for the honey pot.\n state.current = {\n dropTargets: state.current.dropTargets,\n input: getInput(event)\n };\n cancel();\n }\n }].concat(_toConsumableArray(getBindingsForBrokenDrags({\n onDragEnd: cancel\n }))),\n // Once we have started a managed drag operation it is important that we see / own all drag events\n // We got one adoption bug pop up where some code was stopping (`event.stopPropagation()`)\n // all \"drop\" events in the bubble phase on the `document.body`.\n // This meant that we never saw the \"drop\" event.\n {\n capture: true\n });\n dispatch.start({\n nativeSetDragImage: getNativeSetDragImage(event)\n });\n}\nfunction setDropEffectOnEvent(_ref3) {\n var _current$;\n var event = _ref3.event,\n current = _ref3.current;\n // setting the `dropEffect` to be the innerMost drop targets dropEffect\n var innerMost = (_current$ = current[0]) === null || _current$ === void 0 ? void 0 : _current$.dropEffect;\n if (innerMost != null && event.dataTransfer) {\n event.dataTransfer.dropEffect = innerMost;\n }\n}\nfunction getStartLocation(_ref4) {\n var event = _ref4.event,\n dragType = _ref4.dragType,\n getDropTargetsOver = _ref4.getDropTargetsOver;\n var input = getInput(event);\n\n // When dragging from outside of the browser,\n // the drag is not being sourced from any local drop targets\n if (dragType.startedFrom === 'external') {\n return {\n input: input,\n dropTargets: []\n };\n }\n var dropTargets = getDropTargetsOver({\n input: input,\n source: dragType.payload,\n target: event.target,\n current: []\n });\n return {\n input: input,\n dropTargets: dropTargets\n };\n}\nexport var lifecycle = {\n canStart: canStart,\n start: start\n};","// Extending `Map` to allow us to link Key and Values together\n\nvar ledger = new Map();\nfunction registerUsage(_ref) {\n var typeKey = _ref.typeKey,\n mount = _ref.mount;\n var entry = ledger.get(typeKey);\n if (entry) {\n entry.usageCount++;\n return entry;\n }\n var initial = {\n typeKey: typeKey,\n unmount: mount(),\n usageCount: 1\n };\n ledger.set(typeKey, initial);\n return initial;\n}\nexport function register(args) {\n var entry = registerUsage(args);\n return function unregister() {\n entry.usageCount--;\n if (entry.usageCount > 0) {\n return;\n }\n // Only a single usage left, remove it\n entry.unmount();\n ledger.delete(args.typeKey);\n };\n}","/** Create a new combined function that will call all the provided functions */\nexport function combine() {\n for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {\n fns[_key] = arguments[_key];\n }\n return function cleanup() {\n fns.forEach(function (fn) {\n return fn();\n });\n };\n}","export function addAttribute(element, _ref) {\n var attribute = _ref.attribute,\n value = _ref.value;\n element.setAttribute(attribute, value);\n return function () {\n return element.removeAttribute(attribute);\n };\n}","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _createForOfIteratorHelper(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nimport { combine } from '../public-utils/combine';\nimport { addAttribute } from '../util/add-attribute';\nfunction copyReverse(array) {\n return array.slice(0).reverse();\n}\nexport function makeDropTarget(_ref) {\n var typeKey = _ref.typeKey,\n defaultDropEffect = _ref.defaultDropEffect;\n var registry = new WeakMap();\n var dropTargetDataAtt = \"data-drop-target-for-\".concat(typeKey);\n var dropTargetSelector = \"[\".concat(dropTargetDataAtt, \"]\");\n function addToRegistry(args) {\n registry.set(args.element, args);\n return function () {\n return registry.delete(args.element);\n };\n }\n function dropTargetForConsumers(args) {\n // Guardrail: warn if the draggable element is already registered\n if (process.env.NODE_ENV !== 'production') {\n var existing = registry.get(args.element);\n if (existing) {\n // eslint-disable-next-line no-console\n console.warn(\"You have already registered a [\".concat(typeKey, \"] dropTarget on the same element\"), {\n existing: existing,\n proposed: args\n });\n }\n if (args.element instanceof HTMLIFrameElement) {\n // eslint-disable-next-line no-console\n console.warn(\"\\n We recommend not registering